#include <main-planet.hpp>
Inheritance diagram for mainPlanet:
Definition at line 36 of file main-planet.hpp.
Public Member Functions | |
mainPlanet () | |
char * | asText () |
virtual void | genWBHData () |
mainPlanet::mainPlanet | ( | ) |
Class constructor
Definition at line 161 of file main-planet.cpp.
References planet::setGovernment(), planet::setLawlevel(), planet::setNavalBase(), planet::setPopulation(), and planet::setScoutBase().
00161 : planet(MAINPLANET) { 00162 00163 00164 this->calculateStarport(); 00165 00166 this->setPopulation(d2d6()-2); 00167 this->setGovernment(fixCalc(this->getPopulation())); 00168 this->setLawlevel(fixCalc(this->getGovernment())); 00169 00170 this->calculateTechlevel(); 00171 this->setNavalBase(checkForNavalBase()); 00172 this->setScoutBase(checkForScoutBase()); 00173 00174 }
Here is the call graph for this function:
char * mainPlanet::asText | ( | ) |
Output this main planet as text
Calculate trade classifciations
Definition at line 177 of file main-planet.cpp.
References planet::getGovernment(), planet::getHydrosphere(), and planet::getPopulation().
Referenced by parsec::asText().
00177 { 00178 char* buffer; 00179 00180 buffer=(char *)malloc(81); 00181 00182 buffer[0]='\0'; 00183 sprintf(buffer,"%c-%s%s%s%s%s%s-%s -- ", 00184 this->starport, 00185 (this->getDiameter() == 0 ? "S" : itoan(this->getDiameter())), 00186 itoan(this->getAtmosphere()), 00187 itoan(this->getHydrosphere()), 00188 itoan(this->getPopulation()), 00189 itoan(this->getGovernment()), 00190 itoan(this->getLawlevel()), 00191 itoan(this->getTechlevel()) 00192 ); 00193 if ( this->getNavalBase() != 0 ) { 00194 sprintf(buffer,"%s %s",buffer,"N"); 00195 } else { 00196 sprintf(buffer,"%s ",buffer); 00197 } 00198 00199 if ( this->getScoutBase() != 0 ) { 00200 sprintf(buffer,"%s %s",buffer,"S"); 00201 } else { 00202 sprintf(buffer,"%s ",buffer); 00203 } 00207 if ( 00208 ( ( 4 <= this->getAtmosphere() ) && ( this->getAtmosphere() <= 9 ) ) 00209 && 00210 ( ( 4 <= this->getHydrosphere() ) && ( this->getHydrosphere() <= 8 ) ) 00211 && 00212 ( ( 5 <= this->getPopulation() ) && ( this->getPopulation() <= 7) ) 00213 ) { 00214 sprintf(buffer,"%s Ag",buffer); 00215 } 00216 00217 if ( 00218 (this->getAtmosphere() <= 3 ) && 00219 (this->getHydrosphere() <= 3 ) && 00220 ( this->getPopulation() >= 6 ) 00221 ) { 00222 sprintf(buffer,"%s Na",buffer); 00223 } 00224 int t1[]={0,1,2,4,7,9}; 00225 if ( 00226 (isInSet(this->getAtmosphere(),t1,6) == 1 ) 00227 && (this->getPopulation() > 8 ) 00228 ) { 00229 sprintf(buffer,"%s In",buffer); 00230 00231 } 00232 00233 if ( this-> getPopulation() <= 6 ) 00234 sprintf(buffer,"%s Ni",buffer); 00235 int t2[]={6,8}; 00236 00237 if ( ( isInSet(this->getAtmosphere(),t2,2) == 1 ) 00238 && 00239 ( ( 6<= this->getPopulation() ) && ( this->getPopulation() <= 8 ) ) 00240 && 00241 ( ( 4 <= this->getGovernment() ) && ( this->getGovernment() <= 9 )) 00242 ) 00243 { 00244 sprintf(buffer,"%s Ri",buffer); 00245 } 00246 00247 if ( 00248 ( ( 2<= this->getAtmosphere() ) && ( this->getAtmosphere() <= 5 ) ) 00249 && 00250 this->getHydrosphere() <= 3 00251 ) 00252 { 00253 sprintf(buffer,"%s Po",buffer); 00254 } 00255 00256 if ( this->getHydrosphere() == 10 ) 00257 sprintf(buffer,"%s Wa",buffer); 00258 00259 if ( (this->getHydrosphere() == 0 ) && ( this->getAtmosphere() >= 2 ) ) 00260 sprintf(buffer,"%s De",buffer); 00261 00262 if (this->getAtmosphere() == 0 ) 00263 sprintf(buffer,"%s Va",buffer); 00264 00265 if ( isInSet(this->getAtmosphere(),(int[]){0,1},2) && (this->getHydrosphere() > 1 ) ) 00266 sprintf(buffer,"%s Ic",buffer); 00267 00268 00269 return buffer; 00270 00271 }
Here is the call graph for this function:
Here is the caller graph for this function:
void mainPlanet::genWBHData | ( | ) | [virtual] |
Generate World Builder's Handbook data for this planet
figure out the size modifier
Reimplemented from planet.
Definition at line 273 of file main-planet.cpp.
References planet::determinePlanetDensityType(), and planet::setSizeModifier().
00273 { 00274 int roll; 00275 00280 roll= d2d6() -7 ; 00281 00282 while ( roll == 5 ) { 00283 roll=d2d6()-7; 00284 } 00285 this->setSizeModifier(roll*100); 00286 this->determinePlanetDensityType(); 00287 00288 00289 00290 00291 00292 }
Here is the call graph for this function: