Fixup c8b0833
(crash when creating scenario in Editor)
There's no AI manager in the editor (a game state is required), nor a need for one, so I simply disabled the AI initialization if we're not in the editor.
This commit is contained in:
parent
e9e22f30b7
commit
3dc8617ec9
1 changed files with 8 additions and 4 deletions
|
@ -203,11 +203,15 @@ void team::team_info::read(const config& cfg)
|
|||
if(!user_team_name.translatable())
|
||||
user_team_name = t_string::from_serialized(user_team_name);
|
||||
|
||||
display* disp = display::get_singleton();
|
||||
|
||||
if(disp && !disp->in_editor()) {
|
||||
if(cfg.has_attribute("ai_config")) {
|
||||
ai::manager::get_singleton().add_ai_for_side_from_file(side, cfg["ai_config"], true);
|
||||
} else {
|
||||
ai::manager::get_singleton().add_ai_for_side_from_config(side, cfg, true);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> recruits = utils::split(cfg["recruit"]);
|
||||
can_recruit.insert(recruits.begin(), recruits.end());
|
||||
|
|
Loading…
Add table
Reference in a new issue