Changeset 6402 in orxonox.OLD for branches/network/src/story_entities/campaign.cc
- Timestamp:
- Jan 3, 2006, 11:04:50 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/network/src/story_entities/campaign.cc
r6389 r6402 21 21 #include "load_param.h" 22 22 23 #include "campaign_data.h" 23 24 24 25 using namespace std; … … 63 64 64 65 PRINTF(4)("Loaded Campaign specific stuff\n"); 65 66 66 } 67 67 … … 147 147 148 148 149 150 /* ==========================================================================================================151 CampaignData152 ==========================================================================================================153 */154 155 /**156 * constructor for CampaignData157 */158 CampaignData::CampaignData(const TiXmlElement* root)159 {160 this->setClassID(CL_CAMPAIGN_DATA, "CampaignData");161 this->currentEntity = NULL;162 163 this->loadParams(root);164 }165 166 167 /**168 * destructor for CampaignData169 */170 CampaignData::~CampaignData()171 {172 PRINTF(0)("Deleting CampaignData\n");173 while( !this->storyEntities.empty())174 {175 StoryEntity* bo = this->storyEntities.back();176 this->storyEntities.pop_back();177 PRINTF(0)("CampaignData is been deleted: nr %i\n", bo->getStoryID());178 delete bo;179 }180 }181 182 183 184 /**185 * loads the Parameters of a Campaign186 * @param root: The XML-element to load from187 */188 void CampaignData::loadParams(const TiXmlElement* root)189 {190 LoadParamXML(root, "WorldList", this, CampaignData, loadParamsWorldList)191 .describe("A List of Worlds to be loaded in this Campaign");192 193 }194 195 196 /**197 * loads a WorldList198 * @param root: the XML-element to load from199 */200 void CampaignData::loadParamsWorldList(const TiXmlElement* root)201 {202 if( root == NULL)203 return;204 205 LOAD_PARAM_START_CYCLE(root, element);206 {207 StoryEntity* created = (StoryEntity*) Factory::fabricate(element);208 if( created != NULL)209 this->addStoryEntity(created);210 }211 LOAD_PARAM_END_CYCLE(element);212 }213 214 215 /**216 * add the StoryEntity to the campaign data tank217 * @param se the StoryEntity to add218 */219 void CampaignData::addStoryEntity(StoryEntity* se)220 {221 this->storyEntities.push_back(se);222 }223 224 225 /**226 * switch to the next level in the list and return it227 */228 StoryEntity* CampaignData::getFirstLevel()229 {230 int nextStoryID;231 int storyID;232 list<StoryEntity*>::iterator it;233 234 nextStoryID = 0;235 this->currentEntity = NULL;236 for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)237 {238 storyID = (*it)->getStoryID();239 if( storyID == nextStoryID)240 this->currentEntity = (*it);241 }242 return this->currentEntity;243 }244 245 246 /**247 * switch to the next level in the list and return it248 */249 StoryEntity* CampaignData::getNextLevel()250 {251 int nextStoryID;252 int storyID;253 list<StoryEntity*>::iterator it;254 255 nextStoryID = this->currentEntity->getNextStoryID();256 this->currentEntity = NULL;257 for( it = this->storyEntities.begin(); it != this->storyEntities.end(); it++)258 {259 storyID = (*it)->getStoryID();260 if( storyID == nextStoryID)261 this->currentEntity = (*it);262 }263 return this->currentEntity;264 }265 266 267 268 269
Note: See TracChangeset
for help on using the changeset viewer.