Browse files

Add missing MP settings for reloaded games. Fixes #21808.

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

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...
1 parent 80feaee commit fa5b916bf1240c20d3faccb4f3be59c00003433b @thunderstruck thunderstruck committed Mar 22, 2014
Showing with 10 additions and 2 deletions.
  1. +1 −0 changelog
  2. +9 −2 src/mp_game_utils.cpp
@@ -43,6 +43,7 @@ Version 1.13.0-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.
* OS X user data directory is now ~/Library/Application Support/Wesnoth_1.13
@@ -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") +

0 comments on commit fa5b916

Please sign in to comment.