summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/math_func.hpp2
-rw-r--r--src/disaster_cmd.cpp12
-rw-r--r--src/industry_cmd.cpp2
-rw-r--r--src/map.cpp12
-rw-r--r--src/news_gui.cpp2
-rw-r--r--src/npf.cpp4
-rw-r--r--src/pathfind.cpp4
-rw-r--r--src/tree_cmd.cpp2
-rw-r--r--src/viewport.cpp6
9 files changed, 23 insertions, 23 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index a7f07d614..82a4799ac 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -175,7 +175,7 @@ static inline int32 ClampToI32(const int64 a)
* @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;
}
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index aa04e900a..79b8d6e2c 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -311,7 +311,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 (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 @@ static void DisasterTick_Ufo(Vehicle *v)
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 @@ static void DisasterTick_Big_Ufo(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 (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 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
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 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
} 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 @@ static void DisasterTick_Big_Ufo_Destroyer(Vehicle *v)
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);
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 8f3edba49..1aa369c5e 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -1290,7 +1290,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
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)
diff --git a/src/map.cpp b/src/map.cpp
index 7035f955c..4136740c0 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -184,8 +184,8 @@ extern const TileIndexDiffC _tileoffs_by_dir[] = {
*/
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 DistanceSquare(TileIndex t0, TileIndex t1)
*/
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 DistanceMax(TileIndex t0, TileIndex t1)
*/
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;
}
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index f26cc11a8..728b561db 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -220,7 +220,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
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);
diff --git a/src/npf.cpp b/src/npf.cpp
index af42bcb9e..8fdc97fe8 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -40,8 +40,8 @@ static const uint _trackdir_length[TRACKDIR_END] = {
*/
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:
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 4541e9a9a..d2cf00f13 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -663,8 +663,8 @@ static const uint16 _is_upwards_slope[15] = {
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:
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index ac12a18b5..97fbb36b0 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -164,7 +164,7 @@ void PlaceTreeAtSameHeight(TileIndex tile, uint height)
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);
diff --git a/src/viewport.cpp b/src/viewport.cpp
index bd0f7a038..136f1b8cc 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -967,7 +967,7 @@ static void DrawTileSelection(const TileInfo *ti)
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 @@ calc_heightdiff_single_direction:;
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];