From 3bd899c402b721ed2394f7bb3ad1bf155ebf5f4a Mon Sep 17 00:00:00 2001 From: Iurii Chernyi Date: Tue, 31 Mar 2009 13:49:15 +0000 Subject: [PATCH] allow hot-redeployment of the side AI using [modify_side] WML function --- src/game_events.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/game_events.cpp b/src/game_events.cpp index 5fb7a6758b2..4ae1ce0d351 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -18,7 +18,9 @@ */ #include "global.hpp" + #include "actions.hpp" +#include "ai_manager.hpp" #include "dialogs.hpp" #include "foreach.hpp" #include "game_end_exceptions.hpp" @@ -798,6 +800,10 @@ namespace { * @todo also allow client to modify a side's colour if it is possible * to change it on the fly without causing visual glitches */ + /** + * @todo: rename this attribute and document it + */ + std::string redeploy_ai_from_location = cfg["redeploy_ai_from_location"]; assert(state_of_game != NULL); const int side_num = lexical_cast_default(side,1); @@ -857,6 +863,11 @@ namespace { if (ai.first != ai.second) { (*teams)[team_index].set_ai_parameters(ai); } + // Redeploy ai from location (this ignores current AI parameters) + // @todo: this is probably SP-only and on human turn only + if (!redeploy_ai_from_location.empty()) { + ai_manager::add_ai_for_team_from_file(side_num,redeploy_ai_from_location); + } } }