From 0369c585fb16777acd4639122f8cee2d7c60833d Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 24 Jan 2014 09:58:40 +0100 Subject: Fixed a few compile-time and runtime warnings in ScoreboardSerializer. --- src/WorldStorage/ScoreboardSerializer.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/WorldStorage') 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); -- cgit v1.2.3