(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
authortron
Sun, 27 Mar 2005 18:15:27 +0000
changeset 1589 58d173b56509
parent 1588 5cb399cb05e5
child 1590 4e39d1da10c7
(svn r2093) uint -> TileIndex, remove commented out code and a local variable, which was only used once
functions.h
landscape.c
--- a/functions.h	Sun Mar 27 17:20:27 2005 +0000
+++ b/functions.h	Sun Mar 27 18:15:27 2005 +0000
@@ -10,22 +10,22 @@
 void FindLandscapeHeight(TileInfo *ti, uint x, uint y);
 void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile);
 
-void DoClearSquare(uint tile);
-void CDECL ModifyTile(uint tile, uint flags, ...);
+void DoClearSquare(TileIndex tile);
+void CDECL ModifyTile(TileIndex tile, uint flags, ...);
 void RunTileLoop(void);
 
 uint GetPartialZ(int x, int y, int corners);
 uint GetSlopeZ(int x, int y);
-uint32 GetTileTrackStatus(uint tile, TransportType mode);
-void GetAcceptedCargo(uint tile, AcceptedCargo ac);
-void ChangeTileOwner(uint tile, byte old_player, byte new_player);
-void AnimateTile(uint tile);
-void ClickTile(uint tile);
-void GetTileDesc(uint tile, TileDesc *td);
+uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
+void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
+void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player);
+void AnimateTile(TileIndex tile);
+void ClickTile(TileIndex tile);
+void GetTileDesc(TileIndex tile, TileDesc *td);
 void DrawTile(TileInfo *ti);
 void UpdateTownMaxPass(Town *t);
 
-bool IsValidTile(uint tile);
+bool IsValidTile(TileIndex tile);
 
 static inline Point RemapCoords(int x, int y, int z)
 {
--- a/landscape.c	Sun Mar 27 17:20:27 2005 +0000
+++ b/landscape.c	Sun Mar 27 18:15:27 2005 +0000
@@ -57,8 +57,6 @@
 /* find the landscape height for the coordinates x y */
 void FindLandscapeHeight(TileInfo *ti, uint x, uint y)
 {
-	int tile;
-
 	ti->x = x;
 	ti->y = y;
 
@@ -71,8 +69,7 @@
 		return;
 	}
 
-	tile = TILE_FROM_XY(x,y);
-	FindLandscapeHeightByTile(ti, tile);
+	FindLandscapeHeightByTile(ti, TILE_FROM_XY(x,y));
 }
 
 uint GetPartialZ(int x, int y, int corners)
@@ -173,18 +170,9 @@
 uint GetSlopeZ(int x,  int y)
 {
 	TileInfo ti;
-//	int z;
 
 	FindLandscapeHeight(&ti, x, y);
 
-/*
-	z = ti.z;
-	x &= 0xF;
-	y &= 0xF;
-
-
-	assert(z < 256);
-*/
 	return _tile_type_procs[ti.type]->get_slope_z_proc(&ti);
 }
 
@@ -239,7 +227,7 @@
 	}
 }
 
-void DoClearSquare(uint tile)
+void DoClearSquare(TileIndex tile)
 {
 	ModifyTile(tile,
 		MP_SETTYPE(MP_CLEAR) |
@@ -249,28 +237,28 @@
 	);
 }
 
-uint32 GetTileTrackStatus(uint tile, TransportType mode)
+uint32 GetTileTrackStatus(TileIndex tile, TransportType mode)
 {
 	return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode);
 }
 
-void ChangeTileOwner(uint tile, byte old_player, byte new_player)
+void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player)
 {
 	_tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_player, new_player);
 }
 
-void GetAcceptedCargo(uint tile, AcceptedCargo ac)
+void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac)
 {
 	memset(ac, 0, sizeof(AcceptedCargo));
 	_tile_type_procs[GetTileType(tile)]->get_accepted_cargo_proc(tile, ac);
 }
 
-void AnimateTile(uint tile)
+void AnimateTile(TileIndex tile)
 {
 	_tile_type_procs[GetTileType(tile)]->animate_tile_proc(tile);
 }
 
-void ClickTile(uint tile)
+void ClickTile(TileIndex tile)
 {
 	_tile_type_procs[GetTileType(tile)]->click_tile_proc(tile);
 }
@@ -280,7 +268,7 @@
 	_tile_type_procs[ti->type]->draw_tile_proc(ti);
 }
 
-void GetTileDesc(uint tile, TileDesc *td)
+void GetTileDesc(TileIndex tile, TileDesc *td)
 {
 	_tile_type_procs[GetTileType(tile)]->get_tile_desc_proc(tile, td);
 }
@@ -292,10 +280,10 @@
 
 int32 CmdLandscapeClear(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
-	uint tile;
+	TileIndex tile = TILE_FROM_XY(x, y);
+
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 
-	tile = TILE_FROM_XY(x,y);
 	return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags);
 }
 
@@ -350,7 +338,7 @@
 
 
 /* utility function used to modify a tile */
-void CDECL ModifyTile(uint tile, uint flags, ...)
+void CDECL ModifyTile(TileIndex tile, uint flags, ...)
 {
 	va_list va;
 	int i;
@@ -403,7 +391,7 @@
 
 void RunTileLoop(void)
 {
-	uint tile;
+	TileIndex tile;
 	uint count;
 
 	tile = _cur_tileloop_tile;
@@ -694,7 +682,7 @@
 	));
 }
 
-bool IsValidTile(uint tile)
+bool IsValidTile(TileIndex tile)
 {
 	return (tile < MapSizeX() * MapMaxY() && TileX(tile) != MapMaxX());
 }