mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r1451) Fix some of the signed/unsigned comparison warnings
This commit is contained in:
parent
c6c86abeee
commit
49584082a0
2
ai.c
2
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;
|
||||
|
|
|
@ -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 = ¤t->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;
|
||||
|
|
2
aystar.c
2
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
6
misc.c
6
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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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, "");
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
4
ttd.c
4
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue