(svn r9672) -Cleanup: lots of coding style fixes around operands.

This commit is contained in:
rubidium 2007-04-18 22:10:36 +00:00
parent 0d32783f87
commit 7577954ced
62 changed files with 1051 additions and 1051 deletions

View File

@ -77,8 +77,8 @@ static inline bool AI_AllowNewAI()
return true;
}
#define AI_CHANCE16(a,b) ((uint16) AI_Random() <= (uint16)((65536 * a) / b))
#define AI_CHANCE16R(a,b,r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
#define AI_CHANCE16(a, b) ((uint16) AI_Random() <= (uint16)((65536 * a) / b))
#define AI_CHANCE16R(a, b, r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
/**
* The random-function that should be used by ALL AIs.

View File

@ -516,7 +516,7 @@ static void AiFindSubsidyPassengerRoute(FoundRoute *fr)
{
uint i;
const Subsidy* s;
Town *from,*to;
Town *from, *to;
// initially error
fr->distance = -1;
@ -1561,7 +1561,7 @@ static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, b
return false;
if (cargo != CT_MAIL)
return true;
return !!((values[cargo]>>1) & ~7);
return !!((values[cargo] >> 1) & ~7);
}
}
@ -1574,7 +1574,7 @@ static int32 AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData*
int32 total_cost = 0;
Town *t = NULL;
int rating = 0;
int i,j,k;
int i, j, k;
for (;;) {
// This will seldomly overflow for valid reasons. Mask it to be on the safe side.
@ -1588,7 +1588,7 @@ static int32 AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData*
ret = DoCommand(c, railtype, p->attr, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_TRAIN_DEPOT);
} else {
// Station
ret = DoCommand(c, (p->attr&1) | (p->attr>>4)<<8 | (p->attr>>1&7)<<16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
ret = DoCommand(c, (p->attr & 1) | (p->attr >> 4) << 8 | (p->attr >> 1 & 7) << 16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
}
if (CmdFailed(ret)) return CMD_ERROR;
@ -1610,7 +1610,7 @@ clear_town_stuff:;
// Build the rail
for (i = 0; i != 6; i++, j >>= 1) {
if (j&1) {
if (j & 1) {
k = i;
ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
if (CmdFailed(ret)) return CMD_ERROR;
@ -1642,7 +1642,7 @@ clear_town_stuff:;
total_cost += ret + _price.build_rail;
if (flag & DC_EXEC) {
DoCommand(c, railtype, p->attr&1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
DoCommand(c, railtype, p->attr & 1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
}
goto clear_town_stuff;
@ -1784,7 +1784,7 @@ static void AiStateBuildDefaultRailBlocks(Player *p)
if (rule == -1) {
// cannot build, terraform after a while
if (p->ai.state_counter >= 600) {
AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
}
// also try the other terraform direction
if (++p->ai.state_counter >= 1000) {
@ -1804,7 +1804,7 @@ static void AiStateBuildDefaultRailBlocks(Player *p)
);
assert(!CmdFailed(r));
}
} while (++aib,--j);
} while (++aib, --j);
}
// check if we're done with all of them
@ -1812,7 +1812,7 @@ static void AiStateBuildDefaultRailBlocks(Player *p)
j = p->ai.num_build_rec;
do {
if (aib->cur_building_rule == 255) return;
} while (++aib,--j);
} while (++aib, --j);
// yep, all are done. switch state to the rail building state.
p->ai.state = AIS_BUILD_RAIL;
@ -1857,7 +1857,7 @@ static bool AiDoFollowTrack(const Player* p)
arpfd.tile2 = p->ai.cur_tile_a;
arpfd.flag = false;
arpfd.count = 0;
FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a^2),
FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a ^ 2),
(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
return arpfd.count > 8;
}
@ -2001,8 +2001,8 @@ static inline void AiCheckBuildRailTunnelHere(AiRailFinder *arf, TileIndex tile,
if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
int32 cost = DoCommand(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0]&3);
if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0] & 3);
if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
}
}
@ -2017,7 +2017,7 @@ static void AiBuildRailRecursive(AiRailFinder *arf, TileIndex tile, int dir)
// Reached destination?
if (tile == arf->final_tile) {
if (arf->final_dir != (dir^2)) {
if (arf->final_dir != (dir ^ 2)) {
if (arf->recursive_mode != 2) arf->recursive_mode = 1;
} else if (arf->recursive_mode != 2) {
arf->recursive_mode = 2;
@ -2063,17 +2063,17 @@ static void AiBuildRailRecursive(AiRailFinder *arf, TileIndex tile, int dir)
if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
p += 2;
} while (!(p[0]&0x80));
} while (!(p[0] & 0x80));
}
AiCheckBuildRailBridgeHere(arf, tile, p);
AiCheckBuildRailTunnelHere(arf, tile, p+1);
AiCheckBuildRailTunnelHere(arf, tile, p + 1);
arf->depth--;
}
static const byte _dir_table_3[]= {0x25, 0x2A, 0x19, 0x16};
static const byte _dir_table_3[] = {0x25, 0x2A, 0x19, 0x16};
static void AiBuildRailConstruct(Player *p)
{
@ -2324,23 +2324,23 @@ static void AiStateBuildRail(Player *p)
}
// Find first edge to build from.
tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd&3, &dir);
tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd & 3, &dir);
p->ai.start_tile_a = tile;
p->ai.cur_tile_a = tile;
p->ai.start_dir_a = dir;
p->ai.cur_dir_a = dir;
DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
assert(TILE_MASK(tile) != 0xFF00);
// Find second edge to build to
aib = (&p->ai.src) + ((cmd >> 4)&0xF);
tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd>>2)&3, &dir);
aib = (&p->ai.src) + ((cmd >> 4) & 0xF);
tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd >> 2) & 3, &dir);
p->ai.start_tile_b = tile;
p->ai.cur_tile_b = tile;
p->ai.start_dir_b = dir;
p->ai.cur_dir_b = dir;
DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
assert(TILE_MASK(tile) != 0xFF00);
@ -2503,7 +2503,7 @@ static void AiStateDeleteRailBlocks(Player *p)
for (b = _default_rail_track_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
}
} while (++aib,--num);
} while (++aib, --num);
p->ai.state = AIS_0;
}
@ -2682,14 +2682,14 @@ static void AiStateBuildDefaultRoadBlocks(Player *p)
if (rule == -1) {
// cannot build, terraform after a while
if (p->ai.state_counter >= 600) {
AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
}
// also try the other terraform direction
if (++p->ai.state_counter >= 1000) {
p->ai.state_counter = 0;
p->ai.state_mode = -p->ai.state_mode;
}
} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
int32 r;
// player has money, build it.
@ -2702,7 +2702,7 @@ static void AiStateBuildDefaultRoadBlocks(Player *p)
);
assert(!CmdFailed(r));
}
} while (++aib,--j);
} while (++aib, --j);
}
// check if we're done with all of them
@ -2710,7 +2710,7 @@ static void AiStateBuildDefaultRoadBlocks(Player *p)
j = p->ai.num_build_rec;
do {
if (aib->cur_building_rule == 255) return;
} while (++aib,--j);
} while (++aib, --j);
// yep, all are done. switch state to the rail building state.
p->ai.state = AIS_BUILD_ROAD;
@ -2901,8 +2901,8 @@ static inline void AiCheckBuildRoadTunnelHere(AiRoadFinder *arf, TileIndex tile,
if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
int32 cost = DoCommand(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0]&3);
if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0] & 3);
if (arf->depth == 1) AiCheckRoadPathBetter(arf, p);
}
}
@ -2918,7 +2918,7 @@ static void AiBuildRoadRecursive(AiRoadFinder *arf, TileIndex tile, int dir)
// Reached destination?
if (tile == arf->final_tile) {
if ((arf->final_dir^2) == dir) {
if ((arf->final_dir ^ 2) == dir) {
arf->recursive_mode = 2;
arf->cur_best_depth = arf->depth;
}
@ -2962,7 +2962,7 @@ static void AiBuildRoadRecursive(AiRoadFinder *arf, TileIndex tile, int dir)
}
AiCheckBuildRoadBridgeHere(arf, tile, p);
AiCheckBuildRoadTunnelHere(arf, tile, p+1);
AiCheckBuildRoadTunnelHere(arf, tile, p + 1);
arf->depth--;
}
@ -3020,7 +3020,7 @@ do_some_terraform:
tile = TILE_MASK(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a));
if (arf.best_ptr[0]&0x80) {
if (arf.best_ptr[0] & 0x80) {
int i;
int32 bridge_len;
p->ai.cur_tile_a = arf.bridge_end_tile;
@ -3042,7 +3042,7 @@ do_some_terraform:
DoCommand(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
p->ai.state_counter = 0;
} else if (arf.best_ptr[0]&0x40) {
} else if (arf.best_ptr[0] & 0x40) {
// tunnel
DoCommand(tile, 0x200, 0, DC_AUTO | DC_EXEC, CMD_BUILD_TUNNEL);
p->ai.cur_tile_a = _build_tunnel_endtile;
@ -3148,7 +3148,7 @@ static void AiStateBuildRoad(Player *p)
p->ai.cur_dir_a = dir;
// Find second edge to build to
aib = (&p->ai.src) + (cmd&0xF);
aib = (&p->ai.src) + (cmd & 0xF);
tile = AiGetRoadBlockEdge(aib->cur_building_rule, aib->use_tile, &dir);
p->ai.start_tile_b = tile;
p->ai.cur_tile_b = tile;
@ -3239,7 +3239,7 @@ static void AiStateDeleteRoadBlocks(Player *p)
if (b->mode > 1) continue;
DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
}
} while (++aib,--num);
} while (++aib, --num);
p->ai.state = AIS_0;
}
@ -3326,7 +3326,7 @@ static int32 AiDoBuildDefaultAirportBlock(TileIndex tile, const AiDefaultBlockDa
for (; p->mode == 0; p++) {
if (!HASBIT(avail_airports, p->attr)) return CMD_ERROR;
ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr,0,flag | DC_AUTO | DC_NO_WATER,CMD_BUILD_AIRPORT);
ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_AIRPORT);
if (CmdFailed(ret)) return CMD_ERROR;
total_cost += ret;
}
@ -3408,14 +3408,14 @@ static void AiStateBuildDefaultAirportBlocks(Player *p)
if (rule == -1) {
// cannot build, terraform after a while
if (p->ai.state_counter >= 600) {
AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
}
// also try the other terraform direction
if (++p->ai.state_counter >= 1000) {
p->ai.state_counter = 0;
p->ai.state_mode = -p->ai.state_mode;
}
} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
// player has money, build it.
int32 r;
@ -3428,7 +3428,7 @@ static void AiStateBuildDefaultAirportBlocks(Player *p)
);
assert(!CmdFailed(r));
}
} while (++aib,--j);
} while (++aib, --j);
} while (--i);
// check if we're done with all of them
@ -3436,7 +3436,7 @@ static void AiStateBuildDefaultAirportBlocks(Player *p)
j = p->ai.num_build_rec;
do {
if (aib->cur_building_rule == 255) return;
} while (++aib,--j);
} while (++aib, --j);
// yep, all are done. switch state.
p->ai.state = AIS_BUILD_AIRCRAFT_VEHICLES;
@ -3650,7 +3650,7 @@ pos_3:
}
}
} else {
static const byte _depot_bits[] = {0x19,0x16,0x25,0x2A};
static const byte _depot_bits[] = {0x19, 0x16, 0x25, 0x2A};
DiagDirection dir = GetRailDepotDirection(tile);
@ -3795,13 +3795,13 @@ static void AiHandleTakeover(Player *p)
// Ask the guy with the highest performance hist.
FOR_ALL_PLAYERS(pp) {
if (pp->is_active &&
!(asked&1) &&
!(asked & 1) &&
pp->bankrupt_asked == 0 &&
best_val < pp->old_economy[1].performance_history) {
best_val = pp->old_economy[1].performance_history;
best_pl = pp;
}
asked>>=1;
asked >>= 1;
}
// Asked all players?
@ -3843,7 +3843,7 @@ static void AiAdjustLoan(const Player* p)
// Increase loan
if (p->current_loan < _economy.max_loan &&
p->num_valid_stat_ent >= 2 &&
-(p->old_economy[0].expenses+p->old_economy[1].expenses) < base * 60) {
-(p->old_economy[0].expenses + p->old_economy[1].expenses) < base * 60) {
DoCommand(0, 0, 0, DC_EXEC, CMD_INCREASE_LOAN);
}
}
@ -3872,7 +3872,7 @@ void AiDoGameLoop(Player *p)
// to the patch-setting
// Also, it takes into account the setting if the service-interval is in days
// or in %
_ai_service_interval = _patches.servint_ispercent?80:180;
_ai_service_interval = _patches.servint_ispercent ? 80 : 180;
if (IsHumanPlayer(_current_player)) return;
@ -3883,7 +3883,7 @@ void AiDoGameLoop(Player *p)
{
static byte old_state = 99;
static bool hasdots = false;
char *_ai_state_names[]={
char *_ai_state_names[] = {
"AiCase0",
"AiCase1",
"AiStateVehLoop",

View File

@ -123,7 +123,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
}
// Bridge code
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
cost += AiNew_Build_Bridge(p, route[part], route[part-1], flag);
cost += AiNew_Build_Bridge(p, route[part], route[part - 1], flag);
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {
@ -173,7 +173,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
}
// Bridge code
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
cost += AiNew_Build_Bridge(p, route[part], route[part+1], flag);
cost += AiNew_Build_Bridge(p, route[part], route[part + 1], flag);
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {

View File

@ -220,9 +220,9 @@ static bool AiNew_Check_City_or_Industry(Player *p, int ic, byte type)
// Check if the rating in a city is high enough
// If not, take a chance if we want to continue
if (t->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
if (t->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1,AI_CHECKCITY_CITY_CHANCE)) return false;
if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1, AI_CHECKCITY_CITY_CHANCE)) return false;
// Check if we have build a station in this town the last 6 months
// else we don't do it. This is done, because stat updates can be slow
@ -275,7 +275,7 @@ static bool AiNew_Check_City_or_Industry(Player *p, int ic, byte type)
int count = 0;
int j = 0;
if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
// No limits on delevering stations!
// Or for industry that does not give anything yet
@ -642,8 +642,8 @@ static void AiNew_State_FindStation(Player *p)
int r;
uint best;
uint accepts[NUM_CARGO];
TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
// To find a good spot we scan a range from the center, a get the point
// where we get the most cargo and where it is buildable.
// TODO: also check for station of myself and make sure we are not
@ -961,13 +961,13 @@ static void AiNew_State_VerifyRoute(Player *p)
// Now we can build the route, check the direction of the stations!
if (p->ainew.from_direction == AI_PATHFINDER_NO_DIRECTION) {
p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length-1], p->ainew.path_info.route[p->ainew.path_info.route_length-2]);
p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length - 1], p->ainew.path_info.route[p->ainew.path_info.route_length - 2]);
}
if (p->ainew.to_direction == AI_PATHFINDER_NO_DIRECTION) {
p->ainew.to_direction = AiNew_GetDirection(p->ainew.path_info.route[0], p->ainew.path_info.route[1]);
}
if (p->ainew.from_tile == AI_STATION_RANGE)
p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length-1];
p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length - 1];
if (p->ainew.to_tile == AI_STATION_RANGE)
p->ainew.to_tile = p->ainew.path_info.route[0];

View File

@ -105,7 +105,7 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
w = FindWindowById(WC_BUILD_STATION, 0);
if (w != 0)
WP(w,def_d).close = true;
WP(w, def_d).close = true;
break;
case WE_DESTROY:
@ -155,7 +155,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
uint32 avail_airports;
const AirportFTAClass *airport;
if (WP(w,def_d).close) return;
if (WP(w, def_d).close) return;
avail_airports = GetValidAirports();
@ -207,7 +207,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_MOUSELOOP: {
if (WP(w,def_d).close) {
if (WP(w, def_d).close) {
DeleteWindow(w);
return;
}
@ -216,7 +216,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_DESTROY:
if (!WP(w,def_d).close) ResetObjectToPlace();
if (!WP(w, def_d).close) ResetObjectToPlace();
break;
}
}

View File

@ -137,7 +137,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
/* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
if (v->cargo_type == new_cargo_type) return CT_NO_REFIT;
if (CanRefitTo(engine_type, v->cargo_type)) return v->cargo_type;
} while ((v=v->next) != NULL);
} while ((v = v->next) != NULL);
return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
}

View File

@ -312,19 +312,19 @@ static EngList_SortTypeFunction * const _sorter[][9] = {{
&TrainEngineRunningCostSorter,
&TrainEnginePowerVsRunningCostSorter,
&EngineReliabilitySorter,
},{
}, {
/* Road vehicles */
&EngineNumberSorter,
&EngineIntroDateSorter,
&EngineNameSorter,
&EngineReliabilitySorter,
},{
}, {
/* Ships */
&EngineNumberSorter,
&EngineIntroDateSorter,
&EngineNameSorter,
&EngineReliabilitySorter,
},{
}, {
/* Aircraft */
&EngineNumberSorter,
&AircraftEngineCostSorter,
@ -348,21 +348,21 @@ static const StringID _sort_listing[][10] = {{
STR_ENGINE_SORT_POWER_VS_RUNNING_COST,
STR_SORT_BY_RELIABILITY,
INVALID_STRING_ID
},{
}, {
/* Road vehicles */
STR_ENGINE_SORT_ENGINE_ID,
STR_ENGINE_SORT_INTRO_DATE,
STR_SORT_BY_DROPDOWN_NAME,
STR_SORT_BY_RELIABILITY,
INVALID_STRING_ID
},{
}, {
/* Ships */
STR_ENGINE_SORT_ENGINE_ID,
STR_ENGINE_SORT_INTRO_DATE,
STR_SORT_BY_DROPDOWN_NAME,
STR_SORT_BY_RELIABILITY,
INVALID_STRING_ID
},{
}, {
/* Aircraft */
STR_ENGINE_SORT_ENGINE_ID,
STR_ENGINE_SORT_COST,
@ -392,7 +392,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
/* Wagon speed limit, displayed if above zero */
if (rvi->max_speed > 0 && _patches.wagon_speed_limits) {
SetDParam(0, rvi->max_speed * 10 / 16);
DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0);
DrawString(x, y, STR_PURCHASE_INFO_SPEED, 0);
y += 10;
}
return y;
@ -406,13 +406,13 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
/* Purchase Cost - Engine weight */
SetDParam(0, rvi->base_cost * (_price.build_railvehicle >> 3) >> 5);
SetDParam(1, rvi->weight << multihead);
DrawString(x,y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
y += 10;
/* Max speed - Engine power */
SetDParam(0, rvi->max_speed * 10 / 16);
SetDParam(1, rvi->power << multihead);
DrawString(x,y, STR_PURCHASE_INFO_SPEED_POWER, 0);
DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, 0);
y += 10;
/* Max tractive effort - not applicable if old acceleration or maglev */
@ -424,14 +424,14 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
/* Running cost */
SetDParam(0, (rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8) << multihead);
DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
y += 10;
/* Powered wagons power - Powered wagons extra weight */
if (rvi->pow_wag_power != 0) {
SetDParam(0, rvi->pow_wag_power);
SetDParam(1, rvi->pow_wag_weight);
DrawString(x,y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
y += 10;
};
@ -444,7 +444,7 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
bool refittable = (_engine_info[engine_number].refit_mask != 0);
/* Purchase cost - Max speed */
SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5);
SetDParam(0, rvi->base_cost * (_price.roadveh_base >> 3) >> 5);
SetDParam(1, rvi->max_speed * 10 / 32);
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
y += 10;
@ -468,21 +468,21 @@ static int DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number, const R
static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const ShipVehicleInfo *svi)
{
/* Purchase cost - Max speed */
SetDParam(0, svi->base_cost * (_price.ship_base>>3)>>5);
SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
SetDParam(1, svi->max_speed * 10 / 32);
DrawString(x,y, STR_PURCHASE_INFO_COST_SPEED, 0);
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
y += 10;
/* Cargo type + capacity */
SetDParam(0, svi->cargo_type);
SetDParam(1, svi->capacity);
SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
y += 10;
/* Running cost */
SetDParam(0, svi->running_cost * _price.ship_running >> 8);
DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
y += 10;
return y;
@ -494,7 +494,7 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
CargoID cargo;
/* Purchase cost - Max speed */
SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5);
SetDParam(0, avi->base_cost * (_price.aircraft_base >> 3) >> 5);
SetDParam(1, avi->max_speed * 10 / 16);
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
y += 10;
@ -560,7 +560,7 @@ int DrawVehiclePurchaseInfo(int x, int y, uint w, EngineID engine_number)
SetDParam(1, (rvi->capacity * (CountArticulatedParts(engine_number) + 1)) << multihead);
SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY);
}
DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
y += 10;
}
break;
@ -1001,7 +1001,7 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
switch (type) {
case VEH_TRAIN:
WP(w,buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
WP(w, buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
ResizeWindow(w, 0, 16);
break;
case VEH_ROAD:

View File

@ -79,7 +79,7 @@ static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
if (count >= 625) return;
for (t = ts->tile_table; count != 0; count--,t++) {
for (t = ts->tile_table; count != 0; count--, t++) {
if (*t == tile) return;
}
@ -141,7 +141,7 @@ static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
}
}
ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
ret = DoCommand(tile, 0, 0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) {
_terraform_err_tile = tile;
@ -215,8 +215,8 @@ static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height
tile += ToTileIndexDiff(*ttm);
r = TerraformGetHeightOfTile(ts, tile);
if (r != height && r-direction != height && r+direction != height) {
if (!TerraformTileHeight(ts, tile, r+direction))
if (r != height && r - direction != height && r + direction != height) {
if (!TerraformTileHeight(ts, tile, r + direction))
return false;
}
}
@ -382,8 +382,8 @@ int32 CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (ey < sy) Swap(ey, sy);
tile = TileXY(sx, sy);
size_x = ex-sx+1;
size_y = ey-sy+1;
size_x = ex - sx + 1;
size_y = ey - sy + 1;
money = GetAvailableMoneyForCommand();
cost = 0;

View File

@ -407,7 +407,7 @@ int32 GetAvailableMoneyForCommand()
* the callback is called when the command succeeded or failed. */
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
{
int32 res = 0,res2;
int32 res = 0, res2;
CommandProc *proc;
uint32 flags;
bool notest;
@ -544,7 +544,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
if (_additional_cash_required) {
SetDParam(0, _additional_cash_required);
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x, y);
if (res2 == 0) goto callb_err;
}
}
@ -558,7 +558,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
show_error:
/* show error message if the command fails? */
if (IsLocalPlayer() && error_part1 != 0) {
ShowErrorMessage(_error_message, error_part1, x,y);
ShowErrorMessage(_error_message, error_part1, x, y);
}
callb_err:

View File

@ -158,7 +158,7 @@ enum {
CMD_ERROR = ((int32)0x80000000),
};
#define CMD_MSG(x) ((x)<<16)
#define CMD_MSG(x) ((x) << 16)
enum {
CMD_AUTO = 0x0200,

View File

@ -233,7 +233,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
SetDParam(0, GetStationIndex(tile));
AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
0);
}
@ -263,7 +263,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
x = v->x_pos;
y = v->y_pos;
z = GetSlopeZ(x,y);
z = GetSlopeZ(x, y);
if (z < v->z_pos) z = v->z_pos - 1;
SetDisasterVehiclePos(v, x, y, z);
@ -359,14 +359,14 @@ static void DisasterTick_Ufo(Vehicle *v)
if (dist <= TILE_SIZE && z > u->z_pos) z--;
SetDisasterVehiclePos(v, gp.x, gp.y, z);
if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN)==0) {
if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN) == 0) {
v->age++;
if (u->u.road.crashed_ctr == 0) {
u->u.road.crashed_ctr++;
u->vehstatus |= VS_CRASHED;
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
u->index,
0);
}
@ -441,7 +441,7 @@ static void DisasterTick_Airplane(Vehicle *v)
DestructIndustry(i);
SetDParam(0, i->town->index);
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
} else if (v->current_order.dest == 0) {
@ -514,7 +514,7 @@ static void DisasterTick_Helicopter(Vehicle *v)
DestructIndustry(i);
SetDParam(0, i->town->index);
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
}
} else if (v->current_order.dest == 0) {
@ -600,7 +600,7 @@ static void DisasterTick_Big_Ufo(Vehicle *v)
t = ClosestTownFromTile(v->dest_tile, (uint)-1);
SetDParam(0, t->index);
AddNewsItem(STR_B004_UFO_LANDS_NEAR,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0),
v->tile,
0);
@ -951,7 +951,7 @@ static void Disaster_Small_Submarine_Init()
static void Disaster_Big_Submarine_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle();
int x,y;
int x, y;
Direction dir;
uint32 r;
@ -986,7 +986,7 @@ static void Disaster_CoalMine_Init()
if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
SetDParam(0, i->town->index);
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy + TileDiffXY(1, 1), 0);
{
TileIndex tile = i->xy;

View File

@ -165,10 +165,10 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
RaiseWindowButtons(w);
w = FindWindowById(WC_BUILD_STATION, 0);
if (w != NULL) WP(w,def_d).close = true;
if (w != NULL) WP(w, def_d).close = true;
w = FindWindowById(WC_BUILD_DEPOT, 0);
if (w != NULL) WP(w,def_d).close = true;
if (w != NULL) WP(w, def_d).close = true;
break;
case WE_PLACE_PRESIZE: {
@ -233,7 +233,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
int rad;
if (WP(w,def_d).close) return;
if (WP(w, def_d).close) return;
DrawWindowWidgets(w);
rad = (_patches.modified_catchment) ? CA_DOCK : 4;
@ -258,7 +258,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
break;
case WE_MOUSELOOP:
if (WP(w,def_d).close) {
if (WP(w, def_d).close) {
DeleteWindow(w);
return;
}
@ -267,7 +267,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
break;
case WE_DESTROY:
if (!WP(w,def_d).close) ResetObjectToPlace();
if (!WP(w, def_d).close) ResetObjectToPlace();
break;
}
}
@ -333,11 +333,11 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
} break;
case WE_MOUSELOOP:
if (WP(w,def_d).close) DeleteWindow(w);
if (WP(w, def_d).close) DeleteWindow(w);
break;
case WE_DESTROY:
if (!WP(w,def_d).close) ResetObjectToPlace();
if (!WP(w, def_d).close) ResetObjectToPlace();
break;
}
}

