Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6387 in orxonox.OLD


Ignore:
Timestamp:
Jan 2, 2006, 11:00:14 PM (18 years ago)
Author:
patrick
Message:

network: much more work on the StoryEntity functions and reimplementations of the DataTanks of each StoryEntity

Location:
branches/network/src/story_entities
Files:
6 edited

Legend:

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

    r6386 r6387  
    3838  assert( root != NULL);
    3939
    40   this->campaignData = new CampaignData();
     40  this->campaignData = new CampaignData(root);
    4141  this->loadParams(root);
     42
    4243}
    4344
     
    4748 */
    4849Campaign::~Campaign ()
    49 {}
     50{
     51  if( this->campaignData)
     52    delete this->campaignData;
     53}
    5054
    5155
     
    5862  static_cast<StoryEntity*>(this)->loadParams(root);
    5963
    60   LoadParamXML(root, "WorldList", this, Campaign, loadWorldListParams)
    61   .describe("A List of Worlds to be loaded in this Campaign");
    62 
    6364  PRINTF(4)("Loaded Campaign specific stuff\n");
    64 }
    65 
    66 
    67 /**
    68  *  loads a WorldList
    69  * @param root: the XML-element to load from
    70  */
    71 void Campaign::loadWorldListParams(const TiXmlElement* root)
    72 {
    73   if( root == NULL)
    74     return;
    75 
    76   LOAD_PARAM_START_CYCLE(root, element);
    77   {
    78     StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
    79     if( created != NULL)
    80       this->campaignData->addStoryEntity(created);
    81   }
    82   LOAD_PARAM_END_CYCLE(element);
    83 
    84 }
    85 
    86 
    87 /**
    88  *  initializes the class
    89  */
    90 ErrorMessage Campaign::init()
    91 {
    92   this->isInit = true;
     65
    9366}
    9467
     
    9871 * @param storyID the id of the StoryEntity
    9972 */
    100 ErrorMessage Campaign::start()
     73bool Campaign::start()
    10174{
    10275  PRINTF(2)("Starting Campaign nr. %i\n", this->getStoryID());
    10376
     77  this->isRunning = true;
     78  this->run();
     79
     80  PRINTF(2)("There is no StoryEnity left to play, quitting\n");
     81}
     82
     83
     84/**
     85 *  pauses the campaign
     86 */
     87bool Campaign::pause()
     88{
     89  this->isPaused = true;
     90}
     91
     92
     93/**
     94 *  resumes the campaign after a pause
     95 */
     96bool Campaign::resume()
     97{
     98  PRINTF(4)("Resuming the current Campaign\n");
     99  this->isPaused = false;
     100}
     101
     102
     103/**
     104 *  stops the campaign
     105 */
     106bool Campaign::stop()
     107{
     108  PRINTF(4)("Stopping the current Campaign\n");
     109  this->isRunning = false;
     110  if( this->currentEntity != NULL)
     111  {
     112    this->currentEntity->stop();
     113  }
     114}
     115
     116
     117/**
     118 *  runs the campaign
     119 */
     120void Campaign::run()
     121{
    104122  ErrorMessage       errorCode;
    105123  int                storyID = WORLD_ID_0;
     
    116134    this->currentEntity->unloadData();
    117135  }
    118 
    119   PRINTF(2)("There is no StoryEnity left to play, quitting\n");
    120 }
    121 
    122 
    123 /**
    124  *  pauses the campaign
    125  */
    126 ErrorMessage Campaign::pause()
    127 {
    128   if( this->currentEntity != NULL)
    129     this->isPaused = true;
    130 }
    131 
    132 
    133 /**
    134  *  resumes the campaign after a pause
    135  */
    136 ErrorMessage Campaign::resume()
    137 {
    138   if( this->currentEntity != NULL)
    139     this->isPaused = false;
    140 }
    141 
    142 
    143 /**
    144  *  stops the campaign
    145  */
    146 ErrorMessage Campaign::stop()
    147 {
    148   this->isRunning = false;
    149   if( this->currentEntity != NULL)
    150   {
    151     this->currentEntity->stop();
    152   }
    153136}
    154137
     
    159142void Campaign::switchToNextLevel()
    160143{
    161   PRINTF(4)("Campaign:nextLevel()\n");
     144  PRINTF(4)("Switching to the next StoryEntity\n");
    162145  this->currentEntity->stop();
    163146}
     
    165148
    166149
    167 /* CampaignData */
     150/* ==========================================================================================================
     151   CampaignData
     152   ==========================================================================================================
     153*/
    168154
    169155/**
    170156 * constructor for CampaignData
    171157 */
    172 CampaignData::CampaignData()
     158CampaignData::CampaignData(const TiXmlElement* root)
    173159{
    174160  this->setClassID(CL_CAMPAIGN_DATA, "CampaignData");
    175161  this->currentEntity = NULL;
     162
     163  this->loadParams(root);
    176164}
    177165
     
    180168 * destructor for CampaignData
    181169 */
    182 CampaignData::~ CampaignData()
    183 {}
     170CampaignData::~CampaignData()
     171{
     172  PRINTF(0)("Deleting CampaignData\n");
     173  while( !this->storyEntities.empty())
     174  {
     175    StoryEntity* bo = this->storyEntities.front();
     176    PRINTF(0)("CampaignData is been deleted: nr %i\n", bo->getStoryID());
     177    delete bo;
     178  }
     179}
     180
     181
     182
     183/**
     184 *  loads the Parameters of a Campaign
     185 * @param root: The XML-element to load from
     186 */
     187void CampaignData::loadParams(const TiXmlElement* root)
     188{
     189  LoadParamXML(root, "WorldList", this, CampaignData, loadParamsWorldList)
     190      .describe("A List of Worlds to be loaded in this Campaign");
     191
     192}
     193
     194
     195/**
     196 *  loads a WorldList
     197 * @param root: the XML-element to load from
     198 */
     199void CampaignData::loadParamsWorldList(const TiXmlElement* root)
     200{
     201  if( root == NULL)
     202    return;
     203
     204  LOAD_PARAM_START_CYCLE(root, element);
     205  {
     206    StoryEntity* created = (StoryEntity*) Factory::fabricate(element);
     207    if( created != NULL)
     208      this->addStoryEntity(created);
     209  }
     210  LOAD_PARAM_END_CYCLE(element);
     211}
    184212
    185213
  • branches/network/src/story_entities/campaign.h

    r6386 r6387  
    2525
    2626    void loadParams(const TiXmlElement* root);
    27     void loadWorldListParams(const TiXmlElement* root);
    2827
    29     virtual ErrorMessage init();
    30     virtual ErrorMessage start();
    31     virtual ErrorMessage pause();
    32     virtual ErrorMessage resume();
    33     virtual ErrorMessage stop();
     28    virtual bool start();
     29    virtual bool stop();
     30    virtual bool pause();
     31    virtual bool resume();
     32    virtual void run();
    3433
    3534    void switchToNextLevel();
     
    4443
    4544//! A class that contains the data of the Campaign object
    46 class CampaignData : virtual public BaseObject
     45class CampaignData : public BaseObject
    4746{
    4847
    4948  public:
    50     CampaignData();
     49    CampaignData(const TiXmlElement* root);
    5150    virtual ~CampaignData();
     51
     52    void loadParams(const TiXmlElement* root);
    5253
    5354    void addStoryEntity(StoryEntity* se);
     
    5859
    5960  private:
     61    void loadParamsWorldList(const TiXmlElement* root);
     62
     63
     64  private:
    6065    StoryEntity*                  currentEntity;                //!< reference to the currently used StoryEntity
    6166    std::list<StoryEntity*>       storyEntities;                //!< list of story entities
  • branches/network/src/story_entities/game_world.cc

    r6386 r6387  
    9191  this->music = NULL;
    9292  this->shell = NULL;
    93   this->localPlayer = NULL;
    94   this->localCamera = NULL;
    9593
    9694  this->showPNodes = false;
     
    9896
    9997  this->path = NULL;
     98
     99  this->gameWorldData = new GameWorldData();
    100100}
    101101
     
    108108GameWorld::~GameWorld ()
    109109{
    110   delete this->shell;
    111   PRINTF(3)("GameWorld::~GameWorld() - deleting current world\n");
    112 
    113   delete this->localPlayer;
    114 
    115   // delete all the initialized Engines.
    116   FastFactory::flushAll(true);
    117   delete LightManager::getInstance();
    118   delete ParticleEngine::getInstance();
    119   delete AnimationPlayer::getInstance();
    120   delete PhysicsEngine::getInstance();
    121 
    122   // external engines initialized by the orxonox-class get deleted
    123   SoundEngine::getInstance()->flushAllBuffers();
    124   SoundEngine::getInstance()->flushAllSources();
    125 
    126   if (State::getObjectManager() == &this->objectManager)
    127     State::setObjectManager(NULL);
    128   // erease everything that is left.
    129   delete PNode::getNullParent();
    130 
    131   //secondary cleanup of PNodes;
    132   const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
    133   if (nodeList != NULL)
    134     while (!nodeList->empty())
    135       delete nodeList->front();
    136 
    137   Shader::suspendShader();
    138 
    139   // unload the resources !!
    140   ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
     110  if( this->gameWorldData)
     111    delete this->gameWorldData;
    141112}
    142113
     
    179150  PhysicsEngine::getInstance();
    180151
    181   this->localCamera = new Camera();
    182   this->localCamera->setName ("GameWorld-Camera");
    183 
    184   State::setCamera(this->localCamera, this->localCamera->getTarget());
     152  this->gameWorldData->localCamera = new Camera();
     153  this->gameWorldData->localCamera->setName ("GameWorld-Camera");
     154
     155  State::setCamera(this->gameWorldData->localCamera, this->gameWorldData->localCamera->getTarget());
    185156
    186157  GraphicsEngine::getInstance()->displayFPS(true);
     
    240211    }
    241212
    242   ////////////////
    243   // LOADSCREEN //
    244   ////////////////
    245   element = root->FirstChildElement("LoadScreen");
    246   if (element == NULL)
    247     {
    248       PRINTF(2)("no LoadScreen specified, loading default\n");
    249 
    250       glmis->setBackgroundImage("pictures/load_screen.jpg");
    251       this->glmis->setMaximum(8);
    252       this->glmis->draw();
    253     }
    254   else
    255     {
    256       this->glmis->loadParams(element);
    257       this->glmis->draw();
    258     }
    259   this->glmis->draw();
    260 
    261   ////////////////////////
    262   // find WorldEntities //
    263   ////////////////////////
    264 
    265   element = root->FirstChildElement("WorldEntities");
    266 
    267   if( element == NULL)
    268     {
    269       PRINTF(1)("GameWorld is missing 'WorldEntities'\n");
    270     }
    271   else
    272     {
    273       element = element->FirstChildElement();
    274       // load Players/Objects/Whatever
    275       PRINTF(4)("Loading WorldEntities\n");
    276       while( element != NULL)
    277         {
    278           BaseObject* created = Factory::fabricate(element);
    279           if( created != NULL )
    280             printf("Created a %s: %s\n", created->getClassName(), created->getName());
    281 
    282 
    283           //todo do this more elegant
    284           if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
    285             this->sky = dynamic_cast<WorldEntity*>(created);
    286           if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
    287           {
    288             terrain = dynamic_cast<Terrain*>(created);
    289             CDEngine::getInstance()->setTerrain(terrain);
    290           }
    291           element = element->NextSiblingElement();
    292           glmis->step(); //! @todo temporary
    293         }
    294       PRINTF(4)("Done loading WorldEntities\n");
    295     }
     213
     214
     215    this->gameWorldData->loadGUI(root);
     216
     217
     218    this->gameWorldData->loadWorldEntities(root);
    296219
    297220    //////////////////////////////
     
    310233
    311234
    312   // Create a Player
    313   this->localPlayer = new Player();
    314 
    315   Playable* playable;
    316   const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
    317   if (playableList != NULL)
    318   {
    319     playable = dynamic_cast<Playable*>(playableList->front());
    320     this->localPlayer->setControllable(playable);
    321   }
     235
    322236
    323237
    324238//   //localCamera->setParent(TrackNode::getInstance());
    325239//  tn->addChild(this->localCamera);
    326   localCamera->setClipRegion(1, 10000.0);
     240  this->gameWorldData->localCamera->setClipRegion(1, 10000.0);
    327241//  localCamera->lookAt(playable);
    328242//  this->localPlayer->setParentMode(PNODE_ALL);
    329   if (this->sky != NULL)
    330   {
    331     this->localCamera->addChild(sky);
    332   }
    333   SoundEngine::getInstance()->setListener(this->localCamera);
     243  if (this->gameWorldData->sky != NULL)
     244  {
     245    this->gameWorldData->localCamera->addChild(this->gameWorldData->sky);
     246  }
     247  SoundEngine::getInstance()->setListener(this->gameWorldData->localCamera);
    334248
    335249  /* some static stuff*/
     
    348262
    349263/**
     264 *  unload the data of this GameWorld
     265 */
     266ErrorMessage GameWorld::unloadData()
     267{
     268  delete this->shell;
     269  PRINTF(3)("GameWorld::~GameWorld() - unloading the current GameWorld\n");
     270
     271  // delete all the initialized Engines.
     272  FastFactory::flushAll(true);
     273  delete LightManager::getInstance();
     274  delete ParticleEngine::getInstance();
     275  delete AnimationPlayer::getInstance();
     276  delete PhysicsEngine::getInstance();
     277
     278  // external engines initialized by the orxonox-class get deleted
     279  SoundEngine::getInstance()->flushAllBuffers();
     280  SoundEngine::getInstance()->flushAllSources();
     281
     282  if (State::getObjectManager() == &this->objectManager)
     283    State::setObjectManager(NULL);
     284  // erease everything that is left.
     285  delete PNode::getNullParent();
     286
     287  //secondary cleanup of PNodes;
     288  const std::list<BaseObject*>* nodeList = ClassList::getList(CL_PARENT_NODE);
     289  if (nodeList != NULL)
     290    while (!nodeList->empty())
     291      delete nodeList->front();
     292
     293  Shader::suspendShader();
     294
     295  // unload the resources !!
     296  ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL);
     297}
     298
     299
     300/**
    350301 *  starts the GameWorld
    351302 */
    352 ErrorMessage GameWorld::start()
     303bool GameWorld::start()
    353304{
    354305  this->isPaused = false;
    355306  this->isRunning = true;
    356   this->mainLoop();
     307
     308  this->run();
    357309}
    358310
     
    362314   This happens, when the player decides to end the Level.
    363315*/
    364 ErrorMessage GameWorld::stop()
     316bool GameWorld::stop()
    365317{
    366318  PRINTF(3)("GameWorld::stop() - got stop signal\n");
     
    371323 *  pauses the Game
    372324*/
    373 ErrorMessage GameWorld::pause()
     325bool GameWorld::pause()
    374326{
    375327  this->isPaused = true;
     
    379331 *  ends the pause Phase
    380332*/
    381 ErrorMessage GameWorld::resume()
     333bool GameWorld::resume()
    382334{
    383335  this->isPaused = false;
     
    391343{
    392344  PRINTF(3)("GameWorld::displayLoadScreen - start\n");
    393   this->glmis = new GLMenuImageScreen();
    394   this->glmis->setMaximum(8);
     345  this->gameWorldData->glmis = new GLMenuImageScreen();
     346  this->gameWorldData->glmis->setMaximum(8);
    395347  PRINTF(3)("GameWorld::displayLoadScreen - end\n");
    396348}
     
    405357{
    406358  PRINTF(3)("GameWorld::releaseLoadScreen - start\n");
    407   this->glmis->setValue(this->glmis->getMaximum());
     359  this->gameWorldData->glmis->setValue(this->gameWorldData->glmis->getMaximum());
    408360  PRINTF(3)("GameWorld::releaseLoadScreen - end\n");
    409   delete this->glmis;
     361  delete this->gameWorldData->glmis;
    410362}
    411363
     
    485437
    486438      /* update tick the rest */
    487       this->localCamera->tick(this->dtS);
     439      this->gameWorldData->localCamera->tick(this->dtS);
    488440      // tick the engines
    489441      AnimationPlayer::getInstance()->tick(this->dtS);
     
    541493  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    542494  // set camera
    543   this->localCamera->apply ();
     495  this->gameWorldData->localCamera->apply ();
    544496  // draw world
    545497  this->draw();
     
    600552 * collisions drawing everything to the screen.
    601553 */
    602 void GameWorld::mainLoop()
     554void GameWorld::run()
    603555{
    604556  this->lastFrame = SDL_GetTicks ();
     
    659611}
    660612
     613
     614
     615
     616
     617
     618
     619GameWorldData::GameWorldData()
     620{
     621  this->localPlayer = NULL;
     622  this->localCamera = NULL;
     623
     624  this->glmis = NULL;
     625
     626  this->localCamera = NULL;
     627  this->localPlayer = NULL;
     628  this->sky = NULL;
     629  this->terrain = NULL;
     630
     631}
     632
     633
     634GameWorldData::~GameWorldData()
     635{
     636  if( this->localPlayer)
     637    delete this->localPlayer;
     638}
     639
     640
     641
     642ErrorMessage GameWorldData::loadData(TiXmlElement* root)
     643{}
     644
     645
     646
     647
     648ErrorMessage GameWorldData::loadGUI(TiXmlElement* root)
     649{
     650  ////////////////
     651  // LOADSCREEN //
     652  ////////////////
     653  TiXmlElement* element = root->FirstChildElement("LoadScreen");
     654  if( element == NULL)
     655  {
     656    PRINTF(2)("no LoadScreen specified, loading default\n");
     657
     658    glmis->setBackgroundImage("pictures/load_screen.jpg");
     659    this->glmis->setMaximum(8);
     660    this->glmis->draw();
     661  }
     662  else
     663  {
     664    this->glmis->loadParams(element);
     665    this->glmis->draw();
     666  }
     667  this->glmis->draw();
     668
     669}
     670
     671
     672ErrorMessage GameWorldData::loadWorldEntities(TiXmlElement* root)
     673{
     674  ////////////////////////
     675  // find WorldEntities //
     676  ////////////////////////
     677
     678  TiXmlElement* element = root->FirstChildElement("WorldEntities");
     679
     680  if( element == NULL)
     681  {
     682    PRINTF(1)("GameWorld is missing 'WorldEntities'\n");
     683  }
     684  else
     685  {
     686    element = element->FirstChildElement();
     687      // load Players/Objects/Whatever
     688    PRINTF(4)("Loading WorldEntities\n");
     689    while( element != NULL)
     690    {
     691      BaseObject* created = Factory::fabricate(element);
     692      if( created != NULL )
     693        printf("Created a %s: %s\n", created->getClassName(), created->getName());
     694
     695
     696          //todo do this more elegant
     697      if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox"))
     698        this->sky = dynamic_cast<WorldEntity*>(created);
     699      if( element->Value() != NULL && !strcmp( element->Value(), "Terrain"))
     700      {
     701        this->terrain = dynamic_cast<Terrain*>(created);
     702        CDEngine::getInstance()->setTerrain(terrain);
     703      }
     704      element = element->NextSiblingElement();
     705      this->glmis->step(); //! @todo temporary
     706    }
     707    PRINTF(4)("Done loading WorldEntities\n");
     708  }
     709
     710    // Create a Player
     711  this->localPlayer = new Player();
     712
     713  Playable* playable;
     714  const list<BaseObject*>* playableList = ClassList::getList(CL_PLAYABLE);
     715  if (playableList != NULL)
     716  {
     717    playable = dynamic_cast<Playable*>(playableList->front());
     718    this->localPlayer->setControllable(playable);
     719  }
     720}
     721
     722
     723ErrorMessage GameWorldData::loadScene(TiXmlElement* root)
     724{}
     725
  • branches/network/src/story_entities/game_world.h

    r6386 r6387  
    2020class Shell;
    2121class OggPlayer;
     22class GameWorldData;
    2223
    2324//! The game world
     
    3839    virtual ErrorMessage init();
    3940    virtual ErrorMessage loadData();
    40     virtual ErrorMessage unloadData() {}
     41    virtual ErrorMessage unloadData();
    4142
    42     virtual ErrorMessage start();
    43     virtual ErrorMessage stop();
    44     virtual ErrorMessage pause();
    45     virtual ErrorMessage resume();
    46 
     43    virtual bool start();
     44    virtual bool stop();
     45    virtual bool pause();
     46    virtual bool resume();
     47    virtual void run();
    4748
    4849    /**  this returns the current game time @returns elapsed game time     */
     
    6162
    6263  protected:
    63     /* world loading functions */
    64     virtual ErrorMessage loadGUI(TiXmlElement* root) {}
    65     virtual ErrorMessage loadWorldEntities(TiXmlElement* root) {}
    66     virtual ErrorMessage loadScene(TiXmlElement* root) {}
    67 
    6864    /* world - running functions */
    69     virtual void mainLoop ();
    70 
    7165    virtual void synchronize();
    7266    virtual void handleInput();
     
    8579
    8680  protected:
    87     char* path;                         //!< The file from which this world is loaded
     81    GameWorldData*      gameWorldData;                //!< reference to the GameWorld Data Tank
     82    char*               path;                         //!< The file from which this world is loaded
    8883
    89     bool showPNodes;                    //!< if the PNodes should be visible.
    90     bool showBV;                        //!< if the Bounding Volumes should be visible.
    91 
    92     GLMenuImageScreen* glmis;           //!< The Level-Loader Display
     84    bool                showPNodes;                   //!< if the PNodes should be visible.
     85    bool                showBV;                       //!< if the Bounding Volumes should be visible.
    9386
    9487    /* world timing */
    95     Uint32 lastFrame;                   //!< last time of frame
    96     Uint32 cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
    97     Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
    98     float dtS;                          //!< The time needed for caluculations in seconds
    99     float speed;                        //!< how fast the game flows
    100     double gameTime;                    //!< this is where the game time is saved
     88    Uint32              lastFrame;                   //!< last time of frame
     89    Uint32              cycle;                       //!< The cycle we are in (starts with 0 and rises with every frame)
     90    Uint32              dt;                          //!< time needed to calculate this frame (in milliSeconds)
     91    float               dtS;                         //!< The time needed for caluculations in seconds
     92    float               speed;                       //!< how fast the game flows
     93    double              gameTime;                    //!< this is where the game time is saved
    10194
    10295    /* external modules interfaces */
    103     ObjectManager objectManager;        //!< The ObjectManager of this GameWorld.
     96    ObjectManager objectManager;                     //!< The ObjectManager of this GameWorld.
    10497
    10598    /* external modules interfaces */
    106     Shell*     shell;
    107     OggPlayer* music;
     99    Shell*              shell;
     100    OggPlayer*          music;
    108101
    109102    /* important entities */
    110     Camera* localCamera;                //!< The current Camera
    111     Player* localPlayer;                //!< The Player, you fly through the level.
    112     WorldEntity* sky;                   //!< The Environmental Heaven of orxonox @todo insert this to environment insted
    113     Terrain* terrain;                   //!< The Terrain of the GameWorld.
     103};
     104
     105
     106class GameWorldData : public BaseObject
     107{
     108
     109  public:
     110    GameWorldData();
     111    ~GameWorldData();
     112    /* world loading functions */
     113    virtual ErrorMessage loadData(TiXmlElement* root);
     114
     115    virtual ErrorMessage loadGUI(TiXmlElement* root);
     116    virtual ErrorMessage loadWorldEntities(TiXmlElement* root);
     117    virtual ErrorMessage loadScene(TiXmlElement* root);
     118
     119  public:
     120    GLMenuImageScreen*  glmis;                        //!< The Level-Loader Display
     121
     122    Camera*             localCamera;                 //!< The current Camera
     123    Player*             localPlayer;                 //!< The Player, you fly through the level.
     124    WorldEntity*        sky;                         //!< The Environmental Heaven of orxonox @todo insert this to environment insted
     125    Terrain*            terrain;                     //!< The Terrain of the GameWorld.
    114126
    115127};
  • branches/network/src/story_entities/multi_player_world.cc

    r6368 r6387  
    9090  this->music = NULL;
    9191  this->shell = NULL;
    92   this->localPlayer = NULL;
    93   this->localCamera = NULL;
    9492
    9593  this->showPNodes = false;
  • branches/network/src/story_entities/story_entity.h

    r6386 r6387  
    1111#include "story_def.h"
    1212#include "error.h"
     13
     14
     15typedef enum StoryEntityState
     16{
     17  SE_STATE_RUN     = 0,
     18  SE_STATE_STOP,
     19  SE_STATE_PAUSE,
     20
     21  SE_STATE_NUM
     22};
     23
    1324
    1425//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
     
    2839  /** function that unloads the data from the StoryEntity */
    2940  virtual ErrorMessage unloadData() {};
     41
    3042  /* running, stopping and pausing */
    3143  /** starts the Entity. Starts the main cycle */
    32   virtual ErrorMessage start() = 0;
    33   /** pauses the Entity. call to resume required to get it running again */
    34   virtual ErrorMessage pause() = 0;
    35   /** resumes the Entity after a stop/pause or suspend. */
    36   virtual ErrorMessage resume() = 0;
     44  virtual bool start() = 0;
    3745  /**  Stops the entity. */
    38   virtual ErrorMessage stop() = 0;
     46  virtual bool stop() = 0;
     47  /** pauses the Entity, you can resume the game by calling the resume() function */
     48  virtual bool pause() = 0;
     49  /** resumes a paused StoryEntity */
     50  virtual bool resume() = 0;
     51  /** function that is been called when the StoryEntity is started via start() */
     52  virtual void run() = 0;
    3953
     54  /* properties interface */
     55  /** returns the state of this StoryEntity */
     56  StoryEntityState getState();
    4057
    4158  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
Note: See TracChangeset for help on using the changeset viewer.