(svn r4279) s/\<CL_/CLEAR_/
authortron
Tue, 04 Apr 2006 21:35:13 +0000
changeset 3447 1c62c085638a
parent 3446 bb40fd312640
child 3448 bc96e486627d
(svn r4279) s/\<CL_/CLEAR_/
clear_cmd.c
clear_map.h
industry_cmd.c
landscape.c
smallmap_gui.c
terraform_gui.c
tree_cmd.c
--- a/clear_cmd.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/clear_cmd.c	Tue Apr 04 21:35:13 2006 +0000
@@ -409,7 +409,7 @@
 	};
 	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 @@
 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 @@
 	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 @@
 		}
 	}
 
-	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 @@
 	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 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 @@
 	}
 
 	switch (GetClearGround(tile)) {
-		case CL_GRASS:
+		case CLEAR_GRASS:
 			if (GetClearDensity(tile) == 3) return;
 
 			if (_game_mode != GM_EDITOR) {
@@ -639,11 +639,11 @@
 					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 @@
 	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 @@
 			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 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)];
--- a/clear_map.h	Tue Apr 04 19:46:18 2006 +0000
+++ b/clear_map.h	Tue Apr 04 21:35:13 2006 +0000
@@ -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 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 @@
 	_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
--- a/industry_cmd.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/industry_cmd.c	Tue Apr 04 21:35:13 2006 +0000
@@ -895,7 +895,7 @@
 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 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;
 	}
--- a/landscape.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/landscape.c	Tue Apr 04 21:35:13 2006 +0000
@@ -231,7 +231,7 @@
 
 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 @@
 
 	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 @@
 		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);
--- a/smallmap_gui.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/smallmap_gui.c	Tue Apr 04 21:35:13 2006 +0000
@@ -482,7 +482,7 @@
 
 	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)];
--- a/terraform_gui.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/terraform_gui.c	Tue Apr 04 21:35:13 2006 +0000
@@ -82,7 +82,7 @@
 
 	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;
 		}
--- a/tree_cmd.c	Tue Apr 04 19:46:18 2006 +0000
+++ b/tree_cmd.c	Tue Apr 04 21:35:13 2006 +0000
@@ -68,8 +68,8 @@
 
 		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 @@
 		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 @@
 					}
 
 					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 @@
 
 						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 @@
 						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 @@
 			} 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 @@
 	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 @@
 	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;
 		}
 	}