#include <starsystem.h>
Public Member Functions | |
| StarSystem (const string &aStarName, const string &aStarNameDescr, const string &aSsName, const int aStarType, const int aStarSize) | |
| ~StarSystem (void) | |
| const int | GetImageId (void) const |
| const bool | DrawInGalaxy (SDL_Surface *target) |
| const bool | DrawInfluenceZones (SDL_Surface *target) |
| void | DrawStarSystem (SDL_Surface *target, XRect &in, const int aSunIds) |
| const bool | InVicinity (const XPoint *p) |
| const bool | ClickedOn (const XPoint *p) |
| returns true if we have clicked on the sun of the satrsystem object | |
| const string | GetPlanetName (const int pl) |
| const int | GetStarType (void) const |
| const int | GetStarSize (void) const |
| string | GetStarInfo (void) |
| const bool | Save (ofstream *of) |
Data Fields | |
| const int | starType |
| const int | starSize |
| const string | ssName |
| const string | starName |
| const string | starNameDescr |
Protected Member Functions | |
| void | Setup (void) |
Private Attributes | |
| int | sId |
| XRect | dst |
| XRect | ssDst |
| Rsrc | general |
|
||||||||||||||||||||||||
|
Definition at line 6 of file starsystem.cpp. References Setup().
|
|
|
Definition at line 13 of file starsystem.cpp.
00014 {
00015 for( vector<Planet *>::iterator it = begin() ; it != end() ; ++it )
00016 delete (*it);
00017 clear();
00018 }
|
|
|
returns true if we have clicked on the sun of the satrsystem object
Definition at line 106 of file starsystem.cpp. References ssDst. Referenced by StarSystemObject::evMouseLClick().
00107 {
00108 if( ssDst.HitTest( *p ) == XRect::RELPOS_INSIDE )
00109 return true;
00110 return false;
00111 }
|
|
|
Definition at line 61 of file starsystem.cpp. References Parameters::allSpecies, DrawInGalaxy(), icstring, Planet::IsColonized(), Parameters::ratio, and Parameters::species. Referenced by GalaxyScreen::ResetGalaxyDisplay().
00062 {
00063 // Must mark the star with the species'color...
00064 // temporarily mark one star with one species... we will allow mix of colonies later on...
00065 vector<Planet *>::iterator pos = find_if( begin() , end() , mem_fun( &Planet::IsColonized ) );
00066 if( pos != end() )
00067 {
00068 const icstring sp = (*pos)->colony->species;
00069 unsigned int cnt0 = Parameters::species.size();
00070 unsigned int cnt1 = Parameters::allSpecies.size();
00071 map<icstring , SpeciesInfo*>::iterator pos2 = Parameters::species.find( sp );
00072 assert( pos2 != Parameters::species.end() );
00073 RGBColor speciesColor = pos2->second->color;
00074 XPoint p( x - (int)Parameters::ratio / 2 , y - (int)Parameters::ratio / 2 );
00075 for( int i = 0 ; i < Parameters::ratio ; i++ )
00076 for( int j = 0 ; j < Parameters::ratio ; j++ )
00077 if( (i + j) % 4 == 0 )
00078 DrawPoint( target , p + XPoint( i , j ) , speciesColor );
00079 return DrawInGalaxy( target );
00080 }
00081 return false;
00082 }
|
|
|
Definition at line 52 of file starsystem.cpp. Referenced by DrawInfluenceZones(), and GalaxyScreen::ResetGalaxyDisplay().
00053 {
00054 SDL_Surface *sfc = Graf::Img( sId );
00055 dst = XRect( x - sfc->w / 2 , y - sfc->h / 2 , sfc->w , sfc->h );
00056 SDL_BlitSurface( sfc , 0 , target , &dst );
00057
00058 return true;
00059 }
|
|
||||||||||||||||
|
Definition at line 84 of file starsystem.cpp. References Planet::DrawPlanet(), GetStarSize(), GetStarType(), and ssDst. Referenced by StarSystemObject::Draw().
00085 {
00086 XRect r( 0 , 0 , -1 , -1 );
00087 SDL_Surface *suns = Graf::Img( aSunIds , &r );
00088
00089 XRect src( r.h * GetStarType() , 0 , r.h , r.h );
00090 XRect maxDst( in.Right() - in.h , in.y , in.h , in.h );
00091 int size = (int)(in.h * (GetStarSize() / 6.0));
00092 XPoint c = maxDst.Center();
00093 ssDst = XRect( c.x - size / 2 , c.y - size / 2 , size , size );
00094
00095 Graf::SDL_StretchBlt( suns , &src , target , &ssDst );
00096
00097 XRect plRect( in.x , in.y , ssDst.x , in.h );
00098 for_each( begin() , end() , bind2nd( mem_fun( &Planet::DrawPlanet ) , &plRect ) );
00099 }
|
|
|
Definition at line 41 of file starsystem.h. References sId.
00041 { return sId; }
|
|
|
Definition at line 20 of file starsystem.cpp. References ssName.
|
|
|
Definition at line 113 of file starsystem.cpp. References GetStarSize(), GetStarType(), StarInfo::IsId(), ssName, Parameters::starInfo, starName, and starNameDescr.
00114 {
00115 string ans =
00116 "Borg Denomination: ";
00117 ans += ssName + "\n";
00118 ans += "Star Name : ";
00119 ans += starName;
00120 if( !starNameDescr.empty() )
00121 {
00122 ans += " (";
00123 ans += starNameDescr + ")";
00124 }
00125 ans += "\n";
00126 int thisId = GetStarType() << 8 | GetStarSize() - 1;
00127 vector<StarInfo *>::iterator pos = find_if( Parameters::starInfo.begin() , Parameters::starInfo.end() , bind2nd( mem_fun( &StarInfo::IsId ) , &thisId ) );
00128
00129 if( pos != Parameters::starInfo.end() )
00130 {
00131 ans += "Class: ";
00132 ans += (*pos)->classInf;
00133 ans += "\n";
00134 ans += "Temperature: ";
00135 ans += (*pos)->temInf;
00136 }
00137 return ans;
00138
00139 }
|
|
|
Definition at line 53 of file starsystem.h. References starSize. Referenced by DrawStarSystem(), GetStarInfo(), Setup(), Planet::Setup(), and StarInfoDlg::SetupWindow().
00053 { return starSize + 1; }
|
|
|
Definition at line 52 of file starsystem.h. References starType. Referenced by DrawStarSystem(), GetStarInfo(), Save(), Planet::Setup(), and StarInfoDlg::SetupWindow().
00052 { return starType; }
|
|
|
Definition at line 101 of file starsystem.cpp. References dst. Referenced by GalaxyScreen::evMouseLClick(), GalaxyScreen::evMouseMove(), and GalaxyScreen::ShowTip().
00102 {
00103 return dst.HitTest( *p ) == XRect::RELPOS_INSIDE;
00104 }
|
|
|
Definition at line 141 of file starsystem.cpp. References GetStarType(), Planet::Save(), starName, starNameDescr, and starSize. Referenced by Galaxy::Run().
00142 {
00143 *of << "(\"" << starName << "\" \"" << starNameDescr << "\" " << x << " " << y << " " << GetStarType() << " " << starSize << " " << size() << endl;
00144 for_each( begin() , end() , bind2nd( mem_fun( &Planet::Save ) , of ) );
00145 *of << ")~" << endl;
00146
00147 return true;
00148 }
|
|
|
Definition at line 31 of file starsystem.cpp. References GetStarSize(), sId, ssDst, ssName, and starType. Referenced by StarSystem().
00032 {
00033 const string str = ssName.substr( 0 , 2 );
00034
00035 if( (sId = Graf::HasImage( str )) == -1 )
00036 {
00037 const int id = Graf::LoadImg( "Stars" , "Stars" , "@Images" );
00038
00039 SDL_Surface *sfc = Graf::Img( id );
00040 int size = (int)(sfc->h * (GetStarSize() / 6.0));
00041
00042 SDL_Surface *tmp = Graf::NewSurface( size , size );
00043 XRect src( sfc->h * starType , 0 , sfc->h , sfc->h );
00044 Graf::SDL_StretchBlt( sfc , &src , tmp );
00045 Graf::AddImage( tmp , str );
00046
00047 sId = Graf::HasImage( str );
00048 }
00049 ssDst = XRect( 0 , 0 , 0 , 0 );
00050 }
|
|
|
Definition at line 25 of file starsystem.h. Referenced by DrawInGalaxy(), and InVicinity(). |
|
|
Definition at line 27 of file starsystem.h. |
|
|
Definition at line 23 of file starsystem.h. Referenced by DrawInGalaxy(), GetImageId(), and Setup(). |
|
|
Definition at line 25 of file starsystem.h. Referenced by ClickedOn(), DrawStarSystem(), and Setup(). |
|
|
Definition at line 33 of file starsystem.h. Referenced by GetPlanetName(), GetStarInfo(), Setup(), and StarInfoDlg::SetupWindow(). |
|
|
Definition at line 33 of file starsystem.h. Referenced by GetStarInfo(), Save(), and StarInfoDlg::SetupWindow(). |
|
|
Definition at line 33 of file starsystem.h. Referenced by GetStarInfo(), Save(), and StarInfoDlg::SetupWindow(). |
|
|
Definition at line 32 of file starsystem.h. Referenced by GetStarSize(), and Save(). |
|
|
Definition at line 31 of file starsystem.h. Referenced by GetStarType(), and Setup(). |
1.3.3