diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-02 21:19:57 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-11-02 21:19:57 +0100 |
commit | dada2bea27bbc0b5dec68e8089ce5b8c296baabd (patch) | |
tree | c87790fa9c5ce89bddb126c94a3a90fb13ce9478 /source/cPlayer.cpp | |
parent | Fixed player spawn teleport postion. (diff) | |
download | cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.gz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.bz2 cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.lz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.xz cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.tar.zst cuberite-dada2bea27bbc0b5dec68e8089ce5b8c296baabd.zip |
Diffstat (limited to 'source/cPlayer.cpp')
-rw-r--r-- | source/cPlayer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp index 69e163629..85eec3e2d 100644 --- a/source/cPlayer.cpp +++ b/source/cPlayer.cpp @@ -55,6 +55,7 @@ struct cPlayer::sPlayerState cPlayer::GroupList Groups;
std::string PlayerName;
+ std::string LoadedWorldName;
};
cPlayer::cPlayer(cClientHandle* a_Client, const char* a_PlayerName)
@@ -110,7 +111,7 @@ cPlayer::~cPlayer(void) m_Inventory = 0;
}
delete m_pState;
- cRoot::Get()->GetWorld()->RemovePlayer( this ); // TODO - Remove from correct world? Or get rid of this?
+ GetWorld()->RemovePlayer( this ); // TODO - Remove from correct world? Or get rid of this?
}
@@ -702,6 +703,8 @@ bool cPlayer::LoadFromDisk() // TODO - This should also get/set/whatever the cor m_Health = (short)root.get("health", 0 ).asInt();
m_Inventory->LoadFromJson(root["inventory"]);
+
+ m_pState->LoadedWorldName = root.get("world", "world").asString();
return true;
}
@@ -731,6 +734,7 @@ bool cPlayer::SaveToDisk() root["rotation"] = JSON_PlayerRotation;
root["inventory"] = JSON_Inventory;
root["health"] = m_Health;
+ root["world"] = GetWorld()->GetName();
Json::StyledWriter writer;
std::string JsonData = writer.write( root );
@@ -769,3 +773,8 @@ const cPlayer::GroupList & cPlayer::GetGroups() {
return m_pState->Groups;
}
+
+const char* cPlayer::GetLoadedWorldName()
+{
+ return m_pState->LoadedWorldName.c_str();
+}
\ No newline at end of file |