summaryrefslogtreecommitdiff
path: root/pathfind.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-13 21:15:00 +0000
committertron <tron@openttd.org>2006-02-13 21:15:00 +0000
commitea73b466844a048f9f55b933f243ec19bdaaa18c (patch)
tree19340b96ef341c9784a27b719a1a90c2c691ca56 /pathfind.c
parent235e72829e55cbb1e7632fe1b2d1429f6f3be054 (diff)
downloadopenttd-ea73b466844a048f9f55b933f243ec19bdaaa18c.tar.xz
(svn r3597) Miscellaneous (I like that word) changes: Fix some indentation, add consts, reduce indentation level by short-circuit logic, convert if cascades to switch, whitespace, bracing, plus some minor stuff
Diffstat (limited to 'pathfind.c')
-rw-r--r--pathfind.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pathfind.c b/pathfind.c
index 8107fc5ed..10961c5ec 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -558,12 +558,12 @@ static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
uint offs = tpf->hash_tile[hash];
do {
link = NTP_GET_LINK_PTR(tpf, offs);
- if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
- if (length >= (uint)(link->typelength >> 2)) return false;
+ if (tile == link->tile && (link->typelength & 0x3U) == dir) {
+ if (length >= link->typelength >> 2) return false;
link->typelength = dir | (length << 2);
return true;
}
- } while ((offs=link->next) != 0xFFFF);
+ } while ((offs = link->next) != 0xFFFF);
}
/* get here if we need to add a new link to link,
@@ -611,9 +611,9 @@ static bool NtpCheck(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
offs = tpf->hash_tile[hash];
for (;;) {
link = NTP_GET_LINK_PTR(tpf, offs);
- if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
- assert( (uint)(link->typelength >> 2) <= length);
- return length == (uint)(link->typelength >> 2);
+ if (tile == link->tile && (link->typelength & 0x3U) == dir) {
+ assert(link->typelength >> 2 <= length);
+ return length == link->typelength >> 2;
}
offs = link->next;
assert(offs != 0xffff);