summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-01-11 12:32:10 +0000
committercelestar <celestar@openttd.org>2007-01-11 12:32:10 +0000
commit1691b2da618e2701adee128eb5fc4168bff69f59 (patch)
tree5641df6933c5082202a0fd343b0195526ff1345c /src
parent2ac0410767683fb0e6315433f9805712cb85f5bd (diff)
downloadopenttd-1691b2da618e2701adee128eb5fc4168bff69f59.tar.xz
(svn r8056) -Codechange: Remove swap_byte, swap_byte, and siblings (some were not used anyway) and replace them by our SwapT implementation
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp16
-rw-r--r--src/macros.h7
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/train_cmd.cpp8
-rw-r--r--src/viewport.cpp4
5 files changed, 15 insertions, 22 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 5a328e9d0..fff5cef8a 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -2291,10 +2291,10 @@ static void AiStateBuildRail(Player *p)
AiBuildRail(p);
// Alternate between edges
- swap_tile(&p->ai.start_tile_a, &p->ai.start_tile_b);
- swap_tile(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
- swap_byte(&p->ai.start_dir_a, &p->ai.start_dir_b);
- swap_byte(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
+ SwapT(&p->ai.start_tile_a, &p->ai.start_tile_b);
+ SwapT(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
+ SwapT(&p->ai.start_dir_a, &p->ai.start_dir_b);
+ SwapT(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
return;
}
@@ -3112,10 +3112,10 @@ static void AiStateBuildRoad(Player *p)
AiBuildRoad(p);
// Alternate between edges
- swap_tile(&p->ai.start_tile_a, &p->ai.start_tile_b);
- swap_tile(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
- swap_byte(&p->ai.start_dir_a, &p->ai.start_dir_b);
- swap_byte(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
+ SwapT(&p->ai.start_tile_a, &p->ai.start_tile_b);
+ SwapT(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
+ SwapT(&p->ai.start_dir_a, &p->ai.start_dir_b);
+ SwapT(&p->ai.cur_dir_a, &p->ai.cur_dir_b);
return;
}
diff --git a/src/macros.h b/src/macros.h
index 07011f14c..63d59eb72 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -140,13 +140,6 @@ static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
static inline int uintxchg_(uint *a, uint b) { uint t = *a; *a = b; return t; }
#define uintswap(a,b) ((b) = uintxchg_(&(a), (b)))
-static inline void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; }
-static inline void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }
-static inline void swap_int16(int16 *a, int16 *b) { int16 t = *a; *a = *b; *b = t; }
-static inline void swap_uint32(uint32 *a, uint32 *b) { uint32 t = *a; *a = *b; *b = t; }
-static inline void swap_int32(int32 *a, int32 *b) { int32 t = *a; *a = *b; *b = t; }
-static inline void swap_tile(TileIndex *a, TileIndex *b) { TileIndex t = *a; *a = *b; *b = t; }
-
static inline uint16 ReadLE16Aligned(const void* x)
{
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index b920ffc9a..352486444 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -310,7 +310,7 @@ static void FixOldStations(void)
FOR_ALL_STATIONS(st) {
/* Check if we need to swap width and height for the station */
if (st->train_tile != 0 && GetRailStationAxis(st->train_tile) != AXIS_X) {
- swap_byte(&st->trainst_w, &st->trainst_h);
+ SwapT(&st->trainst_w, &st->trainst_h);
}
/* Check if there is a bus or truck station, and convert to new format */
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index c551d1872..98c2dac06 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1603,10 +1603,10 @@ static void ReverseTrainSwapVeh(Vehicle *v, int l, int r)
if (!(b->u.rail.track & 0x80)) b->direction = ReverseDir(b->direction);
/* swap more variables */
- swap_int32(&a->x_pos, &b->x_pos);
- swap_int32(&a->y_pos, &b->y_pos);
- swap_tile(&a->tile, &b->tile);
- swap_byte(&a->z_pos, &b->z_pos);
+ SwapT(&a->x_pos, &b->x_pos);
+ SwapT(&a->y_pos, &b->y_pos);
+ SwapT(&a->tile, &b->tile);
+ SwapT(&a->z_pos, &b->z_pos);
SwapTrainFlags(&a->u.rail.flags, &b->u.rail.flags);
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 85d4493b1..60c0b5b4a 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2043,7 +2043,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
uint h0, h1, ht; // start heigth, end height, and temp variable
if (start_tile == end_tile) return 0;
- if (swap) swap_tile(&start_tile, &end_tile);
+ if (swap) SwapT(&start_tile, &end_tile);
switch (style & HT_DRAG_MASK) {
case HT_RECT: {
@@ -2103,7 +2103,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
} break;
}
- if (swap) swap_uint32(&h0, &h1);
+ if (swap) SwapT(&h0, &h1);
/* Minimap shows height in intervals of 50 meters, let's do the same */
return (int)(h1 - h0) * 50;
}