Difference between revisions of "User:Ayin/Extended terrains proposal"
(→Description: - limits of the proposal) |
(→Code changes) |
||
Line 26: | Line 26: | ||
* Most places where gamemap::TERRAIN is used should use <tt>terrain_group</tt> instead (<tt>actions.cpp</tt>, <tt>unit_display.cpp</tt>, <tt>reports.cpp</tt>, etc.) | * Most places where gamemap::TERRAIN is used should use <tt>terrain_group</tt> instead (<tt>actions.cpp</tt>, <tt>unit_display.cpp</tt>, <tt>reports.cpp</tt>, etc.) | ||
* Modify <tt>builder.cpp</tt> so it works with the new-style maps (changes to <tt>display.cpp</tt> may not be necessary if it is done properly). | * Modify <tt>builder.cpp</tt> so it works with the new-style maps (changes to <tt>display.cpp</tt> may not be necessary if it is done properly). | ||
− | * The map generator will need to take those changes into account. | + | * The map generator will need to take those changes into account. the <tt>terrain</tt> element in the [[map generator WML]], and the <tt>adjacent_liked</tt> element, will have to be somewhat re-thought. |
* The editor is certainly the part which will need the most work, as UI changes will be necessary. | * The editor is certainly the part which will need the most work, as UI changes will be necessary. |
Revision as of 13:31, 9 October 2005
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.
Note that, with the current proposal, the overlay and the base part will be totally independant. There will be no way to specify, on an overlay, terrain graphics which depend on the base terrain it is on. This solution is simpler (more in the KISS spirit), but less powerful than previous 2-letter terrain proposals.
Editor UI
The editor UI will need to have 2 lists of terrains on its right pane: a list of “base” terrains, and a list of “overlay” terrains.
Backwards compatibility
To be determined.
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_group which describes a combo of several terrains. terrain_group should have the same methods as base terrains, but be very lightweight as those will need to be created on-the-fly. It may, for example, have char[2] as a data payload. get_terrain_info should return a terrain_group.
- Fix unit_types.cpp so the defense_modifiers and attack_modifiers work with the new multiple maps. Those methods should not use gamemap:TERRAIN anymore to identify terrain types, but should rather use terrain_group.
- Most places where gamemap::TERRAIN is used should use terrain_group instead (actions.cpp, unit_display.cpp, reports.cpp, etc.)
- Modify builder.cpp so it works with the new-style maps (changes to display.cpp may not be necessary if it is done properly).
- The map generator will need to take those changes into account. the terrain element in the map generator WML, and the adjacent_liked element, will have to be somewhat re-thought.
- The editor is certainly the part which will need the most work, as UI changes will be necessary.