diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/base/game.cc | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc index 56719b9..738edca 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -1841,13 +1841,14 @@ void Game::game_load(core::Player *player, filesystem::IniFile & inifile) if (player->control()) return; - if (!core::server()->mode() == core::GameServer::SinglePlayer) { + if (core::server()->mode() != core::GameServer::SinglePlayer) { return; } SaveGame::load_game(player, inifile); } +// load multiplayer savegame player data void Game::player_load(core::Player *player) { if (!player->guid().is_valid()) { @@ -1857,30 +1858,31 @@ void Game::player_load(core::Player *player) if (player->control()) return; - if (!core::server()->mode() == core::GameServer::MultiPlayer) { - - std::string guid(player->guid().str()); - std::string directory(guid.substr(0,4)); + if (core::server()->mode() != core::GameServer::MultiPlayer) { + return; + } - std::string filename; - filename.append("players"); - filename += '/'; - filename.append(directory); - filename += '/'; - filename.append(guid); + std::string guid(player->guid().str()); + std::string directory(guid.substr(0,4)); + + std::string filename; + filename.append("players"); + filename += '/'; + filename.append(directory); + filename += '/'; + filename.append(guid); - filesystem::IniFile inifile; - inifile.open(filename); - if (!inifile.is_open()) { - return; - } - - con_debug << "player " << player->id() << ": " << "loading data" << std::endl; - - SaveGame::load_game(player, inifile); - - inifile.close(); + filesystem::IniFile inifile; + inifile.open(filename); + if (!inifile.is_open()) { + return; } + + con_debug << "player " << player->id() << ": " << "loading data" << std::endl; + + SaveGame::load_game(player, inifile); + + inifile.close(); } void Game::game_save(core::Player *player, std::ostream & os) |