From 472efa8174626a00ffdf5b39e1a44ac419cd3698 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:12:43 -0700 Subject: Globals.h: Added Floor and Ciel casting, C++ cast cleanups, etc Snow Golems must also be above 64Y to spawn snow (as of 1.8). --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index b9c280b6b..73e8a0d8b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT (int)floor(GetPosX()) -#define POSY_TOINT (int)floor(GetPosY()) -#define POSZ_TOINT (int)floor(GetPosZ()) +#define POSX_TOINT FloorD(GetPosX()) +#define POSY_TOINT FloorD(GetPosY()) +#define POSZ_TOINT FloorD(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3 From e1206568ec71c0e7017c1f764fdc146ba86ce30a Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:22:04 -0700 Subject: Revert "Globals.h: Added Floor and Ciel casting, C++ cast cleanups, etc" This reverts commit 472efa8174626a00ffdf5b39e1a44ac419cd3698. Apparently we don't support some of these features quite yet (darn you C++98!) --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 73e8a0d8b..b9c280b6b 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT FloorD(GetPosX()) -#define POSY_TOINT FloorD(GetPosY()) -#define POSZ_TOINT FloorD(GetPosZ()) +#define POSX_TOINT (int)floor(GetPosX()) +#define POSY_TOINT (int)floor(GetPosY()) +#define POSZ_TOINT (int)floor(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3 From 6444bc25ba326b20f2d6bd2e64992e7d7b8e7231 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Sep 2014 16:55:16 +0200 Subject: Fixed security: Player cannot spawn in a disabled world. --- src/Entities/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 756410989..51a1f8699 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1670,7 +1670,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) cEnderChestEntity::LoadFromJson(root["enderchestinventory"], m_EnderChestContents); m_LoadedWorldName = root.get("world", "world").asString(); - a_World = cRoot::Get()->GetWorld(GetLoadedWorldName(), true); + a_World = cRoot::Get()->GetWorld(GetLoadedWorldName(), false); m_LastBedPos.x = root.get("SpawnX", a_World->GetSpawnX()).asInt(); m_LastBedPos.y = root.get("SpawnY", a_World->GetSpawnY()).asInt(); -- cgit v1.2.3 From 9e1f67932b32241312f25279d924c235d4cff66d Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 6 Sep 2014 15:26:20 +0200 Subject: Fixed player spawning in unknown world. This may happen if the admin removes a world. --- src/Entities/Player.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Entities') diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 51a1f8699..b0da6965a 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -1671,6 +1671,10 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) m_LoadedWorldName = root.get("world", "world").asString(); a_World = cRoot::Get()->GetWorld(GetLoadedWorldName(), false); + if (a_World == NULL) + { + a_World = cRoot::Get()->GetDefaultWorld(); + } m_LastBedPos.x = root.get("SpawnX", a_World->GetSpawnX()).asInt(); m_LastBedPos.y = root.get("SpawnY", a_World->GetSpawnY()).asInt(); -- cgit v1.2.3