summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-09 21:25:44 +0000
committertron <tron@openttd.org>2005-01-09 21:25:44 +0000
commit49584082a08db84344a54ae7e0a7927915261edf (patch)
tree3a16c9375ca0fbd2f06a419b1b0876bf48c7a3e0
parentc6c86abeeec71db7ae8ef484af6f6e2373528a71 (diff)
downloadopenttd-49584082a08db84344a54ae7e0a7927915261edf.tar.xz
(svn r1451) Fix some of the signed/unsigned comparison warnings
-rw-r--r--ai.c2
-rw-r--r--ai_pathfinder.c7
-rw-r--r--aystar.c2
-rw-r--r--command.c4
-rw-r--r--command.h2
-rw-r--r--console.c6
-rw-r--r--landscape.c2
-rw-r--r--misc.c6
-rw-r--r--misc_gui.c2
-rw-r--r--namegen.c5
-rw-r--r--network.c4
-rw-r--r--network_client.c4
-rw-r--r--network_server.c4
-rw-r--r--oldloader.c2
-rw-r--r--road_cmd.c2
-rw-r--r--settings_gui.c4
-rw-r--r--tree_cmd.c2
-rw-r--r--ttd.c4
-rw-r--r--tunnelbridge_cmd.c6
-rw-r--r--window.c2
20 files changed, 39 insertions, 33 deletions
diff --git a/ai.c b/ai.c
index ac9172af0..0bd26e46f 100644
--- a/ai.c
+++ b/ai.c
@@ -425,7 +425,7 @@ static Industry *AiFindRandomIndustry() {
static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
{
- int i;
+ uint i;
byte cargo;
Subsidy *s;
Industry *from, *to_ind;
diff --git a/ai_pathfinder.c b/ai_pathfinder.c
index d1bccb17d..86e391d30 100644
--- a/ai_pathfinder.c
+++ b/ai_pathfinder.c
@@ -148,7 +148,7 @@ static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current,
// 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 @@ static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *curre
// 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;
diff --git a/aystar.c b/aystar.c
index 92e79fee3..704922030 100644
--- a/aystar.c
+++ b/aystar.c
@@ -101,7 +101,7 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
// 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);
diff --git a/command.c b/command.c
index eff7af906..010c461f6 100644
--- a/command.c
+++ b/command.c
@@ -313,11 +313,11 @@ static CommandProc * const _command_proc_table[] = {
};
/* 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;
diff --git a/command.h b/command.h
index c6c80756a..d967d3486 100644
--- a/command.h
+++ b/command.h
@@ -182,7 +182,7 @@ enum {
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 */
diff --git a/console.c b/console.c
index 57f88dd6c..1a4671593 100644
--- a/console.c
+++ b/console.c
@@ -1058,9 +1058,9 @@ void IConsoleCmdExec(const char* cmdstr)
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);
diff --git a/landscape.c b/landscape.c
index fc085deaf..5c762effb 100644
--- a/landscape.c
+++ b/landscape.c
@@ -486,7 +486,7 @@ void RunTileLoop()
void InitializeLandscape()
{
uint map_size = MapSize();
- int i;
+ uint i;
memset(_map_owner, OWNER_NONE, map_size);
memset(_map2, 0, map_size * sizeof(uint16));
diff --git a/misc.c b/misc.c
index f439bad8b..8e779bcb2 100644
--- a/misc.c
+++ b/misc.c
@@ -184,7 +184,7 @@ void ConvertGroundTilesIntoWaterTiles();
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 @@ static const uint16 _autosave_months[] = {
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) {
diff --git a/misc_gui.c b/misc_gui.c
index 919a6675c..ff0197c59 100644
--- a/misc_gui.c
+++ b/misc_gui.c
@@ -213,7 +213,7 @@ static void AboutWindowProc(Window *w, WindowEvent *e)
case WE_PAINT: {
const char *str;
char buffer[100];
- int i;
+ uint i;
int y = WP(w, general_d).j;
DrawWindowWidgets(w);
diff --git a/namegen.c b/namegen.c
index 401c82c5a..5a3df3d71 100644
--- a/namegen.c
+++ b/namegen.c
@@ -306,7 +306,8 @@ static byte MakeFinnishTownName(byte *buf, uint32 seed)
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 MakeNorwegianTownName(byte *buf, uint32 seed)
static byte MakeHungarianTownName(byte *buf, uint32 seed)
{
- int i;
+ uint i;
//null terminates the string for strcat
strcpy(buf, "");
diff --git a/network.c b/network.c
index 26fd3b1ce..dc26e4063 100644
--- a/network.c
+++ b/network.c
@@ -620,7 +620,7 @@ static void NetworkAcceptClients(void)
#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 @@ void NetworkAddServer(const byte *b)
* 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)
diff --git a/network_client.c b/network_client.c
index a7b917b9c..5b4c0f1e4 100644
--- a/network_client.c
+++ b/network_client.c
@@ -144,7 +144,7 @@ DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLIENT_COMMAND)(CommandPacket *cp)
// 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_SYNC)
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);
diff --git a/network_server.c b/network_server.c
index edd2aab6b..b7bc8b3ed 100644
--- a/network_server.c
+++ b/network_server.c
@@ -451,7 +451,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_COMMAND)(NetworkClientState *cs, Com
// 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_MAP_OK)
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;
diff --git a/oldloader.c b/oldloader.c
index c454dc97c..296271968 100644
--- a/oldloader.c
+++ b/oldloader.c
@@ -1377,7 +1377,7 @@ bool LoadOldSaveGame(const char *file)
LoadSavegameState lss;
OldMain *m;
uint map_size;
- int i;
+ uint i;
_cur_state = &lss;
memset(&lss, 0, sizeof(lss));
diff --git a/road_cmd.c b/road_cmd.c
index c7ea7d08e..2c6c56d4b 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -399,7 +399,7 @@ int32 CmdBuildRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
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 */
diff --git a/settings_gui.c b/settings_gui.c
index b607d2960..120dfc363 100644
--- a/settings_gui.c
+++ b/settings_gui.c
@@ -1006,7 +1006,7 @@ void ConsoleSetPatchSetting(char *name, char *value)
const PatchPage *page;
const PatchEntry *pe = NULL;
bool found = false;
- int i;
+ uint i;
unsigned int j;
int val;
@@ -1066,7 +1066,7 @@ void ConsoleGetPatchSetting(char *name)
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 */
diff --git a/tree_cmd.c b/tree_cmd.c
index 52854c9c6..d3a88aa07 100644
--- a/tree_cmd.c
+++ b/tree_cmd.c
@@ -271,7 +271,7 @@ static void DrawTile_Trees(TileInfo *ti)
{
uint16 tmp = ti->x;
- int index;
+ uint index;
tmp = (tmp >> 2) | (tmp << 14);
tmp -= ti->y;
diff --git a/ttd.c b/ttd.c
index 266ca8571..ce245d8d0 100644
--- a/ttd.c
+++ b/ttd.c
@@ -267,7 +267,7 @@ void LoadDriver(int driver, const char *name)
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 @@ void UpdateCurrencies()
// 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;
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 06d398ffa..135f7fd47 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1311,14 +1311,14 @@ static uint32 GetTileTrackStatus_TunnelBridge(uint tile, TransportType mode)
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 @@ static uint32 GetTileTrackStatus_TunnelBridge(uint tile, TransportType mode)
return result;
} else {
/* Transport underneath */
- if ((m5 & 0x18) >> 3 != mode)
+ if ((m5 & 0x18U) >> 3 != mode)
/* Incompatible transport underneath */
return result;
}
diff --git a/window.c b/window.c
index 10bc0de86..08604eb7e 100644
--- a/window.c
+++ b/window.c
@@ -407,7 +407,7 @@ Window *AllocateWindow(
w->resize.step_height = 1;
{
- int i;
+ uint i;
for (i=0;i<lengthof(w->custom);i++)
w->custom[i] = 0;
}