std::vector<fs::DirListNode> player_files = fs::GetDirListing(players_path);
for(u32 i=0; i<player_files.size(); i++)
{
- if(player_files[i].dir)
+ if(player_files[i].dir || player_files[i].name[0] == '.')
continue;
// Full path to this file
infostream<<"Failed to read "<<path<<std::endl;
continue;
}
- testplayer.deSerialize(is);
+ testplayer.deSerialize(is, player_files[i].name);
}
//infostream<<"Loaded test player with name "<<testplayer.getName()<<std::endl;
infostream<<"Failed to read "<<path<<std::endl;
continue;
}
- testplayer.deSerialize(is);
+ testplayer.deSerialize(is, player_files[i].name);
}
if(!string_allowed(testplayer.getName(), PLAYERNAME_ALLOWED_CHARS))
infostream<<"Failed to read "<<path<<std::endl;
continue;
}
- player->deSerialize(is);
+ player->deSerialize(is, player_files[i].name);
}
if(newplayer)
inventory.serialize(os);
}
-void Player::deSerialize(std::istream &is)
+void Player::deSerialize(std::istream &is, std::string playername)
{
Settings args;
{
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);
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