Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3238 in orxonox.OLD for orxonox/branches/nico/src/campaign.cc


Ignore:
Timestamp:
Dec 20, 2004, 2:42:54 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches: updated branches: buerli, nico, sound. And moved bezierTrack to old.bezierTrack. Conflicts resolved in a usefull order.
Conflics mostly resolved in favor of trunk
merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico/src/campaign.cc

    r2816 r3238  
    3434
    3535
    36 Error Campaign::init()
     36ErrorMessage Campaign::init()
    3737{
    3838  this->isInit = true;
     
    4848    want to queue up in the campaign.
    4949*/
    50 void Campaign::addEntity(StoryEntity* se, Uint32 storyID)
     50void Campaign::addEntity(StoryEntity* se, int storyID)
    5151{
    5252  se->setStoryID(storyID);
     
    6060
    6161
    62 void Campaign::removeEntity(Uint32 storyID)
     62void Campaign::removeEntity(int storyID)
    6363{
    6464  this->removeEntity(this->getStoryEntity(storyID));
     
    7373
    7474
    75 Error Campaign::start()
     75ErrorMessage Campaign::start()
    7676{
    7777  this->start(0);
    7878}
    7979
    80 Error Campaign::start(Uint32 storyID = 0)
     80ErrorMessage Campaign::start(int storyID = 0)
    8181{
    8282  printf("World::start() - starting new StoryEntity Nr:%i\n", storyID);
    83   Error errorCode;
    84   if(!this->isInit) return errorCode;
    85   if(storyID == WORLD_ID_GAMEEND) return errorCode;
     83  ErrorMessage errorCode;
     84  if( !this->isInit) return errorCode;
     85  if( storyID == WORLD_ID_GAMEEND) return errorCode;
    8686  this->running = true;
    8787  StoryEntity* se = this->getStoryEntity(storyID);
    88   while(se != NULL && this->running)
     88  this->currentEntity = se;
     89  while( se != NULL && this->running)
    8990    {
    90       se = this->getStoryEntity(storyID);
    91       this->currentEntity = se;
    92      
    93       se->displayEntityScreen();
     91      se->displayLoadScreen();
    9492      se->load();
    9593      se->init();
    96       se->releaseEntityScreen();
     94      se->releaseLoadScreen();
    9795      se->start();
     96      se->destroy();
     97     
     98      delete se;
    9899
    99100      int nextWorldID = se->getNextStoryID();
    100       if(nextWorldID == WORLD_ID_GAMEEND) return errorCode;
     101      //printf("Campaing::start() - got nextWorldID = %i\n", nextWorldID);
    101102      se = this->getStoryEntity(nextWorldID);
    102       if(se == NULL)
    103         printf("Campaign::start() - ERROR: world it not found, oh oh...");
     103      this->currentEntity = se;
     104      if( ( nextWorldID == WORLD_ID_GAMEEND) ||( se == NULL) )
     105        {
     106          printf("Campaign::start() - quitting campaing story loop\n");
     107          if(se != NULL)
     108            delete se;
     109          return errorCode;
     110        }
     111     
    104112    }
    105113}
    106114
    107 Error Campaign::stop()
     115ErrorMessage Campaign::stop()
    108116{
    109117  this->running = false;
     
    111119    {
    112120      this->currentEntity->stop();
    113       delete this->currentEntity;
    114       this->currentEntity = NULL;
     121      //delete this->currentEntity;
     122      //this->currentEntity = NULL;
    115123    }
    116124}
    117125
    118 Error Campaign::pause()
     126ErrorMessage Campaign::pause()
    119127{
    120128  if(this->currentEntity != NULL)
     
    123131
    124132
    125 Error Campaign::resume()
     133ErrorMessage Campaign::resume()
    126134{
    127135  if(this->currentEntity != NULL)
     
    130138
    131139
     140void Campaign::destroy()
     141{
     142  if(this->currentEntity != NULL)
     143    {
     144      this->currentEntity->destroy();
     145      delete this->currentEntity;
     146      this->currentEntity = NULL;
     147    }
     148}
     149
     150/*
     151  \brief this changes to the next level
     152*/
    132153void Campaign::nextLevel()
    133154{
    134   printf("Campaign|nextLevel\n");
    135   int nextID = this->currentEntity->getNextStoryID();
    136   this->stop();
    137   this->start(nextID);
     155  printf("Campaign:nextLevel()\n");
     156  //int nextID = this->currentEntity->getNextStoryID();
     157  //this->stop();
     158  //this->start(nextID);
     159  this->currentEntity->stop();
    138160}
    139161
     162/*
     163  \brief change to the previous level - not implemented
     164
     165  this propably useless
     166*/
    140167void Campaign::previousLevel()
    141168{}
    142169
    143170
    144 StoryEntity* Campaign::getStoryEntity(Uint32 storyID)
     171/*
     172  \brief lookup a entity with a given id
     173  \param story id to be lookuped
     174  \returns the entity found or NULL if search ended without match
     175*/
     176StoryEntity* Campaign::getStoryEntity(int storyID)
    145177{
     178  //printf("Campaing::getStoryEntity(%i) - getting next Entity\n", storyID);
     179  if( storyID == WORLD_ID_GAMEEND)
     180    return NULL;
    146181  ListTemplate<StoryEntity>* l;
    147   StoryEntity* entity;
    148   l = this->entities->get_next(); 
     182  StoryEntity* entity = NULL;
     183  l = this->entities->getNext(); 
    149184  while( l != NULL)
    150185    {
    151       entity = l->get_object();
    152       l = l->get_next();
    153       if(entity->getStoryID() == storyID)
    154         return entity;
     186      entity = l->getObject();
     187      l = l->getNext();
     188      int id = entity->getStoryID();
     189      //printf("Campaing::getStoryEntity() - now looping, found entity nr=%i\n", id);
     190      if(id == storyID)
     191        {
     192          //printf("Campaing::getStoryEntity() - yea, this is what we where looking for: %id\n");
     193          return entity;
     194        }
    155195    }
    156196  return NULL;
Note: See TracChangeset for help on using the changeset viewer.