- Timestamp:
- Feb 3, 2015, 11:38:07 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.