(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
authorcelestar
Mon, 03 Apr 2006 05:32:11 +0000
changeset 3421 7968a4b5ff0a
parent 3420 91b03523125b
child 3422 a6eba3443452
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
aircraft_cmd.c
command.c
disaster_cmd.c
economy.c
industry_cmd.c
misc_gui.c
road_cmd.c
roadveh_cmd.c
ship_cmd.c
smallmap_gui.c
sound.c
vehicle.c
viewport.c
--- a/aircraft_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/aircraft_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -178,8 +178,8 @@
 		v->tile = tile;
 //		u->tile = 0;
 
-		x = TileX(tile) * 16 + 5;
-		y = TileY(tile) * 16 + 3;
+		x = TileX(tile) * TILE_SIZE + 5;
+		y = TileY(tile) * TILE_SIZE + 3;
 
 		v->x_pos = u->x_pos = x;
 		v->y_pos = u->y_pos = y;
@@ -765,8 +765,8 @@
 
 		if (tile == 0) tile = st->xy;
 		// xy of destination
-		x = TileX(tile) * 16;
-		y = TileY(tile) * 16;
+		x = TileX(tile) * TILE_SIZE;
+		y = TileY(tile) * TILE_SIZE;
 	}
 
 	// get airport moving data
--- a/command.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/command.c	Mon Apr 03 05:32:11 2006 +0000
@@ -317,7 +317,7 @@
 
 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
 {
-	return DoCommand(TileX(tile) * 16, TileY(tile) * 16, p1, p2, flags, procc);
+	return DoCommand(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, p1, p2, flags, procc);
 }
 
 
@@ -401,8 +401,8 @@
 	bool notest;
 	StringID error_part1;
 
-	int x = TileX(tile) * 16;
-	int y = TileY(tile) * 16;
+	int x = TileX(tile) * TILE_SIZE;
+	int y = TileY(tile) * TILE_SIZE;
 
 	/* Do not even think about executing out-of-bounds tile-commands */
 	if (tile >= MapSize()) {
--- a/disaster_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/disaster_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -191,7 +191,7 @@
 					0);
 			}
 		}
-		if (v->y_pos >= ((int)MapSizeY() + 9) * 16 - 1)
+		if (v->y_pos >= ((int)MapSizeY() + 9) * TILE_SIZE - 1)
 			DeleteDisasterVeh(v);
 		return;
 	}
