Author: silene
Date: Sat Apr 18 20:38:20 2009
New Revision: 35022

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35022&view=rev
Log:
Added a mechanism for loading Lua code from toplevel WML.
(Warning: not sure if the hack on 'scenario' is completely safe.)

Modified:
    trunk/src/playcampaign.cpp

Modified: trunk/src/playcampaign.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/playcampaign.cpp?rev=35022&r1=35021&r2=35022&view=diff
==============================================================================
--- trunk/src/playcampaign.cpp (original)
+++ trunk/src/playcampaign.cpp Sat Apr 18 20:38:20 2009
@@ -210,6 +210,14 @@
                        scenario = &game_config.find_child(type, "id", 
gamestate.scenario);
                        if (*scenario) {
                                starting_pos = *scenario;
+                               scenario = &starting_pos;
+                               foreach (const config &cfg, 
game_config.child_range("lua")) {
+                                       // Mark all the toplevel [lua] tag as 
preload events.
+                                       config &ev = 
starting_pos.add_child("event");
+                                       ev["name"] = "preload";
+                                       ev["first_time_only"] = "no";
+                                       ev.add_child("lua", cfg);
+                               }
                                gamestate.starting_pos.merge_with(*scenario);
                        } else
                                scenario = NULL;


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

Reply via email to