Factor out magic constant 99 in WML movement costs, renaming it UNREACHABLE.

This commit is contained in:
Eric S. Raymond 2008-08-20 17:38:42 +00:00
parent d51f0e1783
commit bedada8475
17 changed files with 141 additions and 135 deletions

View file

@ -244,9 +244,9 @@
{UNDEAD_GUARDIAN Draug 36 17}
{UNDEAD_GUARDIAN Draug 38 17}
{MODIFY_UNIT side=3 movement_costs.deep_water 99}
{MODIFY_UNIT side=3 movement_costs.shallow_water 99}
{MODIFY_UNIT side=3 movement_costs.swamp_water 99}
{MODIFY_UNIT side=3 movement_costs.deep_water UNREACHABLE}
{MODIFY_UNIT side=3 movement_costs.shallow_water UNREACHABLE}
{MODIFY_UNIT side=3 movement_costs.swamp_water UNREACHABLE}
[/event]
[event]
@ -512,10 +512,10 @@ Soooo... It is you who sent your subordinates to attack us. Now when we've destr
{UNDEAD_GUARDIAN Draug $x1 $y1}
{MODIFY_UNIT side=3 movement_costs.shallow_water 99}
{MODIFY_UNIT side=3 movement_costs.deep_water 99}
{MODIFY_UNIT side=3 movement_costs.swamp_water 99}
{MODIFY_UNIT side=3 movement_costs.forest 99}
{MODIFY_UNIT side=3 movement_costs.shallow_water UNREACHABLE}
{MODIFY_UNIT side=3 movement_costs.deep_water UNREACHABLE}
{MODIFY_UNIT side=3 movement_costs.swamp_water UNREACHABLE}
{MODIFY_UNIT side=3 movement_costs.forest UNREACHABLE}
[if]
{CHECK_VARIABLE undead_killed no}

View file

@ -963,10 +963,10 @@ _f, _f, _f, _f, _f, _f, Re, _f, _f, _f, _f, _f,
apply_to=movement_costs
replace=true
[movement_costs]
swamp_water=99
deep_water=99
shallow_water=99
forest=99
swamp_water=UNREACHABLE
deep_water=UNREACHABLE
shallow_water=UNREACHABLE
forest=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -146,9 +146,9 @@
apply_to=movement_costs
replace=true
[movement_costs]
deep_water=99
shallow_water=99
swamp_water=99
deep_water=UNREACHABLE
shallow_water=UNREACHABLE
swamp_water=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -521,8 +521,8 @@
apply_to=movement_costs
replace=yes
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[/effect]
[/object]
@ -547,8 +547,8 @@
apply_to=movement_costs
replace=yes
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[/effect]
[/object]
@ -1825,8 +1825,8 @@
apply_to=movement_costs
replace=yes
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[/effect]
[/object]
@ -1871,8 +1871,8 @@
apply_to=movement_costs
replace=yes
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -539,9 +539,9 @@
apply_to=movement_costs
replace=true
[movement_costs]
cave=99
grass=99
shallow_water=99
cave=UNREACHABLE
grass=UNREACHABLE
shallow_water=UNREACHABLE
[/movement_costs]
[/effect]
[/object]
@ -566,9 +566,9 @@
apply_to=movement_costs
replace=true
[movement_costs]
cave=99
grass=99
shallow_water=99
cave=UNREACHABLE
grass=UNREACHABLE
shallow_water=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -9,8 +9,8 @@
hitpoints=100
movement_type=smallfoot
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[resistance]
blade=0

View file

@ -10,8 +10,8 @@
hitpoints=40
movement_type=smallfoot
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[resistance]
blade=110

View file

@ -11,8 +11,8 @@
hitpoints=40
movement_type=smallfoot
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[resistance]
blade=110

View file

@ -9,8 +9,8 @@
hitpoints=35
movement_type=smallfoot
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
[defense]
cave=50

View file

@ -7,7 +7,7 @@
hitpoints=28
movement_type=undeadfly
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
swamp_water=3
cave=2

View file

@ -7,8 +7,8 @@
id=Haunt
name= _ "Haunt"
[movement_costs]
cave=99
flat=99
cave=UNREACHABLE
flat=UNREACHABLE
[/movement_costs]
experience=30
description= _ "Haunts are the tortured souls of those who have died suddenly and never been laid to rest. Paralyzed by the shock of their death, they are cursed to forever haunt the place of their death and relive their final moments over and over and over."+{SPECIAL_NOTES}+{SPECIAL_NOTES_DRAIN}+{SPECIAL_NOTES_SPIRIT}+{SPECIAL_NOTES_ARCANE}

View file

@ -3,6 +3,10 @@
#
# These don't rely on any other macros. Please don't change this.
# This needs to match the magic UNREACHABLE constent in unit_movement_type
#define UNREACHABLE
99 #enddef
#define GENERIC_UNIT SIDE TYPE X Y
# Creates a generic unit of TYPE belonging to SIDE at X,Y, which has a
# random name, gender and traits (just like a recruited unit).

View file

