Author: shadowmaster
Date: Sat Jul 26 20:44:31 2008
New Revision: 28223

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28223&view=rev
Log:
* Make UMC terrain graphics rules be prepended to the core rules in the game, 
just like they are in the editor.

Modified:
    trunk/changelog
    trunk/src/game.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=28223&r1=28222&r2=28223&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Jul 26 20:44:31 2008
@@ -10,6 +10,9 @@
      implementation.
    * reversed builtin is now allowed. This allows for random.shuffle to be
      called.
+ * Terrains:
+   * Made user-made content graphic rules be parsed before core ones, so
+     custom tiles look the same in-game as they do in the editor.
  * User interface:
    * Fixed a broken translation which gave all females the prefix female^ on
      alignment description when using the "C" locale or any translation that

Modified: trunk/src/game.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game.cpp?rev=28223&r1=28222&r2=28223&view=diff
==============================================================================
--- trunk/src/game.cpp (original)
+++ trunk/src/game.cpp Sat Jul 26 20:44:31 2008
@@ -23,6 +23,7 @@
 #include "cursor.hpp"
 #include "dialogs.hpp"
 #include "filechooser.hpp"
+#include "foreach.hpp"
 #include "game_display.hpp"
 #include "filesystem.hpp"
 #include "font.hpp"
@@ -2040,6 +2041,15 @@
        }
 
        read(game_config_, *stream, &error_log);
+       // clone and put the gfx rules aside so that we can prepend the add-on
+       // rules to them.
+       config core_terrain_rules;
+       // FIXME: there should be a canned algorithm for cloning child_list 
objects,
+       // along with the memory their elements point to... little 
implementation detail.
+       foreach(config const* p_cfg, 
game_config_.get_children("terrain_graphics")) {
+               core_terrain_rules.add_child("terrain_graphics", *p_cfg);
+       }
+       game_config_.clear_children("terrain_graphics");
 
        // load usermade add-ons
        const std::string user_campaign_dir = get_addon_campaigns_dir();
@@ -2104,6 +2114,7 @@
        }
 
        game_config_.merge_children("units");
+       game_config_.append(core_terrain_rules);
 
        config& hashes = game_config_.add_child("multiplayer_hashes");
        for(config::child_list::const_iterator ch = 
game_config_.get_children("multiplayer").begin(); ch != 
game_config_.get_children("multiplayer").end(); ++ch) {


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

Reply via email to