Display mp::connect (temporary dummy) in between mp scenarios.
Currently, the screen between mp scenarios is displayed for local games only. The missing information to 'set_from_config()' and 'to_config()' were added to have sufficient information to display mp::connect.
This commit is contained in:
parent
be398487ea
commit
2d75c8f000
5 changed files with 56 additions and 8 deletions
|
@ -128,6 +128,7 @@ void mp_game_settings::set_from_config(const config& game_cfg)
|
|||
active_mods = utils::split(cfg["active_mods"], ',');
|
||||
xp_modifier = cfg["experience_modifier"];
|
||||
use_map_settings = cfg["mp_use_map_settings"].to_bool();
|
||||
random_start_time = cfg["mp_random_start_time"].to_bool();
|
||||
fog_game = cfg["mp_fog"].to_bool();
|
||||
shroud_game = cfg["mp_shroud"].to_bool();
|
||||
mp_countdown = cfg["mp_countdown"].to_bool();
|
||||
|
@ -188,6 +189,7 @@ config mp_game_settings::to_config() const
|
|||
cfg["mp_fog"] = fog_game;
|
||||
cfg["mp_shroud"] = shroud_game;
|
||||
cfg["mp_use_map_settings"] = use_map_settings;
|
||||
cfg["mp_random_start_time"] = random_start_time;
|
||||
cfg["observer"] = allow_observers;
|
||||
cfg["shuffle_sides"] = shuffle_sides;
|
||||
cfg["savegame"] = saved_game;
|
||||
|
|
|
@ -460,7 +460,7 @@ static void enter_wait_mode(game_display& disp, const config& game_config, mp::c
|
|||
switch (res) {
|
||||
case mp::ui::PLAY:
|
||||
play_game(disp, state, game_config, IO_CLIENT,
|
||||
preferences::skip_mp_replay() && observe);
|
||||
preferences::skip_mp_replay() && observe, false);
|
||||
recorder.clear();
|
||||
|
||||
break;
|
||||
|
@ -502,7 +502,8 @@ static bool enter_connect_mode(game_display& disp, const config& game_config,
|
|||
|
||||
switch (res) {
|
||||
case mp::ui::PLAY:
|
||||
play_game(disp, state, game_config, IO_SERVER);
|
||||
play_game(disp, state, game_config, IO_SERVER, false,
|
||||
default_controller == mp::CNTR_LOCAL);
|
||||
recorder.clear();
|
||||
|
||||
break;
|
||||
|
@ -869,7 +870,8 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
|||
if (cmdline_opts.multiplayer_label) label = *cmdline_opts.multiplayer_label;
|
||||
recorder.add_log_data("ai_log","ai_label",label);
|
||||
|
||||
play_game(disp, state, game_config, IO_SERVER);
|
||||
play_game(disp, state, game_config, IO_SERVER, false,
|
||||
default_controller == CNTR_LOCAL);
|
||||
recorder.clear();
|
||||
}
|
||||
|
||||
|
@ -898,5 +900,38 @@ void start_client(game_display& disp, const config& game_config,
|
|||
}
|
||||
}
|
||||
|
||||
void goto_mp_connect(game_display& disp, const config& game_config,
|
||||
const mp_game_settings& params)
|
||||
{
|
||||
mp::ui::result res;
|
||||
game_state state;
|
||||
const network::manager net_manager(1,1);
|
||||
network_game_manager m;
|
||||
|
||||
mp::chat chat;
|
||||
config gamelist;
|
||||
|
||||
{
|
||||
mp::connect ui(disp, game_config, chat, gamelist, params, CNTR_LOCAL,
|
||||
true);
|
||||
run_lobby_loop(disp, ui);
|
||||
|
||||
res = ui.get_result();
|
||||
if (res == mp::ui::PLAY) {
|
||||
ui.start_game();
|
||||
state = ui.get_state();
|
||||
}
|
||||
}
|
||||
|
||||
switch (res) {
|
||||
case mp::ui::PLAY:
|
||||
case mp::ui::CREATE:
|
||||
case mp::ui::QUIT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#ifndef MULTIPLAYER_HPP_INCLUDED
|
||||
#define MULTIPLAYER_HPP_INCLUDED
|
||||
|
||||
#include "mp_game_settings.hpp"
|
||||
#include "multiplayer_ui.hpp"
|
||||
#include "commandline_options.hpp"
|
||||
|
||||
|
@ -55,6 +56,8 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
|||
void start_client(game_display& disp, const config& game_config,
|
||||
const std::string& host);
|
||||
|
||||
void goto_mp_connect(game_display& disp, const config& game_config,
|
||||
const mp_game_settings& params);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "log.hpp"
|
||||
#include "map_exception.hpp"
|
||||
#include "mp_game_utils.hpp"
|
||||
#include "multiplayer.hpp"
|
||||
#include "dialogs.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "resources.hpp"
|
||||
|
@ -349,8 +350,9 @@ static LEVEL_RESULT playmp_scenario(const config& game_config,
|
|||
return res;
|
||||
}
|
||||
|
||||
LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_config,
|
||||
io_type_t io_type, bool skip_replay)
|
||||
LEVEL_RESULT play_game(game_display& disp, game_state& gamestate,
|
||||
const config& game_config, io_type_t io_type, bool skip_replay,
|
||||
bool local_mp_game)
|
||||
{
|
||||
std::string type = gamestate.classification().campaign_type;
|
||||
if(type.empty())
|
||||
|
@ -610,6 +612,11 @@ LEVEL_RESULT play_game(display& disp, game_state& gamestate, const config& game_
|
|||
}
|
||||
|
||||
if(io_type == IO_SERVER && scenario != NULL) {
|
||||
if (local_mp_game) {
|
||||
gamestate.mp_settings().scenario_data = *scenario;
|
||||
mp::goto_mp_connect(disp, game_config, gamestate.mp_settings());
|
||||
}
|
||||
|
||||
// Tweaks sides to adapt controllers and descriptions.
|
||||
BOOST_FOREACH(config &side, starting_pos.child_range("side"))
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "game_end_exceptions.hpp"
|
||||
|
||||
class display;
|
||||
class game_display;
|
||||
class game_state;
|
||||
class config;
|
||||
class CVideo;
|
||||
|
@ -31,10 +31,11 @@ enum io_type_t {
|
|||
IO_CLIENT
|
||||
};
|
||||
|
||||
LEVEL_RESULT play_game(display& disp, game_state& state,
|
||||
LEVEL_RESULT play_game(game_display& disp, game_state& state,
|
||||
const config& game_config,
|
||||
io_type_t io_type=IO_NONE,
|
||||
bool skip_replay = false);
|
||||
bool skip_replay = false,
|
||||
bool local_mp_game = true);
|
||||
|
||||
|
||||
void play_replay(display& disp, game_state& state,
|
||||
|
|
Loading…
Add table
Reference in a new issue