View File

@ -201,7 +201,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int color)
static void GfxSetPixel(int x, int y, int color)
{
const DrawPixelInfo* dpi = _cur_dpi;
if ((x-=dpi->left) < 0 || x>=dpi->width || (y-=dpi->top)<0 || y>=dpi->height)
if ((x -= dpi->left) < 0 || x >= dpi->width || (y -= dpi->top)<0 || y >= dpi->height)
return;
dpi->dst_ptr[y * dpi->pitch + x] = color;
}
@ -461,7 +461,7 @@ uint32 FormatStringLinebreaks(char *str, int maxw)
switch (c) {
case '\0': return num + (size << 16); break;
case SCC_SETX: str++; break;
case SCC_SETXY: str +=2; break;
case SCC_SETXY: str += 2; break;
case SCC_TINYFONT: size = FS_SMALL; break;
case SCC_BIGFONT: size = FS_LARGE; break;
case '\n': goto end_of_inner_loop;
@ -509,7 +509,7 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
for (;;) {
w = GetStringBoundingBox(src).width;
DoDrawString(src, x - (w>>1), y, 0xFE);
DoDrawString(src, x - (w >> 1), y, 0xFE);
_cur_fontsize = _last_fontsize;
for (;;) {
@ -524,7 +524,7 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
} else if (c == SCC_SETX) {
src++;
} else if (c == SCC_SETXY) {
src+=2;
src += 2;
}
}
}
@ -574,7 +574,7 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw, int maxh)
} else if (c == SCC_SETX) {
src++;
} else if (c == SCC_SETXY) {
src+=2;
src += 2;
}
}
}
@ -643,7 +643,7 @@ int DoDrawString(const char *string, int x, int y, uint16 real_color)
if (color != 0xFE) {
if (x >= dpi->left + dpi->width ||
x + _screen.width*2 <= dpi->left ||
x + _screen.width * 2 <= dpi->left ||
y >= dpi->top + dpi->height ||
y + _screen.height <= dpi->top)
return x;

View File

@ -222,7 +222,7 @@ static void DrawGraph(const GraphDrawer *gw)
y = gw->top + x_axis_offset - (x_axis_offset * datapoint) / highest_value;
/* Draw the point. */
GfxFillRect(x-1, y-1, x+1, y+1, color);
GfxFillRect(x - 1, y - 1, x + 1, y + 1, color);
/* Draw the line connected to the previous point. */
if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
@ -268,7 +268,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
FOR_ALL_PLAYERS(p) {
if (!p->is_active) continue;
DrawPlayerIcon(p->index, 4, 18+p->index*12);
DrawPlayerIcon(p->index, 4, 18 + p->index * 12);
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
@ -330,7 +330,7 @@ static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
const Player* p;
uint excluded_players = _legend_excluded_players;
byte nums;
int mo,yr;
int mo, yr;
/* Exclude the players which aren't valid */
FOR_ALL_PLAYERS(p) {
@ -908,7 +908,7 @@ static const WindowDesc _company_league_desc = {
void ShowCompanyLeagueTable()
{
AllocateWindowDescFront(&_company_league_desc,0);
AllocateWindowDescFront(&_company_league_desc, 0);
}
/*****************************/

View File

@ -69,7 +69,7 @@ IndustryType GetIndustryType(TileIndex tile)
for (iloop = IT_COAL_MINE; iloop < IT_END; iloop += 1) {
if (IS_BYTE_INSIDE(this_type, industry_gfx_Solver[iloop].MinGfx,
industry_gfx_Solver[iloop].MaxGfx+1)) {
industry_gfx_Solver[iloop].MaxGfx + 1)) {
return iloop;
}
}
@ -496,7 +496,7 @@ static void AnimateTile_Industry(TileIndex tile)
case GFX_OILWELL_ANIMATED_2:
case GFX_OILWELL_ANIMATED_3:
if ((_tick_counter & 7) == 0) {
bool b = CHANCE16(1,7);
bool b = CHANCE16(1, 7);
IndustryGfx gfx = GetIndustryGfx(tile);
m = GetIndustryAnimationState(tile) + 1;
@ -705,7 +705,7 @@ static void TileLoop_Industry(TileIndex tile)
break;
case GFX_POWERPLANT_SPARKS:
if (CHANCE16(1,3)) {
if (CHANCE16(1, 3)) {
SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
AddAnimatedTile(tile);
}
@ -964,7 +964,7 @@ static void ProduceIndustryGoods(Industry *i)
/* play a sound? */
if ((i->counter & 0x3F) == 0) {
if (CHANCE16R(1,14,r) && (num=_industry_sounds[i->type][0]) != 0) {
if (CHANCE16R(1, 14, r) && (num = _industry_sounds[i->type][0]) != 0) {
SndPlayTileFx(
(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
i->xy);
@ -1668,7 +1668,7 @@ static void ExtChangeIndustryProduction(Industry *i)
SetDParam(1, i->index);
AddNewsItem(
percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ECONOMY, 0),
i->xy + TileDiffXY(1, 1), 0
);
}
@ -1682,7 +1682,7 @@ static void ExtChangeIndustryProduction(Industry *i)
SetDParam(0, i->index);
AddNewsItem(
indspec->closure_text,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0),
i->xy + TileDiffXY(1, 1), 0
);
}
@ -1698,7 +1698,7 @@ static void UpdateIndustryStatistics(Industry *i)
pct = 0;
if (i->last_mo_production[0] != 0) {
i->last_prod_year = _cur_year;
pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255);
pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0], 255);
}
i->pct_transported[0] = pct;
@ -1714,7 +1714,7 @@ static void UpdateIndustryStatistics(Industry *i)
pct = 0;
if (i->last_mo_production[1] != 0) {
i->last_prod_year = _cur_year;
pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255);
pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1], 255);
}
i->pct_transported[1] = pct;
@ -1791,7 +1791,7 @@ static void MaybeNewIndustry(void)
SetDParam(0, ind_spc->name);
SetDParam(1, ind->town->index);
AddNewsItem(ind_spc->new_industry_text,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
}
static void ChangeIndustryProduction(Industry *i)
@ -1810,9 +1810,9 @@ static void ChangeIndustryProduction(Industry *i)
if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _opt.landscape == LT_TEMPERATE)
only_decrease = true;
if (only_decrease || CHANCE16(1,3)) {
if (only_decrease || CHANCE16(1, 3)) {
/* If you transport > 60%, 66% chance we increase, else 33% chance we increase */
if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1,3)) {
if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1, 3)) {
/* Increase production */
if (i->prod_level != 0x80) {
byte b;
@ -1849,7 +1849,7 @@ static void ChangeIndustryProduction(Industry *i)
case INDUSTRYLIFE_CLOSABLE:
/* maybe close */
if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1, 2)) {
i->prod_level = 0;
str = indspec->closure_text;
}
@ -1858,7 +1858,7 @@ static void ChangeIndustryProduction(Industry *i)
if (str != STR_NULL) {
SetDParam(0, i->index);
AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
}
}

