User:Ayin/Extended terrains proposal
From The Battle for Wesnoth Wiki
This is a proposal to implement extended terrain types. The base ideas for this proposals were submitted by Ivanovic and freim.
Description
The idea is that scenarios are now to have 2 (or more?) maps. The “base terrain” map, and the “terrain overlay” map. Then, the terrains defined in [terrain] WML will have another attribute, named, for example, layer, defining the map this terrain applies to. Same for [terrain_graphics] rules: a rule may be defined for a layer, or for another.
This will have the following consequences :
- One letter may be available, with different meanings, for both maps (not sure this is a good thing, though).
- Terrains will be a combo of several base terrains. For example, swamp + bridge, forest + village.
Code changes
- Add the support of multiple maps in map.cpp. In terrain.cpp, there should be 2 classes: terrain_type which describes the base terrain types, and terrain_combo which describes a combo of several terrains. terrain_combo should have the same methods as base terrains, but be very lightweight as those will need to be created on-the-fly. get_terrain_info should return a terrain_combo.
- Fix unit_types.cpp so the defense_modifiers and attack_modifiers work with the new multiple maps.
- Modify builder.cpp so it works with the new-style maps (changes to display.cpp may not be necessary if it is done properly).