remove remaining lobby/not_logged_in hacks...

...from the game class as it is no loger used for these purposes
This commit is contained in:
Tomasz Śniatowski 2009-05-19 10:02:32 +01:00
parent b0d4badfd3
commit 07349d0cc9
2 changed files with 1 additions and 40 deletions

View file

@ -63,8 +63,7 @@ game::game(player_map& players, const network::connection host,
save_replays_(save_replays),
replay_save_path_(replay_save_path)
{
// Hack to handle the pseudo games lobby_ and not_logged_in_.
if (owner_ == 0) return;
assert(owner_);
players_.push_back(owner_);
const player_map::iterator pl = player_info_->find(owner_);
if (pl == player_info_->end()) {
@ -78,9 +77,6 @@ game::game(player_map& players, const network::connection host,
game::~game()
{
// Hack to handle the pseudo games lobby_ and not_logged_in_.
if (owner_ == 0) return;
try {
save_replay();
@ -918,11 +914,6 @@ bool game::add_player(const network::connection player, bool observer, bool admi
<< player << ")\n";
return false;
}
// Hack to handle the pseudo games lobby_ and not_logged_in_.
if (owner_ == 0) {
observers_.push_back(player);
return true;
}
const player_map::iterator user = player_info_->find(player);
if (user == player_info_->end()) {
ERR_GAME << "ERROR: Could not find user in player_info_. (socket: "
@ -992,18 +983,6 @@ bool game::remove_player(const network::connection player, const bool disconnect
<< player << ")\n";
return false;
}
// Hack to handle the pseudo games lobby_ and not_logged_in_.
if (owner_ == 0) {
const user_vector::iterator itor =
std::find(observers_.begin(), observers_.end(), player);
if (itor != observers_.end()) {
observers_.erase(itor);
} else {
ERR_GAME << "ERROR: Observer is not in this game. (socket: "
<< player << ")\n";
}
return false;
}
DBG_GAME << debug_player_info();
DBG_GAME << "removing player...\n";
@ -1305,16 +1284,6 @@ void game::set_termination_reason(const std::string& reason) {
if (termination_.empty()) { termination_ = reason; }
}
void game::add_players(const game& other_game, const bool observer) {
user_vector users = other_game.all_game_users();
if (observer){
observers_.insert(observers_.end(), users.begin(), users.end());
}
else{
players_.insert(players_.end(), users.begin(), users.end());
}
}
const user_vector game::all_game_users() const {
user_vector res;

View file

@ -107,14 +107,6 @@ public:
/** Adds players and observers into one vector and returns that. */
const user_vector all_game_users() const;
/**
* Adds players from one game to another. This is used to add players and
* observers from a game to the lobby (which is also implemented as a game),
* if that game ends. The second parameter controls, wether the players are
* added to the players_ or observers_ vector (default observers_).
*/
void add_players(const game& other_game, const bool observer = true);
void start_game(const player_map::const_iterator starter);
/** A user (player only?) asks for the next scenario to advance to. */