View File

@ -37,7 +37,7 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
case WE_PAINT:
DrawWindowWidgets(w);
if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1];
int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1];
SetDParam(0, (_price.build_industry >> 5) * GetIndustrySpec(ind_type)->cost_multiplier);
DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
@ -48,12 +48,12 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
int wid = e->we.click.widget;
if (wid >= 3) {
if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL))
WP(w,def_d).data_1 = wid - 3;
WP(w, def_d).data_1 = wid - 3;
}
} break;
case WE_PLACE_OBJ:
if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
ResetObjectToPlace();
break;
@ -274,7 +274,7 @@ static const WindowDesc * const _industry_window_desc[2][4] = {
void ShowBuildIndustryWindow()
{
if (!IsValidPlayer(_current_player)) return;
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape], 0);
}
static inline bool isProductionMinimum(const Industry *i, int pt) {
@ -330,7 +330,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 127, STR_482B_TRANSPORTED, 0);
/* Let's put out those buttons.. */
if (IsProductionAlterable(i)) {
DrawArrowButtons(5, 127, 3, (WP(w,vp2_d).data_2 == 1) ? WP(w,vp2_d).data_3 : 0,
DrawArrowButtons(5, 127, 3, (WP(w, vp2_d).data_2 == 1) ? WP(w, vp2_d).data_3 : 0,
!isProductionMinimum(i, 0), !isProductionMaximum(i, 0));
}
@ -341,7 +341,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0);
/* Let's put out those buttons.. */
if (IsProductionAlterable(i)) {
DrawArrowButtons(5, 137, 3, (WP(w,vp2_d).data_2 == 2) ? WP(w,vp2_d).data_3 : 0,
DrawArrowButtons(5, 137, 3, (WP(w, vp2_d).data_2 == 2) ? WP(w, vp2_d).data_3 : 0,
!isProductionMinimum(i, 1), !isProductionMaximum(i, 1));
}
}
@ -379,11 +379,11 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
UpdateIndustryProduction(i);
SetWindowDirty(w);
w->flags4 |= 5 << WF_TIMEOUT_SHL;
WP(w,vp2_d).data_2 = line+1;
WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
WP(w, vp2_d).data_2 = line + 1;
WP(w, vp2_d).data_3 = (x < 15 ? 1 : 2);
} else if (IS_INT_INSIDE(x, 34, 160)) {
/* clicked the text */
WP(w,vp2_d).data_1 = line;
WP(w, vp2_d).data_1 = line;
SetDParam(0, i->production_rate[line] * 8);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, w, CS_ALPHANUMERAL);
}
@ -397,15 +397,15 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
}
break;
case WE_TIMEOUT:
WP(w,vp2_d).data_2 = 0;
WP(w,vp2_d).data_3 = 0;
WP(w, vp2_d).data_2 = 0;
WP(w, vp2_d).data_3 = 0;
SetWindowDirty(w);
break;
case WE_ON_EDIT_TEXT:
if (e->we.edittext.str[0] != '\0') {
Industry* i = GetIndustry(w->window_number);
int line = WP(w,vp2_d).data_1;
int line = WP(w, vp2_d).data_1;
i->production_rate[line] = clampu(atoi(e->we.edittext.str), 0, 255);
UpdateIndustryProduction(i);
@ -449,9 +449,9 @@ void ShowIndustryViewWindow(int industry)
if (w != NULL) {
w->flags4 |= WF_DISABLE_VP_SCROLL;
WP(w,vp2_d).data_1 = 0;
WP(w,vp2_d).data_2 = 0;
WP(w,vp2_d).data_3 = 0;
WP(w, vp2_d).data_1 = 0;
WP(w, vp2_d).data_2 = 0;
WP(w, vp2_d).data_3 = 0;
AssignWindowViewport(w, 3, 17, 0xFE, 0x56, GetIndustry(w->window_number)->xy + TileDiffXY(1, 1), 1);
}
}
@ -599,7 +599,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, _num_industry_sort);
DrawWindowWidgets(w);
DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10);
DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, 0x10);
p = w->vscroll.pos;
n = 0;
@ -617,13 +617,13 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
SetDParam(4, i->total_production[1]);
SetDParam(5, i->pct_transported[0] * 100 >> 8);
SetDParam(6, i->pct_transported[1] * 100 >> 8);
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0);
DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_TWO, 0);
} else {
SetDParam(3, i->pct_transported[0] * 100 >> 8);
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0);
DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM, 0);
}
} else {
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
}
p++;
if (++n == w->vscroll.cap) break;
@ -633,25 +633,25 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
switch (e->we.click.widget) {
case 3: {
_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
_industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
case 4: {
_industry_sort_order = _industry_sort_order==2 ? 3 : 2;
_industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
case 5: {
_industry_sort_order = _industry_sort_order==4 ? 5 : 4;
_industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;
case 6: {
_industry_sort_order = _industry_sort_order==6 ? 7 : 6;
_industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
_industry_sort_dirty = true;
SetWindowDirty(w);
} break;

View File

@ -76,13 +76,13 @@ uint GetPartialZ(int x, int y, Slope corners)
break;
case SLOPE_S:
y^=0xF;
y ^= 0xF;
if ( (x - y) >= 0)
z = (x - y) >> 1;
break;
case SLOPE_SW:
z = (x>>1) + 1;
z = (x >> 1) + 1;
break;
case SLOPE_E:
@ -97,12 +97,12 @@ uint GetPartialZ(int x, int y, Slope corners)
break;
case SLOPE_SE:
z = (y>>1) + 1;
z = (y >> 1) + 1;
break;
case SLOPE_WSE:
z = 8;
y^=0xF;
y ^= 0xF;
if (x - y < 0)
z += (x - y) >> 1;
break;
@ -114,7 +114,7 @@ uint GetPartialZ(int x, int y, Slope corners)
break;
case SLOPE_NW:
z = (y^0xF)>>1;
z = (y ^ 0xF) >> 1;
break;
case SLOPE_NWS:
@ -124,7 +124,7 @@ uint GetPartialZ(int x, int y, Slope corners)
break;
case SLOPE_NE:
z = (x^0xF)>>1;
z = (x ^ 0xF) >> 1;
break;
case SLOPE_ENW:
@ -141,19 +141,19 @@ uint GetPartialZ(int x, int y, Slope corners)
break;
case SLOPE_STEEP_S:
z = 1 + ((x+y)>>1);
z = 1 + ((x + y) >> 1);
break;
case SLOPE_STEEP_W:
z = 1 + ((x+(y^0xF))>>1);
z = 1 + ((x + (y ^ 0xF)) >> 1);
break;
case SLOPE_STEEP_N:
z = 1 + (((x^0xF)+(y^0xF))>>1);
z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
break;
case SLOPE_STEEP_E:
z = 1 + (((x^0xF)+(y^0xF))>>1);
z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
break;
default: break;
@ -385,8 +385,8 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
int32 cost, ret, money;
int ex;
int ey;
int sx,sy;
int x,y;
int sx, sy;
int x, y;
bool success = false;
if (p1 >= MapSize()) return CMD_ERROR;
@ -435,7 +435,7 @@ int32 CmdClearArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
#define TILELOOP_BITS 4
#define TILELOOP_SIZE (1 << TILELOOP_BITS)
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE - 1) + ((TILELOOP_SIZE - 1) << MapLogX()))
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
void RunTileLoop()

View File

@ -82,9 +82,9 @@ template<typename T> static inline T TOGGLEBIT(T& x, int y)
/* checking more bits. Maybe unneccessary, but easy to use */
#define HASBITS(x,y) ((x) & (y))
#define SETBITS(x,y) ((x) |= (y))
#define CLRBITS(x,y) ((x) &= ~(y))
#define HASBITS(x, y) ((x) & (y))
#define SETBITS(x, y) ((x) |= (y))
#define CLRBITS(x, y) ((x) &= ~(y))
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
#define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))
@ -98,7 +98,7 @@ extern const byte _ffb_64[128];
/* Returns x with the first bit that is not zero, counted from the left, set
* to zero. So, 10110100 returns 10110000, 00000001 returns 00000000, etc.
*/
#define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
#define KILL_FIRST_BIT(x) _ffb_64[(x) + 64]
static inline int FindFirstBit2x64(int value)
{
@ -133,13 +133,13 @@ static inline int KillFirstBit2x64(int value)
#define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0)
/* [min,max), strictly less than */
#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))
#define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))
#define IS_BYTE_INSIDE(a, min, max) ((byte)((a) - (min)) < (byte)((max) - (min)))
#define IS_INT_INSIDE(a, min, max) ((uint)((a) - (min)) < (uint)((max) - (min)))
#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * (a)) / (b)))
#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
#define CHANCE16(a, b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
#define CHANCE16R(a, b, r) ((uint16)(r = Random()) <= (uint16)((65536 * (a)) / (b)))
#define CHANCE16I(a, b, v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
#define for_each_bit(_i, _b) \

View File

@ -86,9 +86,9 @@ TileIndex TileAdd(TileIndex tile, TileIndexDiff add,
#endif
}
assert(TileXY(x,y) == TILE_MASK(tile + add));
assert(TileXY(x, y) == TILE_MASK(tile + add));
return TileXY(x,y);
return TileXY(x, y);
}
#endif
@ -98,7 +98,7 @@ uint ScaleByMapSize(uint n)
/* First shift by 12 to prevent integer overflow for large values of n.
* >>12 is safe since the min mapsize is 64x64
* Add (1<<4)-1 to round upwards. */
return (n * (MapSize() >> 12) + (1<<4) - 1) >> 4;
return (n * (MapSize() >> 12) + (1 << 4) - 1) >> 4;
}
@ -109,7 +109,7 @@ uint ScaleByMapSize1D(uint n)
* Note, not actually taking the full circumference into account,
* just half of it.
* (1<<9) - 1 is there to scale upwards. */
return (n * (MapSizeX() + MapSizeY()) + (1<<9) - 1) >> 9;
return (n * (MapSizeX() + MapSizeY()) + (1 << 9) - 1) >> 9;
}

