planet Class Reference

Inheritance diagram for planet:

Inheritance graph
[legend]
Collaboration diagram for planet:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 71 of file planet.hpp.

Public Member Functions

 planet ()
 planet (char *s)
void setDiameter (int d)
int getDiameter ()
void setAtmosphere (int a)
int getAtmosphere ()
void setHydrosphere (int h)
int getHydrosphere ()
void setPopulation (int p)
int getPopulation ()
void setGovernment (int g)
int getGovernment ()
void setLawlevel (int l)
int getLawlevel ()
void setTechlevel (int t)
int getTechlevel ()
void setNavalBase (int f)
int getNavalBase ()
void setScoutBase (int f)
int getScoutBase ()
void setSignature (char *s)
virtual char * getSignature ()
virtual void genWBHData ()
void setSizeModifier (int s)
int getSizeModifier ()
void setPlanetDensityType (int d)
int getPlanetDensityType ()
void determinePlanetDensityType ()
void setPlanetDensity (double d)
double getPlanetDensity ()
virtual void calculatePlanetDensity ()
void calculatePlanetMass ()


Constructor & Destructor Documentation

planet::planet (  ) 

Class constructor.

Definition at line 78 of file planet.cpp.

References setSignature().

00078               :orbitPlace(){
00079         this->setPhysicalElements();
00080         this->setSignature("planet");
00081 }

Here is the call graph for this function:

planet::planet ( char *  s  ) 

Full class construtor

Parameters:
s pointer to array of char with will be the signature of the object.

Definition at line 83 of file planet.cpp.

References setSignature().

00083                       : orbitPlace(){
00084         this->setSignature(s);
00085         this->setPhysicalElements();
00086 }

Here is the call graph for this function:


Member Function Documentation

void planet::calculatePlanetDensity (  )  [virtual]

Calculate the planet density using the planet density type Note: this gets overloaded in the gasGiant object.

Definition at line 277 of file planet.cpp.

References setPlanetDensity().

00277                                    {
00278         if ( density_table_initialized == 0 ) 
00279                 initializeDensityTable ();
00280         int rx = d2d6() + d1d6() - 3;
00281         this->setPlanetDensity(density_table[rx][this->getPlanetDensityType()-1]);
00282         
00283         
00284 }

Here is the call graph for this function:

void planet::calculatePlanetMass (  ) 

Calculate the planetary mass

Definition at line 286 of file planet.cpp.

References getDiameter(), and getPlanetDensity().

00286                                 {
00287         double mass;
00288         
00289         mass = ( ( this->getDiameter() == 0 ? 0.8 : (double) this->getDiameter()) / 8 ) ;
00290         mass = mass * mass * mass;
00291         mass = this->getPlanetDensity() * mass;
00292         
00293         size_details.mass = mass;
00294         
00295 }

Here is the call graph for this function:

void planet::determinePlanetDensityType (  ) 

Determine the planet density type

Definition at line 193 of file planet.cpp.

References setPlanetDensityType().

Referenced by mainPlanet::genWBHData().

00193                                        {
00194         int dm=0;
00195         
00196         if ( this->getDiameter() < 5 ) dm = 1;
00197         if ( this->getDiameter() > 5) dm = dm-2;
00198         
00199         if ( this->getAtmosphere() < 4 ) dm = dm+1;
00200         if ( this->getAtmosphere() > 5 ) dm = dm-2;
00201         
00202                 switch(d2d6()){
00203                 case 1: 
00204                         this->setPlanetDensityType(HEAVY_CORE);
00205                 break;
00206                 case 2:
00207                         case 3:
00208                         case 4:
00209                         case 5:
00210                         case 6:
00211                         case 7:
00212                         case 8: 
00213                         case 9:
00214                         case 10:
00215                         this->setPlanetDensityType(MOLTEN_CORE);
00216                 break;
00217                 case 11:
00218                         case 12:
00219                         case 13:
00220                         case 14:
00221                         this->setPlanetDensityType(ROCKY_BODY);
00222                 break;
00223                 default:
00224                         this->setPlanetDensityType(ICY_BODY);
00225                 break;
00226         };
00227 }

Here is the call graph for this function:

Here is the caller graph for this function:

void planet::genWBHData (  )  [virtual]

Generate World Builder's Handbook info about this planet

Reimplemented in mainPlanet.

Definition at line 172 of file planet.cpp.

00172                        {
00173 }

int planet::getAtmosphere (  ) 

Get our atmosphere

Returns:
integer value for the atmosphere

Definition at line 101 of file planet.cpp.

00101                          {
00102          return physicalElements.s.atmosphere;
00103 }

int planet::getDiameter (  ) 

Get our diameter

Returns:
integer value of the diameter.

Definition at line 93 of file planet.cpp.

Referenced by calculatePlanetMass().

00093                        {
00094         return physicalElements.s.diameter;
00095 }

Here is the caller graph for this function:

int planet::getGovernment (  ) 

Get our governement

Returns:
integer value for the governement

Definition at line 125 of file planet.cpp.

Referenced by mainPlanet::asText().

00125                          {
00126         return peopleElements.s.government;
00127 }

Here is the caller graph for this function:

int planet::getHydrosphere (  ) 

Get our hydrosphere

Returns:
integer value for the hydrosphere

Definition at line 109 of file planet.cpp.

Referenced by mainPlanet::asText().

00109                           {
00110         return physicalElements.s.hydrosphere;
00111 }

Here is the caller graph for this function:

int planet::getLawlevel (  ) 

get the lawlevel attr

Returns:
integer value of the lawlevel

Definition at line 130 of file planet.cpp.

00130                        {
00131         return peopleElements.s.lawlevel;
00132 }

int planet::getNavalBase (  ) 

Get the navalBase flag

