Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4597 in orxonox.OLD for orxonox/trunk/src/story_entities/campaign.cc


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

orxonox/trunk: setClassID implemented in all files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/campaign.cc

    r4324 r4597  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    1313   ### File Specific:
    1414   main-programmer: Patrick Boenzli
    15    co-programmer: 
     15   co-programmer:
    1616*/
    1717
     
    3232
    3333
    34 Campaign::Campaign ()
    35 {
     34Campaign::Campaign ()
     35{
     36  this->setClassID(CL_CAMPAIGN, "Campaign");
    3637  this->entities = new tList<StoryEntity>();
    3738  this->isInit = false;
    3839}
    3940
    40 Campaign::Campaign ( TiXmlElement* root)
    41 {
     41Campaign::Campaign ( TiXmlElement* root)
     42{
     43  //! \todo loading with load_param....
     44  this->setClassID(CL_CAMPAIGN, "Campaign");
    4245  TiXmlElement* element;
    4346  const char* string;
    4447  int id;
    45  
     48
    4649  PRINTF(3)("Loading Campaign...\n");
    47  
     50
    4851  assert( root != NULL);
    4952  GameLoader* loader = GameLoader::getInstance();
    50  
     53
    5154  this->entities = new tList<StoryEntity>();
    5255  this->isInit = false;
    53  
     56
    5457  // grab all the necessary parameters
    5558  string = grabParameter( root, "identifier");
     
    6063    }
    6164  else this->setStoryID( id);
    62  
     65
    6366  // find WorldList
    6467  element = root->FirstChildElement( "WorldList");
     
    6972  else
    7073    element = element->FirstChildElement();
    71  
     74
    7275  // load Worlds/Subcampaigns/Whatever
    7376  StoryEntity* lastCreated = NULL;
     
    7780      StoryEntity* created = (StoryEntity*) loader->fabricate( element);
    7881      /*
    79       if( lastCreated != NULL) 
    80         created->setNextStoryID( lastCreated->getStoryID());
     82      if( lastCreated != NULL)
     83        created->setNextStoryID( lastCreated->getStoryID());
    8184      else
    82         created->setNextStoryID( WORLD_ID_GAMEEND);
     85        created->setNextStoryID( WORLD_ID_GAMEEND);
    8386      */
    8487      if( created != NULL)
    85         {
    86           this->addEntity( created);   
    87           lastCreated = created;
    88         }
     88        {
     89          this->addEntity( created);
     90          lastCreated = created;
     91        }
    8992      element = element->NextSiblingElement();
    9093    }
    91   //if( lastCreated != NULL) 
     94  //if( lastCreated != NULL)
    9295  //lastCreated->setStoryID( WORLD_ID_GAMEEND);
    9396}
     
    111114{
    112115  ErrorMessage errorCode;
    113   if( !this->isInit) return errorCode; 
     116  if( !this->isInit) return errorCode;
    114117  if( storyID == WORLD_ID_GAMEEND) return errorCode;
    115118  this->running = true;
     
    126129      se->start();
    127130      se->destroy();
    128      
     131
    129132      delete se;
    130133
     
    133136      se = this->getStoryEntity(nextWorldID);
    134137      this->currentEntity = se;
    135       if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) ) 
    136         {
    137           PRINTF(0)("Quitting campaing story loop\n");
    138           if(se != NULL)
    139             delete se;
    140           return errorCode;
    141         }
    142      
     138      if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) )
     139        {
     140          PRINTF(0)("Quitting campaing story loop\n");
     141          if(se != NULL)
     142            delete se;
     143          return errorCode;
     144        }
     145
    143146    }
    144147}
     
    162165{
    163166  this->running = false;
    164   if(this->currentEntity != NULL) 
     167  if(this->currentEntity != NULL)
    165168    {
    166169      this->currentEntity->stop();
     
    182185
    183186
    184 /** 
     187/**
    185188    \brief adds an game stroy entity to the campaign
    186189
     
    206209{
    207210  this->removeEntity(this->getStoryEntity(storyID));
    208  
     211
    209212}
    210213
     
    251254  tList<StoryEntity>* l;
    252255  StoryEntity* entity = NULL;
    253   l = this->entities->getNext(); 
    254   while( l != NULL) 
    255     { 
     256  l = this->entities->getNext();
     257  while( l != NULL)
     258    {
    256259      entity = l->getObject();
    257260      l = l->getNext();
     
    260263      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
    261264      if(id == storyID)
    262         {
    263           //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
    264           return entity;
    265         }
     265        {
     266          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
     267          return entity;
     268        }
    266269
    267270    }
     
    271274  tIterator<StoryEntity>* iterator = this->entities->getIterator();
    272275  StoryEntity* entity = iterator->nextElement();
    273   while( entity != NULL) 
    274     { 
     276  while( entity != NULL)
     277    {
    275278      int id = entity->getStoryID();
    276279      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
    277280      if(id == storyID)
    278         {
    279           //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
    280           return entity;
    281         }
     281        {
     282          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
     283          return entity;
     284        }
    282285      entity = iterator->nextElement();
    283286    }
Note: See TracChangeset for help on using the changeset viewer.