Stop using 32-bit time in SaveInfo
This commit is contained in:
parent
daabe6a116
commit
5e15d02eb8
@ -1,7 +1,7 @@
|
||||
#include "SaveInfo.h"
|
||||
#include "GameSave.h"
|
||||
|
||||
SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, ByteString _userName, String _name):
|
||||
SaveInfo::SaveInfo(int _id, time_t _createdDate, time_t _updatedDate, int _votesUp, int _votesDown, ByteString _userName, String _name):
|
||||
id(_id),
|
||||
createdDate(_createdDate),
|
||||
updatedDate(_updatedDate),
|
||||
@ -20,7 +20,7 @@ SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, in
|
||||
|
||||
}
|
||||
|
||||
SaveInfo::SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, int _vote, ByteString _userName, String _name, String description_, bool published_, std::list<ByteString> tags_):
|
||||
SaveInfo::SaveInfo(int _id, time_t _createdDate, time_t _updatedDate, int _votesUp, int _votesDown, int _vote, ByteString _userName, String _name, String description_, bool published_, std::list<ByteString> tags_):
|
||||
id(_id),
|
||||
createdDate(_createdDate),
|
||||
updatedDate(_updatedDate),
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "common/String.h"
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <ctime>
|
||||
|
||||
#ifdef GetUserName
|
||||
# undef GetUserName // dammit windows
|
||||
@ -14,8 +15,8 @@ class SaveInfo
|
||||
private:
|
||||
public:
|
||||
int id;
|
||||
int createdDate;
|
||||
int updatedDate;
|
||||
time_t createdDate;
|
||||
time_t updatedDate;
|
||||
int votesUp, votesDown;
|
||||
int vote;
|
||||
bool Favourite;
|
||||
@ -32,9 +33,9 @@ public:
|
||||
std::list<ByteString> tags;
|
||||
std::unique_ptr<GameSave> gameSave;
|
||||
|
||||
SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, ByteString _userName, String _name);
|
||||
SaveInfo(int _id, time_t _createdDate, time_t _updatedDate, int _votesUp, int _votesDown, ByteString _userName, String _name);
|
||||
|
||||
SaveInfo(int _id, int _createdDate, int _updatedDate, int _votesUp, int _votesDown, int _vote, ByteString _userName, String _name, String description_, bool published_, std::list<ByteString> tags);
|
||||
SaveInfo(int _id, time_t _createdDate, time_t _updatedDate, int _votesUp, int _votesDown, int _vote, ByteString _userName, String _name, String description_, bool published_, std::list<ByteString> tags);
|
||||
|
||||
void SetName(String name);
|
||||
const String &GetName() const;
|
||||
|
@ -44,8 +44,8 @@ namespace http
|
||||
}
|
||||
saveInfo = std::make_unique<SaveInfo>(
|
||||
document["ID"].asInt(),
|
||||
document["DateCreated"].asInt(),
|
||||
document["Date"].asInt(),
|
||||
document["DateCreated"].asInt64(),
|
||||
document["Date"].asInt64(),
|
||||
document["ScoreUp"].asInt(),
|
||||
document["ScoreDown"].asInt(),
|
||||
document["ScoreMine"].asInt(),
|
||||
|
@ -64,8 +64,8 @@ namespace http
|
||||
{
|
||||
auto saveInfo = std::make_unique<SaveInfo>(
|
||||
save["ID"].asInt(),
|
||||
save["Created"].asInt(),
|
||||
save["Updated"].asInt(),
|
||||
save["Created"].asInt64(),
|
||||
save["Updated"].asInt64(),
|
||||
save["ScoreUp"].asInt(),
|
||||
save["ScoreDown"].asInt(),
|
||||
save["Username"].asString(),
|
||||
|
@ -1004,7 +1004,7 @@ void GameModel::SetSave(std::unique_ptr<SaveInfo> newSave, bool invertIncludePre
|
||||
gameSave->authors["title"] = currentSave->name.ToUtf8();
|
||||
gameSave->authors["description"] = currentSave->Description.ToUtf8();
|
||||
gameSave->authors["published"] = (int)currentSave->Published;
|
||||
gameSave->authors["date"] = currentSave->updatedDate;
|
||||
gameSave->authors["date"] = (Json::Value::UInt64)currentSave->updatedDate;
|
||||
currentSave->SetGameSave(std::move(gameSave));
|
||||
}
|
||||
// This save was probably just created, and we didn't know the ID when creating it
|
||||
|
Reference in New Issue
Block a user