mirror of https://github.com/OpenTTD/OpenTTD
(svn r2643) Get rid of some unnecessary casts
parent
4b1c520264
commit
7c694f2553
|
@ -909,7 +909,7 @@ static bool AircraftController(Vehicle *v)
|
||||||
dist = myabs(x + amd->x - v->x_pos) + myabs(y + amd->y - v->y_pos);
|
dist = myabs(x + amd->x - v->x_pos) + myabs(y + amd->y - v->y_pos);
|
||||||
|
|
||||||
// Need exact position?
|
// 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;
|
return true;
|
||||||
|
|
||||||
// At final pos?
|
// At final pos?
|
||||||
|
|
12
bridge_gui.c
12
bridge_gui.c
|
@ -10,7 +10,7 @@
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
static struct BridgeData {
|
static struct BridgeData {
|
||||||
int count;
|
uint count;
|
||||||
TileIndex start_tile;
|
TileIndex start_tile;
|
||||||
TileIndex end_tile;
|
TileIndex end_tile;
|
||||||
byte type;
|
byte type;
|
||||||
|
@ -40,11 +40,11 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch(e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int i;
|
uint i;
|
||||||
|
|
||||||
DrawWindowWidgets(w);
|
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];
|
int ind = _bridge.indexes[i + w->vscroll.pos];
|
||||||
|
|
||||||
SetDParam(2, _bridge.costs[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: {
|
case WE_KEYPRESS: {
|
||||||
uint i = e->keypress.keycode - '1';
|
uint i = e->keypress.keycode - '1';
|
||||||
if (i < 9 && i < (uint)_bridge.count) {
|
if (i < 9 && i < _bridge.count) {
|
||||||
e->keypress.cont = false;
|
e->keypress.cont = false;
|
||||||
BuildBridge(w, i);
|
BuildBridge(w, i);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
if (e->click.widget == 2) {
|
if (e->click.widget == 2) {
|
||||||
uint ind = ((int)e->click.pt.y - 14) / 22;
|
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);
|
BuildBridge(w, ind);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -112,7 +112,7 @@ static const WindowDesc _build_road_bridge_desc = {
|
||||||
|
|
||||||
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
|
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
|
||||||
{
|
{
|
||||||
int j = 0;
|
uint j = 0;
|
||||||
int32 ret;
|
int32 ret;
|
||||||
uint16 errmsg;
|
uint16 errmsg;
|
||||||
|
|
||||||
|
|
|
@ -1171,8 +1171,7 @@ static void SignListWndProc(Window *w, WindowEvent *e)
|
||||||
SignStruct *ss;
|
SignStruct *ss;
|
||||||
|
|
||||||
/* Start drawing the signs */
|
/* Start drawing the signs */
|
||||||
i = 0;
|
for (i = w->vscroll.pos; i < w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) {
|
||||||
for (i = w->vscroll.pos; i < (uint)w->vscroll.cap + w->vscroll.pos && i < w->vscroll.count; i++) {
|
|
||||||
ss = GetSign(_sign_sort[i]);
|
ss = GetSign(_sign_sort[i]);
|
||||||
|
|
||||||
if (ss->owner != OWNER_NONE)
|
if (ss->owner != OWNER_NONE)
|
||||||
|
|
|
@ -948,7 +948,7 @@ static void PlantFarmField(TileIndex tile)
|
||||||
{
|
{
|
||||||
uint size_x, size_y;
|
uint size_x, size_y;
|
||||||
uint32 r;
|
uint32 r;
|
||||||
int count;
|
uint count;
|
||||||
int type, type2;
|
int type, type2;
|
||||||
|
|
||||||
if (_opt.landscape == LT_HILLY) {
|
if (_opt.landscape == LT_HILLY) {
|
||||||
|
@ -971,8 +971,7 @@ static void PlantFarmField(TileIndex tile)
|
||||||
cur_tile = TILE_MASK(cur_tile);
|
cur_tile = TILE_MASK(cur_tile);
|
||||||
count += IsBadFarmFieldTile(cur_tile);
|
count += IsBadFarmFieldTile(cur_tile);
|
||||||
END_TILE_LOOP(cur_tile, size_x, size_y, tile)
|
END_TILE_LOOP(cur_tile, size_x, size_y, tile)
|
||||||
if ((uint)(count * 2) >= size_x * size_y)
|
if (count * 2 >= size_x * size_y) return;
|
||||||
return;
|
|
||||||
|
|
||||||
/* determine type of field */
|
/* determine type of field */
|
||||||
r = Random();
|
r = Random();
|
||||||
|
|
|
@ -197,7 +197,8 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch(e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int y,i;
|
uint i;
|
||||||
|
int y;
|
||||||
byte *p;
|
byte *p;
|
||||||
|
|
||||||
w->disabled_state = (msf.playlist <= 3) ? (1 << 11) : 0;
|
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);
|
SetDParam(0, STR_01D5_ALL + msf.playlist);
|
||||||
DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0);
|
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(0, i);
|
||||||
SetDParam(2, i);
|
SetDParam(2, i);
|
||||||
SetDParam(1, SPECSTR_SONGNAME);
|
SetDParam(1, SPECSTR_SONGNAME);
|
||||||
|
|
2
rail.c
2
rail.c
|
@ -133,7 +133,7 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
|
||||||
if ((_m[tile].m5 & 0xC6) == 0xC0 && ((DiagDirection)(_m[tile].m5 & 0x1)) == (exitdir & 0x1))
|
if ((_m[tile].m5 & 0xC6) == 0xC0 && ((DiagDirection)(_m[tile].m5 & 0x1)) == (exitdir & 0x1))
|
||||||
type = (_m[tile].m3 >> 4) & RAILTYPE_MASK;
|
type = (_m[tile].m3 >> 4) & RAILTYPE_MASK;
|
||||||
/* under bridge (any type) */
|
/* 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;
|
type = _m[tile].m3 & RAILTYPE_MASK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -496,7 +496,7 @@ int32 DoConvertStreetRail(TileIndex tile, uint totype, bool exec)
|
||||||
if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR;
|
if (!CheckTileOwnership(tile) || !EnsureNoVehicle(tile)) return CMD_ERROR;
|
||||||
|
|
||||||
// tile is already of requested type?
|
// 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) {
|
if (exec) {
|
||||||
// change type.
|
// change type.
|
||||||
|
|
|
@ -529,7 +529,7 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
|
||||||
int x1,y1,x2,y2;
|
int x1,y1,x2,y2;
|
||||||
int xc,yc;
|
int xc,yc;
|
||||||
|
|
||||||
memset(produced, 0, NUM_CARGO * sizeof(uint));
|
memset(produced, 0, sizeof(AcceptedCargo));
|
||||||
|
|
||||||
x = TileX(tile);
|
x = TileX(tile);
|
||||||
y = TileY(tile);
|
y = TileY(tile);
|
||||||
|
@ -1428,7 +1428,7 @@ int32 DoConvertStationRail(TileIndex tile, uint totype, bool exec)
|
||||||
if (_m[tile].m5 >= 8) return CMD_ERROR;
|
if (_m[tile].m5 >= 8) return CMD_ERROR;
|
||||||
|
|
||||||
// tile is already of requested type?
|
// 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) {
|
if (exec) {
|
||||||
// change type.
|
// change type.
|
||||||
|
|
|
@ -845,7 +845,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
|
||||||
// railway tunnel
|
// railway tunnel
|
||||||
if (!CheckTileOwnership(tile)) return CMD_ERROR;
|
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);
|
endtile = CheckTunnelBusy(tile, &length);
|
||||||
if (endtile == INVALID_TILE) return CMD_ERROR;
|
if (endtile == INVALID_TILE) return CMD_ERROR;
|
||||||
|
@ -864,7 +864,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
|
|
||||||
// tile is already of requested type?
|
// 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.
|
// change type.
|
||||||
if (exec) {
|
if (exec) {
|
||||||
_m[tile].m3 = (_m[tile].m3 & 0xF0) + totype;
|
_m[tile].m3 = (_m[tile].m3 & 0xF0) + totype;
|
||||||
|
@ -893,7 +893,7 @@ int32 DoConvertTunnelBridgeRail(TileIndex tile, uint totype, bool exec)
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (uint)(_m[tile].m3 & 0xF) == totype) return CMD_ERROR;
|
if ((_m[tile].m3 & 0xFU) == totype) return CMD_ERROR;
|
||||||
cost = 0;
|
cost = 0;
|
||||||
do {
|
do {
|
||||||
if (exec) {
|
if (exec) {
|
||||||
|
|
Loading…
Reference in New Issue