From: PilzAdam Date: Fri, 21 Jun 2013 18:32:28 +0000 (+0000) Subject: Print playername when failing to read playerfile and ignore files starting with . X-Git-Tag: 0.4.8~390 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=130464c2688fc2c9cd39d16568c12f17c105cb89;p=oweals%2Fminetest.git Print playername when failing to read playerfile and ignore files starting with . --- diff --git a/src/environment.cpp b/src/environment.cpp index 99da5190c..4b785998b 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -399,7 +399,7 @@ void ServerEnvironment::serializePlayers(const std::string &savedir) std::vector player_files = fs::GetDirListing(players_path); for(u32 i=0; ideSerialize(is); + player->deSerialize(is, player_files[i].name); } if(newplayer) diff --git a/src/player.cpp b/src/player.cpp index a199c9a6c..ec1e3aff7 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -179,7 +179,7 @@ void Player::serialize(std::ostream &os) inventory.serialize(os); } -void Player::deSerialize(std::istream &is) +void Player::deSerialize(std::istream &is, std::string playername) { Settings args; @@ -187,7 +187,7 @@ void Player::deSerialize(std::istream &is) { if(is.eof()) throw SerializationError - ("Player::deSerialize(): PlayerArgsEnd not found"); + (("Player::deSerialize(): PlayerArgsEnd of player \"" + playername + "\" not found").c_str()); std::string line; std::getline(is, line); std::string trimmedline = trim(line); diff --git a/src/player.h b/src/player.h index 517bd354d..89e4667c4 100644 --- a/src/player.h +++ b/src/player.h @@ -197,7 +197,7 @@ public: deSerialize stops reading exactly at the right point. */ void serialize(std::ostream &os); - void deSerialize(std::istream &is); + void deSerialize(std::istream &is, std::string playername); bool touching_ground; // This oscillates so that the player jumps a bit above the surface