(svn r1475) Fix some more signed/unsigned comparison warnings

This commit is contained in:
tron 2005-01-10 22:14:35 +00:00
parent 46d0e2f892
commit 05a3a83b6c
5 changed files with 11 additions and 8 deletions

View File

@ -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;
}
}

View File

@ -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);

2
map.h
View File

@ -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[];

View File

@ -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?

View File

@ -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);