View File

@ -147,7 +147,7 @@ uint DistanceMaxPlusManhattan(TileIndex, TileIndex); ///< Max + Manhattan
uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
#define BEGIN_TILE_LOOP(var,w,h,tile) \
#define BEGIN_TILE_LOOP(var, w, h, tile) \
{ \
int h_cur = h; \
uint var = tile; \
@ -155,7 +155,7 @@ uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the ma
int w_cur = w; \
do {
#define END_TILE_LOOP(var,w,h,tile) \
#define END_TILE_LOOP(var, w, h, tile) \
} while (++var, --w_cur != 0); \
} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
}

View File

@ -286,7 +286,7 @@ static void Load_NAME()
int index;
while ((index = SlIterateArray()) != -1) {
SlArray(_name_array[index],SlGetFieldLength(),SLE_UINT8);
SlArray(_name_array[index], SlGetFieldLength(), SLE_UINT8);
}
}

View File

@ -1457,7 +1457,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
}
if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
DrawEditBox(w, &WP(w,querystr_d), 10);
DrawEditBox(w, &WP(w, querystr_d), 10);
}
break;
}
@ -1550,7 +1550,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break;
if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked
if (!FiosDelete(WP(w,querystr_d).text.buf)) {
if (!FiosDelete(WP(w, querystr_d).text.buf)) {
ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
} else {
BuildFileList();
@ -1562,7 +1562,7 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
} else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked
_switch_mode = SM_SAVE;
FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name));
FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name));
/* In the editor set up the vehicle engines correctly (date might have changed) */
if (_game_mode == GM_EDITOR) StartupEngines();

View File

@ -207,8 +207,8 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
LowerWindowWidget(w, 4);
DrawWindowWidgets(w);
GfxFillRect(3, 23, 3+177,23+191,0);
GfxFillRect(251, 23, 251+177,23+191,0);
GfxFillRect(3, 23, 3 + 177, 23 + 191, 0);
GfxFillRect(251, 23, 251 + 177, 23 + 191, 0);
DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0);
@ -219,14 +219,14 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
SetDParam(0, i);
SetDParam(2, i);
SetDParam(1, SPECSTR_SONGNAME);
DrawString(4, 23+(i-1)*6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
}
for (i = 0; i != 6; i++) {
DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? 0xC : 0x10);
}
DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0);
DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, 0);
#if 0
DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, 0);
#endif

View File

