diff options
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/player.cpp b/src/player.cpp index 40d403952..8e5f56199 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -18,12 +18,16 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #include "player.h" + +#include <fstream> +#include "util/numeric.h" #include "hud.h" #include "constants.h" #include "gamedef.h" #include "settings.h" #include "content_sao.h" -#include "util/numeric.h" +#include "filesys.h" +#include "log.h" Player::Player(IGameDef *gamedef): touching_ground(false), @@ -195,18 +199,10 @@ void Player::serialize(std::ostream &os) void Player::deSerialize(std::istream &is, std::string playername) { Settings args; - - for(;;) - { - if(is.eof()) - throw SerializationError - (("Player::deSerialize(): PlayerArgsEnd of player \"" + playername + "\" not found").c_str()); - std::string line; - std::getline(is, line); - std::string trimmedline = trim(line); - if(trimmedline == "PlayerArgsEnd") - break; - args.parseConfigLine(line); + + if (!args.parseConfigLines(is, "PlayerArgsEnd")) { + throw SerializationError("PlayerArgsEnd of player " + + playername + " not found!"); } //args.getS32("version"); // Version field value not used |