- Timestamp:
- Dec 19, 2004, 10:44:35 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/campaign.cc
r3220 r3221 82 82 printf("World::start() - starting new StoryEntity Nr:%i\n", storyID); 83 83 Error errorCode; 84 if( !this->isInit) return errorCode;85 if( storyID == WORLD_ID_GAMEEND) return errorCode;84 if( !this->isInit) return errorCode; 85 if( storyID == WORLD_ID_GAMEEND) return errorCode; 86 86 this->running = true; 87 87 StoryEntity* se = this->getStoryEntity(storyID); 88 88 this->currentEntity = se; 89 while( se != NULL && this->running)89 while( se != NULL && this->running) 90 90 { 91 //se = this->getStoryEntity(storyID);92 93 94 91 se->displayLoadScreen(); 95 92 se->load(); … … 97 94 se->releaseLoadScreen(); 98 95 se->start(); 99 96 se->destroy(); 97 100 98 delete se; 101 99 -
orxonox/trunk/src/command_node.cc
r3216 r3221 166 166 void CommandNode::bind (WorldEntity* entity) 167 167 { 168 bound->add 168 bound->add(entity); 169 169 } 170 170 … … 175 175 void CommandNode::unbind (WorldEntity* entity) 176 176 { 177 bound->remove 177 bound->remove(entity); 178 178 } 179 179 -
orxonox/trunk/src/list.h
r3194 r3221 106 106 void tList<T>::add(WorldEntity* entity) 107 107 { 108 printf("tList<T>::add() \n");109 108 listElement* el = new listElement; 110 109 el->prev = this->last; … … 128 127 { 129 128 if( this->currentEl->curr == entity) 130 { 131 printf("tList<T>::remove() - object found\n"); 132 129 { 133 130 if( this->currentEl->prev == NULL ) this->first = this->currentEl->next; 134 131 else this->currentEl->prev->next = this->currentEl->next; … … 150 147 void tList<T>::destroy() 151 148 { 152 printf("tList<T>::clear() - clearing all world objects, releasing mem\n");153 149 this->currentEl = this->first; 154 150 while(this->currentEl != NULL) -
orxonox/trunk/src/story_entity.cc
r3220 r3221 30 30 /** 31 31 \brief initialize the entity before use. 32 \returns an error code if not able to apply. 32 33 33 34 After execution of this function, the Entity is ready to be played/executed, 34 35 this shifts the initialisation work before the execution - very important... 35 36 36 */ 37 37 Error StoryEntity::init() … … 39 39 40 40 41 /** 42 \brief sets the story ID 43 44 sets the story id of the current entity, this enables it to be identified in a 45 global context. 46 */ 41 47 void StoryEntity::setStoryID(int storyID) 42 48 { … … 44 50 } 45 51 52 53 /** 54 \brief this reads the story id of the current entity 55 \returns the story entity id 56 */ 46 57 int StoryEntity::getStoryID() 47 58 { … … 50 61 51 62 63 /** 64 \brief sets the id of the next story entity 65 66 StoryEntities can choose their following entity themselfs. the entity id defined here 67 will be startet after this entity ends. this can be convenient if you want to have a 68 non linear story with switches. 69 */ 52 70 void StoryEntity::setNextStoryID(int nextStoryID) 53 71 { … … 55 73 } 56 74 75 /** 76 \brief gets the story id of the current entity 77 \returns story id 78 */ 57 79 int StoryEntity::getNextStoryID() 58 80 { … … 61 83 62 84 85 /** 86 \brief starts the entity with the choosen id. only for entities with lists. 87 \param story id 88 \returns error code if this action has caused a error 89 90 this simply starts the story with the id storyID. the story with the choosen id has 91 to be part of the current entity else, this doesn't make sense. this is used for 92 campaigns or the GameLoader, they have lists of Campaigns/Worlds with their own 93 storyID. 94 */ 63 95 Error StoryEntity::start(int storyID) 64 96 {} 65 97 98 99 /** 100 \brief starts the current entity 101 \returns error code if this action has caused a error 102 */ 66 103 Error StoryEntity::start() 67 104 {} 68 105 106 107 /** 108 \brief stops the current entity 109 \returns error code if this action has caused a error 110 111 ATTENTION: this function shouldn't call other functions, or if so, they must return 112 after finishing. If you ignore or forget to do so, the current entity is not able to 113 terminate and it will run in the background or the ressources can't be freed or even 114 worse: are freed and the program will end in a segmentation fault! 115 hehehe, all seen... :) 116 */ 69 117 Error StoryEntity::stop() 70 118 {} 71 119 120 121 /** 122 \brief pause the current entity 123 \returns error code if this action has caused a error 124 125 this pauses the current entity or passes this call forth to the running entity. 126 */ 72 127 Error StoryEntity::pause() 73 128 {} 74 129 130 131 /** 132 \brief resumes a pause 133 \returns error code if this action has caused a error 134 135 this resumess the current entity or passes this call forth to the running entity. 136 */ 75 137 Error StoryEntity::resume() 76 138 {} 77 139 78 140 141 /** 142 \brief loads the current entity 143 144 this is here to enable you loading maps into the entities. for all other actions you 145 should take the init() function. 146 */ 79 147 void StoryEntity::load() 80 148 {} 81 149 150 151 /** 152 \brief destroys and cleans up the current entity. 153 154 this cleans up ressources before the deconstructor is called. for terminating 155 the entity please use the stop() function. 156 */ 82 157 void StoryEntity::destroy() 83 158 {} 84 159 85 160 161 /** 162 \brief this displays the load screen 163 164 it will need some time to load maps or things like that. to inform the user about 165 progress and to just show him/her something for the eyes, put here this stuff 166 */ 86 167 void StoryEntity::displayLoadScreen() 87 168 {} 88 169 170 171 /** 172 \brief undisplay the load screen 173 174 the load process has terminated, you now can release the load screen and start this 175 entity. 176 */ 89 177 void StoryEntity::releaseLoadScreen() 90 178 {} -
orxonox/trunk/src/story_entity.h
r3220 r3221 1 /*! 2 \file story_entity.h 3 \brief holds the base class of everything that is playable - that is part of the story 4 */ 5 1 6 2 7 #ifndef STORY_ENTITY_H … … 6 11 #include "story_def.h" 7 12 13 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 8 14 class StoryEntity { 9 15 10 16 public: 11 17 StoryEntity (); 12 ~StoryEntity ();18 virtual ~StoryEntity (); 13 19 14 bool isInit; 15 bool isPaused; 20 bool isInit; //! if the entity is initialized, this has to be true 21 bool isPaused; //! is true if the entity is paused 16 22 17 23 virtual Error init(); … … 36 42 37 43 private: 38 int storyID; 39 int nextStoryID; 44 int storyID; //! this is the number of this entity, identifying it in a list/tree... 45 int nextStoryID; //! if this entity has finished, this entity shall be called 40 46 }; 41 47 -
orxonox/trunk/src/world.cc
r3220 r3221 105 105 { 106 106 this->isPaused = false; 107 } 108 109 void World::destroy() 110 { 111 107 112 } 108 113 -
orxonox/trunk/src/world.h
r3216 r3221 22 22 World (char* name); 23 23 World (int worldID); 24 ~World ();24 virtual ~World (); 25 25 26 26 template<typename T> … … 36 36 37 37 virtual void load(); 38 virtual void destroy(); 38 39 39 40 void time_slice (Uint32 deltaT); -
orxonox/trunk/src/world_entity.h
r2551 r3221 18 18 public: 19 19 WorldEntity (bool isFree = false); 20 ~WorldEntity ();20 virtual ~WorldEntity (); 21 21 22 22 Location* get_location ();
Note: See TracChangeset
for help on using the changeset viewer.