User:Ayin/Extended terrains proposal

From The Battle for Wesnoth Wiki
< User:Ayin
Revision as of 13:16, 9 October 2005 by Ayin (talk | contribs) (Description)

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.

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 editor is certainly the part which will need the most work, as UI changes will be necessary.