49   float lightspeed = 0.00815;
 
   56   player->
setStep( lightspeed/20.0 * 0.2 );  
 
   59   GameObjects.push_back( player );
 
   61   list<GameObject*>::iterator it = GameObjects.begin();
 
   72   GameObjects.push_back( sun );
 
   80   unsigned int coriolisPlanetNr = nrForCoriolis[wrapper->getCurrentSystem()];
 
   85   float scaleFactor = (4155.0*0.5) / (planet.
distance); 
 
   86   for( 
unsigned int i=0; i < planets.size(); i++ ) {    
 
   97     GameObjects.push_back( planet );
 
   98     if (i == coriolisPlanetNr) 
 
  111   sx = coriolisPlanet->
getPos().
x;
 
  112   sy = coriolisPlanet->
getPos().
y;
 
  113   sz =  coriolisPlanet->
getPos().
z;
 
  117   station->
setPos( sx+a.
x, sy+a.
y, sz+a.
z );
 
  121   GameObjects.push_back( station );
 
  122   stationPosition = ++it;
 
  124   playerStartDistance = 1000;
 
  129   unsigned int numOfPirates = rand()%6+5;
 
  132   for (
unsigned i = 0; i < numOfPirates; i++)
 
  138       int rangeStart = (int)((playerStartDistance) * 0.50); 
 
  139       int rangeEnd = (int)((playerStartDistance) * 0.90);
 
  140       int range = rangeEnd-rangeStart;
 
  143       offset.
x = (rand()%101)-50;
 
  144       offset.
y = (rand()%101)-50;
 
  145       offset.
z = (rand()%range)+rangeStart;
 
  149       ship->setPos (stationPos+offset);
 
  153   unsigned int maxNumberOfThargoids = 
max((
int)0,(
int)(11-numOfPirates));
 
  154   unsigned int numOfThargoids = rand()%(maxNumberOfThargoids+1);
 
  158   int thargoidPositionRangeStart = (int)((playerStartDistance) * 0.20);
 
  159   int thargoidPositionRangeEnd   = (int)((playerStartDistance) * 0.45);
 
  160   int thargoidPositionRange = thargoidPositionRangeEnd-thargoidPositionRangeStart;
 
  162   int thargoidPosition = rand()%thargoidPositionRange+thargoidPositionRangeStart;
 
  164   int thargoidRange = 100;
 
  166   for (
unsigned i = 0; i < numOfThargoids; i++)
 
  174       offset.
x = (rand()%101)-50;
 
  175       offset.
y = (rand()%101)-50;
 
  176       offset.
z = (thargoidPosition+rand()%thargoidRange-thargoidRange/2);
 
  179       ship->setPos( stationPos + offset);
 
  184   unsigned int numOfPoliceShips = 3 + rand()%3;
 
  186   int shipsPositionRangeStart = (int)((playerStartDistance) * 0.01);
 
  187   int shipsPositionRangeEnd   = (int)((playerStartDistance) * 0.15);
 
  188   int shipsPositionRange = shipsPositionRangeEnd-shipsPositionRangeStart;
 
  190   for (
unsigned int i = 0; i < numOfPoliceShips; i++)
 
  192       std::vector<Vector3> pointList;
 
  197       unsigned int shipPosition= rand()%shipsPositionRange+shipsPositionRangeStart;
 
  199       for (
unsigned int j = 0; j < 3; j++)
 
  201           offset.
x = (rand()%51)-25;
 
  202           offset.
y = (rand()%51)-25;
 
  203           offset.
z = shipPosition;
 
  204           pointList.push_back(offset+stationPos);
 
  213   int shipPositionRangeStart = (int)((playerStartDistance) * 0.01);
 
  214   int shipPositionRangeEnd   = (int)((playerStartDistance) * 0.05);
 
  215   int shipPositionRange = shipsPositionRangeEnd-shipsPositionRangeStart;
 
  218   offset.
x = (rand()%41)-20;
 
  219   offset.
y = (rand()%41)-20;
 
  220   offset.
z = rand()%shipsPositionRange+shipsPositionRangeStart;
 
  226   ship->setPos( stationPos + offset);
 
  227   Vector3 viewVector = player->
getPos()+offset - stationPos + offset;
 
  229   ship->setView( viewVector );
 
  230   ship->setSpeed( lightspeed/3 );
 
  240   list<GameObject*>::iterator it = GameObjects.begin();
 
  241   while( it !=GameObjects.end() ) {
 
  243     Star * st = 
dynamic_cast<Star*
>(*it);
 
  296     MessageBox(0, 
"Unknown Type!", 
"World::deinitialize()", 0 );
 
  322   Star * st = 
dynamic_cast<Star*
>(*starPosition);
 
  337   vector<Planet*> * planets = 
new vector<Planet*>;
 
  339   if( starPosition == GameObjects.end() )
 
  342   list<GameObject*>::iterator it = starPosition;
 
  346   while( it != GameObjects.end() && (pl = 
dynamic_cast<Planet*
>(*it++)) != 0 )
 
  347     planets->push_back( pl );
 
  373   vector<GraphicsObject*> * retObjects = 
new vector<GraphicsObject*>;
 
  375   list<GameObject*>::iterator it = starPosition;
 
  378   while( it!= GameObjects.end() && (obj = 
dynamic_cast<GraphicsObject*
>(*it++)) != 0 )
 
  379     retObjects->push_back( obj );
 
  395   vector<SpaceShip*> * retObjects = 
new vector<SpaceShip*>;
 
  397   list<GameObject*>::iterator it = stationPosition;
 
  399   if (it==GameObjects.end()) 
return retObjects;
 
  404   while( it!= GameObjects.end() && (obj = 
dynamic_cast<SpaceShip*
>(*it++)) != 0 )
 
  405     retObjects->push_back( obj );
 
  420   vector<ForeignSpaceShip*> * retObjects = 
new vector<ForeignSpaceShip*>;
 
  422   list<GameObject*>::iterator it = stationPosition;
 
  424   if (it==GameObjects.end()) 
return retObjects;
 
  428   ForeignSpaceShip * obj;
 
  429   while( it!= GameObjects.end() && (obj = 
dynamic_cast<ForeignSpaceShip*
>(*it++)) != 0 )
 
  430     retObjects->push_back( obj );
 
  443   vector<PoliceShip*> * retObjects = 
new vector<PoliceShip*>;
 
  445   list<GameObject*>::iterator it = stationPosition;
 
  447   if (it==GameObjects.end()) 
return retObjects;
 
  452   while( it!= GameObjects.end() )
 
  456         retObjects->push_back( obj );
 
  475   GameObjects.push_back( ship );
 
  491   GameObjects.push_back( ship );
 
  507   GameObjects.push_back( ship );
 
  523   GameObjects.push_back( ship );
 
  540  GameObjects.push_back( ship );
 
  556   list<GameObject*>::iterator iti = stationPosition;
 
  557   list<GameObject*>::iterator itj = stationPosition;
 
  559   if( itj == GameObjects.end() )
 
  565   while( iti != GameObjects.end() ) {
 
  568     while( itj != GameObjects.end() ) {
 
  574       float dist = distVector.
length();
 
  578         list<GameObject*>::iterator pred = iti;
 
  583           GameObjects.erase( iti );
 
  591           GameObjects.erase( itj );
 
  611   list<GameObject*>::iterator it = stationPosition;
 
  613   if( it ==GameObjects.end() )
 
  618   while( it != GameObjects.end() ) {
 
  621       list<GameObject*>::iterator pred = it;
 
  623       GameObjects.erase( it );
 
  641 World *World::m_world = 0;
 
  667   for( 
unsigned int i=0; i < 256; i++ )
 
  668     systemPlanets[i] = getSystemPlanetsR();
 
  670   systemStars.reserve( 256 );
 
  671   for( 
unsigned int i=0; i < 256; i++ )
 
  672     systemStars.push_back( this->getStarTextureR() );
 
  675   m_playerStatus->fuel = wrapper->getFuelAmount();
 
  677   for (
int i = 0; i < 256; i++ )
 
  679       vector<PlanetInfoGraphical> planets = *getSystemPlanets(i);     
 
  680       unsigned possiblePlanets = 
min((
float)planets.size(),5.0f);
 
  681       unsigned coriolisPlanetNr = (rand()%possiblePlanets);
 
  682       nrForCoriolis[i] = coriolisPlanetNr;
 
  697   delete m_playerStatus;
 
  701   for( 
unsigned int i=0; i < 256; i++ ) {
 
  702     systemPlanets[i]->clear();
 
  703     delete systemPlanets[i];
 
  725 TextureName World::getPlanetTexture( 
unsigned __int8 number ) {
 
  801 TextureName World::getPlanetTextureR( 
bool reset ) {
 
  802   static vector<TextureName> usedTextures;
 
  804     usedTextures.clear();
 
  811     for( 
unsigned int i=0; i < usedTextures.size(); i++ )
 
  812       if( usedTextures[i] == getPlanetTexture( num ) )
 
  814   } 
while ( newTexture );
 
  816   usedTextures.push_back( getPlanetTexture( num ) );
 
  817   return getPlanetTexture( num );
 
  828 TextureName World::getStarTexture( 
unsigned __int8 number ) {
 
  877   unsigned __int8 num = rand()%11;
 
  878   return getStarTexture( num );
 
  887   return getSystemInfo( wrapper->getCurrentSystem() );
 
  901   System system = wrapper->getSystemInfo( number );
 
  906   sysinfo.
size = 591352  * (4155.0 / 149600);
 
  924   return wrapper->getSystemInfo( number ).name;
 
  933   return systemPlanets[wrapper->getCurrentSystem()];
 
  943   return systemPlanets[number];
 
  959 vector<PlanetInfoGraphical>  * World::getSystemPlanetsR() {
 
  960   vector<PlanetInfoGraphical> *solarSystem = 
new vector<PlanetInfoGraphical>;
 
  962   int planetCount = (rand()%5 + 1) + (rand()%5 + 1); 
 
  965   int minPlanetPosition = 0;
 
  968   float c1 = (float)800000 / pow((
float)2, (float) planetCount-1);
 
  969   float c2 = (pow((
float)2, (
float)(planetCount*0.75))  * c1) / pow((
float)(planetCount*0.75), (float)2);
 
  970   float rotateSpeed = -1;
 
  973   for(
int i = 0; i < planetCount; i++) {
 
  983     int dist1 = c2*(i+1)*(i+1) + 20000;
 
  984     int dist2 = pow((
float)2, (
float)i)  * c1;
 
  985     maxDistance = 
max( dist1, dist2 );
 
  988     int planetDistance = maxDistance;
 
  989     if( minPlanetPosition != 0 && minPlanetPosition < maxDistance )
 
  990       planetDistance = getRandNumber( minPlanetPosition, maxDistance );
 
  995       rotateSpeed = 1  * planetDistance;
 
  996     planet.
rotateSpeed =(rotateSpeed / planetDistance);
 
 1002     planet.
texture = getPlanetTextureR( reset );
 
 1004     solarSystem->push_back( planet );
 
 1009     minPlanetPosition = planetDistance + 20000;
 
 1024   vector<SystemInfo> *systems;
 
 1025   switch( systemList ) {
 
 1032     vector<int> *
localSystems = wrapper->getLocalSystems();
 
 1034     maxPos.
x = wrapper->getSystemInfo(localSystems->at(0)).posx;
 
 1035     maxPos.
y = wrapper->getSystemInfo(localSystems->at(0)).posy;
 
 1037     for(
unsigned int i = 0; i < localSystems->size(); i++) {
 
 1038       System reachableSystem = wrapper->getSystemInfo(localSystems->at(i));
 
 1039       if( reachableSystem.
posx < minPos.
x )
 
 1040         minPos.
x = reachableSystem.
posx;
 
 1041       if( reachableSystem.
posy < minPos.
y )
 
 1042         minPos.
y = reachableSystem.
posy;
 
 1043       if( reachableSystem.
posx > maxPos.
x )
 
 1044         maxPos.
x = reachableSystem.
posx;
 
 1045       if( reachableSystem.
posy > maxPos.
y )
 
 1046         maxPos.
y = reachableSystem.
posy;
 
 1048     localSystems->clear();
 
 1050     systems = getSystems( minPos.
x, maxPos.
x, minPos.
y, maxPos.
y );
 
 1055     systems = 
new vector<SystemInfo>;
 
 1056     vector<int> *
localSystems = wrapper->getLocalSystems();
 
 1057     for(
unsigned int i = 0; i < localSystems->size(); i++) {
 
 1059       System wsystem = wrapper->getSystemInfo(localSystems->at(i));
 
 1072       systems->push_back( sysinfo );
 
 1074     localSystems->clear();
 
 1094   vector<SystemInfo> *systems = 
new vector<SystemInfo>;
 
 1096   vector<int> *
localSystems = wrapper->getSystemsInRectangle( left, right, bottom, top );
 
 1098   for(
unsigned int i = 0; i < localSystems->size(); i++) {
 
 1100     System wsystem = wrapper->getSystemInfo(localSystems->at(i));
 
 1113     systems->push_back( sysinfo );
 
 1115   localSystems->clear();
 
 1126   return this->systemStars.at( wrapper->getCurrentSystem() );
 
 1135   return systemStars.at( number );
 
 1143   return wrapper->systemIsReachable( systemNumber );
 
 1152   return wrapper->systemIsInLocalRange( systemNumber );
 
 1162   wrapper->performJump( number );
 
 1163   m_playerStatus->fuel = wrapper->getFuelAmount();
 
 1183   wrapper->buyFuel(amount);
 
 1184   m_playerStatus->fuel = wrapper->getFuelAmount();
 
 1189   return wrapper->getAllTradegoodDescriptions();
 
 1194   return wrapper->getCargoBaySize();
 
 1199   return wrapper->getCurrentCash();
 
 1204   return wrapper->getCurrentCargo();
 
 1209   return wrapper->getCurrentMarketplace();
 
 1214   return wrapper->getFreeHoldspace();
 
 1219   return wrapper->getNumberOfTradegoods();
 
 1228   return wrapper->getTradegoodDescription(number);
 
 1237   return wrapper->performPurchase(number,amount);
 
 1246   return wrapper->performSale(number,amount);
 
 1255   return wrapper->getFuelCost();
 
 1264   return wrapper->getFuelAmount();
 
 1273   return wrapper->getMaxFuel();
 
 1282   return wrapper->tradegoodIsInTons(number);
 
 1296   return m_playerStatus;
 
 1312   return "Average agricultural";
 
 1314   return "Average industrial";
 
 1316   return "Mainly agricultural";
 
 1318   return "Mainly industrial";
 
 1320   return "Poor agricultural";
 
 1322   return "Poor industrial";
 
 1324   return "Rich agricultural";
 
 1326   return "Rich industrial";
 
 1337   switch(government) {
 
 1343   return "Confederacy";
 
 1345   return "Corporate State";
 
 1349   return "Dictatorship";
 
 1353   return "Multiple Governments";
 
 1373 unsigned int World::getRandNumber( 
unsigned int min, 
unsigned int max ) {
 
 1377   unsigned int returnVal;
 
 1380     unsigned int upperBound = max - 
min;
 
 1381     unsigned int factor = upperBound / 32767;
 
 1384     unsigned int randomFactor = rand()%factor; 
 
 1385     unsigned int randomOffset = rand(); 
 
 1386     returnVal = (randomFactor  * 32767 + randomOffset) + min; 
 
 1387   } 
while( returnVal > max );