summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-09-13 21:39:01 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-13 21:39:01 (GMT)
commit5b52ac3675f08f9f16f44f530df8877ad6c64f2e (patch)
treed1b087ac413010f4248ddb4f6cb07a9f3f7ebbe3 /src/client
parenta11cd592cb9b985298dd16be78dec10226bf3e47 (diff)
downloadpowder-5b52ac3675f08f9f16f44f530df8877ad6c64f2e.zip
powder-5b52ac3675f08f9f16f44f530df8877ad6c64f2e.tar.gz
Save history and new multiline formatter
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Client.cpp11
-rw-r--r--src/client/SaveInfo.cpp13
-rw-r--r--src/client/SaveInfo.h4
3 files changed, 21 insertions, 7 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp
index 191cebb..051dfcd 100644
--- a/src/client/Client.cpp
+++ b/src/client/Client.cpp
@@ -1412,6 +1412,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
json::Boolean tempFavourite = objDocument["Favourite"];
json::Number tempComments = objDocument["Comments"];
json::Number tempViews = objDocument["Views"];
+ json::Number tempVersion = objDocument["Version"];
json::Array tagsArray = objDocument["Tags"];
std::vector<std::string> tempTags;
@@ -1437,6 +1438,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
tempSave->Comments = tempComments.Value();
tempSave->Favourite = tempFavourite.Value();
tempSave->Views = tempViews.Value();
+ tempSave->Version = tempVersion.Value();
return tempSave;
}
catch (json::Exception &e)
@@ -1643,16 +1645,17 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, std::string q
json::Number tempScoreDown = savesArray[j]["ScoreDown"];
json::String tempUsername = savesArray[j]["Username"];
json::String tempName = savesArray[j]["Name"];
- saveArray->push_back(
- new SaveInfo(
+ json::Number tempVersion = savesArray[j]["Version"];
+ SaveInfo * tempSaveInfo = new SaveInfo(
tempID.Value(),
tempDate.Value(),
tempScoreUp.Value(),
tempScoreDown.Value(),
tempUsername.Value(),
tempName.Value()
- )
- );
+ );
+ tempSaveInfo->Version = tempVersion.Value();
+ saveArray->push_back(tempSaveInfo);
}
}
catch (json::Exception &e)
diff --git a/src/client/SaveInfo.cpp b/src/client/SaveInfo.cpp
index c6cafb1..2d8fd52 100644
--- a/src/client/SaveInfo.cpp
+++ b/src/client/SaveInfo.cpp
@@ -12,7 +12,7 @@
SaveInfo::SaveInfo(SaveInfo & save) :
userName(save.userName), name(save.name), Description(save.Description), date(
save.date), Published(save.Published), id(save.id), votesUp(
- save.votesUp), votesDown(save.votesDown), gameSave(NULL), vote(save.vote), tags(save.tags), Comments(save.Comments), Views(save.Views) {
+ save.votesUp), votesDown(save.votesDown), gameSave(NULL), vote(save.vote), tags(save.tags), Comments(save.Comments), Views(save.Views), Version(save.Version) {
if(save.gameSave)
gameSave = new GameSave(*save.gameSave);
}
@@ -21,14 +21,14 @@ SaveInfo::SaveInfo(int _id, int _date, int _votesUp, int _votesDown, std::string
std::string _name) :
id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name(
_name), Description(""), date(_date), Published(
- true), gameSave(NULL), vote(0), tags(), Comments(0), Views(0) {
+ true), gameSave(NULL), vote(0), tags(), Comments(0), Views(0), Version(0) {
}
SaveInfo::SaveInfo(int _id, int date_, int _votesUp, int _votesDown, int _vote, std::string _userName,
std::string _name, std::string description_, bool published_, std::vector<std::string> tags_) :
id(_id), votesUp(_votesUp), votesDown(_votesDown), userName(_userName), name(
_name), Description(description_), date(date_), Published(
- published_), gameSave(NULL), vote(_vote), tags(tags_), Views(0), Comments(0) {
+ published_), gameSave(NULL), vote(_vote), tags(tags_), Views(0), Comments(0), Version(0) {
}
SaveInfo::~SaveInfo()
@@ -99,6 +99,13 @@ int SaveInfo::GetVotesDown() {
return votesDown;
}
+void SaveInfo::SetVersion(int version) {
+ this->Version = version;
+}
+int SaveInfo::GetVersion() {
+ return Version;
+}
+
void SaveInfo::SetTags(std::vector<std::string> tags)
{
this->tags = tags;
diff --git a/src/client/SaveInfo.h b/src/client/SaveInfo.h
index 49057ac..3f52c25 100644
--- a/src/client/SaveInfo.h
+++ b/src/client/SaveInfo.h
@@ -18,6 +18,7 @@ public:
bool Favourite;
int Comments;
int Views;
+ int Version;
GameSave * gameSave;
@@ -64,6 +65,9 @@ public:
void SetVotesDown(int votesDown);
int GetVotesDown();
+ void SetVersion(int version);
+ int GetVersion();
+
void SetTags(std::vector<std::string> tags);
std::vector<std::string> GetTags();