1
0

Save last gamemode

git-svn-id: http://mc-server.googlecode.com/svn/trunk@660 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
lapayo94@gmail.com
2012-07-12 20:55:29 +00:00
parent a7d72ac70f
commit 6c5a42737f
2 changed files with 11 additions and 1 deletions

View File

@@ -915,6 +915,7 @@ bool cPlayer::LoadFromDisk()
m_Health = (short)root.get("health", 0 ).asInt();
m_FoodLevel = (short)root.get("food", 0 ).asInt();
m_GameMode = (eGameMode) root.get("gamemode", cRoot::Get()->GetDefaultWorld()->GetGameMode()).asInt();
m_Inventory->LoadFromJson(root["inventory"]);
m_CreativeInventory->LoadFromJson(root["creativeinventory"]);
@@ -960,6 +961,7 @@ bool cPlayer::SaveToDisk()
root["health"] = m_Health;
root["food"] = m_FoodLevel;
root["world"] = GetWorld()->GetName();
root["gamemode"] = (int) m_GameMode;
Json::StyledWriter writer;
std::string JsonData = writer.write( root );