# HG changeset patch # User Darkvater # Date 1121623877 0 # Node ID 607a900aefa3edddcca501c0e16729163a1a111e # Parent e0cbbec2e6e917efdfd09330a1128d7e74a566a0 (svn r2617) - Fix: fix some warnings, and reenable vs.net2003 signed/unsigned warnings diff -r e0cbbec2e6e9 -r 607a900aefa3 gfx.c --- a/gfx.c Sun Jul 17 18:09:23 2005 +0000 +++ b/gfx.c Sun Jul 17 18:11:17 2005 +0000 @@ -261,9 +261,9 @@ * @param *dest string that is checked and possibly truncated * @param maxw maximum width in pixels of the string * @return new width of (truncated) string */ -static int TruncateString(char *str, uint maxw) +static uint TruncateString(char *str, uint maxw) { - int w = 0; + uint w = 0; int base = _stringwidth_base; int ddd, ddd_w; @@ -305,7 +305,7 @@ return w; } -static inline int TruncateStringID(StringID src, char *dest, uint maxw) +static inline uint TruncateStringID(StringID src, char *dest, uint maxw) { GetString(dest, src); return TruncateString(dest, maxw); @@ -361,7 +361,7 @@ int DrawStringCenteredTruncated(int x, int y, StringID str, uint16 color, uint maxw) { char buffer[512]; - int w = TruncateStringID(str, buffer, maxw); + uint w = TruncateStringID(str, buffer, maxw); return DoDrawString(buffer, x - (w / 2), y, color); } diff -r e0cbbec2e6e9 -r 607a900aefa3 players.c --- a/players.c Sun Jul 17 18:09:23 2005 +0000 +++ b/players.c Sun Jul 17 18:11:17 2005 +0000 @@ -522,7 +522,7 @@ // when there's a lot of computers in game, the probability that a new one starts is lower if (n < (uint)_opt.diff.max_no_competitors) - if (n < (!_network_server) ? RandomRange(_opt.diff.max_no_competitors + 2) : InteractiveRandomRange(_opt.diff.max_no_competitors + 2)) + if (n < (!_network_server ? RandomRange(_opt.diff.max_no_competitors + 2) : InteractiveRandomRange(_opt.diff.max_no_competitors + 2)) ) DoStartupNewPlayer(true); // The next AI starts like the difficulty setting said, with +2 month max diff -r e0cbbec2e6e9 -r 607a900aefa3 roadveh_cmd.c --- a/roadveh_cmd.c Sun Jul 17 18:09:23 2005 +0000 +++ b/roadveh_cmd.c Sun Jul 17 18:11:17 2005 +0000 @@ -1154,6 +1154,7 @@ return best_track; } +#if 0 static uint RoadFindPathToStation(const Vehicle *v, TileIndex tile) { NPFFindStationOrTileData fstd; @@ -1165,6 +1166,7 @@ return NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE, PBS_MODE_NONE).best_path_dist; } +#endif typedef struct RoadDriveEntry { byte x,y; @@ -1664,19 +1666,19 @@ // In that case, add penalty. switch(v->direction) { case 1: // going north east,x position decreasing - if (v->x_pos <= TileX(rs->xy) * 16 + 15) + if (v->x_pos <= (int32)TileX(rs->xy) * 16 + 15) dist += 6; break; case 3: // Going south east, y position increasing - if (v->y_pos >= TileY(rs->xy) * 16) + if (v->y_pos >= (int32)TileY(rs->xy) * 16) dist += 6; break; case 5: // Going south west, x position increasing - if (v->x_pos >= TileX(rs->xy) * 16) + if (v->x_pos >= (int32)TileX(rs->xy) * 16) dist += 6; break; case 7: // Going north west, y position decrasing. - if (v->y_pos <= TileY(rs->xy) * 16 + 15) + if (v->y_pos <= (int32)TileY(rs->xy) * 16 + 15) dist += 6; break; } diff -r e0cbbec2e6e9 -r 607a900aefa3 stdafx.h --- a/stdafx.h Sun Jul 17 18:09:23 2005 +0000 +++ b/stdafx.h Sun Jul 17 18:11:17 2005 +0000 @@ -9,7 +9,7 @@ #pragma warning(disable: 4244) // conversion #pragma warning(disable: 4245) // conversion #pragma warning(disable: 4305) // 'initializing' : truncation from 'const int ' to 'char ' -#pragma warning(disable: 4018) // warning C4018: '==' : signed/unsigned mismatch +//#pragma warning(disable: 4018) // warning C4018: '==' : signed/unsigned mismatch #pragma warning(disable: 4201) // nameless union #pragma warning(disable: 4514) // removed unref inline #pragma warning(disable: 4127) // constant conditional expression diff -r e0cbbec2e6e9 -r 607a900aefa3 strgen/strgen.c --- a/strgen/strgen.c Sun Jul 17 18:09:23 2005 +0000 +++ b/strgen/strgen.c Sun Jul 17 18:11:17 2005 +0000 @@ -634,7 +634,7 @@ for(;;) { // read until next command from a. - ar = ParseCommandString(&s, param, &argno, &casei); + ar = ParseCommandString((const char **)&s, param, &argno, &casei); if (ar == NULL) break; @@ -891,7 +891,7 @@ hash = MyHashStr(hash, s + 1); s = ls->english; - while ((cs = ParseCommandString(&s, buf, &argno, &casei)) != NULL) { + while ((cs = ParseCommandString((const char **)&s, buf, &argno, &casei)) != NULL) { if (cs->flags & C_DONTCOUNT) continue; diff -r e0cbbec2e6e9 -r 607a900aefa3 strings.c --- a/strings.c Sun Jul 17 18:09:23 2005 +0000 +++ b/strings.c Sun Jul 17 18:11:17 2005 +0000 @@ -763,7 +763,7 @@ // Each LEN is printed using 2 bytes in big endian order. uint num = (byte)*str++; while (num) { - if (str[0] == casei) { + if ((byte)str[0] == casei) { // Found the case, adjust str pointer and continue str += 3; break;