Fixed reloading for commandline mp
This commit is contained in:
parent
99b3bd2699
commit
b53461e075
1 changed files with 22 additions and 8 deletions
|
@ -41,6 +41,8 @@
|
|||
#include "settings.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "unit_id.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "game_config_manager.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
@ -790,11 +792,29 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
|||
|
||||
// Override era, faction (side) and scenario if set on the commandline
|
||||
if (cmdline_opts.multiplayer_era) parameters.mp_era = *cmdline_opts.multiplayer_era;
|
||||
const config &era_cfg = game_config.find_child("era", "id", parameters.mp_era);
|
||||
if (!era_cfg) {
|
||||
const config& era_cfg_preload = game_config.find_child("era", "id", parameters.mp_era);
|
||||
|
||||
if (!era_cfg_preload) {
|
||||
std::cerr << "Could not find era '" << parameters.mp_era << "'\n";
|
||||
return;
|
||||
}
|
||||
if (cmdline_opts.multiplayer_scenario) parameters.name = *cmdline_opts.multiplayer_scenario;
|
||||
const config &level_preload = game_config.find_child("multiplayer", "id", parameters.name);
|
||||
if (!level_preload) {
|
||||
std::cerr << "Could not find scenario '" << parameters.name << "'\n";
|
||||
return;
|
||||
}
|
||||
|
||||
game_classification classification;
|
||||
classification.campaign_type = game_classification::MULTIPLAYER;
|
||||
classification.scenario_define = level_preload["define"].str();
|
||||
classification.era_define = era_cfg_preload["define"].str();
|
||||
resources::config_manager->load_game_config_for_game(classification);
|
||||
|
||||
const config& era_cfg = classification.era_define.empty() ? era_cfg_preload :
|
||||
resources::config_manager->game_config().find_child("era", "id", parameters.mp_era);
|
||||
const config& level = classification.scenario_define.empty() ? level_preload :
|
||||
resources::config_manager->game_config().find_child("multiplayer", "id", parameters.name);
|
||||
|
||||
if (cmdline_opts.multiplayer_side) {
|
||||
for(std::vector<boost::tuple<unsigned int, std::string> >::const_iterator
|
||||
|
@ -808,12 +828,6 @@ void start_local_game_commandline(game_display& disp, const config& game_config,
|
|||
}
|
||||
}
|
||||
|
||||
if (cmdline_opts.multiplayer_scenario) parameters.name = *cmdline_opts.multiplayer_scenario;
|
||||
const config &level = game_config.find_child("multiplayer", "id", parameters.name);
|
||||
if (!level) {
|
||||
std::cerr << "Could not find scenario '" << parameters.name << "'\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Should the map be randomly generated?
|
||||
if (level["map_generation"].empty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue