#textdomain wesnoth # Utility macros for manipulating map terrain and overlays. # These don't depend on any other macros. Please don't change this. # ! in comments is used in generating HTML documentation, ignore it otherwise. #define MODIFY_TERRAIN TERRAIN X Y # Changes the terrain at a given list of coordinates # # For example, we could make 14,15 and 14,16 grassland: #! {MODIFY_TERRAIN Gg (14,14) (15,16)} [terrain] terrain={TERRAIN} x={X} y={Y} [/terrain] #enddef #define MODIFY_TERRAIN_MASK X Y MASK_VALUE RULES_WML # Changes the terrain for a given area [terrain_mask] x={X} y={Y} mask={MASK_VALUE} {RULES_WML} [/terrain_mask] #enddef #define RANDOM_FEATURE_PLACEMENT_ON X_SPAN Y_SPAN FILTER NUMBER IMAGE MOD_WML # Place NUMBER copies of the IMAGE on map hexes matching FILTER in the # region specified by X_SPAN and Y_SPAN. Insert MOD_WML in the image # declaration (useful for alpha hacks). Does not check for collisions. # # This call will scatter 20 copies of a pine-tree graphic over grassland: #! {RANDOM_FEATURE_PLACEMENT_ON 1-44 1-30 (terrain=Gg) 20 scenery/pine1.png ()} [store_locations] x={X_SPAN} y={Y_SPAN} terrain={TERRAIN_PATTERN} variable=random_placement_locations [/store_locations] {VARIABLE_OP random_string format "0..$random_placement_locations.length"} {VARIABLE REPEAT_i 0} [while] [variable] name=REPEAT_i less_than={NUMBER} [/variable] [do] {RANDOM $random_string} {VARIABLE_OP random_placement_x format "$random_placement_locations[$random].x"} {VARIABLE_OP random_placement_y format "$random_placement_locations[$random].y"} [item] image={IMAGE} x,y=$random_placement_x,$random_placement_y {MOD_WML} [/item] {VARIABLE_OP REPEAT_i add 1} [/do] [/while] {CLEAR_VARIABLE REPEAT_i} {CLEAR_VARIABLE random_placement_locations} #enddef