diff options
author | tron <tron@openttd.org> | 2005-07-19 21:49:35 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-07-19 21:49:35 +0000 |
commit | 7c694f25537097f380d7215082b42eea51e86815 (patch) | |
tree | 02f05ccb111e772991e342a10812e26ae8d1a118 | |
parent | 4b1c5202640d5c741ebdda3b3775a337a1c36be8 (diff) | |
download | openttd-7c694f25537097f380d7215082b42eea51e86815.tar.xz |
(svn r2643) Get rid of some unnecessary casts
-rw-r--r-- | aircraft_cmd.c | 2 | ||||
-rw-r--r-- | bridge_gui.c | 12 | ||||
-rw-r--r-- | graph_gui.c | 3 | ||||
-rw-r--r-- | industry_cmd.c | 5 | ||||
-rw-r--r-- | music_gui.c | 5 | ||||
-rw-r--r-- | rail.c | 2 | ||||
-rw-r--r-- | road_cmd.c | 2 | ||||
-rw-r--r-- | station_cmd.c | 4 | ||||
-rw-r--r-- | tunnelbridge_cmd.c | 6 |
9 files changed, 20 insertions, 21 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c index d05f65d81..e67e21ad0 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -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? diff --git a/bridge_gui.c b/bridge_gui.c index d3273757f..a84a6a2d1 100644 --- a/bridge_gui.c +++ b/bridge_gui.c @@ -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; diff --git a/graph_gui.c b/graph_gui.c index 460f1ec6b..6f65854f1 100644 --- a/graph_gui.c +++ b/graph_gui.c @@ -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) diff --git a/industry_cmd.c b/industry_cmd.c index 066f2d58b..d421617e6 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -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(); diff --git a/music_gui.c b/music_gui.c index 7f2e93cde..4cf254b43 100644 --- a/music_gui.c +++ b/music_gui.c @@ -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); @@ -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: diff --git a/road_cmd.c b/road_cmd.c index 0ef9a1b43..cf1d96cbd 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -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. diff --git a/station_cmd.c b/station_cmd.c index 3dcd34b2f..1e0d2af44 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -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. diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index d2d4a67e0..8da2c779c 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -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) { |