(svn r2643) Get rid of some unnecessary casts

This commit is contained in:
tron 2005-07-19 21:49:35 +00:00
parent 4b1c520264
commit 7c694f2553
9 changed files with 20 additions and 21 deletions

View File

@ -909,7 +909,7 @@ static bool AircraftController(Vehicle *v)
dist = myabs(x + amd->x - v->x_pos) + myabs(y + amd->y - v->y_pos);
// Need exact position?
if (!(amd->flag & AMED_EXACTPOS) && dist <= (uint)((amd->flag&AMED_SLOWTURN)?8:4))
if (!(amd->flag & AMED_EXACTPOS) && dist <= (amd->flag & AMED_SLOWTURN ? 8 : 4))
return true;
// At final pos?

View File

@ -10,7 +10,7 @@
#include "sound.h"
static struct BridgeData {
int count;
uint count;
TileIndex start_tile;
TileIndex end_tile;
byte type;
@ -40,11 +40,11 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT: {
int i;
uint i;
DrawWindowWidgets(w);
for(i=0; i < 4 && i + w->vscroll.pos < _bridge.count; i++) {
for (i = 0; i < 4 && i + w->vscroll.pos < _bridge.count; i++) {
int ind = _bridge.indexes[i + w->vscroll.pos];
SetDParam(2, _bridge.costs[i + w->vscroll.pos]);
@ -58,7 +58,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
case WE_KEYPRESS: {
uint i = e->keypress.keycode - '1';
if (i < 9 && i < (uint)_bridge.count) {
if (i < 9 && i < _bridge.count) {
e->keypress.cont = false;
BuildBridge(w, i);
}
@ -69,7 +69,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
if (e->click.widget == 2) {
uint ind = ((int)e->click.pt.y - 14) / 22;
if (ind < 4 && (ind += w->vscroll.pos) < (uint)_bridge.count)
if (ind < 4 && (ind += w->vscroll.pos) < _bridge.count)
BuildBridge(w, ind);
}
break;
@ -112,7 +112,7 @@ static const WindowDesc _build_road_bridge_desc = {
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
{
int j = 0;
uint j = 0;
int32 ret;
uint16 errmsg;

View File

@ -1171,8 +1171,7 @@ static void SignListWndProc(Window *w, WindowEvent *e)
SignStruct *ss;
/* Start drawing the signs */
i = 0;
for (i = w->vscroll.pos; i < (uint)w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) {
for (i = w->vscroll.pos; i < w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) {
ss = GetSign(_sign_sort[i]);
if (ss->owner != OWNER_NONE)

View File

@ -948,7 +948,7 @@ static void PlantFarmField(TileIndex tile)
{
uint size_x, size_y;
uint32 r;
int count;
uint count;
int type, type2;
if (_opt.landscape == LT_HILLY) {
@ -971,8 +971,7 @@ static void PlantFarmField(TileIndex tile)
cur_tile = TILE_MASK(cur_tile);
count += IsBadFarmFieldTile(cur_tile);
END_TILE_LOOP(cur_tile, size_x, size_y, tile)
if ((uint)(count * 2) >= size_x * size_y)
return;
if (count * 2 >= size_x * size_y) return;
/* determine type of field */
r = Random();

View File

@ -197,7 +197,8 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
{
switch(e->event) {
case WE_PAINT: {
int y,i;
uint i;
int y;
byte *p;
w->disabled_state = (msf.playlist <= 3) ? (1 << 11) : 0;
@ -212,7 +213,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
SetDParam(0, STR_01D5_ALL + msf.playlist);
DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0);
for(i=1; (uint)i <= NUM_SONGS_AVAILABLE; i++) {
for (i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
SetDParam(0, i);
SetDParam(2, i);
SetDParam(1, SPECSTR_SONGNAME);

2
rail.c
View File

@ -133,7 +133,7 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
if ((_m[tile].m5 & 0xC6) == 0xC0 && ((DiagDirection)(_m[tile].m5 & 0x1)) == (exitdir & 0x1))
type = (_m[tile].m3 >> 4) & RAILTYPE_MASK;
/* under bridge (any type) */
if ((_m[tile].m5 & 0xC0) == 0xC0 && ((uint)_m[tile].m5 & 0x1) != (exitdir & 0x1))
if ((_m[tile].m5 & 0xC0) == 0xC0 && (_m[tile].m5 & 0x1U) != (exitdir & 0x1))
type = _m[tile].m3 & RAILTYPE_MASK;
break;
default:

View File

@ -496,7 +496,7 @@ int32 DoConvertStreetRail(TileIndex tile, uint totype, bool exec)
if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR;
// tile is already of requested type?
if ( (uint)(_m[tile].m4 & 0xF) == totype) return CMD_ERROR;
if ((_m[tile].m4 & 0xFU) == totype) return CMD_ERROR;
if (exec) {
// change type.

View File

@ -529,7 +529,7 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
int x1,y1,x2,y2;
int xc,yc;
memset(produced, 0, NUM_CARGO * sizeof(uint));
memset(produced, 0, sizeof(AcceptedCargo));
x = TileX(tile);
y = TileY(tile);
@ -1428,7 +1428,7 @@ int32 DoConvertStationRail(TileIndex tile, uint totype, bool exec)
if (_m[tile].m5 >= 8) return CMD_ERROR;
// tile is already of requested type?
if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR;
if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR;
if (exec) {
// change type.

View File

@ -845,7 +845,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
// railway tunnel
if (!CheckTileOwnership(tile)) return CMD_ERROR;
if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR;
if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR;
endtile = CheckTunnelBusy(tile, &length);
if (endtile == INVALID_TILE) return CMD_ERROR;
@ -864,7 +864,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
return CMD_ERROR;
// tile is already of requested type?
if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR;
if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR;
// change type.
if (exec) {
_m[tile].m3 = (_m[tile].m3 & 0xF0) + totype;
@ -893,7 +893,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
return CMD_ERROR;
}
if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR;
if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR;
cost = 0;
do {
if (exec) {