summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-04 21:35:13 +0000
committertron <tron@openttd.org>2006-04-04 21:35:13 +0000
commit99a6b9b8f239b43924282ea6b1775ee3850ca551 (patch)
tree8fd9a06aeed0593b1ea4c6f859fd0e7ce9f86442
parent52892863e5c140e9e486b97e252b184a9f08a196 (diff)
downloadopenttd-99a6b9b8f239b43924282ea6b1775ee3850ca551.tar.xz
(svn r4279) s/\<CL_/CLEAR_/
-rw-r--r--clear_cmd.c46
-rw-r--r--clear_map.h18
-rw-r--r--industry_cmd.c4
-rw-r--r--landscape.c6
-rw-r--r--smallmap_gui.c2
-rw-r--r--terraform_gui.c2
-rw-r--r--tree_cmd.c40
7 files changed, 59 insertions, 59 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index 39d253a28..766182cba 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -409,7 +409,7 @@ static int32 ClearTile_Clear(TileIndex tile, byte flags)
};
int32 price;
- if (IsClearGround(tile, CL_GRASS) && GetClearDensity(tile) == 0) {
+ if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) == 0) {
price = 0;
} else {
price = *clear_price_table[GetClearGround(tile)];
@@ -485,27 +485,27 @@ void DrawClearLandFence(const TileInfo *ti)
static void DrawTile_Clear(TileInfo *ti)
{
switch (GetClearGround(ti->tile)) {
- case CL_GRASS:
+ case CLEAR_GRASS:
DrawClearLandTile(ti, GetClearDensity(ti->tile));
break;
- case CL_ROUGH:
+ case CLEAR_ROUGH:
DrawHillyLandTile(ti);
break;
- case CL_ROCKS:
+ case CLEAR_ROCKS:
DrawGroundSprite(SPR_FLAT_ROCKY_LAND_1 + _tileh_to_sprite[ti->tileh]);
break;
- case CL_FIELDS:
+ case CLEAR_FIELDS:
DrawGroundSprite(_clear_land_sprites_1[GetFieldType(ti->tile)] + _tileh_to_sprite[ti->tileh]);
break;
- case CL_SNOW:
+ case CLEAR_SNOW:
DrawGroundSprite(_clear_land_sprites_2[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh]);
break;
- case CL_DESERT:
+ case CLEAR_DESERT:
DrawGroundSprite(_clear_land_sprites_3[GetClearDensity(ti->tile)] + _tileh_to_sprite[ti->tileh]);
break;
}
@@ -539,9 +539,9 @@ void TileLoopClearHelper(TileIndex tile)
byte neighbour;
TileIndex dirty = INVALID_TILE;
- self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CL_FIELDS));
+ self = (IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS));
- neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CL_FIELDS));
+ neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
if (GetFenceSW(tile) == 0) {
if (self != neighbour) {
SetFenceSW(tile, 3);
@@ -554,7 +554,7 @@ void TileLoopClearHelper(TileIndex tile)
}
}
- neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CL_FIELDS));
+ neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CLEAR_FIELDS));
if (GetFenceSE(tile) == 0) {
if (self != neighbour) {
SetFenceSE(tile, 3);
@@ -578,11 +578,11 @@ static void TileLoopClearAlps(TileIndex tile)
int k = GetTileZ(tile) - _opt.snow_line;
if (k < -TILE_HEIGHT) { // well below the snow line
- if (!IsClearGround(tile, CL_SNOW)) return;
- if (GetClearDensity(tile) == 0) SetClearGroundDensity(tile, CL_GRASS, 3);
+ if (!IsClearGround(tile, CLEAR_SNOW)) return;
+ if (GetClearDensity(tile) == 0) SetClearGroundDensity(tile, CLEAR_GRASS, 3);
} else {
- if (!IsClearGround(tile, CL_SNOW)) {
- SetClearGroundDensity(tile, CL_SNOW, 0);
+ if (!IsClearGround(tile, CLEAR_SNOW)) {
+ SetClearGroundDensity(tile, CLEAR_SNOW, 0);
} else {
uint density = min((uint)(k + TILE_HEIGHT) / TILE_HEIGHT, 3);
@@ -601,17 +601,17 @@ static void TileLoopClearAlps(TileIndex tile)
static void TileLoopClearDesert(TileIndex tile)
{
- if (IsClearGround(tile, CL_DESERT)) return;
+ if (IsClearGround(tile, CLEAR_DESERT)) return;
if (GetTropicZone(tile) == TROPICZONE_DESERT) {
- SetClearGroundDensity(tile, CL_DESERT, 3);
+ SetClearGroundDensity(tile, CLEAR_DESERT, 3);
} else {
if (GetTropicZone(tile + TileDiffXY( 1, 0)) != TROPICZONE_DESERT &&
GetTropicZone(tile + TileDiffXY(-1, 0)) != TROPICZONE_DESERT &&
GetTropicZone(tile + TileDiffXY( 0, 1)) != TROPICZONE_DESERT &&
GetTropicZone(tile + TileDiffXY( 0, -1)) != TROPICZONE_DESERT)
return;
- SetClearGroundDensity(tile, CL_DESERT, 1);
+ SetClearGroundDensity(tile, CLEAR_DESERT, 1);
}
MarkTileDirtyByTile(tile);
@@ -627,7 +627,7 @@ static void TileLoop_Clear(TileIndex tile)
}
switch (GetClearGround(tile)) {
- case CL_GRASS:
+ case CLEAR_GRASS:
if (GetClearDensity(tile) == 3) return;
if (_game_mode != GM_EDITOR) {
@@ -639,11 +639,11 @@ static void TileLoop_Clear(TileIndex tile)
AddClearDensity(tile, 1);
}
} else {
- SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? CL_GRASS : CL_ROUGH, 3);
+ SetClearGroundDensity(tile, GB(Random(), 0, 8) > 21 ? CLEAR_GRASS : CLEAR_ROUGH, 3);
}
break;
- case CL_FIELDS: {
+ case CLEAR_FIELDS: {
uint field_type;
if (_game_mode == GM_EDITOR) return;
@@ -677,7 +677,7 @@ void GenerateClearTile(void)
i = ScaleByMapSize(GB(Random(), 0, 10) + 0x400);
do {
tile = RandomTile();
- if (IsTileType(tile, MP_CLEAR)) SetClearGroundDensity(tile, CL_ROUGH, 3);
+ if (IsTileType(tile, MP_CLEAR)) SetClearGroundDensity(tile, CLEAR_ROUGH, 3);
} while (--i);
/* add grey squares */
@@ -690,7 +690,7 @@ void GenerateClearTile(void)
for (;;) {
TileIndex tile_new;
- SetClearGroundDensity(tile, CL_ROCKS, 3);
+ SetClearGroundDensity(tile, CLEAR_ROCKS, 3);
do {
if (--j == 0) goto get_out;
tile_new = tile + TileOffsByDir(GB(Random(), 0, 2));
@@ -723,7 +723,7 @@ static const StringID _clear_land_str[] = {
static void GetTileDesc_Clear(TileIndex tile, TileDesc *td)
{
- if (IsClearGround(tile, CL_GRASS) && GetClearDensity(tile) == 0) {
+ if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) == 0) {
td->str = STR_080C_BARE_LAND;
} else {
td->str = _clear_land_str[GetClearGround(tile)];
diff --git a/clear_map.h b/clear_map.h
index 655b0ef06..5769443a1 100644
--- a/clear_map.h
+++ b/clear_map.h
@@ -10,12 +10,12 @@
* valid densities (bits 0...1) in comments after the enum
*/
typedef enum ClearGround {
- CL_GRASS = 0, // 0-3
- CL_ROUGH = 1, // 3
- CL_ROCKS = 2, // 3
- CL_FIELDS = 3, // 3
- CL_SNOW = 4, // 0-3
- CL_DESERT = 5 // 1,3
+ CLEAR_GRASS = 0, // 0-3
+ CLEAR_ROUGH = 1, // 3
+ CLEAR_ROCKS = 2, // 3
+ CLEAR_FIELDS = 3, // 3
+ CLEAR_SNOW = 4, // 0-3
+ CLEAR_DESERT = 5 // 1,3
} ClearGround;
@@ -73,13 +73,13 @@ static inline void SetClearGroundDensity(TileIndex t, ClearGround type, uint den
static inline uint GetFieldType(TileIndex t)
{
- assert(GetClearGround(t) == CL_FIELDS);
+ assert(GetClearGround(t) == CLEAR_FIELDS);
return GB(_m[t].m3, 0, 4);
}
static inline void SetFieldType(TileIndex t, uint f)
{
- assert(GetClearGround(t) == CL_FIELDS); // XXX incomplete
+ assert(GetClearGround(t) == CLEAR_FIELDS); // XXX incomplete
SB(_m[t].m3, 0, 4, f);
}
@@ -128,7 +128,7 @@ static inline void MakeField(TileIndex t, uint field_type)
_m[t].m2 = 0;
_m[t].m3 = field_type;
_m[t].m4 = 0 << 5 | 0 << 2;
- SetClearGroundDensity(t, CL_FIELDS, 3);
+ SetClearGroundDensity(t, CLEAR_FIELDS, 3);
}
#endif
diff --git a/industry_cmd.c b/industry_cmd.c
index f16b04f32..e7973df87 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -895,7 +895,7 @@ static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5,
static bool IsBadFarmFieldTile(TileIndex tile)
{
switch (GetTileType(tile)) {
- case MP_CLEAR: return IsClearGround(tile, CL_FIELDS) || IsClearGround(tile, CL_SNOW);
+ case MP_CLEAR: return IsClearGround(tile, CLEAR_FIELDS) || IsClearGround(tile, CLEAR_SNOW);
case MP_TREES: return false;
default: return true;
}
@@ -904,7 +904,7 @@ static bool IsBadFarmFieldTile(TileIndex tile)
static bool IsBadFarmFieldTile2(TileIndex tile)
{
switch (GetTileType(tile)) {
- case MP_CLEAR: return IsClearGround(tile, CL_SNOW);
+ case MP_CLEAR: return IsClearGround(tile, CLEAR_SNOW);
case MP_TREES: return false;
default: return true;
}
diff --git a/landscape.c b/landscape.c
index b1431da0d..b8853671a 100644
--- a/landscape.c
+++ b/landscape.c
@@ -231,7 +231,7 @@ void DrawFoundation(TileInfo *ti, uint f)
void DoClearSquare(TileIndex tile)
{
- MakeClear(tile, CL_GRASS, _generating_world ? 3 : 0);
+ MakeClear(tile, CLEAR_GRASS, _generating_world ? 3 : 0);
MarkTileDirtyByTile(tile);
}
@@ -380,7 +380,7 @@ void InitializeLandscape(void)
for (y = 0; y < maxy; y++) {
for (x = 0; x < maxx; x++) {
- MakeClear(sizex * y + x, CL_GRASS, 3);
+ MakeClear(sizex * y + x, CLEAR_GRASS, 3);
SetTileHeight(sizex * y + x, 0);
}
MakeVoid(sizex * y + x);
@@ -550,7 +550,7 @@ static void CreateDesertOrRainForest(void)
for (data = _make_desert_or_rainforest_data;
data != endof(_make_desert_or_rainforest_data); ++data) {
TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data));
- if (IsTileType(t, MP_CLEAR) && IsClearGround(t, CL_DESERT)) break;
+ if (IsTileType(t, MP_CLEAR) && IsClearGround(t, CLEAR_DESERT)) break;
}
if (data == endof(_make_desert_or_rainforest_data))
SetTropicZone(tile, TROPICZONE_RAINFOREST);
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 4e2851a48..360b89fdb 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -482,7 +482,7 @@ static inline uint32 GetSmallMapVegetationPixels(TileIndex tile)
switch (t) {
case MP_CLEAR:
- if (IsClearGround(tile, CL_GRASS) && GetClearDensity(tile) < 3) {
+ if (IsClearGround(tile, CLEAR_GRASS) && GetClearDensity(tile) < 3) {
bits = MKCOLOR(0x37373737);
} else {
bits = _vegetation_clear_bits[GetClearGround(tile)];
diff --git a/terraform_gui.c b/terraform_gui.c
index 9a37bbc10..154d7d230 100644
--- a/terraform_gui.c
+++ b/terraform_gui.c
@@ -82,7 +82,7 @@ static void GenerateRockyArea(TileIndex end, TileIndex start)
BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) {
- MakeClear(tile, CL_ROCKS, 3);
+ MakeClear(tile, CLEAR_ROCKS, 3);
MarkTileDirtyByTile(tile);
success = true;
}
diff --git a/tree_cmd.c b/tree_cmd.c
index 2ba02d4d9..114554d12 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -68,8 +68,8 @@ static void DoPlaceMoreTrees(TileIndex tile)
if (dist <= 13 &&
IsTileType(cur_tile, MP_CLEAR) &&
- !IsClearGround(cur_tile, CL_FIELDS) &&
- !IsClearGround(cur_tile, CL_ROCKS)) {
+ !IsClearGround(cur_tile, CLEAR_FIELDS) &&
+ !IsClearGround(cur_tile, CLEAR_ROCKS)) {
PlaceTree(cur_tile, r);
}
}
@@ -92,8 +92,8 @@ void PlaceTreesRandomly(void)
uint32 r = Random();
TileIndex tile = RandomTileSeed(r);
if (IsTileType(tile, MP_CLEAR) &&
- !IsClearGround(tile, CL_FIELDS) &&
- !IsClearGround(tile, CL_ROCKS)) {
+ !IsClearGround(tile, CLEAR_FIELDS) &&
+ !IsClearGround(tile, CLEAR_ROCKS)) {
PlaceTree(tile, r);
}
} while (--i);
@@ -179,8 +179,8 @@ int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
}
switch (GetClearGround(tile)) {
- case CL_FIELDS: cost += _price.clear_3; break;
- case CL_ROCKS: cost += _price.clear_2; break;
+ case CLEAR_FIELDS: cost += _price.clear_3; break;
+ case CLEAR_ROCKS: cost += _price.clear_2; break;
default: break;
}
@@ -202,9 +202,9 @@ int32 CmdPlantTree(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
growth = _game_mode == GM_EDITOR ? 3 : 0;
switch (GetClearGround(tile)) {
- case CL_ROUGH: MakeTree(tile, treetype, 0, growth, TREE_GROUND_ROUGH, 0); break;
- case CL_SNOW: MakeTree(tile, treetype, 0, growth, TREE_GROUND_SNOW_DESERT, GetClearDensity(tile)); break;
- default: MakeTree(tile, treetype, 0, growth, TREE_GROUND_GRASS, 0); break;
+ case CLEAR_ROUGH: MakeTree(tile, treetype, 0, growth, TREE_GROUND_ROUGH, 0); break;
+ case CLEAR_SNOW: MakeTree(tile, treetype, 0, growth, TREE_GROUND_SNOW_DESERT, GetClearDensity(tile)); break;
+ default: MakeTree(tile, treetype, 0, growth, TREE_GROUND_GRASS, 0); break;
}
MarkTileDirtyByTile(tile);
@@ -482,13 +482,13 @@ static void TileLoop_Trees(TileIndex tile)
if (!IsTileType(tile, MP_CLEAR)) return;
switch (GetClearGround(tile)) {
- case CL_GRASS:
+ case CLEAR_GRASS:
if (GetClearDensity(tile) != 3) return;
MakeTree(tile, treetype, 0, 0, TREE_GROUND_GRASS, 0);
break;
- case CL_ROUGH: MakeTree(tile, treetype, 0, 0, TREE_GROUND_ROUGH, 0); break;
- case CL_SNOW: MakeTree(tile, treetype, 0, 0, TREE_GROUND_SNOW_DESERT, GetClearDensity(tile)); break;
+ case CLEAR_ROUGH: MakeTree(tile, treetype, 0, 0, TREE_GROUND_ROUGH, 0); break;
+ case CLEAR_SNOW: MakeTree(tile, treetype, 0, 0, TREE_GROUND_SNOW_DESERT, GetClearDensity(tile)); break;
default: return;
}
break;
@@ -508,9 +508,9 @@ static void TileLoop_Trees(TileIndex tile)
} else {
/* just one tree, change type into MP_CLEAR */
switch (GetTreeGround(tile)) {
- case TREE_GROUND_GRASS: MakeClear(tile, CL_GRASS, 3); break;
- case TREE_GROUND_ROUGH: MakeClear(tile, CL_ROUGH, 3); break;
- default: MakeClear(tile, CL_SNOW, GetTreeDensity(tile)); break;
+ case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, 3); break;
+ case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break;
+ default: MakeClear(tile, CLEAR_SNOW, GetTreeDensity(tile)); break;
}
}
break;
@@ -534,9 +534,9 @@ void OnTick_Trees(void)
if (_opt.landscape == LT_DESERT &&
(r = Random(), tile = RandomTileSeed(r), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
IsTileType(tile, MP_CLEAR) &&
- (ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH) &&
+ (ct = GetClearGround(tile), ct == CLEAR_GRASS || ct == CLEAR_ROUGH) &&
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
- MakeTree(tile, tree, 0, 0, ct == CL_ROUGH ? TREE_GROUND_ROUGH : TREE_GROUND_GRASS, 0);
+ MakeTree(tile, tree, 0, 0, ct == CLEAR_ROUGH ? TREE_GROUND_ROUGH : TREE_GROUND_GRASS, 0);
}
// byte underflow
@@ -546,11 +546,11 @@ void OnTick_Trees(void)
r = Random();
tile = TILE_MASK(r);
if (IsTileType(tile, MP_CLEAR) &&
- (ct = GetClearGround(tile), ct == CL_GRASS || ct == CL_ROUGH || ct == CL_SNOW) &&
+ (ct = GetClearGround(tile), ct == CLEAR_GRASS || ct == CLEAR_ROUGH || ct == CLEAR_SNOW) &&
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
switch (ct) {
- case CL_GRASS: MakeTree(tile, tree, 0, 0, TREE_GROUND_GRASS, 0); break;
- case CL_ROUGH: MakeTree(tile, tree, 0, 0, TREE_GROUND_ROUGH, 0); break;
+ case CLEAR_GRASS: MakeTree(tile, tree, 0, 0, TREE_GROUND_GRASS, 0); break;
+ case CLEAR_ROUGH: MakeTree(tile, tree, 0, 0, TREE_GROUND_ROUGH, 0); break;
default: MakeTree(tile, tree, 0, 0, TREE_GROUND_SNOW_DESERT, GetClearDensity(tile)); break;
}
}