Mercurial > hg > openttd
changeset 7970:c49c1607b294 draft
(svn r11526) -Codechange: Rename the function delta fitting to the naming style
author | skidd13 <skidd13@openttd.org> |
---|---|
date | Mon, 26 Nov 2007 16:01:29 +0000 |
parents | 3f7b82356f85 |
children | b54ea77a319b |
files | src/core/math_func.hpp src/disaster_cmd.cpp src/industry_cmd.cpp src/map.cpp src/news_gui.cpp src/npf.cpp src/pathfind.cpp src/tree_cmd.cpp src/viewport.cpp |
diffstat | 9 files changed, 23 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -175,7 +175,7 @@ * @param b The second scalar * @return The absolute difference between the given scalars */ -template <typename T> static inline T delta(const T a, const T b) { +template <typename T> static inline T Delta(const T a, const T b) { return (a < b) ? b - a : a - b; }
--- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -311,7 +311,7 @@ /* Fly around randomly */ int x = TileX(v->dest_tile) * TILE_SIZE; int y = TileY(v->dest_tile) * TILE_SIZE; - if (delta(x, v->x_pos) + delta(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); GetNewVehiclePosResult gp = GetNewVehiclePos(v); SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); @@ -340,7 +340,7 @@ return; } - dist = delta(v->x_pos, u->x_pos) + delta(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; @@ -567,7 +567,7 @@ 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 (delta(v->x_pos, x) + delta(v->y_pos, y) >= 8) { + if (Delta(v->x_pos, x) + Delta(v->y_pos, y) >= 8) { v->direction = GetDirectionTowards(v, x, y); GetNewVehiclePosResult gp = GetNewVehiclePos(v); @@ -585,7 +585,7 @@ FOR_ALL_VEHICLES(u) { if (u->type == VEH_TRAIN || u->type == VEH_ROAD) { - if (delta(u->x_pos, v->x_pos) + delta(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; } @@ -617,7 +617,7 @@ } else if (v->current_order.dest == 0) { int x = TileX(v->dest_tile) * TILE_SIZE; int y = TileY(v->dest_tile) * TILE_SIZE; - if (delta(x, v->x_pos) + delta(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); GetNewVehiclePosResult gp = GetNewVehiclePos(v); SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos); @@ -667,7 +667,7 @@ if (v->current_order.dest == 0) { u = GetVehicle(v->u.disaster.big_ufo_destroyer_target); - if (delta(v->x_pos, u->x_pos) > TILE_SIZE) return; + if (Delta(v->x_pos, u->x_pos) > TILE_SIZE) return; v->current_order.dest = 1; CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE);
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1290,7 +1290,7 @@ return false; /* Don't allow too big of a change if this is the sub-tile check */ - if (internal != 0 && delta(curh, height) > 1) return false; + if (internal != 0 && Delta(curh, height) > 1) return false; /* Different height, so the surrounding tiles of this tile * has to be correct too (in level, or almost in level)
--- a/src/map.cpp +++ b/src/map.cpp @@ -184,8 +184,8 @@ */ uint DistanceManhattan(TileIndex t0, TileIndex t1) { - const uint dx = delta(TileX(t0), TileX(t1)); - const uint dy = delta(TileY(t0), TileY(t1)); + const uint dx = Delta(TileX(t0), TileX(t1)); + const uint dy = Delta(TileY(t0), TileY(t1)); return dx + dy; } @@ -216,8 +216,8 @@ */ uint DistanceMax(TileIndex t0, TileIndex t1) { - const uint dx = delta(TileX(t0), TileX(t1)); - const uint dy = delta(TileY(t0), TileY(t1)); + const uint dx = Delta(TileX(t0), TileX(t1)); + const uint dy = Delta(TileY(t0), TileY(t1)); return max(dx, dy); } @@ -232,8 +232,8 @@ */ uint DistanceMaxPlusManhattan(TileIndex t0, TileIndex t1) { - const uint dx = delta(TileX(t0), TileX(t1)); - const uint dy = delta(TileY(t0), TileY(t1)); + const uint dx = Delta(TileX(t0), TileX(t1)); + const uint dy = Delta(TileY(t0), TileY(t1)); return dx > dy ? 2 * dx + dy : 2 * dy + dx; }
--- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -220,7 +220,7 @@ if (w->viewport != NULL) w->viewport->top += y - w->top; - diff = delta(w->top, y); + diff = Delta(w->top, y); w->top = y; SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
--- a/src/npf.cpp +++ b/src/npf.cpp @@ -40,8 +40,8 @@ */ static uint NPFDistanceTrack(TileIndex t0, TileIndex t1) { - const uint dx = delta(TileX(t0), TileX(t1)); - const uint dy = delta(TileY(t0), TileY(t1)); + const uint dx = Delta(TileX(t0), TileX(t1)); + const uint dy = Delta(TileY(t0), TileY(t1)); const uint straightTracks = 2 * min(dx, dy); /* The number of straight (not full length) tracks */ /* OPTIMISATION:
--- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -663,8 +663,8 @@ static uint DistanceMoo(TileIndex t0, TileIndex t1) { - const uint dx = delta(TileX(t0), TileX(t1)); - const uint dy = delta(TileY(t0), TileY(t1)); + const uint dx = Delta(TileX(t0), TileX(t1)); + const uint dy = Delta(TileY(t0), TileY(t1)); const uint straightTracks = 2 * min(dx, dy); // The number of straight (not full length) tracks /* OPTIMISATION:
--- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -164,7 +164,7 @@ continue; /* Not too much height difference */ - if (delta(GetTileZ(cur_tile), height) > 2) continue; + if (Delta(GetTileZ(cur_tile), height) > 2) continue; /* Place one tree and quit */ PlaceTree(cur_tile, r);
--- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -967,7 +967,7 @@ side = 0; } else { TileIndex start = TileVirtXY(_thd.selstart.x, _thd.selstart.y); - side = delta(delta(TileX(start), TileX(ti->tile)), delta(TileY(start), TileY(ti->tile))); + side = Delta(Delta(TileX(start), TileX(ti->tile)), Delta(TileY(start), TileY(ti->tile))); } DrawAutorailSelection(ti, _AutorailType[dir][side]); @@ -2730,8 +2730,8 @@ TileIndex t0 = TileVirtXY(sx, sy); TileIndex t1 = TileVirtXY(x, y); - uint dx = delta(TileX(t0), TileX(t1)) + 1; - uint dy = delta(TileY(t0), TileY(t1)) + 1; + uint dx = Delta(TileX(t0), TileX(t1)) + 1; + uint dy = Delta(TileY(t0), TileY(t1)) + 1; byte index = 0; uint64 params[3];