summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-25 15:37:00 +0100
committermadmaxoft <github@xoft.cz>2014-01-25 15:37:00 +0100
commita2dfb2853718cc8bf73b954e5b678c12d93c815c (patch)
treeb793ef13c8793cf4943659d75fcbe10cb4074daf /src/WorldStorage
parentRemoved unnecessary define (diff)
parentComm logging is available in both Debug and Release modes. (diff)
downloadcuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar.gz
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar.bz2
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar.lz
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar.xz
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.tar.zst
cuberite-a2dfb2853718cc8bf73b954e5b678c12d93c815c.zip
Diffstat (limited to 'src/WorldStorage')
-rw-r--r--src/WorldStorage/ScoreboardSerializer.cpp8
-rw-r--r--src/WorldStorage/WSSAnvil.cpp9
2 files changed, 9 insertions, 8 deletions
diff --git a/src/WorldStorage/ScoreboardSerializer.cpp b/src/WorldStorage/ScoreboardSerializer.cpp
index fa094a033..c65e13f98 100644
--- a/src/WorldStorage/ScoreboardSerializer.cpp
+++ b/src/WorldStorage/ScoreboardSerializer.cpp
@@ -31,16 +31,12 @@ cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScore
bool cScoreboardSerializer::Load(void)
{
- cFile File;
- if (!File.Open(FILE_IO_PREFIX + m_Path, cFile::fmRead))
+ AString Data = cFile::ReadWholeFile(FILE_IO_PREFIX + m_Path);
+ if (Data.empty())
{
return false;
}
- AString Data;
- File.ReadRestOfFile(Data);
- File.Close();
-
AString Uncompressed;
int res = UncompressStringGZIP(Data.data(), Data.size(), Uncompressed);
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 8be6372e2..e2a882f65 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1926,14 +1926,19 @@ bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_N
double Speed[3];
if (!LoadDoublesListFromNBT(Speed, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Motion")))
{
- return false;
+ // Provide default speed:
+ Speed[0] = 0;
+ Speed[1] = 0;
+ Speed[2] = 0;
}
a_Entity.SetSpeed(Speed[0], Speed[1], Speed[2]);
double Rotation[3];
if (!LoadDoublesListFromNBT(Rotation, 2, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Rotation")))
{
- return false;
+ // Provide default rotation:
+ Rotation[0] = 0;
+ Rotation[1] = 0;
}
a_Entity.SetYaw(Rotation[0]);
a_Entity.SetRoll(Rotation[1]);