summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 577a33ad9..ca0d625e2 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -1502,6 +1502,24 @@ bool cPlayer::LoadFromDisk()
//SetExperience(root.get("experience", 0).asInt());
m_GameMode = (eGameMode) root.get("gamemode", eGameMode_NotSet).asInt();
+
+ if (m_GameMode == eGameMode_Creative)
+ {
+ m_CanFly = true;
+ }
+ else if (m_GameMode == eGameMode_NotSet)
+ {
+ cWorld * World = cRoot::Get()->GetWorld(GetLoadedWorldName());
+ if (World == NULL)
+ {
+ World = cRoot::Get()->GetDefaultWorld();
+ }
+
+ if (World->GetGameMode() == eGameMode_Creative)
+ {
+ m_CanFly = true;
+ }
+ }
m_Inventory.LoadFromJson(root["inventory"]);