(svn r1451) Fix some of the signed/unsigned comparison warnings
authortron
Sun, 09 Jan 2005 21:25:44 +0000
changeset 959 b031d88c76f3
parent 958 f5ccffdadd48
child 960 5dad48857cd2
(svn r1451) Fix some of the signed/unsigned comparison warnings
ai.c
ai_pathfinder.c
aystar.c
command.c
command.h
console.c
landscape.c
misc.c
misc_gui.c
namegen.c
network.c
network_client.c
network_server.c
oldloader.c
road_cmd.c
settings_gui.c
tree_cmd.c
ttd.c
tunnelbridge_cmd.c
window.c
--- a/ai.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/ai.c	Sun Jan 09 21:25:44 2005 +0000
@@ -425,7 +425,7 @@
 
 static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
 {
-	int i;
+	uint i;
 	byte cargo;
 	Subsidy *s;
 	Industry *from, *to_ind;
--- a/ai_pathfinder.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/ai_pathfinder.c	Sun Jan 09 21:25:44 2005 +0000
@@ -148,7 +148,7 @@
 // We found the end.. let's get the route back and put it in an array
 static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *current) {
 	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
-	int i = 0;
+	uint i = 0;
 	PathNode *parent = &current->path;
 
 	do {
@@ -168,7 +168,10 @@
 
 // What tiles are around us.
 static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current) {
-    int i, r, dir;
+		uint i;
+		int r;
+		int dir;
+
    	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
 
     aystar->num_neighbours = 0;
--- a/aystar.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/aystar.c	Sun Jan 09 21:25:44 2005 +0000
@@ -101,7 +101,7 @@
 
 	// Check if this item is already in the OpenList
 	if ((check = AyStarMain_OpenList_IsInList(aystar, current)) != NULL) {
-		int i;
+		uint i;
 		// Yes, check if this g value is lower..
 		if (new_g > check->g) return AYSTAR_DONE;
 		aystar->OpenListQueue.del(&aystar->OpenListQueue, check, 0);
--- a/command.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/command.c	Sun Jan 09 21:25:44 2005 +0000
@@ -313,11 +313,11 @@
 };
 
 /* This function range-checks a cmd, and checks if the cmd is not NULL */
-bool IsValidCommand(int cmd)
+bool IsValidCommand(uint cmd)
 {
 	cmd = cmd & 0xFF;
 
-	if (cmd < 0 || cmd >= lengthof(_command_proc_table) || _command_proc_table[cmd] == NULL)
+	if (cmd >= lengthof(_command_proc_table) || _command_proc_table[cmd] == NULL)
 		return false;
 
 	return true;
--- a/command.h	Sun Jan 09 20:45:07 2005 +0000
+++ b/command.h	Sun Jan 09 21:25:44 2005 +0000
@@ -182,7 +182,7 @@
 int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
 
-bool IsValidCommand(int cmd);
+bool IsValidCommand(uint cmd);
 int32 GetAvailableMoneyForCommand();
 
 #endif /* COMMAND_H */
--- a/console.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/console.c	Sun Jan 09 21:25:44 2005 +0000
@@ -1058,9 +1058,9 @@
 	bool valid_token;
 	bool skip_lt_change;
 
-	int c;
-	int i;
-	int l;
+	uint c;
+	uint i;
+	uint l;
 
 	if (_stdlib_con_developer)
 		IConsolePrintF(_iconsole_color_debug, "CONDEBUG: execution_cmdline: %s", cmdstr);
--- a/landscape.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/landscape.c	Sun Jan 09 21:25:44 2005 +0000
@@ -486,7 +486,7 @@
 void InitializeLandscape()
 {
 	uint map_size = MapSize();
-	int i;
+	uint i;
 
 	memset(_map_owner, OWNER_NONE, map_size);
 	memset(_map2, 0, map_size * sizeof(uint16));
--- a/misc.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/misc.c	Sun Jan 09 21:25:44 2005 +0000
@@ -184,7 +184,7 @@
 void InitializeGame()
 {
 	// Initialize the autoreplace array. Needs to be cleared between each game
-	int i;
+	uint i;
 	for (i = 0; i < lengthof(_autoreplace_array); i++)
 		_autoreplace_array[i] = i;
 
@@ -608,7 +608,9 @@
 void IncreaseDate()
 {
 	const int vehicles_per_day = (1 << (sizeof(_date_fract) * 8)) / 885;
-	int i,ctr,t;
+	uint i;
+	VehicleID ctr;
+	int t;
 	YearMonthDay ymd;
 
 	if (_game_mode == GM_MENU) {
--- a/misc_gui.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/misc_gui.c	Sun Jan 09 21:25:44 2005 +0000
@@ -213,7 +213,7 @@
 	case WE_PAINT: {
 		const char *str;
 		char buffer[100];
-		int i;
+		uint i;
 		int y = WP(w, general_d).j;
 		DrawWindowWidgets(w);
 
--- a/namegen.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/namegen.c	Sun Jan 09 21:25:44 2005 +0000
@@ -306,7 +306,8 @@
 
 static byte MakePolishTownName(byte *buf, uint32 seed)
 {
-	int i, j;
+	uint i;
+	uint j;
 
 	//null terminates the string for strcat
 	strcpy(buf, "");
@@ -402,7 +403,7 @@
 
 static byte MakeHungarianTownName(byte *buf, uint32 seed)
 {
-	int i;
+	uint i;
 
 	//null terminates the string for strcat
 	strcpy(buf, "");
--- a/network.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/network.c	Sun Jan 09 21:25:44 2005 +0000
@@ -620,7 +620,7 @@
 #else
 	LONG sin_len; // for some reason we need a 'LONG' under MorphOS
 #endif
-	int i;
+	uint i;
 	bool banned;
 
 	// Should never ever happen.. is it possible??
@@ -878,7 +878,7 @@
  * by the function that generates the config file. */
 void NetworkRebuildHostList()
 {
-	int i = 0;
+	uint i = 0;
 	NetworkGameList *item = _network_game_list;
 	while (item != NULL && i != lengthof(_network_host_list)) {
 		if (item->manually)
--- a/network_client.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/network_client.c	Sun Jan 09 21:25:44 2005 +0000
@@ -144,7 +144,7 @@
 	//    uint8:  CallBackID (see callback_table.c)
 	//
 
-	int i;
+	uint i;
 	char *dparam_char;
 	Packet *p = NetworkSend_Init(PACKET_CLIENT_COMMAND);
 
@@ -572,7 +572,7 @@
 
 DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMMAND)
 {
-	int i;
+	uint i;
 	char *dparam_char;
 	CommandPacket *cp = malloc(sizeof(CommandPacket));
 	cp->player = NetworkRecv_uint8(MY_CLIENT, p);
--- a/network_server.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/network_server.c	Sun Jan 09 21:25:44 2005 +0000
@@ -451,7 +451,7 @@
 	//    uint32: Frame of execution
 	//
 
-	int i;
+	uint i;
 	char *dparam_char;
 	Packet *p = NetworkSend_Init(PACKET_SERVER_COMMAND);
 
@@ -749,7 +749,7 @@
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
 {
 	// The client has done a command and wants us to handle it
-	int i;
+	uint i;
 	byte callback;
 	NetworkClientState *new_cs;
 	NetworkClientInfo *ci;
--- a/oldloader.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/oldloader.c	Sun Jan 09 21:25:44 2005 +0000
@@ -1377,7 +1377,7 @@
 	LoadSavegameState lss;
 	OldMain *m;
 	uint map_size;
-	int i;
+	uint i;
 
 	_cur_state = &lss;
 	memset(&lss, 0, sizeof(lss));
--- a/road_cmd.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/road_cmd.c	Sun Jan 09 21:25:44 2005 +0000
@@ -399,7 +399,7 @@
 				goto do_clear;
 
 		/* only allow roads pertendicular to bridge */
-		if ((pieces & 5) == (ti.map5 & 0x01))
+		if ((pieces & 5U) == (ti.map5 & 0x01U))
 				goto do_clear;
 
 		/* check if clear land under bridge */
--- a/settings_gui.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/settings_gui.c	Sun Jan 09 21:25:44 2005 +0000
@@ -1006,7 +1006,7 @@
 	const PatchPage *page;
 	const PatchEntry *pe = NULL;
 	bool found = false;
-	int i;
+	uint i;
 	unsigned int j;
 	int val;
 
@@ -1066,7 +1066,7 @@
 	const PatchEntry *pe = NULL;
 	char value[50];
 	bool found = false;
-	int i;
+	uint i;
 	unsigned int j;
 
 	/* Search for the name in the patch-settings */
--- a/tree_cmd.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/tree_cmd.c	Sun Jan 09 21:25:44 2005 +0000
@@ -271,7 +271,7 @@
 
 	{
 		uint16 tmp = ti->x;
-		int index;
+		uint index;
 
 		tmp = (tmp >> 2) | (tmp << 14);
 		tmp -= ti->y;
--- a/ttd.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/ttd.c	Sun Jan 09 21:25:44 2005 +0000
@@ -267,7 +267,7 @@
 		ttd_strlcpy(buffer, name, sizeof(buffer));
 		parm = strchr(buffer, ':');
 		if (parm) {
-			int np = 0;
+			uint np = 0;
 			// Tokenize the parm.
 			do {
 				*parm++ = 0;
@@ -1243,7 +1243,7 @@
 // even though they should have. This is fixed by this function
 void UpdateVoidTiles()
 {
-	int i;
+	uint i;
 	// create void tiles on the border
 	for (i = 0; i != MapMaxY(); i++)
 		_map_type_and_height[ i * MapSizeX() + MapMaxY() ] = MP_VOID << 4;
--- a/tunnelbridge_cmd.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/tunnelbridge_cmd.c	Sun Jan 09 21:25:44 2005 +0000
@@ -1311,14 +1311,14 @@
 
 	if ((m5 & 0xF0) == 0) {
 		/* This is a tunnel */
-		if (((m5 & 0xC) >> 2) == mode) {
+		if (((m5 & 0xCU) >> 2) == mode) {
 			/* Tranport in the tunnel is compatible */
 			return m5&1 ? 0x202 : 0x101;
 		}
 	} else if (m5 & 0x80) {
 		/* This is a bridge */
 		result = 0;
-		if (((m5 & 0x6) >> 1) == mode) {
+		if (((m5 & 0x6U) >> 1) == mode) {
 			/* Transport over the bridge is compatible */
 			result = m5&1 ? 0x202 : 0x101;
 		}
@@ -1334,7 +1334,7 @@
 						return result;
 			} else {
 				/* Transport underneath */
-				if ((m5 & 0x18) >> 3 != mode)
+				if ((m5 & 0x18U) >> 3 != mode)
 					/* Incompatible transport underneath */
 					return result;
 			}
--- a/window.c	Sun Jan 09 20:45:07 2005 +0000
+++ b/window.c	Sun Jan 09 21:25:44 2005 +0000
@@ -407,7 +407,7 @@
 	w->resize.step_height = 1;
 
 	{
-		int i;
+		uint i;
 		for (i=0;i<lengthof(w->custom);i++)
 			w->custom[i] = 0;
 	}