diff options
| author | jacob1 <jfu614@gmail.com> | 2012-10-02 02:00:57 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-05 14:20:33 (GMT) |
| commit | d45dd605e97fa6c8f6e90495fbb1ae203ac314df (patch) | |
| tree | a53149f388f073d5a41fc50ad3b29355535cce6e /src/client | |
| parent | cb8efcd0f98185104805c8caa88decd39fbd9070 (diff) | |
| download | powder-d45dd605e97fa6c8f6e90495fbb1ae203ac314df.zip powder-d45dd605e97fa6c8f6e90495fbb1ae203ac314df.tar.gz | |
Stamp fix button to bring back deleted stamps
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/Client.cpp | 23 | ||||
| -rw-r--r-- | src/client/Client.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 238c216..a1becf4 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -8,6 +8,7 @@ #include <stdio.h> #include <deque> #include <fstream> +#include <dirent.h> #ifdef MACOSX #include <mach-o/dyld.h> @@ -910,6 +911,28 @@ void Client::updateStamps() return; } +void Client::UnDeleteStamps() +{ + DIR * directory; + struct dirent * entry; + directory = opendir("stamps"); + if (directory != NULL) + { + stampIDs.clear(); + while (entry = readdir(directory)) + { + if(strncmp(entry->d_name, "..", 3) && strncmp(entry->d_name, ".", 2) && strcmp(entry->d_name, ".stm")) + { + char stampname[11]; + strncpy(stampname, entry->d_name, 10); + stampIDs.push_front(stampname); + } + } + closedir(directory); + updateStamps(); + } +} + int Client::GetStampsCount() { return stampIDs.size(); diff --git a/src/client/Client.h b/src/client/Client.h index 95ae952..1cda795 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -112,6 +112,7 @@ public: void DeleteStamp(std::string stampID); std::string AddStamp(GameSave * saveData); std::vector<std::string> GetStamps(int start, int count); + void Client::UnDeleteStamps(); int GetStampsCount(); SaveFile * GetFirstStamp(); |
