From e4f94adc07393b099fa61cedd346945bdfd39f18 Mon Sep 17 00:00:00 2001 From: ln-zookeeper Date: Sat, 12 Jul 2014 13:10:59 +0300 Subject: [PATCH] Fix SCATTER_UNITS placing units on map borders --- data/core/macros/utils.cfg | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/data/core/macros/utils.cfg b/data/core/macros/utils.cfg index 08aae708ff7..1bcfa82c02c 100644 --- a/data/core/macros/utils.cfg +++ b/data/core/macros/utils.cfg @@ -515,8 +515,24 @@ #! [/modifications] #! )} + [store_map_dimensions] + variable=scatter_units_map_dimensions + [/store_map_dimensions] + [store_locations] - {FILTER} + [and] + {FILTER} + [/and] + + # This (and the above wrapper [and]) is used to filter out border hexes; + # if a more straightforward way to exclude border hexes is implemented, + # then this should be replaced with that + [not] + x="0, $($scatter_units_map_dimensions.width + 1)" + [or] + y="0, $($scatter_units_map_dimensions.height + 1)" + [/or] + [/not] variable=possible_unit_locations [/store_locations] @@ -590,7 +606,7 @@ [/do] [/while] - {CLEAR_VARIABLE unit_type_table,unit_type_table_i,possible_unit_locations,random_subscript,units_to_place} + {CLEAR_VARIABLE unit_type_table,unit_type_table_i,scatter_units_map_dimensions,possible_unit_locations,random_subscript,units_to_place} #enddef #define FORCE_CHANCE_TO_HIT FILTER SECOND_FILTER CTH_NUMBER EXTRA_CONDITIONS_WML