summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-24 09:58:40 +0100
committermadmaxoft <github@xoft.cz>2014-01-24 09:58:40 +0100
commit0369c585fb16777acd4639122f8cee2d7c60833d (patch)
treed293e0ff8772f1e520bddce25cbe2a1041303e4a /src
parentFixed crash with failed entity-loading. (diff)
downloadcuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar.gz
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar.bz2
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar.lz
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar.xz
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.tar.zst
cuberite-0369c585fb16777acd4639122f8cee2d7c60833d.zip
Diffstat (limited to 'src')
-rw-r--r--src/WorldStorage/ScoreboardSerializer.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/WorldStorage/ScoreboardSerializer.cpp b/src/WorldStorage/ScoreboardSerializer.cpp
index a53971dc2..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);
@@ -313,13 +309,13 @@ bool cScoreboardSerializer::LoadScoreboardFromNBT(const cParsedNBT & a_NBT)
CurrLine = a_NBT.FindChildByName(Child, "AllowFriendlyFire");
if (CurrLine >= 0)
{
- AllowsFriendlyFire = a_NBT.GetInt(CurrLine);
+ AllowsFriendlyFire = (a_NBT.GetInt(CurrLine) != 0);
}
CurrLine = a_NBT.FindChildByName(Child, "SeeFriendlyInvisibles");
if (CurrLine >= 0)
{
- CanSeeFriendlyInvisible = a_NBT.GetInt(CurrLine);
+ CanSeeFriendlyInvisible = (a_NBT.GetInt(CurrLine) != 0);
}
cTeam * Team = m_ScoreBoard->RegisterTeam(Name, DisplayName, Prefix, Suffix);