SCATTER_IMAGE and SCATTER_UNITS should not use RANDOM...
...as the caller may be using $random already as a macro parameter. This is a gratuitous fix to an issue that would be correctly solved if mainline macros used a well defined variable naming convention for the lack of the scope concept.
This commit is contained in:
parent
c5dce56726
commit
234dd067cd
2 changed files with 15 additions and 9 deletions
|
@ -48,10 +48,13 @@
|
|||
[/variable]
|
||||
|
||||
[do]
|
||||
{RANDOM $random_string}
|
||||
[set_variable]
|
||||
name=random_subscript
|
||||
rand=$random_string
|
||||
[/set_variable]
|
||||
|
||||
{VARIABLE_OP random_placement_x format "$random_placement_locations[$random].x"}
|
||||
{VARIABLE_OP random_placement_y format "$random_placement_locations[$random].y"}
|
||||
{VARIABLE_OP random_placement_x format "$random_placement_locations[$random_subscript].x"}
|
||||
{VARIABLE_OP random_placement_y format "$random_placement_locations[$random_subscript].y"}
|
||||
|
||||
[item]
|
||||
image={IMAGE}
|
||||
|
@ -63,6 +66,6 @@
|
|||
[/while]
|
||||
|
||||
{CLEAR_VARIABLE REPEAT_i}
|
||||
|
||||
{CLEAR_VARIABLE random_subscript}
|
||||
{CLEAR_VARIABLE random_placement_locations}
|
||||
#enddef
|
||||
|
|
|
@ -558,19 +558,22 @@
|
|||
[/variable]
|
||||
|
||||
[do]
|
||||
{RANDOM 1..$possible_unit_locations.length}
|
||||
{VARIABLE_OP random add -1}
|
||||
[set_variable]
|
||||
name=random_subscript
|
||||
rand=1..$possible_unit_locations.length
|
||||
[/set_variable]
|
||||
{VARIABLE_OP random_subscript add -1}
|
||||
|
||||
[unit]
|
||||
type=$unit_type_table[$unit_type_table_i].type
|
||||
x,y=$possible_unit_locations[$random].x,$possible_unit_locations[$random].y
|
||||
x,y=$possible_unit_locations[$random_subscript].x,$possible_unit_locations[$random_subscript].y
|
||||
{UNIT}
|
||||
[/unit]
|
||||
|
||||
[store_locations]
|
||||
find_in=possible_unit_locations
|
||||
[not]
|
||||
x,y=$possible_unit_locations[$random].x,$possible_unit_locations[$random].y
|
||||
x,y=$possible_unit_locations[$random_subscript].x,$possible_unit_locations[$random_subscript].y
|
||||
radius={PADDING_RADIUS}
|
||||
[/not]
|
||||
variable=possible_unit_locations
|
||||
|
@ -604,7 +607,7 @@
|
|||
[/do]
|
||||
[/while]
|
||||
|
||||
{CLEAR_VARIABLE unit_type_table,unit_type_table_i,possible_unit_locations}
|
||||
{CLEAR_VARIABLE unit_type_table,unit_type_table_i,possible_unit_locations,random_subscript}
|
||||
#enddef
|
||||
|
||||
#define FORCE_CHANCE_TO_HIT FILTER FILTER_SECOND CTH EXTRA_CONDITIONS
|
||||
|
|
Loading…
Add table
Reference in a new issue