Returns:
1 for a naval base present, 0 if not

Definition at line 160 of file planet.cpp.

00160                         {
00161         return navalBase;
00162 }

double planet::getPlanetDensity (  ) 

get the actual planetary density

Definition at line 234 of file planet.cpp.

Referenced by calculatePlanetMass().

00234                                {
00235         return size_details.density;
00236 }

Here is the caller graph for this function:

int planet::getPlanetDensityType (  ) 

Get the WBH Planet Density Type

Definition at line 189 of file planet.cpp.

00189                                 {
00190         return size_details.density_type;
00191 }

int planet::getPopulation (  ) 

get our population

Returns:
integer value for the population

Definition at line 117 of file planet.cpp.

Referenced by mainPlanet::asText().

00117                          {
00118         return peopleElements.s.population;
00119 }

Here is the caller graph for this function:

int planet::getScoutBase (  ) 

Get the scoutBase flag

return 1 if scout base is present 0 if not

Definition at line 152 of file planet.cpp.

00152                         {
00153         return scoutBase;
00154 }

char * planet::getSignature (  )  [virtual]

Retrieve the signature

Returns:
pointer to array of char representing the ascii signature of the object.

Definition at line 168 of file planet.cpp.

00168                           {
00169         return signature;
00170 }

int planet::getSizeModifier (  ) 

Return the WBH size detail of the size modifier

Definition at line 181 of file planet.cpp.

00181                            {
00182         return size_details.modifier;
00183 }

int planet::getTechlevel (  ) 

get the techlevel attr

Returns:
integer value for the techlevel attr

Definition at line 144 of file planet.cpp.

00144                         {
00145         return techlevel;
00146 }

void planet::setAtmosphere ( int  a  ) 

Set our atmosphere

Parameters:
a integer value to set the atmosphere to

Definition at line 97 of file planet.cpp.

00097                                {
00098         physicalElements.s.atmosphere = a; 
00099 }

void planet::setDiameter ( int  d  ) 

Set our diameter

Parameters:
d integer value of the diameter.

Definition at line 89 of file planet.cpp.

00089                              {
00090         physicalElements.s.diameter = ( d>= 0? d : 0 );
00091 }

void planet::setGovernment ( int  g  ) 

set our governement

Parameters:
g integer value to set the governement type to

Definition at line 121 of file planet.cpp.

Referenced by mainPlanet::mainPlanet().

00121                                {
00122         peopleElements.s.government = g;
00123 }

Here is the caller graph for this function:

void planet::setHydrosphere ( int  h  ) 

Set our Hydrosphere

Parameters:
h integer value for the hydrosphere

Definition at line 105 of file planet.cpp.

00105                                 {
00106         physicalElements.s.hydrosphere = h;
00107 }

void planet::setLawlevel ( int  l  ) 

Set the lawlevel attr

Parameters:
l integer value to set the lawlevel to

Definition at line 134 of file planet.cpp.

Referenced by mainPlanet::mainPlanet().

00134                               {
00135         peopleElements.s.lawlevel=l;
00136 }

Here is the caller graph for this function:

void planet::setNavalBase ( int  f  ) 

Set flag for navalBase attr

Parameters:
f integer flag to set for naval base

Definition at line 156 of file planet.cpp.

Referenced by mainPlanet::mainPlanet().

00156                               {
00157         navalBase = ( f != 0 ? 1:0);
00158 }

Here is the caller graph for this function:

void planet::setPlanetDensity ( double  d  ) 

set the actual planetary density

Parameters:
d double value for the planetary density

Definition at line 229 of file planet.cpp.

Referenced by calculatePlanetDensity().

00229                                      {
00230         size_details.density=d;
00231         
00232 }

Here is the caller graph for this function:

void planet::setPlanetDensityType ( int  d  ) 

Set the WBH Planet Density Type

Parameters:
d integer value to set the density type to

Definition at line 185 of file planet.cpp.

Referenced by determinePlanetDensityType().

00185                                       {
00186         size_details.density_type=d;
00187 }

Here is the caller graph for this function:

void planet::setPopulation ( int  p  ) 

Set our population

Parameters:
p integer value to set the population to

Definition at line 113 of file planet.cpp.

Referenced by mainPlanet::mainPlanet().

00113                                {
00114         peopleElements.s.population = p;
00115 }

Here is the caller graph for this function:

void planet::setScoutBase ( int  f  ) 

Set flag for scoutBase attr

Parameters:
f integer flag to set for a scout base

Definition at line 148 of file planet.cpp.

Referenced by mainPlanet::mainPlanet().

00148                               {
00149         scoutBase = (f != 0 ? 1:0);
00150 }

Here is the caller graph for this function:

void planet::setSignature ( char *  s  ) 

Set the object's ascii signature

Parameters:
s pointer to array of char containing ascii signature.

Definition at line 164 of file planet.cpp.

Referenced by planet().

00164                                 {
00165         signature = s;
00166 }

Here is the caller graph for this function:

void planet::setSizeModifier ( int  s  ) 

Set the WBH size detail of the size modifier

Parameters:
s integer value to set the size modifier to

Definition at line 175 of file planet.cpp.

Referenced by mainPlanet::genWBHData().

00175                                  {
00176         size_details.modifier = s;
00177         
00178 }

Here is the caller graph for this function:

void planet::setTechlevel ( int  t  ) 

set the techlevel attr

Parameters:
t integer value to set the techlevel attr to.

Definition at line 138 of file planet.cpp.

00138                               {
00139         techlevel = t;
00140         techlevel = ( techlevel < 0 ? 0 : techlevel );
00141         
00142 }


The documentation for this class was generated from the following files:
Generated on Fri Mar 7 16:42:34 2008 for frpuniverse by  doxygen 1.4.7