--- a/ai_pathfinder.c Mon Jan 10 21:56:02 2005 +0000
+++ b/ai_pathfinder.c Mon Jan 10 22:14:35 2005 +0000
@@ -189,11 +189,11 @@
if (!PathFinderInfo->rail_or_road && AI_PATHFINDER_IS_ROAD(current->path.node.tile + TileOffsByDir(i))) {
if (IS_TILETYPE(current->path.node.tile + TileOffsByDir(i), MP_TUNNELBRIDGE)) {
// An existing bridge... let's test the direction ;)
- if ((_map5[current->path.node.tile + TileOffsByDir(i)] & 1) != (i & 1)) continue;
+ if ((_map5[current->path.node.tile + TileOffsByDir(i)] & 1U) != (i & 1)) continue;
// This problem only is valid for tunnels:
// When the last tile was not yet a tunnel, check if we enter from the right side..
if (!IS_TILETYPE(current->path.node.tile, MP_TUNNELBRIDGE) && (_map5[current->path.node.tile + TileOffsByDir(i)] & 0x80) == 0) {
- if (i != (_map5[current->path.node.tile + TileOffsByDir(i)] & 3)) continue;
+ if (i != (_map5[current->path.node.tile + TileOffsByDir(i)] & 3U)) continue;
}
}
}
@@ -201,7 +201,7 @@
if (!PathFinderInfo->rail_or_road && AI_PATHFINDER_IS_ROAD(current->path.node.tile)) {
if (IS_TILETYPE(current->path.node.tile, MP_TUNNELBRIDGE)) {
// An existing bridge/tunnel... let's test the direction ;)
- if ((_map5[current->path.node.tile] & 1) != (i & 1)) continue;
+ if ((_map5[current->path.node.tile] & 1U) != (i & 1)) continue;
}
}
--- a/graph_gui.c Mon Jan 10 21:56:02 2005 +0000
+++ b/graph_gui.c Mon Jan 10 22:14:35 2005 +0000
@@ -558,7 +558,7 @@
// Bah, player gone :(
w->disabled_state += 1 << (i+13);
// Is this player selected? If so, select first player (always save? :s)
- if (w->click_state == 1 << (i+13))
+ if (w->click_state == 1U << (i + 13))
w->click_state = 1 << 13;
// We need a repaint
SetWindowDirty(w);
--- a/map.h Mon Jan 10 21:56:02 2005 +0000
+++ b/map.h Mon Jan 10 22:14:35 2005 +0000
@@ -4,7 +4,7 @@
#define TILE_FROM_XY(x,y) (int)((((y) >> 4) << MapLogX()) + ((x) >> 4))
#define TILE_XY(x,y) (int)(((y) << MapLogX()) + (x))
-#define TILE_MASK(x) (int)((x) & ((1 << (MapLogX() + MapLogY())) - 1))
+#define TILE_MASK(x) ((x) & ((1 << (MapLogX() + MapLogY())) - 1))
extern byte _map_type_and_height[];
extern byte _map5[];
--- a/pathfind.c Mon Jan 10 21:56:02 2005 +0000
+++ b/pathfind.c Mon Jan 10 22:14:35 2005 +0000
@@ -450,7 +450,7 @@
HashLink *new_link;
uint num_links_left;
- int nstack;
+ uint nstack;
StackedItem stack[256]; // priority queue of stacked items
uint16 hash_head[0x400]; // hash heads. 0 means unused. 0xFFC0 = length, 0x3F = type
@@ -484,7 +484,10 @@
{
StackedItem si;
int i = 1, j;
- int n = --tpf->nstack;
+ int n;
+
+ assert(tpf->nstack > 0);
+ n = --tpf->nstack;
if (n == 0) return; // heap is empty so nothing to do?
--- a/viewport.c Mon Jan 10 21:56:02 2005 +0000
+++ b/viewport.c Mon Jan 10 22:14:35 2005 +0000
@@ -1186,7 +1186,7 @@
// This assert should never happen (because the length of the parent_list
// is checked)
- assert(vd.parent_list - parent_list <= lengthof(parent_list));
+ assert(vd.parent_list <= endof(parent_list));
if (vd.first_tile != NULL)
ViewportDrawTileSprites(vd.first_tile);