diff options
author | tron <tron@openttd.org> | 2007-01-19 11:47:48 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-01-19 11:47:48 +0000 |
commit | 81e88a2a7c6bc999a46620906bed02d6b1e02814 (patch) | |
tree | b99fe1407a3f7165356bacf607eb1e59804164a9 /src/pathfind.cpp | |
parent | 659adc7c42cbad3220519b08e80f5c7cdcfd088a (diff) | |
download | openttd-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/pathfind.cpp')
-rw-r--r-- | src/pathfind.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pathfind.cpp b/src/pathfind.cpp index 955394603..056d96155 100644 --- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -932,11 +932,11 @@ start_at: assert(tpf->nstack == 1 || tpf->nstack == 2 || tpf->nstack == 3); if (tpf->nstack != 1) { uint32 r = Random(); - if (r&1) SwapT(&tpf->stack[0].track, &tpf->stack[1].track); + if (r & 1) Swap(tpf->stack[0].track, tpf->stack[1].track); if (tpf->nstack != 2) { TrackdirByte t = tpf->stack[2].track; - if (r&2) SwapT(&tpf->stack[0].track, &t); - if (r&4) SwapT(&tpf->stack[1].track, &t); + if (r & 2) Swap(tpf->stack[0].track, t); + if (r & 4) Swap(tpf->stack[1].track, t); tpf->stack[2].first_track = tpf->stack[2].track = t; } tpf->stack[0].first_track = tpf->stack[0].track; |