changes to make network play more stable
This commit is contained in:
parent
3dd3bd255f
commit
11417a45cf
3 changed files with 17 additions and 9 deletions
|
@ -109,7 +109,7 @@ int mp_connect::load_map(int map, int num_turns, int village_gold,
|
|||
}
|
||||
|
||||
loaded_level_ = state_->starting_pos;
|
||||
level_ptr= &loaded_level_;
|
||||
level_ptr = &loaded_level_;
|
||||
|
||||
//make all sides untaken
|
||||
for(config::child_itors i = level_ptr->child_range("side");
|
||||
|
@ -122,14 +122,20 @@ int mp_connect::load_map(int map, int num_turns, int village_gold,
|
|||
|
||||
recorder = replay(state_->replay_data);
|
||||
|
||||
//if this is a snapshot save, we don't want to use the replay data
|
||||
if(loaded_level_["snapshot"] == "yes")
|
||||
recorder.set_to_end();
|
||||
config* const start = level_ptr->child("start");
|
||||
|
||||
//add the replay data under the level data so clients can
|
||||
//receive it
|
||||
level_ptr->clear_children("replay");
|
||||
level_ptr->add_child("replay") = state_->replay_data;
|
||||
//if this is a snapshot save, we don't want to use the replay data
|
||||
if(loaded_level_["snapshot"] == "yes") {
|
||||
if(start != NULL)
|
||||
start->clear_children("replay");
|
||||
level_ptr->clear_children("replay");
|
||||
recorder.set_to_end();
|
||||
} else {
|
||||
//add the replay data under the level data so clients can
|
||||
//receive it
|
||||
level_ptr->clear_children("replay");
|
||||
level_ptr->add_child("replay") = state_->replay_data;
|
||||
}
|
||||
|
||||
} else {
|
||||
//Load a new map
|
||||
|
|
|
@ -42,7 +42,6 @@ error::error(const std::string& msg, connection sock) : message(msg), socket(soc
|
|||
|
||||
void error::disconnect()
|
||||
{
|
||||
bad_sockets.erase(socket);
|
||||
if(socket) {
|
||||
network::disconnect(socket);
|
||||
}
|
||||
|
@ -164,6 +163,7 @@ void disconnect(connection s)
|
|||
return;
|
||||
}
|
||||
|
||||
bad_sockets.erase(s);
|
||||
received_data.erase(s);
|
||||
current_connection = received_data.end();
|
||||
|
||||
|
|
|
@ -313,6 +313,8 @@ void server::run()
|
|||
//send all players the information that a player has logged
|
||||
//out of the system
|
||||
lobby_players_.send_data(initial_response_);
|
||||
|
||||
std::cerr << "done closing socket...\n";
|
||||
}
|
||||
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue