- Timestamp:
- May 19, 2016, 1:34:34 PM (9 years ago)
- Location:
- code/branches/bindermFS16/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bindermFS16/src/orxonox/LevelManager.cc
r11186 r11188 33 33 34 34 #include "LevelManager.h" 35 #include "LevelStatus.h" 35 36 36 37 #include <map> … … 51 52 { 52 53 53 //Mission endmission true54 //check if index level is activated...55 int LevelManager::missionactivate(int index)56 {57 updateAllLevelStatus();58 int activated = allLevelStatus_[index].activated;59 return activated;60 }61 62 void LevelManager::updatewon(int lastwon)63 {64 allLevelStatus_[lastwon].won=true;65 66 }67 68 void LevelManager::updateAllLevelStatus()69 {70 for(unsigned int i =0;i<allLevelStatus_.size();i++)71 {72 if(allLevelStatus_[i].won)73 {74 allLevelStatus_[i].activated=1;75 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels;76 for(unsigned int j=i+1;j<allLevelStatus_.size();j++)77 {78 allLevelStatus_[j].activated=nextLevels[j];79 }80 }81 }82 }83 84 //updates the won variable of the corresponding LevelStatus in allLevelStatus_85 void LevelManager::setLevelStatus(const std::string& LevelWon)86 {87 ModifyConfigValue(lastWonMission_, set, LevelWon);88 }89 90 91 //build up allLevelStatus92 //has to be done once per game (not per level)93 //all connections between the levels are saved in here94 void LevelManager::buildallLevelStatus()95 {96 LevelStatus level;97 allLevelStatus_.assign (campaignMissions_.size(),level);98 allLevelStatus_[0].activated=1;99 //allLevelStatus_[0].won=true;100 101 102 allLevelStatus_[0].nextLevels.push_back(1);103 allLevelStatus_[0].nextLevels.push_back(1);104 allLevelStatus_[0].nextLevels.push_back(0);105 allLevelStatus_[0].nextLevels.push_back(0);106 allLevelStatus_[0].nextLevels.push_back(0);107 allLevelStatus_[0].nextLevels.push_back(0);108 allLevelStatus_[0].nextLevels.push_back(0);109 110 allLevelStatus_[1].nextLevels.push_back(1);111 allLevelStatus_[1].nextLevels.push_back(2);112 allLevelStatus_[1].nextLevels.push_back(1);113 allLevelStatus_[1].nextLevels.push_back(0);114 allLevelStatus_[1].nextLevels.push_back(0);115 allLevelStatus_[1].nextLevels.push_back(0);116 allLevelStatus_[1].nextLevels.push_back(0);117 118 allLevelStatus_[2].nextLevels.push_back(2);119 allLevelStatus_[2].nextLevels.push_back(1);120 allLevelStatus_[2].nextLevels.push_back(0);121 allLevelStatus_[2].nextLevels.push_back(0);122 allLevelStatus_[2].nextLevels.push_back(1);123 allLevelStatus_[2].nextLevels.push_back(0);124 allLevelStatus_[2].nextLevels.push_back(0);125 126 127 128 }129 54 130 55 … … 180 105 SetConfigValue(campaignMissions_, std::vector<std::string>()) 181 106 .description("The list of missions in the campaign"); 182 SetConfigValue(test_, std::vector<int>())183 .description("The list of missions and their statuses");107 //SetConfigValue(test_, std::vector<int>()) 108 // .description("The list of missions and their statuses"); 184 109 185 110 } … … 408 333 //TODO: Implement some kind of update? 409 334 } 335 336 337 //Mission endmission true 338 //check if index level is activated... 339 int LevelManager::missionactivate(int index) 340 { 341 updateAllLevelStatus(); 342 int activated = allLevelStatus_[index].activated; 343 return activated; 344 } 345 346 void LevelManager::updatewon(int lastwon) 347 { 348 allLevelStatus_[lastwon].won=true; 349 350 } 351 352 void LevelManager::updateAllLevelStatus() 353 { 354 for(unsigned int i =0;i<allLevelStatus_.size();i++) 355 { 356 if(allLevelStatus_[i].won) 357 { 358 allLevelStatus_[i].activated=1; 359 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels; 360 for(unsigned int j=i+1;j<allLevelStatus_.size();j++) 361 { 362 allLevelStatus_[j].activated=nextLevels[j]; 363 } 364 } 365 } 366 } 367 368 //updates the won variable of the corresponding LevelStatus in allLevelStatus_ 369 void LevelManager::setLevelStatus(const std::string& LevelWon) 370 { 371 ModifyConfigValue(lastWonMission_, set, LevelWon); 372 } 373 374 375 //build up allLevelStatus 376 //has to be done once per game (not per level) 377 //all connections between the levels are saved in here 378 void LevelManager::buildallLevelStatus() 379 { 380 LevelStatus* level = new LevelStatus(this->getContext()); 381 382 /*LevelStatus level; 383 allLevelStatus_.assign (campaignMissions_.size(),level); 384 allLevelStatus_[0].activated=1; 385 //allLevelStatus_[0].won=true; 386 387 388 allLevelStatus_[0].nextLevels.push_back(1); 389 allLevelStatus_[0].nextLevels.push_back(1); 390 allLevelStatus_[0].nextLevels.push_back(0); 391 allLevelStatus_[0].nextLevels.push_back(0); 392 allLevelStatus_[0].nextLevels.push_back(0); 393 allLevelStatus_[0].nextLevels.push_back(0); 394 allLevelStatus_[0].nextLevels.push_back(0); 395 396 allLevelStatus_[1].nextLevels.push_back(1); 397 allLevelStatus_[1].nextLevels.push_back(2); 398 allLevelStatus_[1].nextLevels.push_back(1); 399 allLevelStatus_[1].nextLevels.push_back(0); 400 allLevelStatus_[1].nextLevels.push_back(0); 401 allLevelStatus_[1].nextLevels.push_back(0); 402 allLevelStatus_[1].nextLevels.push_back(0); 403 404 allLevelStatus_[2].nextLevels.push_back(2); 405 allLevelStatus_[2].nextLevels.push_back(1); 406 allLevelStatus_[2].nextLevels.push_back(0); 407 allLevelStatus_[2].nextLevels.push_back(0); 408 allLevelStatus_[2].nextLevels.push_back(1); 409 allLevelStatus_[2].nextLevels.push_back(0); 410 allLevelStatus_[2].nextLevels.push_back(0);*/ 411 412 413 414 } 410 415 } -
code/branches/bindermFS16/src/orxonox/LevelStatus.cc
r11186 r11188 20 20 RegisterClass(LevelStatus); 21 21 22 LevelStatus::LevelStatus( )22 LevelStatus::LevelStatus(Context* context) : BaseObject(context) 23 23 { 24 24 RegisterObject(LevelStatus); -
code/branches/bindermFS16/src/orxonox/LevelStatus.h
r11186 r11188 56 56 { 57 57 public: 58 LevelStatus( );58 LevelStatus(Context* context); 59 59 virtual ~LevelStatus(); 60 60 … … 62 62 std::vector<int> nextLevels; //in this vector at the index i is saved if the ith level should be activated =1, visible but not activated =2, or not activated =0 63 63 int activated; //0 not activated, 1 activated, 2 visible 64 65 64 }; 66 65 }
Note: See TracChangeset
for help on using the changeset viewer.