@ -90,7 +90,7 @@ static byte MakeEnglishAdditionalTownName(char *buf, uint32 seed, const char *la
/* optional first segment */
i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50);
if (i >= 0)
strecat(buf,name_additional_english_prefix[i], last);
strecat(buf, name_additional_english_prefix[i], last);
if (SeedChance(3, 20, seed) >= 14) {
strecat(buf, name_additional_english_1a[SeedChance(6, lengthof(name_additional_english_1a), seed)], last);
@ -176,13 +176,13 @@ static byte MakeGermanTownName(char *buf, uint32 seed, const char *last)
/* optional prefix */
if (seed_derivative == 12 || seed_derivative == 19) {
i = SeedChance(2, lengthof(name_german_pre), seed);
strecat(buf,name_german_pre[i], last);
strecat(buf, name_german_pre[i], last);
}
/* mandatory middle segments including option of hardcoded name */
i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed);
if (i < lengthof(name_german_real)) {
strecat(buf,name_german_real[i], last);
strecat(buf, name_german_real[i], last);
} else {
strecat(buf, name_german_1[i - lengthof(name_german_real)], last);
@ -679,7 +679,7 @@ static byte MakeItalianTownName(char *buf, uint32 seed, const char *last)
if (SeedModChance(3, 3, seed) == 0) {
strecat(buf, name_italian_2[SeedModChance(11, lengthof(name_italian_2), seed)], last);
strecat(buf,mascul_femin_italian[i], last);
strecat(buf, mascul_femin_italian[i], last);
} else {
strecat(buf, name_italian_2i[SeedModChance(16, lengthof(name_italian_2i), seed)], last);
}

View File

@ -161,7 +161,7 @@ typedef unsigned long in_addr_t;
/* Make the names compatible */
# define closesocket(s) CloseSocket(s)
# define GET_LAST_ERROR() Errno()
# define ioctlsocket(s,request,status) IoctlSocket((LONG)s,(ULONG)request,(char*)status)
# define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status)
# define ioctl ioctlsocket
typedef unsigned int in_addr_t;

View File

@ -789,7 +789,7 @@ static void ShowNetworkStartServerWindow()
_saveload_mode = SLD_NEW_GAME;
BuildFileList();
w->vscroll.cap = 12;
w->vscroll.count = _fios_num+1;
w->vscroll.count = _fios_num + 1;
WP(w, network_ql_d).q.afilter = CS_ALPHANUMERAL;
InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160);

View File

@ -1523,7 +1523,7 @@ static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, i
uint32 tempfix = grf_load_dword(&buf);
if (curidx < NUM_CURRENCY) {
memcpy(&_currency_specs[curidx].suffix,&tempfix,4);
memcpy(&_currency_specs[curidx].suffix, &tempfix, 4);
_currency_specs[curidx].suffix[4] = 0;
} else {
grfmsg(1, "GlobalVarChangeInfo: Currency symbol %d out of range, ignoring", curidx);
@ -2796,7 +2796,7 @@ static void FeatureNewName(byte *buf, int len)
case GSF_CANAL :
case GSF_BRIDGE :
AddGRFString(_cur_spriteid, id, lang, name);
switch (GB(id, 8,8)) {
switch (GB(id, 8, 8)) {
case 0xC9: // House name
default:
grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id);

View File

@ -24,7 +24,7 @@ typedef bool ValidationProc ( uint data_a, uint data_b );
typedef void DrawNewsCallbackProc(Window *w);
typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode))
#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode))
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
void NewsLoop();
void DrawNewsBorder(const Window *w);

View File

@ -149,7 +149,7 @@ static byte ReadByte(LoadgameState *ls)
/* Old savegames have a nice compression algorithm (RLE)
which means that we have a chunk, which starts with a length
byte. If that byte is negative, we have to repeat the next byte
that many times (+1). Else, we need to read that amount of bytes.
that many times ( + 1). Else, we need to read that amount of bytes.
Works pretty good if you have many zero's behind eachother */
if (ls->chunk_size == 0) {
@ -433,7 +433,7 @@ static const OldChunks town_chunk[] = {
OCL_SVAR( OC_UINT16, Town, ratings[7] ),
/* XXX - This is pretty odd.. we read 32bit, but only write 8bit.. sure there is
nothing changed?? */
nothing changed ? ? */
OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, have_ratings ),
OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, statues ),
OCL_SVAR( OC_UINT16, Town, num_houses ),
@ -1219,8 +1219,8 @@ static bool LoadOldVehicle(LoadgameState *ls, int num)
static const OldChunks sign_chunk[] = {
OCL_SVAR( OC_UINT16, Sign, str ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, x ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, y ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, x ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, y ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_I8, Sign, z ),
OCL_NULL( 6 ), ///< Width of sign, no longer in use

View File

@ -348,7 +348,7 @@ int ttd_main(int argc, char *argv[])
int i;
const char *optformat;
char musicdriver[32], sounddriver[32], videodriver[32];
int resolution[2] = {0,0};
int resolution[2] = {0, 0};
Year startyear = INVALID_YEAR;
uint generation_seed = GENERATE_NEW_SEED;
bool save_config = true;
@ -379,7 +379,7 @@ int ttd_main(int argc, char *argv[])
#endif
;
MyGetOptData mgo(argc-1, argv+1, optformat);
MyGetOptData mgo(argc - 1, argv + 1, optformat);
while ((i = MyGetOpt(&mgo)) != -1) {
switch (i) {

View File

@ -821,7 +821,7 @@ start_at:
}
/* If we reach here, the tile has exactly one track, and this
track is reachable => Rail segment continues */
track is reachable = > Rail segment continues */
track = _new_trackdir[FIND_FIRST_BIT(bits)][direction];
assert(track != INVALID_TRACKDIR);

View File

@ -29,7 +29,7 @@ static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_sti
static void DrawPlayerEconomyStats(const Player *p, byte mode)
{
int x,y,i,j,year;
int x, y, i, j, year;
const int64 (*tbl)[13];
int64 sum, cost;
StringID str;
@ -38,8 +38,8 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
/* draw categories */
DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
for (i = 0; i != 13; i++)
DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, 0);
DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, 0);
/* draw the price columns */
year = _cur_year - 2;
@ -60,16 +60,16 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
str = STR_701E;
if (cost < 0) { cost = -cost; str++; }
SetDParam64(0, cost);
DrawStringRightAligned(x, 27+i*10, str, 0);
DrawStringRightAligned(x, 27 + i * 10, str, 0);
}
}
str = STR_701E;
if (sum < 0) { sum = -sum; str++; }
SetDParam64(0, sum);
DrawStringRightAligned(x, 27 + 13*10 + 2, str, 0);
DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0);
GfxFillRect(x - 75, 27 + 10*13, x, 27 + 10*13, 215);
GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215);
x += 95;
}
year++;
@ -80,7 +80,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
/* draw max loan aligned to loan below (y += 10) */
SetDParam64(0, (uint64)_economy.max_loan);
DrawString(202, y+10, STR_MAX_LOAN, 0);
DrawString(202, y + 10, STR_MAX_LOAN, 0);
} else {
y = 15;
}
@ -97,7 +97,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
y += 12;
GfxFillRect(182 - 75, y-2, 182, y-2, 215);
GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
SetDParam64(0, p->money64 - p->current_loan);
DrawStringRightAligned(182, y, STR_7028, 0);
@ -166,13 +166,13 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
SetDParam(4, 10000);
DrawWindowWidgets(w);
DrawPlayerEconomyStats(p, (byte)WP(w,def_d).data_1);
DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
} break;
case WE_CLICK:
switch (e->we.click.widget) {
case 2: {/* toggle size */
byte mode = (byte)WP(w,def_d).data_1;
byte mode = (byte)WP(w, def_d).data_1;
bool stickied = !!(w->flags4 & WF_STICKY);
PlayerID player = (PlayerID)w->window_number;
DeleteWindow(w);
@ -239,7 +239,7 @@ static void DoShowPlayerFinances(PlayerID player, bool show_small, bool show_sti
w = AllocateWindowDescFront(desc_table[mode], player);
if (w != NULL) {
w->caption_color = w->window_number;
WP(w,def_d).data_1 = mode;
WP(w, def_d).data_1 = mode;
if (show_stickied) w->flags4 |= WF_STICKY;
}
}
@ -554,14 +554,14 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
DrawWindowWidgets(w);
p = GetPlayer((PlayerID)w->window_number);
DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
DrawPlayerFace(WP(w, facesel_d).face, p->player_color, 2, 16);
} break;
case WE_CLICK:
switch (e->we.click.widget) {
case 3: DeleteWindow(w); break;
case 4: /* ok click */
DoCommandP(0, 0, WP(w,facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
DoCommandP(0, 0, WP(w, facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
DeleteWindow(w);
break;
case 5: /* male click */
@ -572,7 +572,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
SetWindowDirty(w);
break;
case 7:
WP(w,facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
WP(w, facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
SetWindowDirty(w);
break;
}
@ -656,8 +656,8 @@ static void DrawPlayerVehiclesAmount(PlayerID player)
}
}
if (train+road+air+ship == 0) {
DrawString(x+70, y, STR_7042_NONE, 0);
if (train + road + air + ship == 0) {
DrawString(x + 70, y, STR_7042_NONE, 0);
} else {
if (train != 0) {
SetDParam(0, train);
@ -762,7 +762,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
DrawPlayerVehiclesAmount((PlayerID)w->window_number);
DrawString(110,48, STR_7006_COLOR_SCHEME, 0);
DrawString(110, 48, STR_7006_COLOR_SCHEME, 0);
/* Draw company-colour bus */
DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49);
@ -786,8 +786,8 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
Window *wf = AllocateWindowDescFront(&_select_player_face_desc, w->window_number);
if (wf != NULL) {
wf->caption_color = w->window_number;
WP(wf,facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
WP(wf,facesel_d).gender = 0;
WP(wf, facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
WP(wf, facesel_d).gender = 0;
}
break;
}
@ -796,8 +796,8 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
Window *wf = AllocateWindowDescFront(_have_2cc ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number);
if (wf != NULL) {
wf->caption_color = wf->window_number;
WP(wf,livery_d).livery_class = LC_OTHER;
WP(wf,livery_d).sel = 1;
WP(wf, livery_d).livery_class = LC_OTHER;
WP(wf, livery_d).sel = 1;
LowerWindowWidget(wf, 2);
}
break;
@ -813,7 +813,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
case PCW_WIDGET_COMPANY_NAME: {
Player *p = GetPlayer((PlayerID)w->window_number);
WP(w,def_d).byte_1 = 1;
WP(w, def_d).byte_1 = 1;
SetDParam(0, p->name_2);
ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
break;
@ -852,7 +852,7 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
#ifdef ENABLE_NETWORK
case PCW_WIDGET_COMPANY_PASSWORD:
if (w->window_number == _local_player) {
WP(w,def_d).byte_1 = 2;
WP(w, def_d).byte_1 = 2;
ShowQueryString(BindCString(_network_player_info[_local_player].password),
STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w, CS_ALPHANUMERAL);
}
@ -885,10 +885,10 @@ static void PlayerCompanyWndProc(Window *w, WindowEvent *e)
char *b = e->we.edittext.str;
/* empty string is allowed for password */
if (*b == '\0' && WP(w,def_d).byte_1 != 2) return;
if (*b == '\0' && WP(w, def_d).byte_1 != 2) return;
_cmd_text = b;
switch (WP(w,def_d).byte_1) {
switch (WP(w, def_d).byte_1) {
case 0: /* Change president name */
DoCommandP(0, 0, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT));
break;

View File

@ -68,8 +68,8 @@ extern const TrackBits _track_crosses_tracks[] = {
/* Maps a trackdir to the (4-way) direction the tile is exited when following
* that trackdir */
extern const DiagDirection _trackdir_to_exitdir[] = {
DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_SW,DIAGDIR_SE, DIAGDIR_NE,DIAGDIR_NE,
DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NW,DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NE,
DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE,
DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
};
extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {

View File

@ -60,10 +60,10 @@ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, bool *ed
/* Get a bitmask of which neighbouring roads has a tile */
n = ROAD_NONE;
present = GetAnyRoadBits(tile);
if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile,-1, 0)) & ROAD_SW) n |= ROAD_NE;
if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile, -1, 0)) & ROAD_SW) n |= ROAD_NE;
if (present & ROAD_SE && GetAnyRoadBits(TILE_ADDXY(tile, 0, 1)) & ROAD_NW) n |= ROAD_SE;
if (present & ROAD_SW && GetAnyRoadBits(TILE_ADDXY(tile, 1, 0)) & ROAD_NE) n |= ROAD_SW;
if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0,-1)) & ROAD_SE) n |= ROAD_NW;
if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0, -1)) & ROAD_SE) n |= ROAD_NW;
/* If 0 or 1 bits are set in n, or if no bits that match the bits to remove,
* then allow it */
@ -431,7 +431,7 @@ int32 CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
TileIndex t = start_tile;
start_tile = end_tile;
end_tile = t;
p2 ^= IS_INT_INSIDE(p2&3, 1, 3) ? 3 : 0;
p2 ^= IS_INT_INSIDE(p2 & 3, 1, 3) ? 3 : 0;
}
cost = 0;

