diff options
Diffstat (limited to 'src/client/Client.cpp')
| -rw-r--r-- | src/client/Client.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 4799d9a..a2ae2e7 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -805,7 +805,26 @@ RequestStatus Client::UploadSave(SaveInfo & save) SaveFile * Client::GetStamp(std::string stampID) { - std::ifstream stampFile; + std::string stampFile = std::string(STAMPS_DIR PATH_SEP + stampID + ".stm"); + if(FileExists(stampFile)) + { + SaveFile * file = new SaveFile(stampID); + try + { + GameSave * tempSave = new GameSave(ReadFile(stampFile)); + file->SetGameSave(tempSave); + } + catch (ParseException & e) + { + std::cerr << "Client: Invalid stamp file, " << stampID << " " << std::string(e.what()) << std::endl; + } + return file; + } + else + { + return NULL; + } + /*std::ifstream stampFile; stampFile.open(std::string(STAMPS_DIR PATH_SEP + stampID + ".stm").c_str(), std::ios::binary); if(stampFile.is_open()) { @@ -835,7 +854,7 @@ SaveFile * Client::GetStamp(std::string stampID) else { return NULL; - } + }*/ } void Client::DeleteStamp(std::string stampID) @@ -886,6 +905,8 @@ std::string Client::AddStamp(GameSave * saveData) stampStream.write((const char *)gameData, gameDataLength); stampStream.close(); + delete[] gameData; + stampIDs.push_front(saveID.str()); updateStamps(); |
