Changeset 11186 for code/branches/bindermFS16/src
- Timestamp:
- May 12, 2016, 4:07:25 PM (9 years ago)
- Location:
- code/branches/bindermFS16/src/orxonox
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bindermFS16/src/orxonox/CMakeLists.txt
r11173 r11186 26 26 Level.cc 27 27 LevelInfo.cc 28 LevelStatus.cc 28 29 LevelManager.cc 29 30 Main.cc … … 61 62 LevelInfo.h 62 63 LevelManager.h 64 LevelStatus.h 63 65 MoodManager.h 64 66 controllers/HumanController.h -
code/branches/bindermFS16/src/orxonox/LevelManager.cc
r11181 r11186 47 47 #include "PlayerManager.h" 48 48 49 49 50 namespace orxonox 50 51 { 51 52 52 LevelStatus::LevelStatus() 53 { 54 this->won = false; 55 this->nextLevels.insert(this->nextLevels.begin(),1); 56 } 57 58 LevelStatus::~LevelStatus() 59 {} 60 61 53 //Mission endmission true 62 54 //check if index level is activated... 63 55 int LevelManager::missionactivate(int index) 64 56 { 65 66 if (allLevelStatus_[index].won) 67 return 1; 68 69 //check if level is activated 70 for(unsigned int i=0;i<allLevelStatus_.size();i++) 71 { 72 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels; 73 bool won=allLevelStatus_[i].won; 74 if(nextLevels[index]==1&&won) 75 return 1; 76 }; 77 78 //check if level visible but not activated 79 for(unsigned int i=0;i<allLevelStatus_.size();i++) 80 { 81 std::vector<int> nextLevels=allLevelStatus_[i].nextLevels; 82 bool won=allLevelStatus_[i].won; 83 if(nextLevels[index]==2&&won) 84 return 2; 85 }; 86 return 0; 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 } 87 82 } 88 83 89 84 //updates the won variable of the corresponding LevelStatus in allLevelStatus_ 90 void LevelManager::setLevelStatus(const int completedLevel) 91 { 92 allLevelStatus_[completedLevel].won=true; 93 } 85 void LevelManager::setLevelStatus(const std::string& LevelWon) 86 { 87 ModifyConfigValue(lastWonMission_, set, LevelWon); 88 } 89 94 90 95 91 //build up allLevelStatus … … 99 95 { 100 96 LevelStatus level; 101 allLevelStatus_.assign (10,level); 102 allLevelStatus_[0].won=true; 103 104 105 allLevelStatus_[1].nextLevels.push_back(2); 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); 106 111 allLevelStatus_[1].nextLevels.push_back(2); 107 112 allLevelStatus_[1].nextLevels.push_back(1); 108 allLevelStatus_[1].nextLevels.push_back(2); 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 109 126 110 127 … … 159 176 SetConfigValue(defaultLevelName_, "missionOne.oxw") 160 177 .description("Sets the pre selection of the level in the main menu."); 161 SetConfigValue(last FinishedCampaignMission_, "")178 SetConfigValue(lastWonMission_, "") 162 179 .description("The last finished mission of a campaign"); 163 180 SetConfigValue(campaignMissions_, std::vector<std::string>()) 164 181 .description("The list of missions in the campaign"); 182 SetConfigValue(test_, std::vector<int>()) 183 .description("The list of missions and their statuses"); 184 165 185 } 166 186 … … 168 188 * @brief Stores the argument in the corresponding config value. 169 189 */ 170 void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission)171 { 172 ModifyConfigValue(last FinishedCampaignMission_, set, lastFinishedCampaignMission);173 } 174 190 /* void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission) 191 { 192 ModifyConfigValue(lastWonMission_, set, lastFinishedCampaignMission); 193 } 194 */ 175 195 176 196 -
code/branches/bindermFS16/src/orxonox/LevelManager.h
r11180 r11186 47 47 #include "util/Singleton.h" 48 48 #include "core/config/Configurable.h" 49 #include "LevelStatus.h" 49 50 50 51 namespace orxonox52 {53 54 class LevelStatus55 {56 public:57 LevelStatus();58 virtual ~LevelStatus();59 60 bool won;61 std::vector<int> nextLevels;62 63 };64 }65 51 66 52 // tolua_begin … … 95 81 virtual ~LevelManager(); 96 82 97 void setLevelStatus(const int integer);83 //void setLevelStatus(const int integer); 98 84 void buildallLevelStatus(); 85 void updateAllLevelStatus(); 86 void setLevelStatus(const std::string& LevelWon); 99 87 100 88 … … 107 95 108 96 // tolua_begin 97 void updatewon(int lastwon); 109 98 int missionactivate(int index); 110 99 void setDefaultLevel(const std::string& levelName); //!< Set the default Level. … … 118 107 LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels. 119 108 120 void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission);121 inline const std::string& getLast FinishedCampaignMission() const122 { return this->last FinishedCampaignMission_; }109 //void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission); 110 inline const std::string& getLastWonMission() const 111 { return this->lastWonMission_; } 123 112 124 113 inline unsigned int getNumberOfCampaignMissions() … … 156 145 // config values 157 146 std::string defaultLevelName_; 158 std::string last FinishedCampaignMission_;147 std::string lastWonMission_; 159 148 std::vector<std::string> campaignMissions_; 160 149 std::vector<int> test_; 161 150 std::vector<LevelStatus> allLevelStatus_; 162 151 -
code/branches/bindermFS16/src/orxonox/gametypes/Mission.cc
r11180 r11186 91 91 this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); 92 92 93 LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename());93 //LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename()); 94 94 95 95 //gibt index von bestandenem level weiter 96 LevelManager::getInstance().setLevelStatus( 7);96 LevelManager::getInstance().setLevelStatus(this->getFilename()); 97 97 } 98 98 else if (!this->gtinfo_->hasEnded())
Note: See TracChangeset
for help on using the changeset viewer.