#include <planet.h>
Collaboration diagram for Planet:

Public Member Functions | |
| Planet (StarSystem *&aSs, const string &aPlanetName, const int aPLanetType, const int aPlanetSize, const int aPlanetNo) | |
| virtual | ~Planet (void) |
| const int | GetPlanetSize (void) const |
| const bool | DrawPlanet (XRect *plRect) |
| const int | GetType (void) const |
| const double | GetSurfaceGravity (void) const |
| const double | GetTotalHumidity (void) const |
| const double | GetTotalSurfaceTemperature (void) const |
| const double | GetTotalPressure (void) const |
| const double | GetSoil (void) const |
| const double | GetSunFactor (void) const |
| const double | GetOre (void) const |
| const double | GetEnergy (void) const |
| const double | GetFauna (void) const |
| const double | GetFlora (void) const |
| const double | GetWater (void) const |
| const double | GetLithium (void) const |
| const double | GetDeuterium (void) const |
| const bool | ClickedOn (const XPoint *p) |
| returns true if we have clicked on the sun of the satrsystem object | |
| void | Colonize (const icstring &aSpecies, const bool aHomeWorld=false) |
| const bool | IsColonized (void) const |
| const bool | IsCompatible (SpeciesInfo *aPi) |
| const bool | IsHomeWorldOf (const icstring &species) |
| const bool | IsPlanetName (const char *aName) const |
Data Fields | |
| const int | planetType |
| const int | planetSize |
| const string | planetName |
| const int | planetNo |
Static Public Attributes | |
| vector< Planet * > | allPlanets |
Protected Member Functions | |
| const bool | Save (ofstream *of) |
| void | Setup (void) |
Protected Attributes | |
| int | ore |
| int | energy |
| int | soil |
| int | fauna |
| int | flora |
| int | lithium |
| int | deuterium |
| StarSystem *& | ss |
| Colony * | colony |
| double | humidity |
| double | surfaceTemperature |
| double | gravity |
| double | atmPressure |
| double | sunEnergy |
| double | water |
| double | humidityTerraformedDelta |
| double | surfaceTemperatureTerraformedDelta |
| double | pressureTerraformedDelta |
Private Attributes | |
| int | id |
| XRect | area |
Friends | |
| class | Colony |
| class | StarSystem |
| class | Galaxy |
|
||||||||||||||||||||||||
|
Definition at line 7 of file planet.cpp. References allPlanets, and Setup().
00008 : ss( aSs ) , planetName( aPlanetName ) , planetType( aPLanetType ) , planetSize( aPlanetSize ) 00009 , planetNo( aPlanetNo ) 00010 , ore( 0 ) , energy( 0 ) , soil( 0 ) , fauna( 0 ) , flora( 0 ) , lithium( 0 ) , deuterium( 0 ) 00011 , humidity( 0 ) , surfaceTemperature( 0 ) , gravity( 0 ) , atmPressure( 0 ) , sunEnergy( 0 ) 00012 , humidityTerraformedDelta( 0 ) , surfaceTemperatureTerraformedDelta( 0 ) , pressureTerraformedDelta( 0 ) 00013 , colony( 0 ) 00014 { 00015 Setup(); 00016 allPlanets.push_back( this ); 00017 } |
|
|
Definition at line 19 of file planet.cpp.
00020 {
00021 }
|
|
|
returns true if we have clicked on the sun of the satrsystem object
Definition at line 98 of file planet.cpp. References area. Referenced by StarSystemObject::evMouseLClick(), and PlanetInfoDlg::evMouseLClick().
00099 {
00100 if( area.HitTest( *p ) == XRect::RELPOS_INSIDE )
00101 return true;
00102 return false;
00103 }
|
|
||||||||||||
|
Definition at line 105 of file planet.cpp. References Colony, and colony. Referenced by Parameters::CreateGalaxy().
|
|
|
Definition at line 58 of file planet.cpp. References area, colony, GetPlanetSize(), GetType(), id, IsColonized(), Parameters::species, and Colony::species. Referenced by StarSystem::DrawStarSystem().
00059 {
00060 XRect ara = *plRect;
00061 if( GetType() != -1 && GetPlanetSize() != 7 )
00062 {
00063 SDL_Surface *sfc = Graf::Img( id );
00064 const int size = (int)(sfc->h * (GetPlanetSize() / 6.0));
00065 XRect src( sfc->h * GetType() , 0 , sfc->h , sfc->h );
00066
00067 XRect r( 0 , 0 , size , size );
00068
00069 ara.w = r.w + 20;
00070 ara.x = plRect->Right() - ara.w;
00071
00072 XPoint c = ara.Center();
00073 r.x = c.x - r.w / 2;
00074 r.y = c.y - r.h / 2;
00075 Graf::SDL_StretchBlt( sfc , &src , GetGDI() , &r , true );
00076 area = r;
00077
00078 if( IsColonized() )
00079 {
00080 XPoint sz = GetTextSize( colony->species.c_str() );
00081
00082 XRect rct( r.Center().x - sz.x / 2, r.y - GetFontSize() * 4 , sz.x , GetFontSize() * 2 );
00083 TextOutStr( rct , colony->species.c_str() , Parameters::species[colony->species]->color );
00084 }
00085 }
00086 else
00087 {
00088 XRect r( 0 , 0 , -1 , -1 );
00089 Graf::Img( id , &r );
00090 ara.x = ara.Right() - r.h;
00091 ara.w = r.h;
00092 }
00093 plRect->w -= ara.Width();
00094
00095 return true;
00096 }
|
|
|
Definition at line 70 of file planet.h. References deuterium, and GetWater(). Referenced by PlanetInfoDlg::SetupInfo().
|
|
|
Definition at line 65 of file planet.h. References energy. Referenced by PlanetInfoDlg::SetupInfo().
00065 { return energy; }
|
|
|
Definition at line 66 of file planet.h. References fauna, and GetFlora(). Referenced by PlanetInfoDlg::SetupInfo().
|
|
|
Definition at line 67 of file planet.h. References flora, GetSoil(), and GetWater(). Referenced by GetFauna(), and PlanetInfoDlg::SetupInfo().
|
|
|
Definition at line 69 of file planet.h. References GetOre(), and lithium. Referenced by PlanetInfoDlg::SetupInfo().
|
|
|
Definition at line 64 of file planet.h. References ore. Referenced by GetLithium(), and PlanetInfoDlg::SetupInfo().
00064 { return ore; }
|
|
|
Definition at line 53 of file planet.h. References planetSize. Referenced by DrawPlanet().
00053 { return 1 + planetSize; }
|
|
|
Definition at line 62 of file planet.h. References GetSunFactor(), GetTotalHumidity(), and soil. Referenced by GetFlora(), and PlanetInfoDlg::SetupInfo().
00062 { return soil + soil * (GetTotalHumidity() + (1 - GetSunFactor())) / 200.0; }
|
|
|
Definition at line 63 of file planet.h. References sunEnergy. Referenced by GetSoil(), and PlanetInfoDlg::SetupInfo().
00063 { return sunEnergy; } // - sunEnergy * GetTotalHumidity() / 100.0; }
|
|
|
Definition at line 58 of file planet.h. References gravity. Referenced by PlanetInfoDlg::SetupInfo().
00058 { return gravity; }
|
|
|
Definition at line 59 of file planet.h. References humidity, and humidityTerraformedDelta. Referenced by Parameters::CreateGalaxy(), GetSoil(), GetWater(), IsCompatible(), and PlanetInfoDlg::SetupInfo().
00059 { return humidity + humidityTerraformedDelta; }
|
|
|
Definition at line 61 of file planet.h. References atmPressure, and pressureTerraformedDelta. Referenced by Parameters::CreateGalaxy(), GetWater(), IsCompatible(), and PlanetInfoDlg::SetupInfo().
00061 { return atmPressure + pressureTerraformedDelta; }
|
|
|
Definition at line 60 of file planet.h. References surfaceTemperature, and surfaceTemperatureTerraformedDelta. Referenced by Parameters::CreateGalaxy(), IsCompatible(), and PlanetInfoDlg::SetupInfo().
00060 { return surfaceTemperature + surfaceTemperatureTerraformedDelta; }
|
|
|
Definition at line 57 of file planet.h. References planetType. Referenced by DrawPlanet(), and Setup().
00057 { return planetType; }
|
|
|
Definition at line 68 of file planet.h. References GetTotalHumidity(), GetTotalPressure(), and water. Referenced by GetDeuterium(), GetFlora(), and PlanetInfoDlg::SetupInfo().
00068 { return water * GetTotalPressure() / 100.0 + GetTotalHumidity() / 10.0; }
|
|
|
Definition at line 76 of file planet.h. References colony. Referenced by StarSystem::DrawInfluenceZones(), DrawPlanet(), IsCompatible(), and IsHomeWorldOf().
00076 { return colony != 0; }
|
|
|
Definition at line 111 of file planet.cpp. References SpeciesInfo::atmPressure, GetTotalHumidity(), GetTotalPressure(), GetTotalSurfaceTemperature(), SpeciesInfo::humidity, SpeciesInfo::hwPlanet, IsColonized(), SpeciesInfo::residue, and SpeciesInfo::surfaceTemperature. Referenced by Parameters::CreateGalaxy().
00112 {
00113 if( !IsColonized() )
00114 {
00115 double residue = fabs( aSi->surfaceTemperature - GetTotalSurfaceTemperature() );
00116 if( residue < 5.0 )
00117 {
00118 residue += fabs( aSi->atmPressure - GetTotalPressure() );
00119 residue += fabs( aSi->humidity - GetTotalHumidity() );
00120 residue /= 3.0;
00121
00122 if( aSi->residue > residue )
00123 {
00124 aSi->residue = residue;
00125 aSi->hwPlanet = this;
00126 }
00127
00128 }
00129 if( residue < 0.01 )
00130 return true;
00131 }
00132 return false;
00133 }
|
|
|
Definition at line 135 of file planet.cpp. References colony, Colony::homeWorld, IsColonized(), and Colony::species.
00136 {
00137 return IsColonized() && colony->homeWorld && colony->species == species;
00138 }
|
|
|
Definition at line 82 of file planet.h. References planetName. Referenced by PlayGame::Load().
00082 { return planetName == aName; }
|
|
|
Definition at line 140 of file planet.cpp. References atmPressure, deuterium, energy, fauna, flora, gravity, humidity, humidityTerraformedDelta, lithium, ore, planetNo, planetSize, planetType, pressureTerraformedDelta, soil, sunEnergy, surfaceTemperature, surfaceTemperatureTerraformedDelta, and water. Referenced by StarSystem::Save().
00141 {
00142 *of << "\t(" << planetNo << " "
00143 << planetSize << " " << planetType << " "
00144 << ore << " " << energy << " " << soil << " " << fauna << " " << flora << " " << lithium << " " << deuterium << " "
00145 << std::fixed << std::setprecision( 2 ) << humidity << " " << surfaceTemperature << " " << gravity << " " << atmPressure << " " << sunEnergy << " " << water <<" "
00146 << humidityTerraformedDelta << " " << surfaceTemperatureTerraformedDelta << " " << pressureTerraformedDelta
00147 << ")" << endl;
00148
00149 return true;
00150 } |
|
|
|
Definition at line 27 of file planet.h. Referenced by Colonize(). |
|
|
|
|
|
|
|
|
Definition at line 3 of file planet.cpp. Referenced by Parameters::CreateGalaxy(), PlayGame::Load(), Planet(), and Galaxy::Reset(). |
|
|
Definition at line 23 of file planet.h. Referenced by ClickedOn(), and DrawPlanet(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetTotalPressure(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 35 of file planet.h. Referenced by Colonize(), DrawPlanet(), IsColonized(), and IsHomeWorldOf(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetDeuterium(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetEnergy(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetFauna(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetFlora(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetSurfaceGravity(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetTotalHumidity(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 38 of file planet.h. Referenced by GetTotalHumidity(), Galaxy::Load(), and Save(). |
|
|
Definition at line 21 of file planet.h. Referenced by DrawPlanet(), and Setup(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetLithium(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetOre(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 44 of file planet.h. Referenced by IsPlanetName(), Colony::Save(), and PlanetInfoDlg::SetupInfo(). |
|
|
|
|
|
Definition at line 43 of file planet.h. Referenced by GetPlanetSize(), Save(), and Setup(). |
|
|
Definition at line 42 of file planet.h. Referenced by GetType(), Save(), Setup(), and PlanetInfoDlg::SetupInfo(). |
|
|
Definition at line 38 of file planet.h. Referenced by GetTotalPressure(), Galaxy::Load(), and Save(). |
|
|
Definition at line 31 of file planet.h. Referenced by GetSoil(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 33 of file planet.h. Referenced by Setup(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetSunFactor(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetTotalSurfaceTemperature(), Galaxy::Load(), Save(), and Setup(). |
|
|
Definition at line 38 of file planet.h. Referenced by GetTotalSurfaceTemperature(), Galaxy::Load(), and Save(). |
|
|
Definition at line 37 of file planet.h. Referenced by GetWater(), Galaxy::Load(), Save(), and Setup(). |
1.3.3