There was some oversight when changes to factions, leaders and genders set
up were made and as a result, in some cases, things were seriously broken.
This is an attempt to fix existing major problems. Some minor problems still
need to be addressed.
Specifically, this commit should fix problems with showing different factions,
leaders and genders lists for non-host and host players for the same sides. And
it should also avoid a situation where non-host player sees a "Custom" faction
even if it should not appear.
this is similar to previous commit which adds a "party full"
notification
note: we don't check the notification preference as this should be done
in the notification function and not by the caller. however, it seems
this is only done with DBUS notifications currently? see previous commit
message...
(fixup of 736ceaa6c7e81882c9c5b2e932307b1f1ecb3bfd)
Following discussion with Soliton, we move all "controller tweaks"
i.e. assignments of networked side to human on the matching client
at start of game, to be server decisions, performed concurrent with
start of game.
In fact the controller tweaks are performed using
game::change_controller, which is modified so that it doesn't try to
make server messages before the game has started.
When the server receives [start_game] from the host, the server will
call game::change_controller for every side, sending corresponding
messages to all players and observers, updating them as appropriate.
The server will also rewrite level_ so that human sides are "network"
and ai sides are "network_ai", making the level_ correct for any
observer who subsequently joins.
We remove the obsoleted client-side code in playcampaign.cpp,
multiplayer.cpp.
We also add to multiplayer_wait.cpp the necessary support code to
interpret [change_controller] messages recieved before game start.
The game config is being reloaded to make sure that players have the
same config as host, if possible.
Note that reloading only happens when it is necessary and it would not
happen if host's cache defines matches the player's ones. I.e. regular
MP scenarios won't trigger a config reload.
Fixes a bug which was introduced when "allow_new_game" was checked in
play_game() loop for non-host players and caused them to abort the game
if they didn't have that scenario.
The relevant functions from mp::connect were moved to mp::ui to enable
them to use by mp::wait as well. This is not the most elegant solution,
but in the future mp::connect and mp::wait should be merged into one,
and those functions could be moved back to where they were.
leader_list.?pp has been removed since it is no longer used.
The screen is displayed only if '--campaign-screens' command line
option was specified. The same now goes for mp::connect screen for the
game's host.
Server has been modified to not immediately start the game after
'store_next_scenario', but to wait for explicit 'start_game'.
Minor changes to parameter passing inside multiplayer.?pp have been
made as well.
The code has been improved to switch from index lookups to lookups by
ids. This makes the implementation more flexible for future improvements
and easier for maintenance.
The "Custom" faction has been added. It is automatically chosen and
locked for sides with a recruit list. The sides without recruit list
won't see it in their faction choice combo box.
The recruit list in side will be now be overriden by a faction if map
settings are not in use.
...of config::attribute_value & to tstring & or t_token reference
causes crashes. Some compilers were generating a temporary object and
binding a reference to the temporary when creating an implicit cast to
an attribute value. I removed the implicit cast and replaced all (I
think) instances of the implicit cast with explicit 2 step operation.
This fixes bugs like bug #18663, bug #18684