Changeset - r7970:d9b5a6d3e872
[Not reviewed]
master
0 9 0
skidd13 - 17 years ago 2007-11-26 16:01:29
skidd13@openttd.org
(svn r11526) -Codechange: Rename the function delta fitting to the naming style
9 files changed with 23 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/core/math_func.hpp
Show inline comments
 
@@ -175,7 +175,7 @@ static inline int32 ClampToI32(const int
 
 * @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;
 
}
 

	
src/disaster_cmd.cpp
Show inline comments
 
@@ -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
 
	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
 

	
 
		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
 
	} 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_Destroy
 

	
 
	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);
src/industry_cmd.cpp
Show inline comments
 
@@ -1290,7 +1290,7 @@ static bool CheckCanTerraformSurrounding
 
			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)
src/map.cpp
Show inline comments
 
@@ -184,8 +184,8 @@ extern const TileIndexDiffC _tileoffs_by
 
 */
 
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, TileIn
 
 */
 
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
 
 */
 
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;
 
}
 

	
src/news_gui.cpp
Show inline comments
 
@@ -220,7 +220,7 @@ static void NewsWindowProc(Window *w, Wi
 
		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);
src/npf.cpp
Show inline comments
 
@@ -40,8 +40,8 @@ static const uint _trackdir_length[TRACK
 
 */
 
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:
src/pathfind.cpp
Show inline comments
 
@@ -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:
src/tree_cmd.cpp
Show inline comments
 
@@ -164,7 +164,7 @@ void PlaceTreeAtSameHeight(TileIndex til
 
			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);
src/viewport.cpp
Show inline comments
 
@@ -967,7 +967,7 @@ static void DrawTileSelection(const Tile
 
				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];
 

	
0 comments (0 inline, 0 general)