View File

@ -257,11 +257,11 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
InvalidateWidget(w, RTW_REMOVE);
w = FindWindowById(WC_BUS_STATION, 0);
if (w != NULL) WP(w,def_d).close = true;
if (w != NULL) WP(w, def_d).close = true;
w = FindWindowById(WC_TRUCK_STATION, 0);
if (w != NULL) WP(w,def_d).close = true;
if (w != NULL) WP(w, def_d).close = true;
w = FindWindowById(WC_BUILD_DEPOT, 0);
if (w != NULL) WP(w,def_d).close = true;
if (w != NULL) WP(w, def_d).close = true;
break;
case WE_PLACE_DRAG: {
@ -414,11 +414,11 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
} break;
case WE_MOUSELOOP:
if (WP(w,def_d).close) DeleteWindow(w);
if (WP(w, def_d).close) DeleteWindow(w);
break;
case WE_DESTROY:
if (!WP(w,def_d).close) ResetObjectToPlace();
if (!WP(w, def_d).close) ResetObjectToPlace();
break;
}
}
@ -458,7 +458,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
case WE_PAINT: {
int image;
if (WP(w,def_d).close) return;
if (WP(w, def_d).close) return;
DrawWindowWidgets(w);
@ -472,9 +472,9 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE;
StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, image);
StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image+1);
StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image+2);
StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image+3);
StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image + 1);
StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image + 2);
StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image + 3);
image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT;
@ -482,7 +482,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, image + 1);
DrawStationCoverageAreaText(2, 146,
((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)),
((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)),
3);
} break;
@ -507,7 +507,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_MOUSELOOP: {
if (WP(w,def_d).close) {
if (WP(w, def_d).close) {
DeleteWindow(w);
return;
}
@ -516,7 +516,7 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
} break;
case WE_DESTROY:
if (!WP(w,def_d).close) ResetObjectToPlace();
if (!WP(w, def_d).close) ResetObjectToPlace();
break;
}
}

View File

@ -168,11 +168,11 @@ int32 CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
v->x_pos = x;
v->y_pos = y;
v->z_pos = GetSlopeZ(x,y);
v->z_pos = GetSlopeZ(x, y);
v->z_height = 6;
v->u.road.state = RVSB_IN_DEPOT;
v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
v->spritenum = rvi->image_index;
v->cargo_type = rvi->cargo_type;

View File

@ -251,14 +251,14 @@ static void SlWriteSimpleGamma(uint i)
if (i >= (1 << 14)) {
if (i >= (1 << 21)) {
assert(i < (1 << 28));
SlWriteByte((byte)0xE0 | (i>>24));
SlWriteByte((byte)(i>>16));
SlWriteByte((byte)0xE0 | (i >> 24));
SlWriteByte((byte)(i >> 16));
} else {
SlWriteByte((byte)0xC0 | (i>>16));
SlWriteByte((byte)0xC0 | (i >> 16));
}
SlWriteByte((byte)(i>>8));
SlWriteByte((byte)(i >> 8));
} else {
SlWriteByte((byte)(0x80 | (i>>8)));
SlWriteByte((byte)(0x80 | (i >> 8)));
}
}
SlWriteByte(i);
@ -925,7 +925,7 @@ static const ChunkHandler *SlFindChunkHandler(uint32 id)
{
const ChunkHandler *ch;
const ChunkHandler *const *chsc;
for (chsc = _sl.chs; (ch=*chsc++) != NULL;) {
for (chsc = _sl.chs; (ch = *chsc++) != NULL;) {
for (;;) {
if (ch->id == id) return ch;
if (ch->flags & CH_LAST) break;
@ -1030,7 +1030,7 @@ static void WriteNoComp(uint size)
static bool InitNoComp()
{
_sl.bufsize = LZO_SIZE;
_sl.buf = _sl.buf_ori =(byte*)malloc(LZO_SIZE);
_sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE);
return true;
}

View File

@ -268,7 +268,7 @@ struct PcxHeader {
uint32 unused;
uint16 xmax, ymax;
uint16 hdpi, vdpi;
byte pal_small[16*3];
byte pal_small[16 * 3];
byte reserved;
byte planes;
uint16 pitch;

View File

@ -1140,15 +1140,15 @@ static int32 CheckInterval(int32 p1)
const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
if (p1) {
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 5, 90+1) || ptc->servint_trains == 0) &&
(IS_INT_INSIDE(ptc->servint_roadveh, 5, 90+1) || ptc->servint_roadveh == 0) &&
(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90+1) || ptc->servint_aircraft == 0) &&
(IS_INT_INSIDE(ptc->servint_ships, 5, 90+1) || ptc->servint_ships == 0) );
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) &&
(IS_INT_INSIDE(ptc->servint_roadveh, 5, 90 + 1) || ptc->servint_roadveh == 0) &&
(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
(IS_INT_INSIDE(ptc->servint_ships, 5, 90 + 1) || ptc->servint_ships == 0) );
} else {
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 30, 800+1) || ptc->servint_trains == 0) &&
(IS_INT_INSIDE(ptc->servint_roadveh, 30, 800+1) || ptc->servint_roadveh == 0) &&
(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800+1) || ptc->servint_aircraft == 0) &&
(IS_INT_INSIDE(ptc->servint_ships, 30, 800+1) || ptc->servint_ships == 0) );
warning = ( (IS_INT_INSIDE(ptc->servint_trains, 30, 800 + 1) || ptc->servint_trains == 0) &&
(IS_INT_INSIDE(ptc->servint_roadveh, 30, 800 + 1) || ptc->servint_roadveh == 0) &&
(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
(IS_INT_INSIDE(ptc->servint_ships, 30, 800 + 1) || ptc->servint_ships == 0) );
}
if (!warning)
@ -1280,7 +1280,7 @@ static const SettingDesc _gameopt_settings[] = {
* and why not byte for example? */
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 0, 3),
SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 4, SL_MAX_VERSION),
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 0, 0, 3, 0, STR_NULL, NULL),
SDT_VAR(GameOptions, diff_level, SLE_UINT8, 0, 0, 0, 0, 3, 0, STR_NULL, NULL),
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
@ -1527,7 +1527,7 @@ const SettingDesc _patch_settings[] = {
static const SettingDesc _currency_settings[] = {
SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, 100, 0, STR_NULL, NULL),
SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL),
SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, 0,3000, 0, STR_NULL, NULL),
SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, 0, 3000, 0, STR_NULL, NULL),
SDT_STR(CurrencySpec, prefix, SLE_STRBQ, S, 0, NULL, STR_NULL, NULL),
SDT_STR(CurrencySpec, suffix, SLE_STRBQ, S, 0, " credits", STR_NULL, NULL),
SDT_END()

View File

@ -551,7 +551,7 @@ static inline NPFFoundTargetData PerfNPFRouteToStationOrTile(TileIndex tile, Tra
* direction in which we are entering the tile */
static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
{
assert(enterdir>=0 && enterdir<=3);
assert(enterdir >= 0 && enterdir <= 3);
if (_patches.yapf.ship_use_yapf) {
Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
@ -654,11 +654,11 @@ static const byte _ship_subcoord[4][6][3] = {
},
{
{ 0, 0, 0},
{ 8,15, 7},
{ 8, 15, 7},
{ 0, 0, 0},
{ 8,15, 6},
{ 8, 15, 6},
{ 0, 0, 0},
{ 7,15, 0},
{ 7, 15, 0},
}
};
@ -880,7 +880,7 @@ int32 CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
v->x_pos = x;
v->y_pos = y;
v->z_pos = GetSlopeZ(x,y);
v->z_pos = GetSlopeZ(x, y);
v->z_height = 6;
v->sprite_width = 6;

View File

@ -78,7 +78,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
{
SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service);
DrawString(13, 102, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
DrawString(13, 102, _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0);
}
DrawShipImage(v, 3, 57, INVALID_VEHICLE);
@ -120,7 +120,7 @@ static void ShipDetailsWndProc(Window *w, WindowEvent *e)
mod = _ctrl_pressed? 5 : 10;
goto do_change_service_int;
case 6: /* decrease int */
mod = _ctrl_pressed?- 5 : -10;
mod = _ctrl_pressed ? - 5 : -10;
do_change_service_int:
v = GetVehicle(w->window_number);
@ -157,7 +157,7 @@ static const Widget _ship_details_widgets[] = {
static const WindowDesc _ship_details_desc = {
WDP_AUTO, WDP_AUTO, 405, 113,
WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW,
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
_ship_details_widgets,
ShipDetailsWndProc
@ -326,7 +326,7 @@ static const Widget _ship_view_widgets[] = {
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_SEND_SHIP_TODEPOT, STR_982A_SEND_SHIP_TO_DEPOT},
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, SPR_REFIT_VEHICLE, STR_983A_REFIT_CARGO_SHIP_TO_CARRY},
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, SPR_SHOW_ORDERS, STR_9828_SHOW_SHIP_S_ORDERS},
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, SPR_SHOW_VEHICLE_DETAILS,STR_982B_SHOW_SHIP_DETAILS},
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, SPR_SHOW_VEHICLE_DETAILS, STR_982B_SHOW_SHIP_DETAILS},
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_CLONE_SHIP, STR_CLONE_SHIP_INFO},
{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL },
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL },

View File

@ -136,7 +136,7 @@ int32 CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
si->x = x;
si->y = y;
si->owner = _current_player; // owner of the sign; just eyecandy
si->z = GetSlopeZ(x,y);
si->z = GetSlopeZ(x, y);
UpdateSignVirtCoords(si);
MarkSignDirty(si);
InvalidateWindow(WC_SIGN_LIST, 0);

View File

