diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | a7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/disaster_cmd.cpp | |
parent | ce75f6549dd379b506c9f1e9383bd881aa7cf5c7 (diff) | |
download | openttd-a7d0cdf95fd8847ab76b35446e1c9b77f8ef1cb7.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/disaster_cmd.cpp')
-rw-r--r-- | src/disaster_cmd.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index 2d4579b52..f018149f2 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -276,7 +276,7 @@ static void DisasterTick_UFO(Vehicle *v) // fly around randomly 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) { + if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) { v->direction = GetDirectionTowards(v, x, y); GetNewVehiclePos(v, &gp); SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); @@ -305,7 +305,7 @@ static void DisasterTick_UFO(Vehicle *v) return; } - dist = abs(v->x_pos - u->x_pos) + abs(v->y_pos - u->y_pos); + dist = delta(v->x_pos, u->x_pos) + delta(v->y_pos, u->y_pos); if (dist < TILE_SIZE && !(u->vehstatus&VS_HIDDEN) && u->breakdown_ctr==0) { u->breakdown_ctr = 3; @@ -526,7 +526,7 @@ static void DisasterTick_4(Vehicle *v) if (v->current_order.dest == 1) { int x = TileX(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2; int y = TileY(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2; - if (abs(v->x_pos - x) + abs(v->y_pos - y) >= 8) { + if (delta(v->x_pos, x) + delta(v->y_pos, y) >= 8) { v->direction = GetDirectionTowards(v, x, y); GetNewVehiclePos(v, &gp); @@ -544,7 +544,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 * TILE_SIZE) { + if (delta(u->x_pos, v->x_pos) + delta(u->y_pos, v->y_pos) <= 12 * TILE_SIZE) { u->breakdown_ctr = 5; u->breakdown_delay = 0xF0; } @@ -578,7 +578,7 @@ static void DisasterTick_4(Vehicle *v) 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) { + if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) { v->direction = GetDirectionTowards(v, x, y); GetNewVehiclePos(v, &gp); SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); @@ -626,7 +626,7 @@ static void DisasterTick_4b(Vehicle *v) if (v->current_order.dest == 0) { u = GetVehicle(v->u.disaster.unk2); - if (abs(v->x_pos - u->x_pos) > TILE_SIZE) + if (delta(v->x_pos, u->x_pos) > TILE_SIZE) return; v->current_order.dest = 1; |