Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7020 in orxonox.OLD for trunk/src/story_entities


Ignore:
Timestamp:
Feb 3, 2006, 4:34:44 PM (19 years ago)
Author:
patrick
Message:

trunk: added the game rules

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/game_world_data.cc

    r6988 r7020  
    5757#include "animation_player.h"
    5858#include "animation3d.h"
     59
     60#include "game_rules.h"
    5961
    6062#include "ogg_player.h"
     
    302304  LoadParam(root, "Music", this, GameWorldData, setSoundTrack);
    303305
    304   //  LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
     306
     307  LoadParamXML(root, "GameRule", this, GameWorldData, loadGameRule);
     308
     309
     310  //LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
    305311  //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    306312
     
    310316  SoundEngine::getInstance()->setListener(this->localCamera);
    311317}
     318
    312319
    313320
     
    353360
    354361
     362void GameWorldData::loadGameRule(const TiXmlElement* root)
     363{
     364
     365  const TiXmlElement* element = root->FirstChildElement("GameRule");
     366
     367  if( element == NULL)
     368  {
     369    PRINTF(1)("GameWorld is missing 'GameRule'\n");
     370  }
     371  else
     372  {
     373    element = element->FirstChildElement();
     374
     375    while( element != NULL)
     376    {
     377      BaseObject* created = Factory::fabricate(element);
     378      if (created == NULL /*|| !created->isA(CL_GAME_RULE)*/)
     379        delete created;
     380      else
     381      {
     382        this->gameRule = dynamic_cast<GameRules*>(created);
     383        element = element->NextSiblingElement();
     384      }
     385    }
     386  }
     387
     388
     389
     390}
     391
     392
     393
  • trunk/src/story_entities/game_world_data.h

    r6827 r7020  
    2222class TiXmlElement;
    2323class OggPlayer;
     24class GameRules;
    2425
    2526
     
    4243    /* interface functions */
    4344    void setSoundTrack(const char* name);
     45    void loadGameRule(const TiXmlElement* root);
    4446
    4547  protected:
     
    6264    OggPlayer*          music;                       //!< Reference to the SoundEngine's music player (OggPlayer)
    6365    ObjectManager*      objectManager;               //!< Reference to the objects manager
     66
     67    GameRules*          gameRule;                   //!< Reference to the game rules of this game
    6468};
    6569
Note: See TracChangeset for help on using the changeset viewer.