Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 11, 2005, 12:55:48 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: setClassID implemented in all files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/game_loader.cc

    r4511 r4597  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    3939   \brief simple constructor
    4040*/
    41 GameLoader::GameLoader ()
    42 {
     41GameLoader::GameLoader ()
     42{
     43  this->setClassID(CL_GAME_LOADER, "GameLoader");
     44  this->setName("GameLoader");
    4345  first = NULL;
    4446}
     
    110112  switch(campaignID)
    111113    {
    112       /* 
    113         Debug Level 0: Debug level used to test the base frame work.
    114         As you can see, all storyentity data is allocated before game
    115         start. the storyentity will load themselfs shortly before start
    116         through the StoryEntity::init() funtion.
     114      /*
     115        Debug Level 0: Debug level used to test the base frame work.
     116        As you can see, all storyentity data is allocated before game
     117        start. the storyentity will load themselfs shortly before start
     118        through the StoryEntity::init() funtion.
    117119      */
    118120    case DEBUG_CAMPAIGN_0:
    119121      {
    120         Campaign* debugCampaign = new Campaign();
    121 
    122         World* world0 = new World(DEBUG_WORLD_0);
    123         world0->setNextStoryID(WORLD_ID_1);
    124         debugCampaign->addEntity(world0, WORLD_ID_0);
    125 
    126         World* world1 = new World(DEBUG_WORLD_1);
    127         world1->setNextStoryID(WORLD_ID_2);
    128         debugCampaign->addEntity(world1, WORLD_ID_1);
    129 
    130         World* world2 = new World(DEBUG_WORLD_2);
    131         world2->setNextStoryID(WORLD_ID_GAMEEND);
    132         debugCampaign->addEntity(world2, WORLD_ID_2);
    133 
    134         this->currentCampaign = debugCampaign;
    135         break;
     122        Campaign* debugCampaign = new Campaign();
     123
     124        World* world0 = new World(DEBUG_WORLD_0);
     125        world0->setNextStoryID(WORLD_ID_1);
     126        debugCampaign->addEntity(world0, WORLD_ID_0);
     127
     128        World* world1 = new World(DEBUG_WORLD_1);
     129        world1->setNextStoryID(WORLD_ID_2);
     130        debugCampaign->addEntity(world1, WORLD_ID_1);
     131
     132        World* world2 = new World(DEBUG_WORLD_2);
     133        world2->setNextStoryID(WORLD_ID_GAMEEND);
     134        debugCampaign->addEntity(world2, WORLD_ID_2);
     135
     136        this->currentCampaign = debugCampaign;
     137        break;
    136138      }
    137139    }
     
    139141
    140142
    141 /** 
     143/**
    142144    \brief starts the current entity
    143     \returns error code if this action has caused a error   
     145    \returns error code if this action has caused a error
    144146*/
    145147ErrorMessage GameLoader::start()
     
    150152
    151153
    152 /** 
     154/**
    153155    \brief stops the current entity
    154156    \returns error code if this action has caused a error
     
    168170
    169171
    170 /** 
     172/**
    171173    \brief pause the current entity
    172174    \returns error code if this action has caused a error
     
    182184
    183185
    184 /** 
     186/**
    185187    \brief resumes a pause
    186188    \returns error code if this action has caused a error
     
    218220     can load everything it needs into memory then.
    219221  */
    220  
     222
    221223  if( fileName == NULL)
    222224    {
     
    224226      return NULL;
    225227    }
    226  
     228
    227229  TiXmlDocument* XMLDoc = new TiXmlDocument( fileName);
    228230  // load the campaign document
     
    234236      return NULL;
    235237    }
    236        
     238
    237239  // check basic validity
    238240  TiXmlElement* root = XMLDoc->RootElement();
    239241  assert( root != NULL);
    240        
     242
    241243  if( strcmp( root->Value(), "Campaign"))
    242244    {
     
    246248      return NULL;
    247249    }
    248        
     250
    249251  // construct campaign
    250252  Campaign* c = new Campaign( root);
    251        
     253
    252254  // free the XML data
    253255  delete XMLDoc;
     
    258260
    259261/**
    260    \brief handle keyboard commands 
     262   \brief handle keyboard commands
    261263   \param event the event to handle
    262264*/
     
    265267  if( event.type == KeyMapper::PEV_NEXT_WORLD)
    266268    {
    267       if( likely(event.bPressed)) 
    268         {
    269           this->nextLevel();
    270         }
     269      if( likely(event.bPressed))
     270        {
     271          this->nextLevel();
     272        }
    271273    }
    272274  else if( event.type == KeyMapper::PEV_PREVIOUS_WORLD)
    273275    {
    274276      if( likely(event.bPressed))
    275         {
    276           this->previousLevel();
    277         }
     277        {
     278          this->previousLevel();
     279        }
    278280    }
    279281  else if( event.type == KeyMapper::PEV_PAUSE)
    280282    {
    281283      if( likely(event.bPressed))
    282         {
    283           if(this->isPaused)
    284             this->resume();
    285           else
    286             this->pause();
    287         }
     284        {
     285          if(this->isPaused)
     286            this->resume();
     287          else
     288            this->pause();
     289        }
    288290    }
    289291  else if( event.type == KeyMapper::PEV_QUIT)
     
    322324void GameLoader::registerFactory( Factory* factory)
    323325{
    324         assert( factory != NULL);
    325        
    326         PRINTF(4)("Registered factory for '%s'\n", factory->getFactoryName());
    327        
    328         if( first == NULL) first = factory;
    329         else first->registerFactory( factory);
     326        assert( factory != NULL);
     327
     328        PRINTF(4)("Registered factory for '%s'\n", factory->getFactoryName());
     329
     330        if( first == NULL) first = factory;
     331        else first->registerFactory( factory);
    330332}
    331333
     
    338340{
    339341  assert( element != NULL);
    340        
     342
    341343  if( first == NULL)
    342344    {
     
    344346      return NULL;
    345347    }
    346        
     348
    347349  if( element->Value() != NULL)
    348350    {
    349351      PRINTF(4)("Attempting fabrication of a '%s'\n", element->Value());
    350352      BaseObject* b = first->fabricate( element);
    351       if( b == NULL) 
    352         PRINTF(2)("Failed to fabricate a '%s'\n", element->Value());
    353       else 
    354         PRINTF(4)("Successfully fabricated a '%s'\n", element->Value());
     353      if( b == NULL)
     354        PRINTF(2)("Failed to fabricate a '%s'\n", element->Value());
     355      else
     356        PRINTF(4)("Successfully fabricated a '%s'\n", element->Value());
    355357      return b;
    356358    }
    357        
     359
    358360  PRINTF(2)("Fabricate failed, TiXmlElement did not contain a value\n");
    359        
     361
    360362  return NULL;
    361363}
Note: See TracChangeset for help on using the changeset viewer.