206 Commits

Author SHA1 Message Date
Andrius Silinskas
4784530759 Fixes for factions, leaders and genders in networked games.
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.
2014-04-14 19:40:05 +01:00
Chris Beck
d8ae9fc970 add game start notification
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...
2014-04-14 13:37:25 -04:00
Chris Beck
fb726e0610 move controller tweaks to server
(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.
2014-04-03 16:51:49 -04:00
Chris Beck
21e167f6eb add a sound played when the host clicks "begin" in an mp game 2014-02-21 23:33:06 -05:00
Ignacio R. Morelle
a4f47a63c7 New Year copyright update 2014-01-01 02:08:52 -03:00
Andrius Silinskas
50460f2596 Reload game config in mp::wait.
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.
2013-09-20 09:08:45 +01:00
Andrius Silinskas
ec2e592dcc Add missing out-of-range checks (mp::wait). 2013-09-20 09:08:45 +01:00
Andrius Silinskas
f57b29fc13 Moved level download utility functions to mp::wait. 2013-09-20 09:08:43 +01:00
Andrius Silinskas
569ef65e09 Check if a scenario allows new game in mp::wait for non-host players.
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.
2013-09-05 18:33:44 +01:00
Andrius Silinskas
1083d6d7cc Unify the level's data download between mp::wait and play_game() loop. 2013-09-05 18:33:44 +01:00
Andrius Silinskas
020067dbc4 Update flg_manager.?pp according to the mp::connect tests. 2013-09-05 18:33:42 +01:00
Andrius Silinskas
40c7cc8dbd Use factions, leaders and genders manager in mp::connect. 2013-09-05 18:33:41 +01:00
Andrius Silinskas
54d776d236 Use factions, leaders and genders manager in mp::wait. 2013-09-05 18:33:41 +01:00
Andrius Silinskas
63beb77d11 Lock side configurations for non-first scenario with map settings off. 2013-09-05 18:33:41 +01:00
Andrius Silinskas
8cf2c0c171 Allow user to select factions even if side recruit list was specified.
To force user to play with recruit list specified, the "faction"
attribute should be set to "Custom".
2013-09-05 18:33:38 +01:00
Andrius Silinskas
4ef5a40f48 Use the same instance of game_state for MP screens and game.
These changes are towards the unification of MP scenario campaigns
initialization.
2013-09-05 18:33:37 +01:00
Andrius Silinskas
f557dfbeaa Move "level_to_gamestate()" to mp_game_utils.?pp. 2013-09-05 18:33:37 +01:00
Andrius Silinskas
812afc7190 Add "Quit" option for mp::connect/wait when used in between scenarios. 2013-09-05 18:33:36 +01:00
Andrius Silinskas
0509d0c188 Unify leaders and genders set up between mp::connect and mp::wait.
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.
2013-09-05 18:33:35 +01:00
Andrius Silinskas
f7fa3c59b5 Display mp::wait (temporary dummy) in between mp::scenarios.
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.
2013-09-05 18:33:34 +01:00
Andrius Silinskas
13e22fd6f1 Initial step for splitting mp::connect into gui and engine. 2013-09-05 18:33:33 +01:00
Andrius Silinskas
77523d86d6 Refactor faction set up in multiplayer.
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.
2013-09-05 18:33:33 +01:00
Eric S. Raymond
043c4f9fd3 Remove $Id$ cookies. 2013-03-26 21:41:37 -04:00
Mark de Wever
43b71f2ff0 New year copyright update. 2013-01-01 09:22:03 +00:00
Mark de Wever
36f05a020d Remove a useless cast.
Detected by the upcoming gcc-4.8.
2012-10-07 09:17:44 +00:00
Anja Keicher
9d0ca55d9b Moved difficulty, current and next scenario info...
...to new carryover_info and game_data
2012-08-20 17:22:47 +00:00
Sergey Popov
6b6eafb213 Use BOOST_FOREACH directly instead of #define foreach BOOST_FOREACH
The define is extremely unreliable, will break compile with boost >=
1.50 and upstream can't fix issues with it, see
https://svn.boost.org/trac/boost/ticket/6131
2012-07-07 00:49:45 +00:00
Mark de Wever
1f3f809cce Remove a variable which is only assigned.
Issue found by cppcheck.
2012-02-06 20:27:13 +00:00
Mark de Wever
7c0090b77f Remove unreachable code.
Issue found by cppcheck.
2012-01-30 18:35:36 +00:00
Ignacio R. Morelle
6ca69b2df5 New year copyright update 2012-01-07 02:35:17 +00:00
Alexander van Gessel
81e0a2007f Revert token t_token commits from 2011-09-08T19:15:40Z!thonsew@yahoo.com on. 2011-10-10 03:43:29 +01:00
Thonsew
cdb129508d Fix implicit static cast...
...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
2011-09-20 21:20:54 +00:00
Thonsew
d2690e0cc6 Move anonymous namespace static const t_token...
...into function local scope in order make sure control flows over
them and initializes in the correct order.
2011-09-11 18:21:49 +00:00
Thonsew
7e99017fa4 Updated image.cpp to
1. Use t_token in place of std:string to save on string construction

2. Use boost::unordered_map in place of std::map as per todo by silene
2011-09-08 19:17:41 +00:00
Thonsew
3a41db7acd Updated unit_types to use t_token...
...in place of std::string and to replace std::map with
boost::unordered_map in the t_move_cost_cache, both to increase speed.
2011-09-08 19:17:31 +00:00
Mark de Wever
4ae425d811 Limit variable scope.
Also removes an old-style cast. Issue found by cppcheck.
2011-09-04 16:52:11 +00:00
Mark de Wever
0dc228b7e5 Remove some deprecated backwards compability code. 2011-04-09 15:59:53 +00:00
Mark de Wever
9dd8fe33d1 Polish ttransient_message.
The removal of a header also forced some additional files to be edited.
2011-03-20 18:26:19 +00:00
Mark de Wever
a9bb8f8d0d Add deprecated warnings about colour.
The code was deprecated, but no warning was added so the user might not
be aware of the change. So added a warning and set a new removal date.
2011-01-10 20:38:42 +00:00
Mark de Wever
ecbabea838 New year copyright update. 2011-01-01 15:57:50 +00:00
Guillaume Melquiond
e5779c6a68 Shared faction selection algorithm between host and clients.
(Fix for bug #17407.)
2010-12-30 11:18:53 +00:00
Ignacio R. Morelle
d6a3de1938 Apply patch #2213 by stikonas, using file #11274 2010-11-21 01:56:29 +00:00
Alexander van Gessel
9a508b5730 Remove the 'gzipped' parameters from the network API.
ANA did not even implement binary WML.
2010-11-17 00:28:08 +01:00
Guillaume Melquiond
ec533c0727 Avoided comparing of config objects with zero. 2010-10-30 22:50:55 +00:00
Ali El Gariani
c63a7d97ae Improving constness of surface: forbid to blit on a const surface. 2010-10-01 01:43:16 +00:00
Ali El Gariani
d0bb4ad22f Move all calls of SDL_BlitSurface into one place (sdl_blit) 2010-09-24 18:45:02 +00:00
Guillaume Melquiond
eeb047de55 Fixed file headers so that they match the content of the COPYING file. 2010-09-01 21:12:38 +00:00
Mark de Wever
1aac317bf5 Remove an unneeded include in a header. 2010-08-29 10:48:31 +00:00
Mark de Wever
f8b0e3aec6 Make Wesnoth more compatible with C++0x (g++-4.5). 2010-06-12 16:02:58 +00:00
Ali El Gariani
51ab72860e Replace all uses of 'colour' by 'color' in code. 2010-06-03 01:47:06 +00:00