(svn r2617) - Fix: fix some warnings, and reenable vs.net2003 signed/unsigned warnings

This commit is contained in:
Darkvater 2005-07-17 18:11:17 +00:00
parent b9a6c16461
commit ff2662ebe7
6 changed files with 15 additions and 13 deletions

8
gfx.c
View File

@ -261,9 +261,9 @@ enum {
* @param *dest string that is checked and possibly truncated * @param *dest string that is checked and possibly truncated
* @param maxw maximum width in pixels of the string * @param maxw maximum width in pixels of the string
* @return new width of (truncated) 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 base = _stringwidth_base;
int ddd, ddd_w; int ddd, ddd_w;
@ -305,7 +305,7 @@ static int TruncateString(char *str, uint maxw)
return w; 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); GetString(dest, src);
return TruncateString(dest, maxw); return TruncateString(dest, maxw);
@ -361,7 +361,7 @@ int DrawStringCentered(int x, int y, StringID str, uint16 color)
int DrawStringCenteredTruncated(int x, int y, StringID str, uint16 color, uint maxw) int DrawStringCenteredTruncated(int x, int y, StringID str, uint16 color, uint maxw)
{ {
char buffer[512]; char buffer[512];
int w = TruncateStringID(str, buffer, maxw); uint w = TruncateStringID(str, buffer, maxw);
return DoDrawString(buffer, x - (w / 2), y, color); return DoDrawString(buffer, x - (w / 2), y, color);
} }

View File

@ -522,7 +522,7 @@ static void MaybeStartNewPlayer(void)
// when there's a lot of computers in game, the probability that a new one starts is lower // 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 < (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); DoStartupNewPlayer(true);
// The next AI starts like the difficulty setting said, with +2 month max // The next AI starts like the difficulty setting said, with +2 month max

View File

@ -1154,6 +1154,7 @@ found_best_track:;
return best_track; return best_track;
} }
#if 0
static uint RoadFindPathToStation(const Vehicle *v, TileIndex tile) static uint RoadFindPathToStation(const Vehicle *v, TileIndex tile)
{ {
NPFFindStationOrTileData fstd; NPFFindStationOrTileData fstd;
@ -1165,6 +1166,7 @@ static uint RoadFindPathToStation(const Vehicle *v, TileIndex tile)
return NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE, PBS_MODE_NONE).best_path_dist; return NPFRouteToStationOrTile(v->tile, trackdir, &fstd, TRANSPORT_ROAD, v->owner, INVALID_RAILTYPE, PBS_MODE_NONE).best_path_dist;
} }
#endif
typedef struct RoadDriveEntry { typedef struct RoadDriveEntry {
byte x,y; byte x,y;
@ -1664,19 +1666,19 @@ void OnNewDay_RoadVeh(Vehicle *v)
// In that case, add penalty. // In that case, add penalty.
switch(v->direction) { switch(v->direction) {
case 1: // going north east,x position decreasing 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; dist += 6;
break; break;
case 3: // Going south east, y position increasing 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; dist += 6;
break; break;
case 5: // Going south west, x position increasing 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; dist += 6;
break; break;
case 7: // Going north west, y position decrasing. 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; dist += 6;
break; break;
} }

View File

@ -9,7 +9,7 @@
#pragma warning(disable: 4244) // conversion #pragma warning(disable: 4244) // conversion
#pragma warning(disable: 4245) // conversion #pragma warning(disable: 4245) // conversion
#pragma warning(disable: 4305) // 'initializing' : truncation from 'const int ' to 'char ' #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: 4201) // nameless union
#pragma warning(disable: 4514) // removed unref inline #pragma warning(disable: 4514) // removed unref inline
#pragma warning(disable: 4127) // constant conditional expression #pragma warning(disable: 4127) // constant conditional expression

View File

@ -634,7 +634,7 @@ static void ExtractCommandString(ParsedCommandStruct *p, char *s, bool warnings)
for(;;) { for(;;) {
// read until next command from a. // read until next command from a.
ar = ParseCommandString(&s, param, &argno, &casei); ar = ParseCommandString((const char **)&s, param, &argno, &casei);
if (ar == NULL) if (ar == NULL)
break; break;
@ -891,7 +891,7 @@ static void MakeHashOfStrings()
hash = MyHashStr(hash, s + 1); hash = MyHashStr(hash, s + 1);
s = ls->english; 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) if (cs->flags & C_DONTCOUNT)
continue; continue;

View File

@ -763,7 +763,7 @@ static char *FormatString(char *buff, const char *str, const int32 *argv, uint c
// Each LEN is printed using 2 bytes in big endian order. // Each LEN is printed using 2 bytes in big endian order.
uint num = (byte)*str++; uint num = (byte)*str++;
while (num) { while (num) {
if (str[0] == casei) { if ((byte)str[0] == casei) {
// Found the case, adjust str pointer and continue // Found the case, adjust str pointer and continue
str += 3; str += 3;
break; break;