Changeset 10253 for code/branches/storymodeHS14/src
- Timestamp:
- Feb 3, 2015, 11:38:07 PM (10 years ago)
- Location:
- code/branches/storymodeHS14/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/storymodeHS14/src/orxonox/LevelManager.cc
r9667 r10253 89 89 SetConfigValue(defaultLevelName_, "missionOne.oxw") 90 90 .description("Sets the pre selection of the level in the main menu."); 91 SetConfigValue(lastFinishedCampaignMission_, "") 92 .description("The last finished mission of a campaign"); 93 SetConfigValue(campaignMissions_, std::vector<std::string>()) 94 .description("The list of missions in the campaign"); 95 } 96 97 /** 98 * @brief Stores the argument in the corresponding config value. 99 */ 100 void LevelManager::setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission) 101 { 102 ModifyConfigValue(lastFinishedCampaignMission_, set, lastFinishedCampaignMission); 91 103 } 92 104 -
code/branches/storymodeHS14/src/orxonox/LevelManager.h
r9667 r10253 91 91 LevelInfoItem* getAvailableLevelListItem(unsigned int index); //!< Get the LevelInfoItem at the given index in the list of available Levels. 92 92 93 void setLastFinishedCampaignMission(const std::string& lastFinishedCampaignMission); 94 inline const std::string& getLastFinishedCampaignMission() const 95 { return this->lastFinishedCampaignMission_; } 96 97 inline unsigned int getNumberOfCampaignMissions() 98 { return this->campaignMissions_.size(); } 99 inline const std::string& getCampaignMission(unsigned int index) 100 { return this->campaignMissions_[index]; } 101 93 102 /** 94 103 @brief Get the instance of the LevelManager. … … 116 125 // config values 117 126 std::string defaultLevelName_; 127 std::string lastFinishedCampaignMission_; 128 std::vector<std::string> campaignMissions_; 118 129 119 130 static LevelManager* singletonPtr_s; -
code/branches/storymodeHS14/src/orxonox/gametypes/Mission.cc
r10251 r10253 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/command/ConsoleCommand.h" 38 #include "core/config/ConfigValueIncludes.h" 38 39 #include "infos/PlayerInfo.h" 39 40 #include "network/Host.h" 40 41 #include "worldentities/pawns/Pawn.h" 41 #include <iostream> 42 #include <fstream> 43 #include <string> 44 #include <ios> 42 #include "LevelManager.h" 45 43 46 44 namespace orxonox … … 93 91 } 94 92 95 std::string GenerateHelperString(int number)96 {97 std::string helperstring = "";98 while (number > 1)99 {100 helperstring = helperstring + " ";101 number = number - 1;102 }103 helperstring = helperstring + ".";104 return helperstring;105 }106 107 93 void Mission::end() 108 94 { … … 112 98 this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); 113 99 114 boost::filesystem::path filepath("campaign.txt"); 115 std::fstream myfile; 116 myfile.open(filepath.string().c_str(), std::fstream::out); 117 118 std::string line; 119 std::string mission = this->getFilename(); 120 int k = 58 - mission.length(); 121 std::string helperstring = ""; 122 if (myfile.is_open()) 123 { 124 while (k > 1) 125 { 126 helperstring = helperstring + " "; 127 k = k - 1; 128 } 129 helperstring = helperstring + "."; 130 while (getline(myfile, line)) 131 { 132 if (line == mission + " 0" + helperstring) 133 { 134 long pos = (long) myfile.tellp(); 135 myfile.seekp(pos - 61); 136 myfile << mission + " 1" + helperstring; 137 } 138 } 139 } else { 140 orxout(internal_warning) << "failed to open campaign file" << endl; 141 } 142 myfile.flush(); 143 myfile.clear(); 144 myfile.close(); 100 LevelManager::getInstance().setLastFinishedCampaignMission(this->getFilename()); 145 101 } 146 102
Note: See TracChangeset
for help on using the changeset viewer.