Commented out some debug output about saving players on server.
This commit is contained in:
parent
1c776c3df8
commit
80acdab93b
@ -322,7 +322,7 @@ void Environment::serializePlayers(const std::string &savedir)
|
|||||||
// Full path to this file
|
// Full path to this file
|
||||||
std::string path = players_path + "/" + player_files[i].name;
|
std::string path = players_path + "/" + player_files[i].name;
|
||||||
|
|
||||||
dstream<<"Checking player file "<<path<<std::endl;
|
//dstream<<"Checking player file "<<path<<std::endl;
|
||||||
|
|
||||||
// Load player to see what is its name
|
// Load player to see what is its name
|
||||||
ServerRemotePlayer testplayer;
|
ServerRemotePlayer testplayer;
|
||||||
@ -337,18 +337,18 @@ void Environment::serializePlayers(const std::string &savedir)
|
|||||||
testplayer.deSerialize(is);
|
testplayer.deSerialize(is);
|
||||||
}
|
}
|
||||||
|
|
||||||
dstream<<"Loaded test player with name "<<testplayer.getName()<<std::endl;
|
//dstream<<"Loaded test player with name "<<testplayer.getName()<<std::endl;
|
||||||
|
|
||||||
// Search for the player
|
// Search for the player
|
||||||
std::string playername = testplayer.getName();
|
std::string playername = testplayer.getName();
|
||||||
Player *player = getPlayer(playername.c_str());
|
Player *player = getPlayer(playername.c_str());
|
||||||
if(player == NULL)
|
if(player == NULL)
|
||||||
{
|
{
|
||||||
dstream<<"Didn't find matching player, ignoring file."<<std::endl;
|
dstream<<"Didn't find matching player, ignoring file "<<path<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
dstream<<"Found matching player, overwriting."<<std::endl;
|
//dstream<<"Found matching player, overwriting."<<std::endl;
|
||||||
|
|
||||||
// OK, found. Save player there.
|
// OK, found. Save player there.
|
||||||
{
|
{
|
||||||
@ -370,15 +370,15 @@ void Environment::serializePlayers(const std::string &savedir)
|
|||||||
Player *player = *i;
|
Player *player = *i;
|
||||||
if(saved_players.find(player) != NULL)
|
if(saved_players.find(player) != NULL)
|
||||||
{
|
{
|
||||||
dstream<<"Player "<<player->getName()
|
/*dstream<<"Player "<<player->getName()
|
||||||
<<" was already saved."<<std::endl;
|
<<" was already saved."<<std::endl;*/
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::string playername = player->getName();
|
std::string playername = player->getName();
|
||||||
// Don't save unnamed player
|
// Don't save unnamed player
|
||||||
if(playername == "")
|
if(playername == "")
|
||||||
{
|
{
|
||||||
dstream<<"Not saving unnamed player."<<std::endl;
|
//dstream<<"Not saving unnamed player."<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -399,24 +399,26 @@ void Environment::serializePlayers(const std::string &savedir)
|
|||||||
}
|
}
|
||||||
if(found == false)
|
if(found == false)
|
||||||
{
|
{
|
||||||
dstream<<"Didn't find free file for player"<<std::endl;
|
dstream<<"WARNING: Didn't find free file for player"<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
dstream<<"Saving player "<<player->getName()<<" to "
|
/*dstream<<"Saving player "<<player->getName()<<" to "
|
||||||
<<path<<std::endl;
|
<<path<<std::endl;*/
|
||||||
// Open file and serialize
|
// Open file and serialize
|
||||||
std::ofstream os(path.c_str(), std::ios_base::binary);
|
std::ofstream os(path.c_str(), std::ios_base::binary);
|
||||||
if(os.good() == false)
|
if(os.good() == false)
|
||||||
{
|
{
|
||||||
dstream<<"Failed to overwrite "<<path<<std::endl;
|
dstream<<"WARNING: Failed to overwrite "<<path<<std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
player->serialize(os);
|
player->serialize(os);
|
||||||
saved_players.insert(player, true);
|
saved_players.insert(player, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//dstream<<"Saved "<<saved_players.size()<<" players."<<std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::deSerializePlayers(const std::string &savedir)
|
void Environment::deSerializePlayers(const std::string &savedir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user