summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-10 22:14:35 +0000
committertron <tron@openttd.org>2005-01-10 22:14:35 +0000
commit05a3a83b6ce2d8d993900b1741ec26c61fa7a5e8 (patch)
tree6883287048b8258867d42f07df628238162411dc
parent46d0e2f892bdb7a17deb7b5e2847db458967bf14 (diff)
downloadopenttd-05a3a83b6ce2d8d993900b1741ec26c61fa7a5e8.tar.xz
(svn r1475) Fix some more signed/unsigned comparison warnings
-rw-r--r--ai_pathfinder.c6
-rw-r--r--graph_gui.c2
-rw-r--r--map.h2
-rw-r--r--pathfind.c7
-rw-r--r--viewport.c2
5 files changed, 11 insertions, 8 deletions
diff --git a/ai_pathfinder.c b/ai_pathfinder.c
index 86e391d30..7e9efc4a7 100644
--- a/ai_pathfinder.c
+++ b/ai_pathfinder.c
@@ -189,11 +189,11 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
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 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
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;
}
}
diff --git a/graph_gui.c b/graph_gui.c
index c8d0b63e4..c9b5d1377 100644
--- a/graph_gui.c
+++ b/graph_gui.c
@@ -558,7 +558,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
// 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);
diff --git a/map.h b/map.h
index ba69cfb8a..489cb025c 100644
--- a/map.h
+++ b/map.h
@@ -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[];
diff --git a/pathfind.c b/pathfind.c
index befb45f4c..337bdcff7 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -450,7 +450,7 @@ typedef struct {
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 @@ static inline void HeapifyDown(NewTrackPathFinder *tpf)
{
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?
diff --git a/viewport.c b/viewport.c
index b7d338a75..d33ff6a3e 100644
--- a/viewport.c
+++ b/viewport.c
@@ -1186,7 +1186,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
// 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);