Author: crab
Date: Tue Mar 31 15:49:15 2009
New Revision: 34328

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34328&view=rev
Log:
allow hot-redeployment of the side AI using [modify_side] WML function

Modified:
    trunk/src/game_events.cpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=34328&r1=34327&r2=34328&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Tue Mar 31 15:49:15 2009
@@ -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 @@
                 * @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<int>(side,1);
@@ -856,6 +862,11 @@
                        // Override AI parameters
                        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);
                        }
                }
        }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to