summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-03 05:32:11 +0000
committercelestar <celestar@openttd.org>2006-04-03 05:32:11 +0000
commit6443c14ebd7ed0f9920673c218eaaa1172076a5f (patch)
tree7d8babf7cbe0b9ecf1ebc12e27848ef54f79d0e3
parent16c721237bc2ac93b80bb1a22fae1340158b7d71 (diff)
downloadopenttd-6443c14ebd7ed0f9920673c218eaaa1172076a5f.tar.xz
(svn r4246) -Codechange. Replaced about 100 occurences of '16' by TILE_SIZE
-rw-r--r--aircraft_cmd.c8
-rw-r--r--command.c6
-rw-r--r--disaster_cmd.c76
-rw-r--r--economy.c2
-rw-r--r--industry_cmd.c8
-rw-r--r--misc_gui.c2
-rw-r--r--road_cmd.c4
-rw-r--r--roadveh_cmd.c16
-rw-r--r--ship_cmd.c4
-rw-r--r--smallmap_gui.c20
-rw-r--r--sound.c4
-rw-r--r--vehicle.c2
-rw-r--r--viewport.c54
13 files changed, 103 insertions, 103 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 1a9e123cf..86b62beaf 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -178,8 +178,8 @@ int32 CmdBuildAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
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 @@ static bool AircraftController(Vehicle *v)
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
diff --git a/command.c b/command.c
index b7c3a5ede..d7436be00 100644
--- a/command.c
+++ b/command.c
@@ -317,7 +317,7 @@ byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;}
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 DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
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()) {
diff --git a/disaster_cmd.c b/disaster_cmd.c
index 95e7089b0..94a03810f 100644
--- a/disaster_cmd.c
+++ b/disaster_cmd.c
@@ -191,7 +191,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
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 @@ static void DisasterTick_UFO(Vehicle *v)
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 @@ static void DisasterTick_UFO(Vehicle *v)
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 @@ static void DisasterTick_UFO(Vehicle *v)
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 @@ static void DisasterTick_2(Vehicle *v)
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 @@ static void DisasterTick_2(Vehicle *v)
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 @@ static void DisasterTick_3(Vehicle *v)
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 @@ static void DisasterTick_3(Vehicle *v)
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 @@ static void DisasterTick_3(Vehicle *v)
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 @@ static void DisasterTick_4(Vehicle *v)
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 @@ static void DisasterTick_4(Vehicle *v)
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 @@ static void DisasterTick_4(Vehicle *v)
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 @@ static void DisasterTick_4(Vehicle *v)
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 @@ static void DisasterTick_4b(Vehicle *v)
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 @@ static void Disaster0_Init(void)
/* 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 @@ static void Disaster1_Init(void)
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 @@ static void Disaster2_Init(void)
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 @@ static void Disaster3_Init(void)
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 @@ static void Disaster4_Init(void)
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 @@ static void Disaster5_Init(void)
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 @@ static void Disaster6_Init(void)
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;
diff --git a/economy.c b/economy.c
index a4a0a566b..1bc1d3e93 100644
--- a/economy.c
+++ b/economy.c
@@ -1448,7 +1448,7 @@ int LoadUnloadVehicle(Vehicle *v)
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;
diff --git a/industry_cmd.c b/industry_cmd.c
index 407fcb0cb..55ca863ca 100644
--- a/industry_cmd.c
+++ b/industry_cmd.c
@@ -734,8 +734,8 @@ static void TileLoopIndustry_BubbleGenerator(TileIndex tile)
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 @@ static void TileLoop_Industry(TileIndex tile)
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 @@ static bool CheckNewIndustry_Oil(TileIndex tile, int type)
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;
diff --git a/misc_gui.c b/misc_gui.c
index 68245528c..f504cb457 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -711,7 +711,7 @@ void DrawStationCoverageAreaText(int sx, int sy, uint mask, int rad) {
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);
}
}
diff --git a/road_cmd.c b/road_cmd.c
index 7edc503f7..0e093aaa5 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -943,8 +943,8 @@ static void TileLoop_Road(TileIndex tile)
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);
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 2ee1a3c72..33473f517 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -141,8 +141,8 @@ int32 CmdBuildRoadVeh(int x, int y, uint32 flags, uint32 p1, uint32 p2)
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 @@ static void RoadVehController(Vehicle *v)
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 @@ again:
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 @@ again:
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;
diff --git a/ship_cmd.c b/ship_cmd.c
index f75b8eef8..0fd9387c0 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -854,8 +854,8 @@ int32 CmdBuildShip(int x, int y, uint32 flags, uint32 p1, uint32 p2)
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);
diff --git a/smallmap_gui.c b/smallmap_gui.c
index 4b6636dfe..e9401702b 100644
--- a/smallmap_gui.c
+++ b/smallmap_gui.c
@@ -623,8 +623,8 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town
}
}
- 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 @@ skip_column:
(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 @@ skip_column:
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 @@ skip_column:
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;
diff --git a/sound.c b/sound.c
index a0fab3655..0c63825e2 100644
--- a/sound.c
+++ b/sound.c
@@ -208,8 +208,8 @@ static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
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);
}
diff --git a/vehicle.c b/vehicle.c
index 6950b0e7c..303a03253 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -367,7 +367,7 @@ static VehicleID _vehicle_position_hash[0x1000];
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;
diff --git a/viewport.c b/viewport.c
index 7d88bb33a..30ae9f9be 100644
--- a/viewport.c
+++ b/viewport.c
@@ -135,8 +135,8 @@ void AssignWindowViewport(Window *w, int x, int y,
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 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
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 @@ void UpdateViewportPosition(Window *w)
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 MarkAllViewportsDirty(int left, int top, int right, int bottom)
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 @@ void MarkTileDirty(int x, int y)
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 @@ static void SetSelectionTilesDirty(void)
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 ScrollMainWindowTo(int x, int y)
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 SetRedErrorSquare(TileIndex tile)
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 @@ void UpdateTileSelection(void)
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 UpdateTileSelection(void)
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 VpSetPlaceSizingLimit(int limit)
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;
}