Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 4, 2006, 1:49:20 AM (18 years ago)
Author:
patrick
Message:

network: working on the last steps, completion is in reach. sadly the world isn't loaded anymore at the moment. continue work later. work flush

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/network/src/story_entities/multi_player_world.cc

    r6402 r6404  
    1616
    1717#include "multi_player_world.h"
     18#include "multi_player_world_data.h"
    1819
    19 #include "state.h"
    20 #include "class_list.h"
    21 
     20#include "factory.h"
    2221#include "load_param.h"
    23 #include "fast_factory.h"
    24 #include "factory.h"
    25 
    26 
    27 #include "shell_command.h"
    28 #include "resource_manager.h"
    29 #include "state.h"
    30 
    31 #include "game_loader.h"
    32 #include "glmenu_imagescreen.h"
    33 
    34 #include "p_node.h"
    35 #include "world_entity.h"
    36 #include "player.h"
    37 #include "camera.h"
    38 #include "environment.h"
    39 #include "terrain.h"
    40 
    41 
    4222
    4323
    4424using namespace std;
     25
    4526
    4627//! This creates a Factory to fabricate a MultiPlayerWorld
     
    5334  this->setClassID(CL_MULTI_PLAYER_WORLD, "MultiPlayerWorld");
    5435
    55   this->path = NULL;
    56 
     36  this->multiPlayerWorldData = new MultiPlayerWorldData();
    5737  this->loadParams(root);
    5838}
     
    6848{
    6949  PRINTF(3)("MultiPlayerWorld::~MultiPlayerWorld() - deleting current world\n");
    70 }
    71 
    72 
    73 /**
    74  * initializes the world.
    75  * @param name the name of the world
    76  * @param worldID the ID of this world
    77  *
    78  * set all stuff here that is world generic and does not use to much memory
    79  * because the real init() function StoryEntity::init() will be called
    80  * shortly before start of the game.
    81  * since all worlds are initiated/referenced before they will be started.
    82  * NO LEVEL LOADING HERE - NEVER!
    83 */
    84 void MultiPlayerWorld::constuctorInit(const char* name, int worldID)
    85 {
    86   this->gameTime = 0.0f;
    87   this->setSpeed(1.0);
    88   this->shell = NULL;
    89 
    90   this->showPNodes = false;
    91   this->showBV = false;
     50  if( this->multiPlayerWorldData)
     51    delete this->multiPlayerWorldData;
    9252}
    9353
     
    10767
    10868
    109 /**
    110  *  loads the GameWorld by initializing all resources, and set their default values.
    111  */
    112 ErrorMessage MultiPlayerWorld::load()
    113 {
    114 
    115   ////////////////////////////
    116   // Loading Spawning Point //
    117   ////////////////////////////
    118 //   element = root->FirstChildElement("SpawningPoints");
    119 //   if( element == NULL)
    120 //   {
    121 //     PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
    122 //   }
    123 //   else
    124 //   {
    125 //     element = element->FirstChildElement();
    126 //       // load Players/Objects/Whatever
    127 //     PRINTF(4)("Loading Spawning Points\n");
    128 //     while( element != NULL)
    129 //     {
    130 //       BaseObject* created = Factory::fabricate(element);
    131 //       if( created != NULL )
    132 //       {
    133 // //        if(created->isA(CL_SPAWNING_POINT))
    134 // //          this->spawn(dynamic_cast<WorldEntity*>(created));
    135 //         printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
    136 //       }
    137 //
    138 //
    139 //       element = element->NextSiblingElement();
    140 //       glmis->step(); //! @todo temporary
    141 //     }
    142 //     PRINTF(4)("Done loading NetworkWorldEntities\n");
    143 //   }
    144 //
    145 //
    146 //   ////////////////////////
    147 //   // find WorldEntities //
    148 //   ////////////////////////
    149 //   element = root->FirstChildElement("WorldEntities");
    150 //   if( element == NULL)
    151 //   {
    152 //     PRINTF(1)("NetworkWorld is missing 'WorldEntities'\n");
    153 //   }
    154 //   else
    155 //   {
    156 //     element = element->FirstChildElement();
    157 //       // load Players/Objects/Whatever
    158 //     PRINTF(4)("Loading NetworkWorldEntities\n");
    159 //     while( element != NULL)
    160 //     {
    161 //       if( NetworkManager::getInstance()->isGameServer())
    162 //       {
    163 //
    164 //         BaseObject* created = NetworkGameManager::getInstance()->createEntity(element);
    165 //         if( created != NULL )
    166 //         {
    167 // //          if(created->isA(CL_WORLD_ENTITY))
    168 // //            this->spawn(dynamic_cast<WorldEntity*>(created));
    169 //           printf("Created a %s: %s\n", created->getClassName(), created->getName());
    170 //         }
    171 //         else
    172 //           PRINTF(1)("NetworkWorld: could not create this entity\n");
    173 //
    174 //           // if we load a 'Player' we use it as localPlayer
    175 //
    176 //
    177 //           //todo do this more elegant
    178 //         if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    179 //           sky = dynamic_cast<WorldEntity*>(created);
    180 //         if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    181 //         {
    182 //           terrain = dynamic_cast<Terrain*>(created);
    183 //           CDEngine::getInstance()->setTerrain(terrain);
    184 //
    185 //         }
    186 //
    187 //       }
    188 //       else if( /* !strcmp( element->Value(), "SkyBox") || */ /* !strcmp( element->Value(), "Terrain") || */ !strcmp( element->Value(), "SpaceShip"))
    189 //       {
    190 //         BaseObject* created = Factory::fabricate(element);
    191 //         if( created != NULL )
    192 //         {
    193 // //          if(created->isA(CL_WORLD_ENTITY))
    194 // //            this->spawn(dynamic_cast<WorldEntity*>(created));
    195 //           printf("Created a %s: %s\n", created->getClassName(), created->getName());
    196 //         }
    197 //         else
    198 //           PRINTF(1)("NetworkWorld: could not create this entity\n");
    199 //
    200 //           // if we load a 'Player' we use it as localPlayer
    201 //
    202 //
    203 //           //todo do this more elegant
    204 //         if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    205 //           sky = dynamic_cast<WorldEntity*>(created);
    206 //         if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    207 //         {
    208 //           terrain = dynamic_cast<Terrain*>(created);
    209 //           CDEngine::getInstance()->setTerrain(terrain);
    210 //         }
    211 //       }
    212 //       element = element->NextSiblingElement();
    213 //       glmis->step(); //! @todo temporary
    214 //       PRINTF(4)("Done loading NetworkWorldEntities\n");
    215 //     }
    216   }
    21769
    21870
    219 
    220 
Note: See TracChangeset for help on using the changeset viewer.