Fix bug where players are allowed to join a game with all controllers...

..set to computers, if they've clicked it while there was a vacant slot.
This commit is contained in:
Jon Daniel 2005-08-01 23:00:54 +00:00
parent 0426a8de95
commit 23d11f1145
3 changed files with 12 additions and 5 deletions

View file

@ -47,7 +47,7 @@ void start_client(display& disp, const config& game_config, game_data& data,
const std::string host);
struct error {
error(const std::string& msg) : message(msg) {}
error(const std::string& msg = "") : message(msg) { }
std::string message;
};

View file

@ -645,7 +645,7 @@ void connect::process_network_data(const config& data, const network::connection
const int side_drop = lexical_cast_default<int>(data["side_drop"], 0) - 1;
if(side_drop >= 0 && side_drop < int(sides_.size())) {
connected_user_list::iterator player = find_player(sides_[side_drop].get_id());
sides_[side_drop].reset(default_controller_);
sides_[side_drop].reset(sides_[side_drop].get_controller());
if (player != users_.end()) {
users_.erase(player);
update_user_combos();
@ -685,6 +685,13 @@ void connect::process_network_data(const config& data, const network::connection
config response;
response.values["failed"] = "yes";
network::send_data(response, sock);
config kick;
kick["username"] = data["name"];
config res;
res.add_child("kick", kick);
network::send_data(res);
update_user_combos();
update_and_send_diff();
return;
}
}

View file

@ -178,7 +178,7 @@ void wait::join_game(bool observe)
if(sides_list.empty()) {
set_result(QUIT);
throw mp::error(_("No multiplayer sides available in this game"));
throw network::error(_("No multiplayer sides available in this game"));
return;
}
@ -205,12 +205,12 @@ void wait::join_game(bool observe)
if(allow_changes) {
const config* era = level_.child("era");
if(era == NULL)
throw mp::error(_("Era not available"));
throw network::error(_("Era not available"));
const config::child_list& possible_sides =
era->get_children("multiplayer_side");
if(possible_sides.empty()) {
set_result(QUIT);
throw mp::error(_("No multiplayer sides found"));
throw network::error(_("No multiplayer sides found"));
return;
}