@ -264,7 +264,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=smallfoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=3
@ -277,8 +277,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=3
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -314,7 +314,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=orcishfoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=3
@ -327,8 +327,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=3
[/movement_costs]
@ -364,7 +364,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=largefoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=2
reef=2
swamp_water=2
@ -377,8 +377,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=1
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -414,7 +414,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=armoredfoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=4
reef=4
swamp_water=4
@ -422,13 +422,13 @@ While undead lords arrived on the Great Continent in considerable numbers only i
sand=2
forest=2
hills=3
mountains=99
mountains=UNREACHABLE
village=1
castle=1
cave=2
frozen=4
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -464,7 +464,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=elusivefoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=2
reef=2
swamp_water=2
@ -477,8 +477,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -514,7 +514,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=mounted
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=4
reef=4
swamp_water=4
@ -522,13 +522,13 @@ While undead lords arrived on the Great Continent in considerable numbers only i
sand=2
forest=3
hills=2
mountains=99
mountains=UNREACHABLE
village=1
castle=1
cave=4
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=4
[/movement_costs]
@ -564,7 +564,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=woodland
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=2
@ -577,8 +577,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=3
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -628,8 +628,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=1
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -665,7 +665,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=treefolk
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=2
reef=2
swamp_water=2
@ -678,8 +678,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=3
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -730,7 +730,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=3
frozen=1
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=3
[/movement_costs]
@ -781,7 +781,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=1
frozen=1
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -825,13 +825,13 @@ While undead lords arrived on the Great Continent in considerable numbers only i
sand=4
forest=5
hills=5
mountains=99
mountains=UNREACHABLE
village=2
castle=1
cave=3
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=3
[/movement_costs]
@ -875,13 +875,13 @@ While undead lords arrived on the Great Continent in considerable numbers only i
sand=2
forest=5
hills=5
mountains=99
mountains=UNREACHABLE
village=1
castle=1
cave=3
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=3
[/movement_costs]
@ -930,8 +930,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=2
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -972,18 +972,18 @@ While undead lords arrived on the Great Continent in considerable numbers only i
shallow_water=1
reef=1
swamp_water=2
flat=99
sand=99
forest=99
hills=99
mountains=99
village=99
castle=99
cave=99
frozen=99
unwalkable=99
impassable=99
fungus=99
flat=UNREACHABLE
sand=UNREACHABLE
forest=UNREACHABLE
hills=UNREACHABLE
mountains=UNREACHABLE
village=UNREACHABLE
castle=UNREACHABLE
cave=UNREACHABLE
frozen=UNREACHABLE
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=UNREACHABLE
[/movement_costs]
[defense]
@ -1018,7 +1018,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=mountainfoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=3
@ -1031,8 +1031,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=1
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -1068,7 +1068,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=dwarvishfoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=3
@ -1081,8 +1081,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=1
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -1118,7 +1118,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
[movetype]
name=gruefoot
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=2
@ -1131,8 +1131,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -1181,8 +1181,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -1233,7 +1233,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=1
frozen=1
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -1284,7 +1284,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=1
frozen=1
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -1335,7 +1335,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=1
frozen=1
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -1372,7 +1372,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
name=lizard
flies=false
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=1
@ -1385,8 +1385,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=1
frozen=4
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=1
[/movement_costs]
@ -1423,22 +1423,22 @@ While undead lords arrived on the Great Continent in considerable numbers only i
name=none
flies=false
[movement_costs]
deep_water=99
shallow_water=99
reef=99
swamp_water=99
flat=99
sand=99
forest=99
hills=99
mountains=99
village=99
castle=99
cave=99
frozen=99
unwalkable=99
impassable=99
fungus=99
deep_water=UNREACHABLE
shallow_water=UNREACHABLE
reef=UNREACHABLE
swamp_water=UNREACHABLE
flat=UNREACHABLE
sand=UNREACHABLE
forest=UNREACHABLE
hills=UNREACHABLE
mountains=UNREACHABLE
village=UNREACHABLE
castle=UNREACHABLE
cave=UNREACHABLE
frozen=UNREACHABLE
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=UNREACHABLE
[/movement_costs]
[defense]
@ -1474,7 +1474,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
name=scuttlefoot
flies=false
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=2
@ -1487,8 +1487,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=2
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -1543,7 +1543,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
cave=3
frozen=2
unwalkable=1
impassable=99
impassable=UNREACHABLE
fungus=2
[/movement_costs]
@ -1582,7 +1582,7 @@ While undead lords arrived on the Great Continent in considerable numbers only i
# But the armor makes them a good bit tougher
# Do a bit worse in Swamps as they can't hop to dry spots
[movement_costs]
deep_water=99
deep_water=UNREACHABLE
shallow_water=3
reef=3
swamp_water=3
@ -1595,8 +1595,8 @@ While undead lords arrived on the Great Continent in considerable numbers only i
castle=1
cave=2
frozen=3
unwalkable=99
impassable=99
unwalkable=UNREACHABLE
impassable=UNREACHABLE
fungus=2
[/movement_costs]

View file

@ -1217,7 +1217,7 @@
apply_to=movement_costs
replace=true
[movement_costs]
frozen=99
frozen=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -374,8 +374,8 @@
apply_to=movement_costs
replace=true
[movement_costs]
flat=99
sand=99
flat=UNREACHABLE
sand=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -84,8 +84,8 @@
apply_to=movement_costs
replace=true
[movement_costs]
{TERRAIN_1}=99
{TERRAIN_2}=99
{TERRAIN_1}=UNREACHABLE
{TERRAIN_2}=UNREACHABLE
[/movement_costs]
[/effect]
[/object]

View file

@ -115,7 +115,9 @@ class unit_movement_type;
class unit_movement_type
{
public:
// maximum possible move distance
//this move distance means a hex is unreachable
//if there is an UNREACHABLE macro declared in the data tree
//it should match this value.
static const int UNREACHABLE = 99;
//this class assumes that the passed in reference will remain valid