Skip to content

Commit

Permalink
Add missing MP settings for reloaded games. Fixes #21808.
Browse files Browse the repository at this point in the history
The problam was that mp::configure is not used for reloaded games and so
mp_game_settings will not be fully initialised. This leads to using default
values rather than values set using mp::configure screen or from reloaded game
config.

The optimal solution would be to either display mp::configure for reloaded games
or to populate mp_game_settings using reloaded game config. However, both
solutions require rather a lot of code restructing and are probably not suitable
for a feature freeze.
  • Loading branch information
andrius-sil committed Mar 22, 2014
1 parent f50432b commit 52e7d96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -38,6 +38,7 @@ Version 1.11.11+dev:
when the campaign is reloaded from a non-host side, or after a player rejoins
from observer status. Hopefully, reloading campaigns is easier after this.
* Fix bug #21797: "Mandatory WML child missing" when leaving a reloaded game.
* Fix bug #21808: Cannot join a reloaded game as an observer.
* Fixed halos glitching through locations that become shrouded after the
halo is rendered for the first time.
* Workaround for bug #18921: disable animations for debug create/kill unit
Expand Down
11 changes: 9 additions & 2 deletions src/mp_game_utils.cpp
Expand Up @@ -139,8 +139,15 @@ config initial_level_config(game_display& disp, const mp_game_settings& params,
// This will force connecting clients to be using the same version number as us.
level["version"] = game_config::version;

level["observer"] = params.allow_observers;
level["shuffle_sides"] = params.shuffle_sides;
// If game was reloaded, params won't contain all required information and so we
// need to take it from the actual level config.
if (params.saved_game) {
level["observer"] = level.child("multiplayer")["observer"];
level["shuffle_sides"] = level.child("multiplayer")["shuffle_sides"];
} else {
level["observer"] = params.allow_observers;
level["shuffle_sides"] = params.shuffle_sides;
}

if (level["objectives"].empty()) {
level["objectives"] = "<big>" + t_string(N_("Victory:"), "wesnoth") +
Expand Down

0 comments on commit 52e7d96

Please sign in to comment.