@@ -266,9 +266,9 @@
 
 	if (v->current_order.station == 0) {
 // fly around randomly
-		int x = TileX(v->dest_tile) * 16;
-		int y = TileY(v->dest_tile) * 16;
-		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
+		int x = TileX(v->dest_tile) * TILE_SIZE;
+		int y = TileY(v->dest_tile) * TILE_SIZE;
+		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) {
 			v->direction = GetDirectionTowards(v, x, y);
 			GetNewVehiclePos(v, &gp);
 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -299,7 +299,7 @@
 
 		dist = abs(v->x_pos - u->x_pos) + abs(v->y_pos - u->y_pos);
 
-		if (dist < 16 && !(u->vehstatus&VS_HIDDEN) && u->breakdown_ctr==0) {
+		if (dist < TILE_SIZE && !(u->vehstatus&VS_HIDDEN) && u->breakdown_ctr==0) {
 			u->breakdown_ctr = 3;
 			u->breakdown_delay = 140;
 		}
@@ -308,7 +308,7 @@
 		GetNewVehiclePos(v, &gp);
 
 		z = v->z_pos;
-		if (dist <= 16 && z > u->z_pos) z--;
+		if (dist <= TILE_SIZE && z > u->z_pos) z--;
 		SetDisasterVehiclePos(v, gp.x, gp.y, z);
 
 		if (z <= u->z_pos && (u->vehstatus&VS_HIDDEN)==0) {
@@ -365,8 +365,8 @@
 	if (v->current_order.station == 2) {
 		if (!(v->tick_counter&3)) {
 			Industry *i = GetIndustry(v->dest_tile);
-			int x = TileX(i->xy) * 16;
-			int y = TileY(i->xy) * 16;
+			int x = TileX(i->xy) * TILE_SIZE;
+			int y = TileY(i->xy) * TILE_SIZE;
 			uint32 r = Random();
 
 			CreateEffectVehicleAbove(
@@ -397,10 +397,10 @@
 		TileIndex tile;
 		uint ind;
 
-		x = v->x_pos - 15*16;
+		x = v->x_pos - 15 * TILE_SIZE;
 		y = v->y_pos;
 
-		if ( (uint)x > MapMaxX() * 16-1)
+		if ( (uint)x > MapMaxX() * TILE_SIZE - 1)
 			return;
 
 		tile = TileVirtXY(x, y);
@@ -429,7 +429,7 @@
 	GetNewVehiclePos(v, &gp);
 	SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
 
-	if (gp.x > (int)MapSizeX() * 16 + 9*16 - 1) {
+	if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
 		DeleteDisasterVeh(v);
 		return;
 	}
@@ -437,8 +437,8 @@
 	if (v->current_order.station == 2) {
 		if (!(v->tick_counter&3)) {
 			Industry *i = GetIndustry(v->dest_tile);
-			int x = TileX(i->xy) * 16;
-			int y = TileY(i->xy) * 16;
+			int x = TileX(i->xy) * TILE_SIZE;
+			int y = TileY(i->xy) * TILE_SIZE;
 			uint32 r = Random();
 
 			CreateEffectVehicleAbove(
@@ -469,10 +469,10 @@
 		TileIndex tile;
 		uint ind;
 
-		x = v->x_pos - 15*16;
+		x = v->x_pos - 15 * TILE_SIZE;
 		y = v->y_pos;
 
-		if ( (uint)x > MapMaxX() * 16-1)
+		if ( (uint)x > MapMaxX() * TILE_SIZE - 1)
 			return;
 
 		tile = TileVirtXY(x, y);
@@ -516,8 +516,8 @@
 	v->tick_counter++;
 
 	if (v->current_order.station == 1) {
-		int x = TileX(v->dest_tile) * 16 + 8;
-		int y = TileY(v->dest_tile) * 16 + 8;
+		int x = TileX(v->dest_tile) * TILE_SIZE + 8;
+		int y = TileY(v->dest_tile) * TILE_SIZE + 8;
 		if (abs(v->x_pos - x) + abs(v->y_pos - y) >= 8) {
 			v->direction = GetDirectionTowards(v, x, y);
 
@@ -536,7 +536,7 @@
 
 		FOR_ALL_VEHICLES(u) {
 			if (u->type == VEH_Train || u->type == VEH_Road) {
-				if (abs(u->x_pos - v->x_pos) + abs(u->y_pos - v->y_pos) <= 12*16) {
+				if (abs(u->x_pos - v->x_pos) + abs(u->y_pos - v->y_pos) <= 12 * TILE_SIZE) {
 					u->breakdown_ctr = 5;
 					u->breakdown_delay = 0xF0;
 				}
@@ -556,7 +556,7 @@
 			return;
 		}
 
-		InitializeDisasterVehicle(u, -6 * 16, v->y_pos, 135, DIR_SW, 11);
+		InitializeDisasterVehicle(u, -6 * TILE_SIZE, v->y_pos, 135, DIR_SW, 11);
 		u->u.disaster.unk2 = v->index;
 
 		w = ForceAllocateSpecialVehicle();
@@ -564,13 +564,13 @@
 			return;
 
 		u->next = w;
-		InitializeDisasterVehicle(w, -6 * 16, v->y_pos, 0, DIR_SW, 12);
+		InitializeDisasterVehicle(w, -6 * TILE_SIZE, v->y_pos, 0, DIR_SW, 12);
 		w->vehstatus |= VS_DISASTER;
 	} else if (v->current_order.station < 1) {
 
-		int x = TileX(v->dest_tile) * 16;
-		int y = TileY(v->dest_tile) * 16;
-		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
+		int x = TileX(v->dest_tile) * TILE_SIZE;
+		int y = TileY(v->dest_tile) * TILE_SIZE;
+		if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) {
 			v->direction = GetDirectionTowards(v, x, y);
 			GetNewVehiclePos(v, &gp);
 			SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -610,14 +610,14 @@
 	GetNewVehiclePos(v, &gp);
 	SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
 
-	if (gp.x > (int)MapSizeX() * 16 + 9*16 - 1) {
+	if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
 		DeleteDisasterVeh(v);
 		return;
 	}
 
 	if (v->current_order.station == 0) {
 		u = GetVehicle(v->u.disaster.unk2);
-		if (abs(v->x_pos - u->x_pos) > 16)
+		if (abs(v->x_pos - u->x_pos) > TILE_SIZE)
 			return;
 		v->current_order.station = 1;
 
@@ -715,13 +715,13 @@
 
 	/* Pick a random place, unless we find
 	    a small airport */
-	x = TileX(Random()) * 16 + 8;
+	x = TileX(Random()) * TILE_SIZE + 8;
 
 	FOR_ALL_STATIONS(st) {
 		if (st->xy && st->airport_tile != 0 &&
 				st->airport_type <= 1 &&
 				IS_HUMAN_PLAYER(st->owner)) {
-			x = (TileX(st->xy) + 2) * 16;
+			x = (TileX(st->xy) + 2) * TILE_SIZE;
 			break;
 		}
 	}
@@ -745,7 +745,7 @@
 	if (v == NULL)
 		return;
 
-	x = TileX(Random()) * 16 + 8;
+	x = TileX(Random()) * TILE_SIZE + 8;
 
 	InitializeDisasterVehicle(v, x, 0, 135, DIR_SE, 2);
 	v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
@@ -783,8 +783,8 @@
 	if (v == NULL)
 		return;
 
-	x = (MapSizeX() + 9) * 16 - 1;
-	y = TileY(found->xy) * 16 + 37;
+	x = (MapSizeX() + 9) * TILE_SIZE - 1;
+	y = TileY(found->xy) * TILE_SIZE + 37;
 
 	InitializeDisasterVehicle(v, x, y, 135, DIR_NE, 4);
 
@@ -819,8 +819,8 @@
 	if (v == NULL)
 		return;
 
-	x = -16 * 16;
-	y = TileY(found->xy) * 16 + 37;
+	x = -16 * TILE_SIZE;
+	y = TileY(found->xy) * TILE_SIZE + 37;
 
 	InitializeDisasterVehicle(v, x, y, 135, DIR_SW, 6);
 
@@ -845,9 +845,9 @@
 
 	if (v == NULL) return;
 
-	x = TileX(Random()) * 16 + 8;
+	x = TileX(Random()) * TILE_SIZE + 8;
 
-	y = MapMaxX() * 16 - 1;
+	y = MapMaxX() * TILE_SIZE - 1;
 	InitializeDisasterVehicle(v, x, y, 135, DIR_NW, 9);
 	v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
 	v->age = 0;
@@ -872,10 +872,10 @@
 	if (v == NULL) return;
 
 	r = Random();
-	x = TileX(r) * 16 + 8;
+	x = TileX(r) * TILE_SIZE + 8;
 
 	if (r & 0x80000000) {
-		y = MapMaxX() * 16 - 8 - 1;
+		y = MapMaxX() * TILE_SIZE - 8 - 1;
 		dir = DIR_NW;
 	} else {
 		y = 8;
@@ -896,10 +896,10 @@
 	if (v == NULL) return;
 
 	r = Random();
-	x = TileX(r) * 16 + 8;
+	x = TileX(r) * TILE_SIZE + 8;
 
 	if (r & 0x80000000) {
-		y = MapMaxX() * 16 - 8 - 1;
+		y = MapMaxX() * TILE_SIZE - 8 - 1;
 		dir = DIR_NW;
 	} else {
 		y = 8;
--- a/economy.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/economy.c	Mon Apr 03 05:32:11 2006 +0000
@@ -1448,7 +1448,7 @@
 
 	if (v->type == VEH_Train) {
 		// Each platform tile is worth 2 rail vehicles.
-		int overhang = v->u.rail.cached_total_length - GetStationPlatforms(st, v->tile) * 16;
+		int overhang = v->u.rail.cached_total_length - GetStationPlatforms(st, v->tile) * TILE_SIZE;
 		if (overhang > 0) {
 			unloading_time <<= 1;
 			unloading_time += (overhang * unloading_time) / 8;
--- a/industry_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/industry_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -734,8 +734,8 @@
 	dir = Random() & 3;
 
 	v = CreateEffectVehicleAbove(
-		TileX(tile) * 16 + _tileloop_ind_case_161[dir + 0],
-		TileY(tile) * 16 + _tileloop_ind_case_161[dir + 4],
+		TileX(tile) * TILE_SIZE + _tileloop_ind_case_161[dir + 0],
+		TileY(tile) * TILE_SIZE + _tileloop_ind_case_161[dir + 4],
 		_tileloop_ind_case_161[dir + 8],
 		EV_BUBBLE
 	);
@@ -819,7 +819,7 @@
 		break;
 
 	case 49:
-		CreateEffectVehicleAbove(TileX(tile) * 16 + 6, TileY(tile) * 16 + 6, 43, EV_SMOKE);
+		CreateEffectVehicleAbove(TileX(tile) * TILE_SIZE + 6, TileY(tile) * TILE_SIZE + 6, 43, EV_SMOKE);
 		break;
 
 
@@ -1162,7 +1162,7 @@
 	if (_game_mode == GM_EDITOR && _ignore_restrictions) return true;
 	if (_game_mode == GM_EDITOR && type != IT_OIL_RIG)   return true;
 	if ((type != IT_OIL_RIG || TileHeight(tile) == 0) &&
-			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < 16)   return true;
+			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < TILE_SIZE)   return true;
 
 	_error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
 	return false;
--- a/misc_gui.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/misc_gui.c	Mon Apr 03 05:32:11 2006 +0000
@@ -711,7 +711,7 @@
 	TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y);
 	AcceptedCargo accepts;
 	if (tile < MapSize()) {
-		GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / 16, _thd.size.y / 16 , rad);
+		GetAcceptanceAroundTiles(accepts, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad);
 		DrawStationCoverageText(accepts, sx, sy, mask);
 	}
 }
--- a/road_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/road_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -943,8 +943,8 @@
 
 					SndPlayTileFx(SND_21_JACKHAMMER, tile);
 					CreateEffectVehicleAbove(
-						TileX(tile) * 16 + 7,
-						TileY(tile) * 16 + 7,
+						TileX(tile) * TILE_SIZE + 7,
+						TileY(tile) * TILE_SIZE + 7,
 						0,
 						EV_BULLDOZER);
 					MarkTileDirtyByTile(tile);
--- a/roadveh_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/roadveh_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -141,8 +141,8 @@
 		v->owner = _current_player;
 
 		v->tile = tile;
-		x = TileX(tile) * 16 + 8;
-		y = TileY(tile) * 16 + 8;
+		x = TileX(tile) * TILE_SIZE + 8;
+		y = TileY(tile) * TILE_SIZE + 8;
 		v->x_pos = x;
 		v->y_pos = y;
 		v->z_pos = GetSlopeZ(x,y);
@@ -1211,8 +1211,8 @@
 		rd2 = _roadveh_data_2[dir];
 		rdp = _road_drive_data[(_opt.road_side << 4) + rd2];
 
-		x = TileX(v->tile) * 16 + (rdp[6].x & 0xF);
-		y = TileY(v->tile) * 16 + (rdp[6].y & 0xF);
+		x = TileX(v->tile) * TILE_SIZE + (rdp[6].x & 0xF);
+		y = TileY(v->tile) * TILE_SIZE + (rdp[6].y & 0xF);
 
 		if (RoadVehFindCloseTo(v, x, y, v->direction) != NULL) return;
 
@@ -1299,8 +1299,8 @@
 
 		rdp = _road_drive_data[(dir + (_opt.road_side << 4)) ^ v->u.road.overtaking];
 
-		x = TileX(tile) * 16 + rdp[0].x;
-		y = TileY(tile) * 16 + rdp[0].y;
+		x = TileX(tile) * TILE_SIZE + rdp[0].x;
+		y = TileY(tile) * TILE_SIZE + rdp[0].y;
 
 		newdir = RoadVehGetSlidingDirection(v, x, y);
 		if (RoadVehFindCloseTo(v, x, y, newdir) != NULL) return;
@@ -1360,8 +1360,8 @@
 		tmp = (_opt.road_side << 4) + dir;
 		rdp = _road_drive_data[tmp];
 
-		x = TileX(v->tile) * 16 + rdp[1].x;
-		y = TileY(v->tile) * 16 + rdp[1].y;
+		x = TileX(v->tile) * TILE_SIZE + rdp[1].x;
+		y = TileY(v->tile) * TILE_SIZE + rdp[1].y;
 
 		newdir = RoadVehGetSlidingDirection(v, x, y);
 		if (RoadVehFindCloseTo(v, x, y, newdir) != NULL) return;
--- a/ship_cmd.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/ship_cmd.c	Mon Apr 03 05:32:11 2006 +0000
@@ -854,8 +854,8 @@
 
 		v->owner = _current_player;
 		v->tile = tile;
-		x = TileX(tile) * 16 + 8;
-		y = TileY(tile) * 16 + 8;
+		x = TileX(tile) * TILE_SIZE + 8;
+		y = TileY(tile) * TILE_SIZE + 8;
 		v->x_pos = x;
 		v->y_pos = y;
 		v->z_pos = GetSlopeZ(x,y);
--- a/smallmap_gui.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/smallmap_gui.c	Mon Apr 03 05:32:11 2006 +0000
@@ -623,8 +623,8 @@
 		}
 	}
 
-	tile_x = WP(w,smallmap_d).scroll_x / 16;
-	tile_y = WP(w,smallmap_d).scroll_y / 16;
+	tile_x = WP(w,smallmap_d).scroll_x / TILE_SIZE;
+	tile_y = WP(w,smallmap_d).scroll_y / TILE_SIZE;
 
 	dx = dpi->left + WP(w,smallmap_d).subscroll;
 	tile_x -= dx / 4;
@@ -701,8 +701,8 @@
 					(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
 				// Remap into flat coordinates.
 				Point pt = RemapCoords(
-					(v->x_pos - WP(w,smallmap_d).scroll_x) / 16,
-					(v->y_pos - WP(w,smallmap_d).scroll_y) / 16,
+					(v->x_pos - WP(w,smallmap_d).scroll_x) / TILE_SIZE,
+					(v->y_pos - WP(w,smallmap_d).scroll_y) / TILE_SIZE,
 					0);
 				x = pt.x;
 				y = pt.y;
@@ -746,8 +746,8 @@
 			if (t->xy != 0) {
 				// Remap the town coordinate
 				Point pt = RemapCoords(
-					(int)(TileX(t->xy) * 16 - WP(w, smallmap_d).scroll_x) / 16,
-					(int)(TileY(t->xy) * 16 - WP(w, smallmap_d).scroll_y) / 16,
+					(int)(TileX(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_x) / TILE_SIZE,
+					(int)(TileY(t->xy) * TILE_SIZE - WP(w, smallmap_d).scroll_y) / TILE_SIZE,
 					0);
 				x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1);
 				y = pt.y;
@@ -776,10 +776,10 @@
 
 		x = vp->virtual_left - pt.x;
 		y = vp->virtual_top - pt.y;
-		x2 = (x + vp->virtual_width) / 16;
-		y2 = (y + vp->virtual_height) / 16;
-		x /= 16;
-		y /= 16;
+		x2 = (x + vp->virtual_width) / TILE_SIZE;
+		y2 = (y + vp->virtual_height) / TILE_SIZE;
+		x /= TILE_SIZE;
+		y /= TILE_SIZE;
 
 		x -= WP(w,smallmap_d).subscroll;
 		x2 -= WP(w,smallmap_d).subscroll;
--- a/sound.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/sound.c	Mon Apr 03 05:32:11 2006 +0000
@@ -208,8 +208,8 @@
 void SndPlayTileFx(SoundFx sound, TileIndex tile)
 {
 	/* emits sound from center (+ 8) of the tile */
-	int x = TileX(tile) * 16 + 8;
-	int y = TileY(tile) * 16 + 8;
+	int x = TileX(tile) * TILE_SIZE + 8;
+	int y = TileY(tile) * TILE_SIZE + 8;
 	Point pt = RemapCoords(x, y, GetSlopeZ(x, y));
 	SndPlayScreenCoordFx(sound, pt.x, pt.y);
 }
--- a/vehicle.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/vehicle.c	Mon Apr 03 05:32:11 2006 +0000
@@ -367,7 +367,7 @@
 void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
 {
 	int x,y,x2,y2;
-	Point pt = RemapCoords(TileX(tile) * 16, TileY(tile) * 16, 0);
+	Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, 0);
 
 	x2 = ((pt.x + 104) & 0x1F80) >> 7;
 	x  = ((pt.x - 174) & 0x1F80) >> 7;
--- a/viewport.c	Sun Apr 02 18:03:48 2006 +0000
+++ b/viewport.c	Mon Apr 03 05:32:11 2006 +0000
@@ -135,8 +135,8 @@
 		veh = GetVehicle(WP(w, vp_d).follow_vehicle);
 		pt = MapXYZToViewport(vp, veh->x_pos, veh->y_pos, veh->z_pos);
 	} else {
-		uint x = TileX(follow_flags) * 16;
-		uint y = TileY(follow_flags) * 16;
+		uint x = TileX(follow_flags) * TILE_SIZE;
+		uint y = TileY(follow_flags) * TILE_SIZE;
 
 		WP(w, vp_d).follow_vehicle = INVALID_VEHICLE;
 		pt = MapXYZToViewport(vp, x, y, GetSlopeZ(x, y));
@@ -310,7 +310,7 @@
 	pt.x = a+z;
 	pt.y = b+z;
 
-	if ((uint)pt.x >= MapMaxX() * 16 || (uint)pt.y >= MapMaxY() * 16) {
+	if ((uint)pt.x >= MapMaxX() * TILE_SIZE || (uint)pt.y >= MapMaxY() * TILE_SIZE) {
 		pt.x = pt.y = -1;
 	}
 
@@ -1349,8 +1349,8 @@
 		vx = -x + y * 2;
 		vy =  x + y * 2;
 		// clamp to size of map
-		vx = clamp(vx, 0 * 4, MapMaxX() * 16 * 4);
-		vy = clamp(vy, 0 * 4, MapMaxY() * 16 * 4);
+		vx = clamp(vx, 0 * 4, MapMaxX() * TILE_SIZE * 4);
+		vy = clamp(vy, 0 * 4, MapMaxY() * TILE_SIZE * 4);
 		// Convert map coordinates to viewport coordinates
 		x = (-vx + vy) / 2;
 		y = ( vx + vy) / 4;
@@ -1420,7 +1420,7 @@
 
 void MarkTileDirtyByTile(TileIndex tile)
 {
-	Point pt = RemapCoords(TileX(tile) * 16, TileY(tile) * 16, GetTileZ(tile));
+	Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, GetTileZ(tile));
 	MarkAllViewportsDirty(
 		pt.x - 31,
 		pt.y - 122,
@@ -1434,8 +1434,8 @@
 	uint z = 0;
 	Point pt;
 
-	if (IS_INT_INSIDE(x, 0, MapSizeX() * 16) &&
-			IS_INT_INSIDE(y, 0, MapSizeY() * 16))
+	if (IS_INT_INSIDE(x, 0, MapSizeX() * TILE_SIZE) &&
+			IS_INT_INSIDE(y, 0, MapSizeY() * TILE_SIZE))
 		z = GetTileZ(TileVirtXY(x, y));
 	pt = RemapCoords(x, y, z);
 
@@ -1473,9 +1473,9 @@
 		int y_bk = y;
 		do {
 			MarkTileDirty(x, y);
-		} while ( (y+=16) != y_size);
+		} while ( (y += TILE_SIZE) != y_size);
 		y = y_bk;
-	} while ( (x+=16) != x_size);
+	} while ( (x += TILE_SIZE) != x_size);
 }
 
 
@@ -1801,7 +1801,7 @@
 
 bool ScrollMainWindowToTile(TileIndex tile)
 {
-	return ScrollMainWindowTo(TileX(tile) * 16 + 8, TileY(tile) * 16 + 8);
+	return ScrollMainWindowTo(TileX(tile) * TILE_SIZE + 8, TileY(tile) * TILE_SIZE + 8);
 }
 
 void SetRedErrorSquare(TileIndex tile)
@@ -1819,18 +1819,18 @@
 
 void SetTileSelectSize(int w, int h)
 {
-	_thd.new_size.x = w * 16;
-	_thd.new_size.y = h * 16;
+	_thd.new_size.x = w * TILE_SIZE;
+	_thd.new_size.y = h * TILE_SIZE;
 	_thd.new_outersize.x = 0;
 	_thd.new_outersize.y = 0;
 }
 
 void SetTileSelectBigSize(int ox, int oy, int sx, int sy)
 {
-	_thd.offs.x = ox * 16;
-	_thd.offs.y = oy * 16;
-	_thd.new_outersize.x = sx * 16;
-	_thd.new_outersize.y = sy * 16;
+	_thd.offs.x = ox * TILE_SIZE;
+	_thd.offs.y = oy * TILE_SIZE;
+	_thd.new_outersize.x = sx * TILE_SIZE;
+	_thd.new_outersize.y = sy * TILE_SIZE;
 }
 
 /* returns the best autorail highlight type from map coordinates */
@@ -1860,8 +1860,8 @@
 			if (y1 >= y2) intswap(y1,y2);
 			_thd.new_pos.x = x1;
 			_thd.new_pos.y = y1;
-			_thd.new_size.x = x2 - x1 + 16;
-			_thd.new_size.y = y2 - y1 + 16;
+			_thd.new_size.x = x2 - x1 + TILE_SIZE;
+			_thd.new_size.y = y2 - y1 + TILE_SIZE;
 			_thd.new_drawstyle = _thd.next_drawstyle;
 		}
 	} else if (_thd.place_mode != VHM_NONE) {
@@ -1908,10 +1908,10 @@
 void VpStartPlaceSizing(TileIndex tile, int user)
 {
 	_thd.userdata = user;
-	_thd.selend.x = TileX(tile) * 16;
-	_thd.selstart.x = TileX(tile) * 16;
-	_thd.selend.y = TileY(tile) * 16;
-	_thd.selstart.y = TileY(tile) * 16;
+	_thd.selend.x = TileX(tile) * TILE_SIZE;
+	_thd.selstart.x = TileX(tile) * TILE_SIZE;
+	_thd.selend.y = TileY(tile) * TILE_SIZE;
+	_thd.selstart.y = TileY(tile) * TILE_SIZE;
 	if (_thd.place_mode == VHM_RECT) {
 		_thd.place_mode = VHM_SPECIAL;
 		_thd.next_drawstyle = HT_RECT;
@@ -1932,10 +1932,10 @@
 
 void VpSetPresizeRange(uint from, uint to)
 {
-	_thd.selend.x = TileX(to) * 16;
-	_thd.selend.y = TileY(to) * 16;
-	_thd.selstart.x = TileX(from) * 16;
-	_thd.selstart.y = TileY(from) * 16;
+	_thd.selend.x = TileX(to) * TILE_SIZE;
+	_thd.selend.y = TileY(to) * TILE_SIZE;
+	_thd.selstart.x = TileX(from) * TILE_SIZE;
+	_thd.selstart.y = TileY(from) * TILE_SIZE;
 	_thd.next_drawstyle = HT_RECT;
 }