@ -199,7 +199,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
Station *s;
FOR_ALL_STATIONS(s) {
if (s != st && s->town==t) {
if (s != st && s->town == t) {
uint str = M(s->string_id);
if (str <= 0x20) {
if (str == M(STR_SV_STNAME_FOREST))
@ -230,7 +230,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
}
/* check close enough to town to get central as name? */
if (DistanceMax(tile,t->xy) < 8) {
if (DistanceMax(tile, t->xy) < 8) {
found = M(STR_SV_STNAME);
if (HASBIT(free_names, M(STR_SV_STNAME))) goto done;
@ -272,10 +272,10 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
/* check direction compared to town */
{
static const int8 _direction_and_table[] = {
~( (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) ),
~( (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
};
free_names &= _direction_and_table[
@ -283,7 +283,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
(TileY(tile) < TileY(t->xy)) * 2];
}
tmp = free_names & ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<12)|(1<<26)|(1<<27)|(1<<28)|(1<<29)|(1<<30));
tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30));
if (tmp == 0) {
_error_message = STR_3007_TOO_MANY_STATIONS_LOADING;
return false;
@ -368,7 +368,7 @@ static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *c
}
SetDParam(0, st->index);
AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
}
// Get a list of the cargo types being produced around the tile.
@ -646,10 +646,10 @@ int32 CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint invali
int flat_z = z;
if (tileh != SLOPE_FLAT) {
// need to check so the entrance to the station is not pointing at a slope.
if ((invalid_dirs&1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
(invalid_dirs&2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
(invalid_dirs&4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
(invalid_dirs&8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
if ((invalid_dirs & 1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
(invalid_dirs & 2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
(invalid_dirs & 4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
(invalid_dirs & 8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
}
cost += _price.terraform;
@ -748,7 +748,7 @@ static inline byte *CreateSingle(byte *layout, int n)
{
int i = n;
do *layout++ = 0; while (--i);
layout[((n-1) >> 1)-n] = 2;
layout[((n - 1) >> 1) - n] = 2;
return layout;
}
@ -757,8 +757,8 @@ static inline byte *CreateMulti(byte *layout, int n, byte b)
int i = n;
do *layout++ = b; while (--i);
if (n > 4) {
layout[0-n] = 0;
layout[n-1-n] = 0;
layout[0 - n] = 0;
layout[n - 1 - n] = 0;
}
return layout;
}
@ -1623,7 +1623,7 @@ static int32 RemoveAirport(Station *st, uint32 flags)
DeleteAnimatedTile(tile_cur);
DoClearSquare(tile_cur);
}
} END_TILE_LOOP(tile_cur, w,h,tile)
} END_TILE_LOOP(tile_cur, w, h, tile)
if (flags & DC_EXEC) {
for (uint i = 0; i < afc->nof_depots; ++i) {

View File

@ -730,7 +730,7 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name)
{
ParsedCommandStruct templ;
ParsedCommandStruct lang;
int i,j;
int i, j;
bool result = true;
ExtractCommandString(&templ, b, true);
@ -914,7 +914,7 @@ static void ParseFile(const char *file, bool english)
in = fopen(file, "r");
if (in == NULL) fatal("Cannot open file");
_cur_line = 1;
while (fgets(buf, sizeof(buf),in) != NULL) {
while (fgets(buf, sizeof(buf), in) != NULL) {
rstrip(buf);
HandleString(buf, english);
_cur_line++;

View File

@ -63,7 +63,7 @@ static inline int64 GetInt64(const int32 **argv)
assert(argv);
result = (uint32)(*argv)[0] + ((uint64)(uint32)(*argv)[1] << 32);
(*argv)+=2;
(*argv) += 2;
return result;
}
@ -421,37 +421,37 @@ static int DeterminePluralForm(int32 n)
* Used in:
* Latvian */
case 3:
return n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
return n%10 == 1 && n%100 != 11 ? 0 : n != 0 ? 1 : 2;
/* Three forms, special case for one and two
* Used in:
* Gaelige (Irish) */
case 4:
return n==1 ? 0 : n==2 ? 1 : 2;
return n == 1 ? 0 : n == 2 ? 1 : 2;
/* Three forms, special case for numbers ending in 1[2-9]
* Used in:
* Lithuanian */
case 5:
return n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
return n%10 == 1 && n%100 != 11 ? 0 : n%10 >= 2 && (n%100<10 || n%100 >= 20) ? 1 : 2;
/* Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
* Used in:
* Croatian, Czech, Russian, Slovak, Ukrainian */
case 6:
return n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
return n%10 == 1 && n%100 != 11 ? 0 : n%10 >= 2 && n%10 <= 4 && (n%100<10 || n%100 >= 20) ? 1 : 2;
/* Three forms, special case for one and some numbers ending in 2, 3, or 4
* Used in:
* Polish */
case 7:
return n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
return n == 1 ? 0 : n%10 >= 2 && n%10 <= 4 && (n%100<10 || n%100 >= 20) ? 1 : 2;
/* Four forms, special case for one and all numbers ending in 02, 03, or 04
* Used in:
* Slovenian */
case 8:
return n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
return n%100 == 1 ? 0 : n%100 == 2 ? 1 : n%100 == 3 || n%100 == 4 ? 2 : 3;
}
}
@ -459,7 +459,7 @@ static const char *ParseStringChoice(const char *b, uint form, char *dst, int *d
{
//<NUM> {Length of each string} {each string}
uint n = (byte)*b++;
uint pos,i, mylen=0,mypos=0;
uint pos, i, mylen = 0, mypos = 0;
for (i = pos = 0; i != n; i++) {
uint len = (byte)*b++;

View File

@ -21,7 +21,7 @@ struct AiDefaultRoadBlock {
};
#define MKHDR(a,b,c,d,e) a,b,c,d,e,
#define MKHDR(a, b, c, d, e) a, b, c, d, e,
#define MKDEPOT(a, b, c) {0, a, {b, c}}
#define MKSTATION(a, b, c) {1, a, {b, c}}
#define MKRAIL(a, b, c) {2, a, {b, c}}
@ -424,17 +424,17 @@ static const AiDefaultRailBlock * const _default_rail_track_data[] = {
#undef MKHDR
#define MKHDR(a) a,{
#define MKHDR(a) a, {
static const AiDefaultBlockData _roaddata_ai_0_data[] = {
MKDEPOT(2, -1,1),
MKSTATION(0x2, -1,0),
MKRAIL(0xC, 0,0),
MKRAIL(0x9, 0,1),
MKCLRRAIL(0, 0,-1),
MKCLRRAIL(0, 1,0),
MKCLRRAIL(0, 1,1),
MKCLRRAIL(0, 0,2),
MKDEPOT(2, -1, 1),
MKSTATION(0x2, -1, 0),
MKRAIL(0xC, 0, 0),
MKRAIL(0x9, 0, 1),
MKCLRRAIL(0, 0, -1),
MKCLRRAIL(0, 1, 0),
MKCLRRAIL(0, 1, 1),
MKCLRRAIL(0, 0, 2),
MKEND
};
@ -443,14 +443,14 @@ static const AiDefaultRoadBlock _roaddata_ai_0 = {
};
static const AiDefaultBlockData _roaddata_ai_1_data[] = {
MKDEPOT(1, 0,-1),
MKSTATION(0x1, 1,-1),
MKRAIL(0x3, 0,0),
MKRAIL(0x9, 1,0),
MKCLRRAIL(0, -1,0),
MKCLRRAIL(0, 0,1),
MKCLRRAIL(0, 1,1),
MKCLRRAIL(0, 2,0),
MKDEPOT(1, 0, -1),
MKSTATION(0x1, 1, -1),
MKRAIL(0x3, 0, 0),
MKRAIL(0x9, 1, 0),
MKCLRRAIL(0, -1, 0),
MKCLRRAIL(0, 0, 1),
MKCLRRAIL(0, 1, 1),
MKCLRRAIL(0, 2, 0),
MKEND
};
@ -459,14 +459,14 @@ static const AiDefaultRoadBlock _roaddata_ai_1 = {
};
static const AiDefaultBlockData _roaddata_ai_2_data[] = {
MKDEPOT(3, 1,1),
MKSTATION(0x3, 0,1),
MKRAIL(0x6, 0,0),
MKRAIL(0xC, 1,0),
MKCLRRAIL(0, -1,0),
MKCLRRAIL(0, 0,-1),
MKCLRRAIL(0, 1,-1),
MKCLRRAIL(0, 2,0),
MKDEPOT(3, 1, 1),
MKSTATION(0x3, 0, 1),
MKRAIL(0x6, 0, 0),
MKRAIL(0xC, 1, 0),
MKCLRRAIL(0, -1, 0),
MKCLRRAIL(0, 0, -1),
MKCLRRAIL(0, 1, -1),
MKCLRRAIL(0, 2, 0),
MKEND
};
@ -475,14 +475,14 @@ static const AiDefaultRoadBlock _roaddata_ai_2 = {
};
static const AiDefaultBlockData _roaddata_ai_3_data[] = {
MKDEPOT(0, 1,0),
MKSTATION(0x0, 1,1),
MKRAIL(0x6, 0,0),
MKRAIL(0x3, 0,1),
MKCLRRAIL(0, 0,-1),
MKCLRRAIL(0, -1,0),
MKCLRRAIL(0, -1,1),
MKCLRRAIL(0, 0,2),
MKDEPOT(0, 1, 0),
MKSTATION(0x0, 1, 1),
MKRAIL(0x6, 0, 0),
MKRAIL(0x3, 0, 1),
MKCLRRAIL(0, 0, -1),
MKCLRRAIL(0, -1, 0),
MKCLRRAIL(0, -1, 1),
MKCLRRAIL(0, 0, 2),
MKEND
};
@ -491,11 +491,11 @@ static const AiDefaultRoadBlock _roaddata_ai_3 = {
};
static const AiDefaultBlockData _roaddata_ai_4_data[] = {
MKSTATION(0x2, -1,0),
MKRAIL(0x8, 0,0),
MKCLRRAIL(0, 0,-1),
MKCLRRAIL(0, 1,0),
MKCLRRAIL(0, 0,1),
MKSTATION(0x2, -1, 0),
MKRAIL(0x8, 0, 0),
MKCLRRAIL(0, 0, -1),
MKCLRRAIL(0, 1, 0),
MKCLRRAIL(0, 0, 1),
MKEND
};
@ -504,11 +504,11 @@ static const AiDefaultRoadBlock _roaddata_ai_4 = {
};
static const AiDefaultBlockData _roaddata_ai_5_data[] = {
MKSTATION(0x3, 0,1),
MKRAIL(0x4, 0,0),
MKCLRRAIL(0, -1,0),
MKCLRRAIL(0, 0,-1),
MKCLRRAIL(0, 1,0),
MKSTATION(0x3, 0, 1),
MKRAIL(0x4, 0, 0),
MKCLRRAIL(0, -1, 0),
MKCLRRAIL(0, 0, -1),
MKCLRRAIL(0, 1, 0),
MKEND
};
@ -517,11 +517,11 @@ static const AiDefaultRoadBlock _roaddata_ai_5 = {
};
static const AiDefaultBlockData _roaddata_ai_6_data[] = {
MKSTATION(0x0, 1,1),
MKRAIL(0x2, 0,1),
MKCLRRAIL(0, 0,0),
MKCLRRAIL(0, -1,0),
MKCLRRAIL(0, 0,2),
MKSTATION(0x0, 1, 1),
MKRAIL(0x2, 0, 1),
MKCLRRAIL(0, 0, 0),
MKCLRRAIL(0, -1, 0),
MKCLRRAIL(0, 0, 2),
MKEND
};
@ -530,11 +530,11 @@ static const AiDefaultRoadBlock _roaddata_ai_6 = {
};
static const AiDefaultBlockData _roaddata_ai_7_data[] = {
MKSTATION(0x1, 1,-1),
MKRAIL(0x1, 1,0),
MKCLRRAIL(0, 0,0),
MKCLRRAIL(0, 1,1),
MKCLRRAIL(0, 2,0),
MKSTATION(0x1, 1, -1),
MKRAIL(0x1, 1, 0),
MKCLRRAIL(0, 0, 0),
MKCLRRAIL(0, 1, 1),
MKCLRRAIL(0, 2, 0),
MKEND
};

File diff suppressed because it is too large Load Diff

View File

@ -1931,7 +1931,7 @@ static const char *name_czech_suffix[] = {
static const char *name_romanian_real[]= {
static const char *name_romanian_real[] = {
"Adjud",
"Alba Iulia",
"Alexandria",

View File

@ -34,7 +34,7 @@ static const DrawTileSeqStruct _station_display_datas_4[] = {
{ 0, 0, 0, 16, 5, 7, SPR_RAIL_PLATFORM_PILLARS_X_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 11, 0, 16, 5, 2, SPR_RAIL_PLATFORM_X_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0,(byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_X_TILE_A | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
{ 0, 0, (byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_X_TILE_A | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
TILE_SEQ_END()
};
@ -42,7 +42,7 @@ static const DrawTileSeqStruct _station_display_datas_5[] = {
{ 0, 0, 0, 5, 16, 2, SPR_RAIL_PLATFORM_PILLARS_Y_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 11, 0, 0, 5, 16, 2, SPR_RAIL_PLATFORM_Y_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0,(byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_Y_TILE_A | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
{ 0, 0, (byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_Y_TILE_A | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
TILE_SEQ_END()
};
@ -50,7 +50,7 @@ static const DrawTileSeqStruct _station_display_datas_6[] = {
{ 0, 0, 0, 16, 5, 2, SPR_RAIL_PLATFORM_X_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 11, 0, 16, 5, 2, SPR_RAIL_PLATFORM_PILLARS_X_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_B | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0,(byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_X_TILE_B | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
{ 0, 0, (byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_X_TILE_B | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
TILE_SEQ_END()
};
@ -58,7 +58,7 @@ static const DrawTileSeqStruct _station_display_datas_7[] = {
{ 0, 0, 0, 5, 16, 2, SPR_RAIL_PLATFORM_Y_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 11, 0, 0, 5, 16, 2, SPR_RAIL_PLATFORM_PILLARS_Y_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_B | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
{ 0, 0,(byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_Y_TILE_B | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
{ 0, 0, (byte)0x80, 0, 0, 0, SPR_RAIL_ROOF_GLASS_Y_TILE_B | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
TILE_SEQ_END()
};

View File

@ -25,7 +25,7 @@ static const TreePos _tree_layout_xy[][4] = {
{ { 3, 9 }, { 8, 2 }, { 9, 9 }, { 1, 5 } }
};
static const PalSpriteID _tree_layout_sprite[164+(79-48+1)][4] = {
static const PalSpriteID _tree_layout_sprite[164 + (79 - 48 + 1)][4] = {
{ { 0x652, PAL_NONE }, { 0x659, PAL_NONE }, { 0x660, PAL_NONE }, { 0x667, PAL_NONE } }, /* 0 */
{ { 0x652, PAL_NONE }, { 0x667, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x675, PAL_NONE } }, /* 1 */
{ { 0x652, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x659, PAL_NONE }, { 0x675, PAL_NONE } }, /* 2 */

View File

@ -273,7 +273,7 @@ static const Widget _terraform_widgets[] = {
};
static const WindowDesc _terraform_desc = {
WDP_ALIGN_TBR, 22+36, 158, 36,
WDP_ALIGN_TBR, 22 + 36, 158, 36,
WC_SCEN_LAND_GEN, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
_terraform_widgets,

View File

@ -246,9 +246,9 @@ static bool IsCloseToTown(TileIndex tile, uint dist)
static void MarkTownSignDirty(Town *t)
{
MarkAllViewportsDirty(
t->sign.left-6,
t->sign.top-3,
t->sign.left+t->sign.width_1*4+12,
t->sign.left - 6,
t->sign.top - 3,
t->sign.left + t->sign.width_1 * 4 + 12,
t->sign.top + 45
);
}
@ -530,10 +530,10 @@ static bool IsRoadAllowedHere(TileIndex tile, int dir)
no_slope:
/* Tile has no slope
* Disallow the road if any neighboring tile has a road. */
if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]))), dir^2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]))), dir^2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir))
if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]))), dir ^ 2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]))), dir ^ 2) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir) ||
HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir))
return false;
/* Otherwise allow */
@ -644,7 +644,7 @@ static void GrowTownInTile(TileIndex* tile_ptr, RoadBits mask, int block, Town*
}
rcmd = (RoadBits)((1 << a) + (1 << b));
} else if (block < 5 && !HASBIT(mask,block^2)) {
} else if (block < 5 && !HASBIT(mask, block ^ 2)) {
/* Continue building on a partial road.
* Always OK. */
_grow_town_result = 0;
@ -771,7 +771,7 @@ static int GrowTownAtRoad(Town *t, TileIndex tile)
/* Select a random bit from the blockmask, walk a step
* and continue the search from there. */
do block = Random() & 3; while (!HASBIT(mask,block));
do block = Random() & 3; while (!HASBIT(mask, block));
tile += ToTileIndexDiff(_roadblock_tileadd[block]);
if (IsTileType(tile, MP_STREET)) {

View File

@ -2988,7 +2988,7 @@ static void TrainController(Vehicle *v, bool update_image)
} else if (HasSignalOnTrackdir(gp.new_tile, i)) {
v->cur_speed = 0;
v->subspeed = 0;
v->progress = 255-10;
v->progress = 255 - 10;
if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) {
TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
VehicleAtSignalData vasd;

View File

@ -317,7 +317,7 @@ int32 CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
struct TreeListEnt {
SpriteID image;
SpriteID pal;
byte x,y;
byte x, y;
};
static void DrawTile_Trees(TileInfo *ti)

View File

@ -390,8 +390,8 @@ void SetDParamStr(uint n, const char *str);
StringID BindCString(const char *str);
#define COPY_IN_DPARAM(offs,src,num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
#define COPY_OUT_DPARAM(dst,offs,num) memcpy(dst,_decode_parameters + offs, sizeof(uint32) * (num))
#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint32) * (num))
#define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;

View File

@ -188,9 +188,9 @@ Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z, bool without_c
}
FOR_ALL_VEHICLES(veh) {
if (without_crashed && (veh->vehstatus & VS_CRASHED) != 0) continue;
if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z==0xFF || veh->z_pos == z)) {
if ((veh->x_pos>>4) >= x1 && (veh->x_pos>>4) <= x2 &&
(veh->y_pos>>4) >= y1 && (veh->y_pos>>4) <= y2) {
if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z == 0xFF || veh->z_pos == z)) {
if ((veh->x_pos >> 4) >= x1 && (veh->x_pos >> 4) <= x2 &&
(veh->y_pos >> 4) >= y1 && (veh->y_pos >> 4) <= y2) {
return veh;
}
}
@ -421,7 +421,7 @@ static void UpdateVehiclePosHash(Vehicle* v, int x, int y)
int old_x = v->left_coord;
int old_y = v->top_coord;
new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x,y)];
new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x, y)];
old_hash = (old_x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(old_x, old_y)];
if (old_hash == new_hash) return;

View File

@ -343,16 +343,16 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
SetDParam(1, v->unitnumber);
DrawWindowWidgets(w);
WP(w,refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
WP(w, refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
if (WP(w,refit_d).cargo != NULL) {
if (WP(w, refit_d).cargo != NULL) {
int32 cost;
cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8,
cost = DoCommand(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8,
DC_QUERY_COST, GetCmdRefitVeh(GetVehicle(w->window_number)->type));
if (!CmdFailed(cost)) {
SetDParam(0, WP(w,refit_d).cargo->cargo);
SetDParam(0, WP(w, refit_d).cargo->cargo);
SetDParam(1, _returned_refit_capacity);
SetDParam(2, cost);
DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
@ -365,12 +365,12 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
case 3: { // listbox
int y = e->we.click.pt.y - w->widget[3].top;
if (y >= 0) {
WP(w,refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
SetWindowDirty(w);
}
} break;
case 6: // refit button
if (WP(w,refit_d).cargo != NULL) {
if (WP(w, refit_d).cargo != NULL) {
const Vehicle *v = GetVehicle(w->window_number);
if (WP(w, refit_d).order == INVALID_VEH_ORDER_ID) {
@ -382,9 +382,9 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e)
case VEH_SHIP: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
}
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
} else {
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
}
}
break;
@ -418,7 +418,7 @@ static const Widget _vehicle_refit_widgets[] = {
static const WindowDesc _vehicle_refit_desc = {
WDP_AUTO, WDP_AUTO, 240, 174,
WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
_vehicle_refit_widgets,
VehicleRefitWndProc,
@ -426,7 +426,7 @@ static const WindowDesc _vehicle_refit_desc = {
/** Show the refit window for a vehicle
* @param *v The vehicle to show the refit window for
* @param order of the vehicle (?)
* @param order of the vehicle ( ? )
*/
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order)
{

View File

@ -45,7 +45,7 @@ static void MakePalette()
LOGPALETTE *pal;
uint i;
pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256-1) * sizeof(PALETTEENTRY));
pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256 - 1) * sizeof(PALETTEENTRY));
pal->palVersion = 0x300;
pal->palNumEntries = 256;
@ -653,8 +653,8 @@ static bool AllocateDibSection(int w, int h)
_wnd.alloced_bits = NULL;
}
bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
if (_wnd.double_size) {

View File

@ -2050,7 +2050,7 @@ static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex
* To correctly get the height difference we need the direction we are dragging
* in, as well as with what kind of tool we are dragging. For example a horizontal
* autorail tool that starts in bottom and ends at the top of a tile will need the
* maximum of SW,S and SE,N corners respectively. This is handled by the lookup table below
* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
* See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
* the values yourself.
* @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
@ -2395,7 +2395,7 @@ bool VpHandlePlaceSizingDrag()
e.we.place.userdata = _thd.userdata;
/* stop drag mode if the window has been closed */
w = FindWindowById(_thd.window_class,_thd.window_number);
w = FindWindowById(_thd.window_class, _thd.window_number);
if (w == NULL) {
ResetObjectToPlace();
return false;

View File

@ -651,7 +651,7 @@ static void FloodVehicle(Vehicle *v)
SetDParam(0, pass);
AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
v->index,
0);
CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);

View File

@ -335,7 +335,7 @@ static const TCHAR * const _expand_texts[] = {_T("S&how report >>"), _T("&Hide r
static void SetWndSize(HWND wnd, int mode)
{
RECT r,r2;
RECT r, r2;
int offs;
GetWindowRect(wnd, &r);
@ -368,7 +368,7 @@ static bool DoEmergencySave(HWND wnd)
return b;
}
static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM lParam)
static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG: {
@ -549,7 +549,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
}
{
int i,j;
int i, j;
#ifdef _M_AMD64
uint32 *b = (uint32*)ep->ContextRecord->Rsp;
#else
@ -557,7 +557,7 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
#endif
for (j = 0; j != 24; j++) {
for (i = 0; i != 8; i++) {
if (IsBadReadPtr(b,sizeof(uint32))) {
if (IsBadReadPtr(b, sizeof(uint32))) {
output += sprintf(output, " ????????"); //OCR: WAS - , 0);
} else {
output += sprintf(output, " %.8X", *b);

View File

@ -235,25 +235,25 @@ static void DrawOverlappedWindow(Window* const *wz, int left, int top, int right
bottom > v->top &&
left < v->left + v->width &&
top < v->top + v->height) {
if (left < (x=v->left)) {
if (left < (x = v->left)) {
DrawOverlappedWindow(wz, left, top, x, bottom);
DrawOverlappedWindow(wz, x, top, right, bottom);
return;
}
if (right > (x=v->left + v->width)) {
if (right > (x = v->left + v->width)) {
DrawOverlappedWindow(wz, left, top, x, bottom);
DrawOverlappedWindow(wz, x, top, right, bottom);
return;
}
if (top < (x=v->top)) {
if (top < (x = v->top)) {
DrawOverlappedWindow(wz, left, top, right, x);
DrawOverlappedWindow(wz, left, x, right, bottom);
return;
}
if (bottom > (x=v->top + v->height)) {
if (bottom > (x = v->top + v->height)) {
DrawOverlappedWindow(wz, left, top, right, x);
DrawOverlappedWindow(wz, left, x, right, bottom);
return;