summaryrefslogtreecommitdiff
path: root/src/ai/default
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-01-19 11:47:48 +0000
committertron <tron@openttd.org>2007-01-19 11:47:48 +0000
commit81e88a2a7c6bc999a46620906bed02d6b1e02814 (patch)
treeb99fe1407a3f7165356bacf607eb1e59804164a9 /src/ai/default
parent659adc7c42cbad3220519b08e80f5c7cdcfd088a (diff)
downloadopenttd-81e88a2a7c6bc999a46620906bed02d6b1e02814.tar.xz
(svn r8276) -Fix
Change the signature of Swap() to be less error prone, i.e. pass the variables to be swapped by reference instead of passing pointers to the variables. Just do Swap(x, y) instead of Swap(&x, &y). This prevents accidents when the variables are pointers.
Diffstat (limited to 'src/ai/default')
-rw-r--r--src/ai/default/default.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 09e2f68a4..63a3ff556 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
- 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);
+ Swap(p->ai.start_tile_a, p->ai.start_tile_b);
+ Swap(p->ai.cur_tile_a, p->ai.cur_tile_b);
+ Swap(p->ai.start_dir_a, p->ai.start_dir_b);
+ Swap(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
- 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);
+ Swap(p->ai.start_tile_a, p->ai.start_tile_b);
+ Swap(p->ai.cur_tile_a, p->ai.cur_tile_b);
+ Swap(p->ai.start_dir_a, p->ai.start_dir_b);
+ Swap(p->ai.cur_dir_a, p->ai.cur_dir_b);
return;
}