Fixed MP saves loadind to choose correct human side (bug #10894)
This commit is contained in:
parent
893ce898bc
commit
af0bdd6c0d
4 changed files with 9 additions and 11 deletions
|
@ -5,6 +5,7 @@ Version 1.3.15+svn:
|
|||
* don't display 'Remote scenario' for reloaded games in the multiplayer
|
||||
lobby which is wrong in most cases (fixes bug #10882), the display
|
||||
of 'Reloaded game' is disabled for now because of the string freeze
|
||||
* Fixed MP saves loadind to choose correct human side (bug #10894)
|
||||
|
||||
Version 1.3.15:
|
||||
* language and i18n:
|
||||
|
|
|
@ -223,9 +223,10 @@ void get_player_info(const config& cfg, game_state& gamestate,
|
|||
int get_first_human_team(const config::child_list::const_iterator& cfg, const config::child_list& unit_cfg){
|
||||
int result = -1;
|
||||
const std::string& controller = (**cfg)["controller"];
|
||||
std::cerr << controller << " " << preferences::client_type() << " " << (**cfg)["description"] << std::endl;
|
||||
if (controller == preferences::client_type() && (**cfg)["description"] == preferences::login()) {
|
||||
result = cfg - unit_cfg.begin();
|
||||
} else if(result == -1 && ((**cfg)["controller"] == "human" || (**cfg)["persistent"] == "1")) {
|
||||
} else if((**cfg)["controller"] == "human") {
|
||||
result = cfg - unit_cfg.begin();
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -376,7 +376,7 @@ void connect::side::process_event()
|
|||
int old_side = parent_->find_player_side(new_id);
|
||||
if (old_side != -1) {
|
||||
if (id_.empty()) {
|
||||
parent_->sides_[old_side].set_controller(controller_);
|
||||
parent_->sides_[old_side].set_controller(parent_->default_controller_);
|
||||
} else {
|
||||
parent_->sides_[old_side].set_id(id_);
|
||||
}
|
||||
|
@ -1023,6 +1023,8 @@ const game_state& connect::get_state()
|
|||
|
||||
void connect::start_game()
|
||||
{
|
||||
// Set random start ToD
|
||||
gamestatus game_status(level_,atoi(level_["turns"].c_str()),&state_);
|
||||
// Resolves the "random faction", "random gender" and "random message"
|
||||
for (side_list::iterator itor = sides_.begin(); itor != sides_.end();
|
||||
++itor) {
|
||||
|
@ -1033,7 +1035,7 @@ void connect::start_game()
|
|||
config lock;
|
||||
lock.add_child("stop_updates");
|
||||
network::send_data(lock, 0, true);
|
||||
update_and_send_diff(true);
|
||||
update_and_send_diff();
|
||||
|
||||
// Build the gamestate object after updating the level
|
||||
|
||||
|
@ -1587,17 +1589,11 @@ void connect::update_level()
|
|||
}
|
||||
}
|
||||
|
||||
void connect::update_and_send_diff(bool update_time_of_day)
|
||||
void connect::update_and_send_diff()
|
||||
{
|
||||
config old_level = level_;
|
||||
update_level();
|
||||
|
||||
if (update_time_of_day)
|
||||
{
|
||||
// Set random start ToD
|
||||
gamestatus game_status(level_,atoi(level_["turns"].c_str()),&state_);
|
||||
|
||||
}
|
||||
config diff = level_.get_diff(old_level);
|
||||
if (!diff.empty()) {
|
||||
config scenario_diff;
|
||||
|
|
|
@ -189,7 +189,7 @@ private:
|
|||
void update_level();
|
||||
|
||||
//! Updates the level, and send a diff to the clients.
|
||||
void update_and_send_diff(bool update_time_of_day = false);
|
||||
void update_and_send_diff();
|
||||
|
||||
//! Returns true if there still are sides available for this game.
|
||||
bool sides_available();
|
||||
|
|
Loading…
Add table
Reference in a new issue