Make UMC terrain graphics rules be prepended to the core rules in the game,

...just like they are in the editor.
This commit is contained in:
Ignacio R. Morelle 2008-07-26 18:44:31 +00:00
parent 44a611d50e
commit bf09f965de
2 changed files with 14 additions and 0 deletions

View file

@ -10,6 +10,9 @@ Version 1.5.2+svn:
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

View file

@ -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 @@ void game_controller::read_configs(std::string& error_log)
}
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 @@ void game_controller::read_configs(std::string& error_log)
}
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) {