mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r3511) More whitespace ([FS#46] by Rubidium)
This commit is contained in:
parent
22dc05faf2
commit
84fb96fe85
|
@ -655,7 +655,7 @@ static void AiWantLongIndustryRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyIndustryRoute(&fr);
|
AiFindSubsidyIndustryRoute(&fr);
|
||||||
if (IS_INT_INSIDE(fr.distance, 60, 90+1))
|
if (IS_INT_INSIDE(fr.distance, 60, 90+1))
|
||||||
|
@ -761,7 +761,7 @@ static void AiWantMediumIndustryRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyIndustryRoute(&fr);
|
AiFindSubsidyIndustryRoute(&fr);
|
||||||
|
@ -833,7 +833,7 @@ static void AiWantShortIndustryRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyIndustryRoute(&fr);
|
AiFindSubsidyIndustryRoute(&fr);
|
||||||
|
@ -905,7 +905,7 @@ static void AiWantMailRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyPassengerRoute(&fr);
|
AiFindSubsidyPassengerRoute(&fr);
|
||||||
|
@ -1010,7 +1010,7 @@ static void AiWantPassengerRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyPassengerRoute(&fr);
|
AiFindSubsidyPassengerRoute(&fr);
|
||||||
|
@ -1102,7 +1102,7 @@ static void AiWantLongRoadIndustryRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyIndustryRoute(&fr);
|
AiFindSubsidyIndustryRoute(&fr);
|
||||||
|
@ -1162,7 +1162,7 @@ static void AiWantMediumRoadIndustryRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyIndustryRoute(&fr);
|
AiFindSubsidyIndustryRoute(&fr);
|
||||||
|
@ -1222,7 +1222,7 @@ static void AiWantLongRoadPassengerRoute(Player *p)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyPassengerRoute(&fr);
|
AiFindSubsidyPassengerRoute(&fr);
|
||||||
|
@ -1285,7 +1285,7 @@ static void AiWantPassengerRouteInsideTown(Player *p)
|
||||||
Town *t;
|
Town *t;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// Find a town big enough
|
// Find a town big enough
|
||||||
t = AiFindRandomTown();
|
t = AiFindRandomTown();
|
||||||
if (t != NULL && t->population >= 700)
|
if (t != NULL && t->population >= 700)
|
||||||
|
@ -1357,7 +1357,7 @@ static void AiWantPassengerAircraftRoute(Player *p)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
// look for one from the subsidy list
|
// look for one from the subsidy list
|
||||||
AiFindSubsidyPassengerRoute(&fr);
|
AiFindSubsidyPassengerRoute(&fr);
|
||||||
|
@ -1416,7 +1416,7 @@ static void AiWantOilRigAircraftRoute(Player *p)
|
||||||
Industry *in;
|
Industry *in;
|
||||||
|
|
||||||
i = 60;
|
i = 60;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// Find a town
|
// Find a town
|
||||||
t = AiFindRandomTown();
|
t = AiFindRandomTown();
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
|
@ -1498,7 +1498,7 @@ static void AiStateWantNewRoute(Player *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 200;
|
i = 200;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
r = (uint16)Random();
|
r = (uint16)Random();
|
||||||
|
|
||||||
if (_patches.ai_disable_veh_train && _patches.ai_disable_veh_roadveh &&
|
if (_patches.ai_disable_veh_train && _patches.ai_disable_veh_roadveh &&
|
||||||
|
@ -1536,7 +1536,7 @@ static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, b
|
||||||
uint values[NUM_CARGO];
|
uint values[NUM_CARGO];
|
||||||
int rad;
|
int rad;
|
||||||
|
|
||||||
for(;p->mode != 4;p++) if (p->mode == 1) {
|
for (;p->mode != 4;p++) if (p->mode == 1) {
|
||||||
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
|
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
|
||||||
uint w;
|
uint w;
|
||||||
uint h;
|
uint h;
|
||||||
|
@ -1576,7 +1576,7 @@ static int32 AiDoBuildDefaultRailTrack(TileIndex tile, const AiDefaultBlockData
|
||||||
int rating = 0;
|
int rating = 0;
|
||||||
int i,j,k;
|
int i,j,k;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// This will seldomly overflow for valid reasons. Mask it to be on the safe side.
|
// This will seldomly overflow for valid reasons. Mask it to be on the safe side.
|
||||||
uint c = TILE_MASK(tile + ToTileIndexDiff(p->tileoffs));
|
uint c = TILE_MASK(tile + ToTileIndexDiff(p->tileoffs));
|
||||||
|
|
||||||
|
@ -1965,7 +1965,7 @@ static inline void AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile,
|
||||||
tile_new = tile;
|
tile_new = tile;
|
||||||
// Allow bridges directly over bottom tiles
|
// Allow bridges directly over bottom tiles
|
||||||
flag = arf->ti.z == 0;
|
flag = arf->ti.z == 0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if ((TileIndexDiff)tile_new < -TileOffsByDir(dir2)) return; // Wraping around map, no bridge possible!
|
if ((TileIndexDiff)tile_new < -TileOffsByDir(dir2)) return; // Wraping around map, no bridge possible!
|
||||||
tile_new = TILE_MASK(tile_new + TileOffsByDir(dir2));
|
tile_new = TILE_MASK(tile_new + TileOffsByDir(dir2));
|
||||||
FindLandscapeHeightByTile(&arf->ti, tile_new);
|
FindLandscapeHeightByTile(&arf->ti, tile_new);
|
||||||
|
@ -2118,7 +2118,7 @@ static void AiBuildRailConstruct(Player *p)
|
||||||
// Didn't find anything to build?
|
// Didn't find anything to build?
|
||||||
if (arf.best_ptr == NULL) {
|
if (arf.best_ptr == NULL) {
|
||||||
// Terraform some
|
// Terraform some
|
||||||
for(i=0; i!=5; i++)
|
for (i=0; i!=5; i++)
|
||||||
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
||||||
|
|
||||||
if (++p->ai.state_counter == 21) {
|
if (++p->ai.state_counter == 21) {
|
||||||
|
@ -2169,7 +2169,7 @@ static void AiBuildRailConstruct(Player *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arf.best_tile != 0) {
|
if (arf.best_tile != 0) {
|
||||||
for(i=0; i!=2; i++)
|
for (i=0; i!=2; i++)
|
||||||
AiDoTerraformLand(arf.best_tile, arf.best_dir, 3, 0);
|
AiDoTerraformLand(arf.best_tile, arf.best_dir, 3, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2274,7 +2274,7 @@ static void AiBuildRail(Player *p)
|
||||||
} else if (p->ai.state_mode == 2) {
|
} else if (p->ai.state_mode == 2) {
|
||||||
|
|
||||||
// Terraform some and then try building again.
|
// Terraform some and then try building again.
|
||||||
for(i=0; i!=4; i++)
|
for (i=0; i!=4; i++)
|
||||||
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
||||||
|
|
||||||
if (++p->ai.state_counter == 4) {
|
if (++p->ai.state_counter == 4) {
|
||||||
|
@ -2314,7 +2314,7 @@ static void AiStateBuildRail(Player *p)
|
||||||
num = p->ai.num_build_rec;
|
num = p->ai.num_build_rec;
|
||||||
aib = &p->ai.src;
|
aib = &p->ai.src;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
cmd = aib->buildcmd_a;
|
cmd = aib->buildcmd_a;
|
||||||
aib->buildcmd_a = 255;
|
aib->buildcmd_a = 255;
|
||||||
if (cmd != 255) break;
|
if (cmd != 255) break;
|
||||||
|
@ -2382,7 +2382,7 @@ static void AiStateBuildRailVeh(Player *p)
|
||||||
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
||||||
|
|
||||||
cargo = p->ai.cargo_type;
|
cargo = p->ai.cargo_type;
|
||||||
for(i=0;;) {
|
for (i=0;;) {
|
||||||
if (p->ai.wagon_list[i] == INVALID_VEHICLE) {
|
if (p->ai.wagon_list[i] == INVALID_VEHICLE) {
|
||||||
veh = _cargoc.ai_railwagon[p->ai.railtype_to_use][cargo];
|
veh = _cargoc.ai_railwagon[p->ai.railtype_to_use][cargo];
|
||||||
cost = DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE);
|
cost = DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE);
|
||||||
|
@ -2403,7 +2403,7 @@ static void AiStateBuildRailVeh(Player *p)
|
||||||
handle_nocash:
|
handle_nocash:
|
||||||
// after a while, if AI still doesn't have cash, get out of this block by selling the wagons.
|
// after a while, if AI still doesn't have cash, get out of this block by selling the wagons.
|
||||||
if (++p->ai.state_counter == 1000) {
|
if (++p->ai.state_counter == 1000) {
|
||||||
for(i=0; p->ai.wagon_list[i] != INVALID_VEHICLE; i++) {
|
for (i=0; p->ai.wagon_list[i] != INVALID_VEHICLE; i++) {
|
||||||
cost = DoCommandByTile(tile, p->ai.wagon_list[i], 0, DC_EXEC, CMD_SELL_RAIL_WAGON);
|
cost = DoCommandByTile(tile, p->ai.wagon_list[i], 0, DC_EXEC, CMD_SELL_RAIL_WAGON);
|
||||||
assert(!CmdFailed(cost));
|
assert(!CmdFailed(cost));
|
||||||
}
|
}
|
||||||
|
@ -2426,11 +2426,11 @@ handle_nocash:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the wagons onto the train
|
// Move the wagons onto the train
|
||||||
for(i=0; p->ai.wagon_list[i] != INVALID_VEHICLE; i++) {
|
for (i=0; p->ai.wagon_list[i] != INVALID_VEHICLE; i++) {
|
||||||
DoCommandByTile(tile, p->ai.wagon_list[i] | (loco_id << 16), 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
|
DoCommandByTile(tile, p->ai.wagon_list[i] | (loco_id << 16), 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
for (i=0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
||||||
AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
|
AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
|
||||||
bool is_pass = (p->ai.cargo_type == CT_PASSENGERS ||
|
bool is_pass = (p->ai.cargo_type == CT_PASSENGERS ||
|
||||||
p->ai.cargo_type == CT_MAIL ||
|
p->ai.cargo_type == CT_MAIL ||
|
||||||
|
@ -2495,7 +2495,7 @@ static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, by
|
||||||
rad = 4;
|
rad = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;p++) {
|
for (;;p++) {
|
||||||
if (p->mode == 4) {
|
if (p->mode == 4) {
|
||||||
return true;
|
return true;
|
||||||
} else if (p->mode == 1) {
|
} else if (p->mode == 1) {
|
||||||
|
@ -2523,7 +2523,7 @@ static int AiFindBestDefaultRoadBlock(TileIndex tile, byte direction, byte cargo
|
||||||
|
|
||||||
_want_road_truck_station = (cargo & 0x7F) != CT_PASSENGERS;
|
_want_road_truck_station = (cargo & 0x7F) != CT_PASSENGERS;
|
||||||
|
|
||||||
for(i=0; (p = _road_default_block_data[i]) != NULL; i++) {
|
for (i=0; (p = _road_default_block_data[i]) != NULL; i++) {
|
||||||
if (p->dir == direction) {
|
if (p->dir == direction) {
|
||||||
*cost = AiDoBuildDefaultRoadBlock(tile, p->data, 0);
|
*cost = AiDoBuildDefaultRoadBlock(tile, p->data, 0);
|
||||||
if (!CmdFailed(*cost) && AiCheckRoadResources(tile, p->data, cargo))
|
if (!CmdFailed(*cost) && AiCheckRoadResources(tile, p->data, cargo))
|
||||||
|
@ -2542,7 +2542,7 @@ static int32 AiDoBuildDefaultRoadBlock(TileIndex tile, const AiDefaultBlockData
|
||||||
int rating = 0;
|
int rating = 0;
|
||||||
int roadflag = 0;
|
int roadflag = 0;
|
||||||
|
|
||||||
for(;p->mode != 4;p++) {
|
for (;p->mode != 4;p++) {
|
||||||
uint c = TILE_MASK(tile + ToTileIndexDiff(p->tileoffs));
|
uint c = TILE_MASK(tile + ToTileIndexDiff(p->tileoffs));
|
||||||
|
|
||||||
_cleared_town = NULL;
|
_cleared_town = NULL;
|
||||||
|
@ -2855,7 +2855,7 @@ static inline void AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile,
|
||||||
tile_new = tile;
|
tile_new = tile;
|
||||||
// Allow bridges directly over bottom tiles
|
// Allow bridges directly over bottom tiles
|
||||||
flag = arf->ti.z == 0;
|
flag = arf->ti.z == 0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if ((TileIndexDiff)tile_new < -TileOffsByDir(dir2)) return; // Wraping around map, no bridge possible!
|
if ((TileIndexDiff)tile_new < -TileOffsByDir(dir2)) return; // Wraping around map, no bridge possible!
|
||||||
tile_new = TILE_MASK(tile_new + TileOffsByDir(dir2));
|
tile_new = TILE_MASK(tile_new + TileOffsByDir(dir2));
|
||||||
FindLandscapeHeightByTile(&arf->ti, tile_new);
|
FindLandscapeHeightByTile(&arf->ti, tile_new);
|
||||||
|
@ -2999,7 +2999,7 @@ static void AiBuildRoadConstruct(Player *p)
|
||||||
if (arf.best_ptr == NULL) {
|
if (arf.best_ptr == NULL) {
|
||||||
// Terraform some
|
// Terraform some
|
||||||
do_some_terraform:
|
do_some_terraform:
|
||||||
for(i=0; i!=5; i++)
|
for (i=0; i!=5; i++)
|
||||||
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
||||||
|
|
||||||
if (++p->ai.state_counter == 21) {
|
if (++p->ai.state_counter == 21) {
|
||||||
|
@ -3025,7 +3025,7 @@ do_some_terraform:
|
||||||
unnecessary to check for worse bridge (i=0), since AI will always build that.
|
unnecessary to check for worse bridge (i=0), since AI will always build that.
|
||||||
AI is so fucked up that fixing this small thing will probably not solve a thing
|
AI is so fucked up that fixing this small thing will probably not solve a thing
|
||||||
*/
|
*/
|
||||||
for(i = 10; i != 0; i--) {
|
for (i = 10; i != 0; i--) {
|
||||||
if (CheckBridge_Stuff(i, bridge_len)) {
|
if (CheckBridge_Stuff(i, bridge_len)) {
|
||||||
int32 cost = DoCommandByTile(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO, CMD_BUILD_BRIDGE);
|
int32 cost = DoCommandByTile(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO, CMD_BUILD_BRIDGE);
|
||||||
if (!CmdFailed(cost) && cost < (p->player_money >> 5))
|
if (!CmdFailed(cost) && cost < (p->player_money >> 5))
|
||||||
|
@ -3054,7 +3054,7 @@ do_some_terraform:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arf.best_tile != 0) {
|
if (arf.best_tile != 0) {
|
||||||
for(i=0; i!=2; i++)
|
for (i=0; i!=2; i++)
|
||||||
AiDoTerraformLand(arf.best_tile, arf.best_dir, 3, 0);
|
AiDoTerraformLand(arf.best_tile, arf.best_dir, 3, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3074,7 +3074,7 @@ static void AiBuildRoad(Player *p)
|
||||||
} else if (p->ai.state_mode == 2) {
|
} else if (p->ai.state_mode == 2) {
|
||||||
|
|
||||||
// Terraform some and then try building again.
|
// Terraform some and then try building again.
|
||||||
for(i=0; i!=4; i++)
|
for (i=0; i!=4; i++)
|
||||||
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
AiDoTerraformLand(p->ai.cur_tile_a, p->ai.cur_dir_a, 3, 0);
|
||||||
|
|
||||||
if (++p->ai.state_counter == 4) {
|
if (++p->ai.state_counter == 4) {
|
||||||
|
@ -3124,7 +3124,7 @@ static void AiStateBuildRoad(Player *p)
|
||||||
num = p->ai.num_build_rec;
|
num = p->ai.num_build_rec;
|
||||||
aib = &p->ai.src;
|
aib = &p->ai.src;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
cmd = aib->buildcmd_a;
|
cmd = aib->buildcmd_a;
|
||||||
aib->buildcmd_a = 255;
|
aib->buildcmd_a = 255;
|
||||||
if (cmd != 255) break;
|
if (cmd != 255) break;
|
||||||
|
@ -3173,7 +3173,7 @@ static void AiStateBuildRoadVehicles(Player *p)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ptr = _road_default_block_data[p->ai.src.cur_building_rule]->data;
|
ptr = _road_default_block_data[p->ai.src.cur_building_rule]->data;
|
||||||
for(;ptr->mode != 0;ptr++) {}
|
for (;ptr->mode != 0;ptr++) {}
|
||||||
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
||||||
|
|
||||||
veh = AiChooseRoadVehToBuild(p->ai.cargo_type, p->player_money, tile);
|
veh = AiChooseRoadVehToBuild(p->ai.cargo_type, p->player_money, tile);
|
||||||
|
@ -3336,7 +3336,7 @@ static int32 AiDoBuildDefaultAirportBlock(TileIndex tile, const AiDefaultBlockDa
|
||||||
{
|
{
|
||||||
int32 total_cost = 0, ret;
|
int32 total_cost = 0, ret;
|
||||||
|
|
||||||
for(;p->mode == 0;p++) {
|
for (;p->mode == 0;p++) {
|
||||||
if (!HASBIT(_avail_aircraft, p->attr))
|
if (!HASBIT(_avail_aircraft, p->attr))
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
ret = DoCommandByTile(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr,0,flag | DC_AUTO | DC_NO_WATER,CMD_BUILD_AIRPORT);
|
ret = DoCommandByTile(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr,0,flag | DC_AUTO | DC_NO_WATER,CMD_BUILD_AIRPORT);
|
||||||
|
@ -3359,7 +3359,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
|
||||||
rad = 4;
|
rad = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;p->mode==0;p++) {
|
for (;p->mode==0;p++) {
|
||||||
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
|
TileIndex tile2 = TILE_ADD(tile, ToTileIndexDiff(p->tileoffs));
|
||||||
|
|
||||||
w = _airport_size_x[p->attr];
|
w = _airport_size_x[p->attr];
|
||||||
|
@ -3379,7 +3379,7 @@ static int AiFindBestDefaultAirportBlock(TileIndex tile, byte cargo, byte heli,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const AiDefaultBlockData *p;
|
const AiDefaultBlockData *p;
|
||||||
for(i=0; (p = _airport_default_block_data[i]) != NULL; i++) {
|
for (i=0; (p = _airport_default_block_data[i]) != NULL; i++) {
|
||||||
// If we are doing a helicopter service, avoid building
|
// If we are doing a helicopter service, avoid building
|
||||||
// airports where they can't land.
|
// airports where they can't land.
|
||||||
if (heli && GetAirport(p->attr)->acc_planes == AIRCRAFT_ONLY)
|
if (heli && GetAirport(p->attr)->acc_planes == AIRCRAFT_ONLY)
|
||||||
|
@ -3490,7 +3490,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
||||||
uint loco_id;
|
uint loco_id;
|
||||||
|
|
||||||
ptr = _airport_default_block_data[p->ai.src.cur_building_rule];
|
ptr = _airport_default_block_data[p->ai.src.cur_building_rule];
|
||||||
for(;ptr->mode!=0;ptr++) {}
|
for (;ptr->mode!=0;ptr++) {}
|
||||||
|
|
||||||
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
tile = TILE_ADD(p->ai.src.use_tile, ToTileIndexDiff(ptr->tileoffs));
|
||||||
|
|
||||||
|
@ -3503,7 +3503,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
||||||
if (CmdFailed(DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
|
if (CmdFailed(DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
|
||||||
loco_id = _new_aircraft_id;
|
loco_id = _new_aircraft_id;
|
||||||
|
|
||||||
for(i=0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
for (i=0; p->ai.order_list_blocks[i] != 0xFF; i++) {
|
||||||
AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
|
AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
|
||||||
bool is_pass = (p->ai.cargo_type == CT_PASSENGERS || p->ai.cargo_type == CT_MAIL);
|
bool is_pass = (p->ai.cargo_type == CT_PASSENGERS || p->ai.cargo_type == CT_MAIL);
|
||||||
Order order;
|
Order order;
|
||||||
|
|
|
@ -1836,7 +1836,7 @@ static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport)
|
||||||
//at what terminal does the group start?
|
//at what terminal does the group start?
|
||||||
//that means, sum up all terminals of
|
//that means, sum up all terminals of
|
||||||
//groups with lower number
|
//groups with lower number
|
||||||
for(i = 1; i < target_group; i++)
|
for (i = 1; i < target_group; i++)
|
||||||
group_start += Airport->helipads[i];
|
group_start += Airport->helipads[i];
|
||||||
|
|
||||||
group_end = group_start + Airport->helipads[target_group];
|
group_end = group_start + Airport->helipads[target_group];
|
||||||
|
|
|
@ -141,7 +141,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* listbox */
|
case 2: { /* listbox */
|
||||||
uint i = (e->click.pt.y - 14) / 24;
|
uint i = (e->click.pt.y - 14) / 24;
|
||||||
if (i < w->vscroll.cap) {
|
if (i < w->vscroll.cap) {
|
||||||
|
@ -255,7 +255,7 @@ static void AircraftRefitWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* listbox */
|
case 2: { /* listbox */
|
||||||
int y = e->click.pt.y - 25;
|
int y = e->click.pt.y - 25;
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
|
@ -496,7 +496,7 @@ bool CheckStoppedInHangar(const Vehicle* v); /* XXX extern function declaration
|
||||||
|
|
||||||
static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
static void AircraftViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Vehicle* v = GetVehicle(w->window_number);
|
const Vehicle* v = GetVehicle(w->window_number);
|
||||||
uint32 disabled = 1 << 8;
|
uint32 disabled = 1 << 8;
|
||||||
|
@ -774,13 +774,13 @@ static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||||
|
|
||||||
static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawAircraftDepotWindow(w);
|
DrawAircraftDepotWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: /* click aircraft */
|
case 5: /* click aircraft */
|
||||||
AircraftDepotClickAircraft(w, e->click.pt.x, e->click.pt.y);
|
AircraftDepotClickAircraft(w, e->click.pt.x, e->click.pt.y);
|
||||||
break;
|
break;
|
||||||
|
@ -834,7 +834,7 @@ static void AircraftDepotWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DRAGDROP:
|
case WE_DRAGDROP:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: {
|
case 5: {
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
VehicleID sel = WP(w,traindepot_d).sel;
|
VehicleID sel = WP(w,traindepot_d).sel;
|
||||||
|
@ -985,7 +985,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
PlayerID owner = GB(w->window_number, 0, 8);
|
PlayerID owner = GB(w->window_number, 0, 8);
|
||||||
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int x = 2;
|
int x = 2;
|
||||||
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
||||||
|
@ -1056,7 +1056,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: /* Flip sorting method ascending/descending */
|
case 3: /* Flip sorting method ascending/descending */
|
||||||
vl->flags ^= VL_DESC;
|
vl->flags ^= VL_DESC;
|
||||||
vl->flags |= VL_RESORT;
|
vl->flags |= VL_RESORT;
|
||||||
|
@ -1103,7 +1103,7 @@ static void PlayerAircraftWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
tile = TILE_MASK(tile + 1);
|
tile = TILE_MASK(tile + 1);
|
||||||
} while(tile != _last_built_aircraft_depot_tile);
|
} while (tile != _last_built_aircraft_depot_tile);
|
||||||
|
|
||||||
ShowBuildAircraftWindow(0);
|
ShowBuildAircraftWindow(0);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -40,7 +40,7 @@ static void BuildBridge(Window *w, int i)
|
||||||
|
|
||||||
static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
|
||||||
|
|
||||||
if (count >= 625) return;
|
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;
|
if (*t == tile) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height
|
||||||
{ 0, -2}
|
{ 0, -2}
|
||||||
};
|
};
|
||||||
|
|
||||||
for(ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
|
for (ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
|
||||||
tile += ToTileIndexDiff(*ttm);
|
tile += ToTileIndexDiff(*ttm);
|
||||||
|
|
||||||
r = TerraformGetHeightOfTile(ts, tile);
|
r = TerraformGetHeightOfTile(ts, tile);
|
||||||
|
|
2
depot.h
2
depot.h
|
@ -75,7 +75,7 @@ static inline bool IsValidDepot(const Depot* depot)
|
||||||
*/
|
*/
|
||||||
static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case TRANSPORT_RAIL:
|
case TRANSPORT_RAIL:
|
||||||
return IsTileType(tile, MP_RAILWAY) && (_m[tile].m5 & 0xFC) == 0xC0;
|
return IsTileType(tile, MP_RAILWAY) && (_m[tile].m5 & 0xFC) == 0xC0;
|
||||||
|
|
|
@ -620,7 +620,7 @@ static void DisasterTick_4b(Vehicle *v)
|
||||||
|
|
||||||
DeleteDisasterVeh(u);
|
DeleteDisasterVeh(u);
|
||||||
|
|
||||||
for(i=0; i!=80; i++) {
|
for (i = 0; i != 80; i++) {
|
||||||
uint32 r = Random();
|
uint32 r = Random();
|
||||||
CreateEffectVehicleAbove(
|
CreateEffectVehicleAbove(
|
||||||
GB(r, 0, 6) + v->x_pos - 32,
|
GB(r, 0, 6) + v->x_pos - 32,
|
||||||
|
|
|
@ -115,7 +115,7 @@ static OnButtonClick * const _build_docks_button_proc[] = {
|
||||||
|
|
||||||
static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
break;
|
break;
|
||||||
|
|
17
economy.c
17
economy.c
|
@ -505,7 +505,7 @@ void DrawNewsBankrupcy(Window *w)
|
||||||
|
|
||||||
DrawStringMultiCenter(49, 148, STR_7058_PRESIDENT, 94);
|
DrawStringMultiCenter(49, 148, STR_7058_PRESIDENT, 94);
|
||||||
|
|
||||||
switch(WP(w,news_d).ni->string_id >> 4) {
|
switch (WP(w,news_d).ni->string_id >> 4) {
|
||||||
case 1:
|
case 1:
|
||||||
DrawStringCentered(w->width>>1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0);
|
DrawStringCentered(w->width>>1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0);
|
||||||
|
|
||||||
|
@ -806,7 +806,7 @@ void StartupEconomy(void)
|
||||||
|
|
||||||
assert(sizeof(_price) == NUM_PRICES * sizeof(int32));
|
assert(sizeof(_price) == NUM_PRICES * sizeof(int32));
|
||||||
|
|
||||||
for(i=0; i!=NUM_PRICES; i++) {
|
for (i = 0; i != NUM_PRICES; i++) {
|
||||||
int32 price = _price_base[i];
|
int32 price = _price_base[i];
|
||||||
if (_price_category[i] != 0) {
|
if (_price_category[i] != 0) {
|
||||||
uint mod = _price_category[i] == 1 ? _opt.diff.vehicle_costs : _opt.diff.construction_cost;
|
uint mod = _price_category[i] == 1 ? _opt.diff.vehicle_costs : _opt.diff.construction_cost;
|
||||||
|
@ -883,7 +883,7 @@ void DeleteSubsidyWithIndustry(uint16 index)
|
||||||
{
|
{
|
||||||
Subsidy *s;
|
Subsidy *s;
|
||||||
|
|
||||||
for(s=_subsidies; s != endof(_subsidies); s++) {
|
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type != CT_INVALID && s->age < 12 &&
|
if (s->cargo_type != CT_INVALID && s->age < 12 &&
|
||||||
s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL &&
|
s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL &&
|
||||||
(index == s->from || (s->cargo_type!=CT_GOODS && s->cargo_type!=CT_FOOD && index==s->to))) {
|
(index == s->from || (s->cargo_type!=CT_GOODS && s->cargo_type!=CT_FOOD && index==s->to))) {
|
||||||
|
@ -897,7 +897,7 @@ void DeleteSubsidyWithStation(uint16 index)
|
||||||
Subsidy *s;
|
Subsidy *s;
|
||||||
bool dirty = false;
|
bool dirty = false;
|
||||||
|
|
||||||
for(s=_subsidies; s != endof(_subsidies); s++) {
|
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type != CT_INVALID && s->age >= 12 &&
|
if (s->cargo_type != CT_INVALID && s->age >= 12 &&
|
||||||
(s->from == index || s->to == index)) {
|
(s->from == index || s->to == index)) {
|
||||||
s->cargo_type = CT_INVALID;
|
s->cargo_type = CT_INVALID;
|
||||||
|
@ -1014,9 +1014,8 @@ static void SubsidyMonthlyHandler(void)
|
||||||
FoundRoute fr;
|
FoundRoute fr;
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
for(s=_subsidies; s != endof(_subsidies); s++) {
|
for (s = _subsidies; s != endof(_subsidies); s++) {
|
||||||
if (s->cargo_type == CT_INVALID)
|
if (s->cargo_type == CT_INVALID) continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
if (s->age == 12-1) {
|
if (s->age == 12-1) {
|
||||||
pair = SetupSubsidyDecodeParam(s, 1);
|
pair = SetupSubsidyDecodeParam(s, 1);
|
||||||
|
@ -1090,7 +1089,7 @@ static void Save_SUBS(void)
|
||||||
int i;
|
int i;
|
||||||
Subsidy *s;
|
Subsidy *s;
|
||||||
|
|
||||||
for(i=0; i!=lengthof(_subsidies); i++) {
|
for (i = 0; i != lengthof(_subsidies); i++) {
|
||||||
s = &_subsidies[i];
|
s = &_subsidies[i];
|
||||||
if (s->cargo_type != CT_INVALID) {
|
if (s->cargo_type != CT_INVALID) {
|
||||||
SlSetArrayIndex(i);
|
SlSetArrayIndex(i);
|
||||||
|
@ -1537,7 +1536,7 @@ static void DoAcquireCompany(Player *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
value = CalculateCompanyValue(p) >> 2;
|
value = CalculateCompanyValue(p) >> 2;
|
||||||
for(i=0; i!=4; i++) {
|
for (i = 0; i != 4; i++) {
|
||||||
if (p->share_owners[i] != OWNER_SPECTATOR) {
|
if (p->share_owners[i] != OWNER_SPECTATOR) {
|
||||||
owner = GetPlayer(p->share_owners[i]);
|
owner = GetPlayer(p->share_owners[i]);
|
||||||
owner->money64 += value;
|
owner->money64 += value;
|
||||||
|
|
14
fileio.c
14
fileio.c
|
@ -59,7 +59,7 @@ byte FioReadByte(void)
|
||||||
|
|
||||||
void FioSkipBytes(int n)
|
void FioSkipBytes(int n)
|
||||||
{
|
{
|
||||||
for(;;) {
|
for (;;) {
|
||||||
int m = min(_fio.buffer_end - _fio.buffer, n);
|
int m = min(_fio.buffer_end - _fio.buffer, n);
|
||||||
_fio.buffer += m;
|
_fio.buffer += m;
|
||||||
n -= m;
|
n -= m;
|
||||||
|
@ -117,7 +117,7 @@ bool FiosCheckFileExists(const char *filename)
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
char *s;
|
char *s;
|
||||||
// Make lower case and try again
|
// Make lower case and try again
|
||||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ bool FiosCheckFileExists(const char *filename)
|
||||||
// tries in the 2nd data directory
|
// tries in the 2nd data directory
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ FILE *FioFOpenFile(const char *filename)
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
char *s;
|
char *s;
|
||||||
// Make lower case and try again
|
// Make lower case and try again
|
||||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ FILE *FioFOpenFile(const char *filename)
|
||||||
// tries in the 2nd data directory
|
// tries in the 2nd data directory
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ void FioOpenFile(int slot, const char *filename)
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
char *s;
|
char *s;
|
||||||
// Make lower case and try again
|
// Make lower case and try again
|
||||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ void FioOpenFile(int slot, const char *filename)
|
||||||
// tries in the 2nd data directory
|
// tries in the 2nd data directory
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
for (s = buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
f = fopen(buf, "rb");
|
f = fopen(buf, "rb");
|
||||||
}
|
}
|
||||||
|
|
22
gfx.c
22
gfx.c
|
@ -402,11 +402,11 @@ static uint32 FormatStringLinebreaks(char *str, int maxw)
|
||||||
char *last_space;
|
char *last_space;
|
||||||
byte c;
|
byte c;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
w = 0;
|
w = 0;
|
||||||
last_space = NULL;
|
last_space = NULL;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *str++;
|
c = *str++;
|
||||||
if (c == ASCII_LETTERSTART) last_space = str;
|
if (c == ASCII_LETTERSTART) last_space = str;
|
||||||
|
|
||||||
|
@ -457,12 +457,12 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
|
||||||
|
|
||||||
src = buffer;
|
src = buffer;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
w = GetStringWidth(src);
|
w = GetStringWidth(src);
|
||||||
DoDrawString(src, x - (w>>1), y, 0xFE);
|
DoDrawString(src, x - (w>>1), y, 0xFE);
|
||||||
_stringwidth_base = _stringwidth_out;
|
_stringwidth_base = _stringwidth_out;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *src++;
|
c = *src++;
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
y += mt;
|
y += mt;
|
||||||
|
@ -501,11 +501,11 @@ void DrawStringMultiLine(int x, int y, StringID str, int maxw)
|
||||||
|
|
||||||
src = buffer;
|
src = buffer;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
DoDrawString(src, x, y, 0xFE);
|
DoDrawString(src, x, y, 0xFE);
|
||||||
_stringwidth_base = _stringwidth_out;
|
_stringwidth_base = _stringwidth_out;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *src++;
|
c = *src++;
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
y += mt;
|
y += mt;
|
||||||
|
@ -608,13 +608,13 @@ switch_color:;
|
||||||
check_bounds:
|
check_bounds:
|
||||||
if (y + 19 <= dpi->top || dpi->top + dpi->height <= y) {
|
if (y + 19 <= dpi->top || dpi->top + dpi->height <= y) {
|
||||||
skip_char:;
|
skip_char:;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *string++;
|
c = *string++;
|
||||||
if (c < ASCII_LETTERSTART) goto skip_cont;
|
if (c < ASCII_LETTERSTART) goto skip_cont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *string++;
|
c = *string++;
|
||||||
skip_cont:;
|
skip_cont:;
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
|
@ -1106,7 +1106,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
|
||||||
|
|
||||||
if (bp->mode & 1) {
|
if (bp->mode & 1) {
|
||||||
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
||||||
for(;;) {
|
for (;;) {
|
||||||
do {
|
do {
|
||||||
done = src_o[0];
|
done = src_o[0];
|
||||||
num = done & 0x7F;
|
num = done & 0x7F;
|
||||||
|
@ -1175,7 +1175,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
|
||||||
}
|
}
|
||||||
} else if (bp->mode & 2) {
|
} else if (bp->mode & 2) {
|
||||||
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
||||||
for(;;) {
|
for (;;) {
|
||||||
do {
|
do {
|
||||||
done = src_o[0];
|
done = src_o[0];
|
||||||
num = done & 0x7F;
|
num = done & 0x7F;
|
||||||
|
@ -1240,7 +1240,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
|
||||||
for(;;) {
|
for (;;) {
|
||||||
do {
|
do {
|
||||||
done = src_o[0];
|
done = src_o[0];
|
||||||
num = done & 0x7F;
|
num = done & 0x7F;
|
||||||
|
|
38
graph_gui.c
38
graph_gui.c
|
@ -221,7 +221,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (!p->is_active) SETBIT(_legend_excludebits, p->index);
|
if (!p->is_active) SETBIT(_legend_excludebits, p->index);
|
||||||
|
@ -320,7 +320,7 @@ static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
|
||||||
|
|
||||||
static void OperatingProfitWndProc(Window *w, WindowEvent *e)
|
static void OperatingProfitWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
@ -344,7 +344,7 @@ static void OperatingProfitWndProc(Window *w, WindowEvent *e)
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
||||||
for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
|
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) {
|
||||||
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)(p->old_economy[j].income + p->old_economy[j].expenses);
|
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)(p->old_economy[j].income + p->old_economy[j].expenses);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ void ShowOperatingProfitGraph(void)
|
||||||
|
|
||||||
static void IncomeGraphWndProc(Window *w, WindowEvent *e)
|
static void IncomeGraphWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
@ -417,7 +417,7 @@ static void IncomeGraphWndProc(Window *w, WindowEvent *e)
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
||||||
for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
|
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) {
|
||||||
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].income;
|
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].income;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -467,7 +467,7 @@ void ShowIncomeGraph(void)
|
||||||
|
|
||||||
static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
|
static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
@ -490,7 +490,7 @@ static void DeliveredCargoGraphWndProc(Window *w, WindowEvent *e)
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
||||||
for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
|
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) {
|
||||||
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].delivered_cargo;
|
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].delivered_cargo;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ void ShowDeliveredCargoGraph(void)
|
||||||
|
|
||||||
static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
|
static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
@ -563,7 +563,7 @@ static void PerformanceHistoryWndProc(Window *w, WindowEvent *e)
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
||||||
for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
|
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) {
|
||||||
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].performance_history;
|
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].performance_history;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ void ShowPerformanceHistoryGraph(void)
|
||||||
|
|
||||||
static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
|
static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
const Player* p;
|
const Player* p;
|
||||||
|
@ -639,7 +639,7 @@ static void CompanyValueGraphWndProc(Window *w, WindowEvent *e)
|
||||||
FOR_ALL_PLAYERS(p) {
|
FOR_ALL_PLAYERS(p) {
|
||||||
if (p->is_active) {
|
if (p->is_active) {
|
||||||
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
gd.colors[numd] = _color_list[p->player_color].window_color_bgb;
|
||||||
for(j=gd.num_on_x_axis,i=0; --j >= 0;) {
|
for (j = gd.num_on_x_axis, i = 0; --j >= 0;) {
|
||||||
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].company_value;
|
gd.cost[numd][i] = (j >= p->num_valid_stat_ent) ? INVALID_VALUE : (uint64)p->old_economy[j].company_value;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -691,7 +691,7 @@ static const byte _cargo_legend_colors[12] = {152, 32, 15, 174, 208, 194, 191, 8
|
||||||
|
|
||||||
static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int i, j, x, y;
|
int i, j, x, y;
|
||||||
GraphDrawer gd;
|
GraphDrawer gd;
|
||||||
|
@ -703,7 +703,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
||||||
x = 495;
|
x = 495;
|
||||||
y = 25;
|
y = 25;
|
||||||
|
|
||||||
for(i=0; i!=NUM_CARGO; i++) {
|
for (i = 0; i != NUM_CARGO; i++) {
|
||||||
GfxFillRect(x, y, x+8, y+5, 0);
|
GfxFillRect(x, y, x+8, y+5, 0);
|
||||||
GfxFillRect(x+1, y+1, x+7, y+4, _cargo_legend_colors[i]);
|
GfxFillRect(x+1, y+1, x+7, y+4, _cargo_legend_colors[i]);
|
||||||
SetDParam(0, _cargoc.names_s[i]);
|
SetDParam(0, _cargoc.names_s[i]);
|
||||||
|
@ -726,10 +726,10 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
||||||
gd.unk61A = 10;
|
gd.unk61A = 10;
|
||||||
gd.unk61C = 10;
|
gd.unk61C = 10;
|
||||||
|
|
||||||
for(i=0; i!=NUM_CARGO; i++) {
|
for (i = 0; i != NUM_CARGO; i++) {
|
||||||
gd.colors[i] = _cargo_legend_colors[i];
|
gd.colors[i] = _cargo_legend_colors[i];
|
||||||
for(j=0; j!=20; j++) {
|
for (j = 0; j != 20; j++) {
|
||||||
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j*6+6,i);
|
gd.cost[i][j] = (uint64)GetTransportedGoodsIncome(10, 20, j * 6 + 6, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,7 +740,7 @@ static void CargoPaymentRatesWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: case 4: case 5: case 6:
|
case 3: case 4: case 5: case 6:
|
||||||
case 7: case 8: case 9: case 10:
|
case 7: case 8: case 9: case 10:
|
||||||
case 11: case 12: case 13: case 14:
|
case 11: case 12: case 13: case 14:
|
||||||
|
@ -882,7 +882,7 @@ void ShowCompanyLeagueTable(void)
|
||||||
|
|
||||||
static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int val, needed, score, i;
|
int val, needed, score, i;
|
||||||
byte owner, x;
|
byte owner, x;
|
||||||
|
@ -1134,7 +1134,7 @@ static void GlobalSortSignList(void)
|
||||||
error("Could not allocate memory for the sign-sorting-list");
|
error("Could not allocate memory for the sign-sorting-list");
|
||||||
|
|
||||||
FOR_ALL_SIGNS(ss) {
|
FOR_ALL_SIGNS(ss) {
|
||||||
if(ss->str != STR_NULL) {
|
if (ss->str != STR_NULL) {
|
||||||
_sign_sort[n++] = ss->index;
|
_sign_sort[n++] = ss->index;
|
||||||
_num_sign_sort++;
|
_num_sign_sort++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -505,12 +505,12 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||||
{
|
{
|
||||||
byte m,n;
|
byte m,n;
|
||||||
|
|
||||||
switch(_m[tile].m5) {
|
switch (_m[tile].m5) {
|
||||||
case 174:
|
case 174:
|
||||||
if ((_tick_counter & 1) == 0) {
|
if ((_tick_counter & 1) == 0) {
|
||||||
m = _m[tile].m3 + 1;
|
m = _m[tile].m3 + 1;
|
||||||
|
|
||||||
switch(m & 7) {
|
switch (m & 7) {
|
||||||
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
|
case 2: SndPlayTileFx(SND_2D_RIP_2, tile); break;
|
||||||
case 6: SndPlayTileFx(SND_29_RIP, tile); break;
|
case 6: SndPlayTileFx(SND_29_RIP, tile); break;
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ static void MakeIndustryTileBigger(TileIndex tile, byte size)
|
||||||
if (!(_m[tile].m1 & 0x80))
|
if (!(_m[tile].m1 & 0x80))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(_m[tile].m5) {
|
switch (_m[tile].m5) {
|
||||||
case 8:
|
case 8:
|
||||||
MakeIndustryTileBiggerCase8(tile);
|
MakeIndustryTileBiggerCase8(tile);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -332,7 +332,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
Industry *i;
|
Industry *i;
|
||||||
|
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: {
|
case 5: {
|
||||||
int line;
|
int line;
|
||||||
int x;
|
int x;
|
||||||
|
@ -550,7 +550,7 @@ static void MakeSortedIndustryList(void)
|
||||||
error("Could not allocate memory for the industry-sorting-list");
|
error("Could not allocate memory for the industry-sorting-list");
|
||||||
|
|
||||||
FOR_ALL_INDUSTRIES(i) {
|
FOR_ALL_INDUSTRIES(i) {
|
||||||
if(i->xy)
|
if (i->xy)
|
||||||
_industry_sort[n++] = i->index;
|
_industry_sort[n++] = i->index;
|
||||||
}
|
}
|
||||||
_num_industry_sort = n;
|
_num_industry_sort = n;
|
||||||
|
@ -610,7 +610,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: {
|
case 3: {
|
||||||
_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
|
_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
|
||||||
_industry_sort_dirty = true;
|
_industry_sort_dirty = true;
|
||||||
|
|
|
@ -84,7 +84,7 @@ uint GetPartialZ(int x, int y, int corners)
|
||||||
{
|
{
|
||||||
int z = 0;
|
int z = 0;
|
||||||
|
|
||||||
switch(corners) {
|
switch (corners) {
|
||||||
case 1:
|
case 1:
|
||||||
if (x - y >= 0)
|
if (x - y >= 0)
|
||||||
z = (x - y) >> 1;
|
z = (x - y) >> 1;
|
||||||
|
|
6
macros.h
6
macros.h
|
@ -120,9 +120,9 @@ static inline int KillFirstBit2x64(int value)
|
||||||
#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b))
|
#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * a) / b))
|
||||||
|
|
||||||
|
|
||||||
#define for_each_bit(_i,_b) \
|
#define for_each_bit(_i, _b) \
|
||||||
for(_i=0; _b!=0; _i++,_b>>=1) \
|
for (_i = 0; _b != 0; _i++, _b >>= 1) \
|
||||||
if (_b&1)
|
if (_b & 1)
|
||||||
|
|
||||||
#define abs myabs
|
#define abs myabs
|
||||||
|
|
||||||
|
|
|
@ -1687,7 +1687,7 @@ static void ScenEditIndustryWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
break;
|
break;
|
||||||
|
@ -1850,7 +1850,7 @@ static ToolbarButtonProc* const _toolbar_button_procs[] = {
|
||||||
|
|
||||||
static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
static void MainToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
|
|
||||||
// Draw brown-red toolbar bg.
|
// Draw brown-red toolbar bg.
|
||||||
|
@ -2057,7 +2057,7 @@ static ToolbarButtonProc* const _scen_toolbar_button_procs[] = {
|
||||||
|
|
||||||
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
|
static void ScenEditToolbarWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
/* XXX look for better place for these */
|
/* XXX look for better place for these */
|
||||||
if (_date <= MinDate) {
|
if (_date <= MinDate) {
|
||||||
|
@ -2286,7 +2286,7 @@ extern void UpdateAllStationVirtCoord(void);
|
||||||
static void MainWindowWndProc(Window *w, WindowEvent *e) {
|
static void MainWindowWndProc(Window *w, WindowEvent *e) {
|
||||||
int off_x;
|
int off_x;
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawWindowViewport(w);
|
DrawWindowViewport(w);
|
||||||
if (_game_mode == GM_MENU) {
|
if (_game_mode == GM_MENU) {
|
||||||
|
|
10
mersenne.c
10
mersenne.c
|
@ -25,7 +25,7 @@ void SeedMT(uint32 seed)
|
||||||
register uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = _mt_state;
|
register uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = _mt_state;
|
||||||
register int j;
|
register int j;
|
||||||
|
|
||||||
for(_mt_left=0, *s++=x, j=N; --j;
|
for (_mt_left=0, *s++=x, j=N; --j;
|
||||||
*s++ = (x*=69069U) & 0xFFFFFFFFU);
|
*s++ = (x*=69069U) & 0xFFFFFFFFU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ static uint32 ReloadMT(void)
|
||||||
register uint32 *p0=_mt_state, *p2=_mt_state+2, *pM=_mt_state+M, s0, s1;
|
register uint32 *p0=_mt_state, *p2=_mt_state+2, *pM=_mt_state+M, s0, s1;
|
||||||
register int j;
|
register int j;
|
||||||
|
|
||||||
if(_mt_left < -1)
|
if (_mt_left < -1)
|
||||||
SeedMT(4357U);
|
SeedMT(4357U);
|
||||||
|
|
||||||
_mt_left=N-1, _mt_next=_mt_state+1;
|
_mt_left=N-1, _mt_next=_mt_state+1;
|
||||||
|
|
||||||
for(s0=_mt_state[0], s1=_mt_state[1], j=N-M+1; --j; s0=s1, s1=*p2++)
|
for (s0=_mt_state[0], s1=_mt_state[1], j=N-M+1; --j; s0=s1, s1=*p2++)
|
||||||
*p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
*p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
||||||
|
|
||||||
for(pM=_mt_state, j=M; --j; s0=s1, s1=*p2++)
|
for (pM=_mt_state, j=M; --j; s0=s1, s1=*p2++)
|
||||||
*p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
*p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
||||||
|
|
||||||
s1=_mt_state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
s1=_mt_state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
|
||||||
|
@ -58,7 +58,7 @@ uint32 RandomMT(void)
|
||||||
{
|
{
|
||||||
uint32 y;
|
uint32 y;
|
||||||
|
|
||||||
if(--_mt_left < 0)
|
if (--_mt_left < 0)
|
||||||
return ReloadMT();
|
return ReloadMT();
|
||||||
|
|
||||||
y = *_mt_next++;
|
y = *_mt_next++;
|
||||||
|
|
5
misc.c
5
misc.c
|
@ -223,8 +223,7 @@ void GenerateWorld(int mode, uint size_x, uint size_y)
|
||||||
|
|
||||||
// No need to run the tile loop in the scenario editor.
|
// No need to run the tile loop in the scenario editor.
|
||||||
if (mode != GW_EMPTY) {
|
if (mode != GW_EMPTY) {
|
||||||
for(i=0x500; i!=0; i--)
|
for (i = 0x500; i != 0; i--) RunTileLoop();
|
||||||
RunTileLoop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
|
@ -980,7 +979,7 @@ static void Load_CHTS(void)
|
||||||
Cheat* cht = (Cheat*) &_cheats;
|
Cheat* cht = (Cheat*) &_cheats;
|
||||||
|
|
||||||
uint count = SlGetFieldLength()/2;
|
uint count = SlGetFieldLength()/2;
|
||||||
for(; count; count--, cht++)
|
for (; count; count--, cht++)
|
||||||
{
|
{
|
||||||
cht->been_used = (byte)SlReadByte();
|
cht->been_used = (byte)SlReadByte();
|
||||||
cht->value = (byte)SlReadByte();
|
cht->value = (byte)SlReadByte();
|
||||||
|
|
11
misc_gui.c
11
misc_gui.c
|
@ -548,7 +548,7 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
|
||||||
|
|
||||||
if ( (x|y) != 0) {
|
if ( (x|y) != 0) {
|
||||||
pt = RemapCoords2(x, y);
|
pt = RemapCoords2(x, y);
|
||||||
for(w=_windows; w->window_class != WC_MAIN_WINDOW; w++) {}
|
for (w = _windows; w->window_class != WC_MAIN_WINDOW; w++) {}
|
||||||
vp = w->viewport;
|
vp = w->viewport;
|
||||||
|
|
||||||
// move x pos to opposite corner
|
// move x pos to opposite corner
|
||||||
|
@ -567,7 +567,7 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
|
||||||
} else {
|
} else {
|
||||||
if ( (x|y) != 0) {
|
if ( (x|y) != 0) {
|
||||||
pt = RemapCoords2(x, y);
|
pt = RemapCoords2(x, y);
|
||||||
for(w=_windows; w->window_class != WC_MAIN_WINDOW; w++) {}
|
for (w = _windows; w->window_class != WC_MAIN_WINDOW; w++) {}
|
||||||
vp = w->viewport;
|
vp = w->viewport;
|
||||||
pt.x = clamp(((pt.x - vp->virtual_left) >> vp->zoom) + vp->left - (334/2), 0, _screen.width - 334);
|
pt.x = clamp(((pt.x - vp->virtual_left) >> vp->zoom) + vp->left - (334/2), 0, _screen.width - 334);
|
||||||
pt.y = clamp(((pt.y - vp->virtual_top) >> vp->zoom) + vp->top - (137/2), 22, _screen.height - 137);
|
pt.y = clamp(((pt.y - vp->virtual_top) >> vp->zoom) + vp->top - (137/2), 22, _screen.height - 137);
|
||||||
|
@ -967,7 +967,7 @@ static void QueryStringWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: DeleteWindow(w); break;
|
case 3: DeleteWindow(w); break;
|
||||||
case 4:
|
case 4:
|
||||||
press_ok:;
|
press_ok:;
|
||||||
|
@ -1376,8 +1376,9 @@ static void SaveLoadDlgWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
case WE_DESTROY:
|
case WE_DESTROY:
|
||||||
// pause is only used in single-player, non-editor mode, non menu mode
|
// pause is only used in single-player, non-editor mode, non menu mode
|
||||||
if(!_networking && (_game_mode != GM_EDITOR) && (_game_mode != GM_MENU))
|
if (!_networking && _game_mode != GM_EDITOR && _game_mode != GM_MENU) {
|
||||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
||||||
|
}
|
||||||
FiosFreeSavegameList();
|
FiosFreeSavegameList();
|
||||||
CLRBIT(_no_scroll, SCROLL_SAVE);
|
CLRBIT(_no_scroll, SCROLL_SAVE);
|
||||||
break;
|
break;
|
||||||
|
@ -1534,7 +1535,7 @@ static void SelectScenarioWndProc(Window* w, WindowEvent* e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: /* Sort scenario names by name */
|
case 3: /* Sort scenario names by name */
|
||||||
_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
|
_savegame_sort_order = (_savegame_sort_order == SORT_BY_NAME) ?
|
||||||
SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
|
SORT_BY_NAME | SORT_DESCENDING : SORT_BY_NAME;
|
||||||
|
|
|
@ -203,7 +203,7 @@ void MusicLoop(void)
|
||||||
|
|
||||||
static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
|
static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const byte* p;
|
const byte* p;
|
||||||
uint i;
|
uint i;
|
||||||
|
@ -321,7 +321,7 @@ static void ShowMusicTrackSelection(void)
|
||||||
|
|
||||||
static void MusicWindowWndProc(Window *w, WindowEvent *e)
|
static void MusicWindowWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
uint i;
|
uint i;
|
||||||
StringID str;
|
StringID str;
|
||||||
|
@ -393,7 +393,7 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: // skip to prev
|
case 2: // skip to prev
|
||||||
if (!_song_is_active)
|
if (!_song_is_active)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -237,7 +237,7 @@ static void NetworkClientError(byte res, NetworkClientState *cs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(res) {
|
switch (res) {
|
||||||
case NETWORK_RECV_STATUS_DESYNC: errorno = NETWORK_ERROR_DESYNC; break;
|
case NETWORK_RECV_STATUS_DESYNC: errorno = NETWORK_ERROR_DESYNC; break;
|
||||||
case NETWORK_RECV_STATUS_SAVEGAME: errorno = NETWORK_ERROR_SAVEGAME_FAILED; break;
|
case NETWORK_RECV_STATUS_SAVEGAME: errorno = NETWORK_ERROR_SAVEGAME_FAILED; break;
|
||||||
default: errorno = NETWORK_ERROR_GENERAL;
|
default: errorno = NETWORK_ERROR_GENERAL;
|
||||||
|
@ -1168,7 +1168,7 @@ static void NetworkHandleLocalQueue(void)
|
||||||
// Just a safety check, to be removed in the future.
|
// Just a safety check, to be removed in the future.
|
||||||
// Make sure that no older command appears towards the end of the queue
|
// Make sure that no older command appears towards the end of the queue
|
||||||
// In that case we missed executing it. This will never happen.
|
// In that case we missed executing it. This will never happen.
|
||||||
for(cp = _local_command_queue; cp; cp = cp->next) {
|
for (cp = _local_command_queue; cp; cp = cp->next) {
|
||||||
assert(_frame_counter < cp->frame);
|
assert(_frame_counter < cp->frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,7 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
|
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
|
||||||
switch(e->dropdown.button) {
|
switch (e->dropdown.button) {
|
||||||
case 5:
|
case 5:
|
||||||
_network_lan_internet = e->dropdown.index;
|
_network_lan_internet = e->dropdown.index;
|
||||||
break;
|
break;
|
||||||
|
@ -700,7 +700,7 @@ static void NetworkStartServerWindowWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
|
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
|
||||||
switch(e->dropdown.button) {
|
switch (e->dropdown.button) {
|
||||||
case 8: _network_advertise = (e->dropdown.index != 0); break;
|
case 8: _network_advertise = (e->dropdown.index != 0); break;
|
||||||
case 10: _network_game_info.clients_max = e->dropdown.index; break;
|
case 10: _network_game_info.clients_max = e->dropdown.index; break;
|
||||||
case 12: _network_game_info.companies_max = e->dropdown.index; break;
|
case 12: _network_game_info.companies_max = e->dropdown.index; break;
|
||||||
|
|
|
@ -1474,7 +1474,7 @@ bool NetworkServer_ReadPackets(NetworkClientState *cs)
|
||||||
{
|
{
|
||||||
Packet *p;
|
Packet *p;
|
||||||
NetworkRecvStatus res;
|
NetworkRecvStatus res;
|
||||||
while((p = NetworkRecv_Packet(cs, &res)) != NULL) {
|
while ((p = NetworkRecv_Packet(cs, &res)) != NULL) {
|
||||||
byte type = NetworkRecv_uint8(cs, p);
|
byte type = NetworkRecv_uint8(cs, p);
|
||||||
if (type < PACKET_END && _network_server_packet[type] != NULL && !cs->quited)
|
if (type < PACKET_END && _network_server_packet[type] != NULL && !cs->quited)
|
||||||
_network_server_packet[type](cs, p);
|
_network_server_packet[type](cs, p);
|
||||||
|
|
2
npf.c
2
npf.c
|
@ -209,7 +209,7 @@ static void NPFMarkTile(TileIndex tile)
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
if (_debug_npf_level >= 1)
|
if (_debug_npf_level >= 1)
|
||||||
switch(GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
/* DEBUG: mark visited tiles by mowing the grass under them
|
/* DEBUG: mark visited tiles by mowing the grass under them
|
||||||
* ;-) */
|
* ;-) */
|
||||||
|
|
|
@ -392,7 +392,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* orders list */
|
case 2: { /* orders list */
|
||||||
int sel;
|
int sel;
|
||||||
sel = (e->click.pt.y - 15) / 10;
|
sel = (e->click.pt.y - 15) / 10;
|
||||||
|
@ -460,7 +460,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
for(i = 0; i < lengthof(_order_keycodes); i++) {
|
for (i = 0; i < lengthof(_order_keycodes); i++) {
|
||||||
if (e->keypress.keycode == _order_keycodes[i]) {
|
if (e->keypress.keycode == _order_keycodes[i]) {
|
||||||
e->keypress.cont = false;
|
e->keypress.cont = false;
|
||||||
//see if the button is disabled
|
//see if the button is disabled
|
||||||
|
|
10
pathfind.c
10
pathfind.c
|
@ -185,7 +185,7 @@ static void TPFMode2(TrackPathFinder *tpf, TileIndex tile, int direction)
|
||||||
|
|
||||||
// Change direction 4 times only
|
// Change direction 4 times only
|
||||||
if ((byte)i != tpf->rd.pft_var6) {
|
if ((byte)i != tpf->rd.pft_var6) {
|
||||||
if(++tpf->rd.depth > 4) {
|
if (++tpf->rd.depth > 4) {
|
||||||
tpf->rd = rd;
|
tpf->rd = rd;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ FindLengthOfTunnelResult FindLengthOfTunnel(TileIndex tile, uint direction)
|
||||||
|
|
||||||
z = GetSlopeZ(x+8, y+8);
|
z = GetSlopeZ(x+8, y+8);
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
flotr.length++;
|
flotr.length++;
|
||||||
|
|
||||||
x += _get_tunlen_inc[direction];
|
x += _get_tunlen_inc[direction];
|
||||||
|
@ -609,7 +609,7 @@ static bool NtpCheck(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
|
||||||
|
|
||||||
// else it's a linked list of many tiles
|
// else it's a linked list of many tiles
|
||||||
offs = tpf->hash_tile[hash];
|
offs = tpf->hash_tile[hash];
|
||||||
for(;;) {
|
for (;;) {
|
||||||
link = NTP_GET_LINK_PTR(tpf, offs);
|
link = NTP_GET_LINK_PTR(tpf, offs);
|
||||||
if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
|
if (tile == link->tile && (uint)(link->typelength & 0x3) == dir) {
|
||||||
assert( (uint)(link->typelength >> 2) <= length);
|
assert( (uint)(link->typelength >> 2) <= length);
|
||||||
|
@ -690,7 +690,7 @@ static void NTPEnum(NewTrackPathFinder *tpf, TileIndex tile, uint direction)
|
||||||
si.first_track = 0xFF;
|
si.first_track = 0xFF;
|
||||||
goto start_at;
|
goto start_at;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// Get the next item to search from from the priority queue
|
// Get the next item to search from from the priority queue
|
||||||
do {
|
do {
|
||||||
if (tpf->nstack == 0)
|
if (tpf->nstack == 0)
|
||||||
|
@ -734,7 +734,7 @@ start_at:
|
||||||
// This is a special loop used to go through
|
// This is a special loop used to go through
|
||||||
// a rail net and find the first intersection
|
// a rail net and find the first intersection
|
||||||
tile_org = tile;
|
tile_org = tile;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
assert(direction <= 3);
|
assert(direction <= 3);
|
||||||
tile += TileOffsByDir(direction);
|
tile += TileOffsByDir(direction);
|
||||||
|
|
||||||
|
|
2
player.h
2
player.h
|
@ -201,7 +201,7 @@ void GetNameOfOwner(PlayerID owner, TileIndex tile);
|
||||||
int64 CalculateCompanyValue(const Player* p);
|
int64 CalculateCompanyValue(const Player* p);
|
||||||
void InvalidatePlayerWindows(const Player* p);
|
void InvalidatePlayerWindows(const Player* p);
|
||||||
void UpdatePlayerMoney32(Player *p);
|
void UpdatePlayerMoney32(Player *p);
|
||||||
#define FOR_ALL_PLAYERS(p) for(p=_players; p != endof(_players); p++)
|
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++)
|
||||||
|
|
||||||
VARDEF PlayerID _local_player;
|
VARDEF PlayerID _local_player;
|
||||||
VARDEF PlayerID _current_player;
|
VARDEF PlayerID _current_player;
|
||||||
|
|
22
player_gui.c
22
player_gui.c
|
@ -35,7 +35,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
|
||||||
if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status
|
if (!(mode & 1)) { // normal sized economics window (mode&1) is minimized status
|
||||||
/* draw categories */
|
/* draw categories */
|
||||||
DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
|
DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
|
||||||
for(i=0; i!=13; i++)
|
for (i = 0; i != 13; i++)
|
||||||
DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
|
DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
|
||||||
DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
|
DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ static void DrawPlayerEconomyStats(const Player *p, byte mode)
|
||||||
SetDParam(0, year + 1920);
|
SetDParam(0, year + 1920);
|
||||||
DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
|
DrawStringCenterUnderline(x-17, 15, STR_7010, 0);
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for(i=0; i!=13; i++) {
|
for (i = 0; i != 13; i++) {
|
||||||
/* draw one row in the price column */
|
/* draw one row in the price column */
|
||||||
cost = (*tbl)[i];
|
cost = (*tbl)[i];
|
||||||
if (cost != 0) {
|
if (cost != 0) {
|
||||||
|
@ -148,7 +148,7 @@ static const Widget _player_finances_small_widgets[] = {
|
||||||
|
|
||||||
static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
|
static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
PlayerID player = w->window_number;
|
PlayerID player = w->window_number;
|
||||||
const Player* p = GetPlayer(player);
|
const Player* p = GetPlayer(player);
|
||||||
|
@ -165,7 +165,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: {/* toggle size */
|
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);
|
bool stickied = !!(w->flags4 & WF_STICKY);
|
||||||
|
@ -246,7 +246,7 @@ void ShowPlayerFinances(PlayerID player)
|
||||||
|
|
||||||
static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)
|
static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
const Player* p;
|
const Player* p;
|
||||||
uint used_colors = 0;
|
uint used_colors = 0;
|
||||||
|
@ -268,7 +268,7 @@ static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)
|
||||||
y = 17;
|
y = 17;
|
||||||
pos = w->vscroll.pos;
|
pos = w->vscroll.pos;
|
||||||
|
|
||||||
for(i=0; i!=16; i++) {
|
for (i = 0; i != 16; i++) {
|
||||||
if (!(used_colors & 1) && --pos < 0 && pos >= -8) {
|
if (!(used_colors & 1) && --pos < 0 && pos >= -8) {
|
||||||
DrawString(x + 30, y, STR_00D1_DARK_BLUE + i, 2);
|
DrawString(x + 30, y, STR_00D1_DARK_BLUE + i, 2);
|
||||||
DrawSprite((i << 16) + 0x3078C1A, x + 14, y + 4);
|
DrawSprite((i << 16) + 0x3078C1A, x + 14, y + 4);
|
||||||
|
@ -289,7 +289,7 @@ static void SelectPlayerColorWndProc(Window *w, WindowEvent *e)
|
||||||
item += w->vscroll.pos;
|
item += w->vscroll.pos;
|
||||||
used_colors = WP(w,def_d).data_1;
|
used_colors = WP(w,def_d).data_1;
|
||||||
|
|
||||||
for(i=0; i!=16; i++) {
|
for (i = 0; i != 16; i++) {
|
||||||
if (!(used_colors & 1) && --item < 0) {
|
if (!(used_colors & 1) && --item < 0) {
|
||||||
DoCommandP(0, 0, i, NULL, CMD_SET_PLAYER_COLOR);
|
DoCommandP(0, 0, i, NULL, CMD_SET_PLAYER_COLOR);
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
|
@ -320,7 +320,7 @@ static const WindowDesc _select_player_color_desc = {
|
||||||
|
|
||||||
static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
|
static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Player *p;
|
Player *p;
|
||||||
w->click_state = (w->click_state & ~(1<<5|1<<6)) | ((1<<5) << WP(w,facesel_d).gender);
|
w->click_state = (w->click_state & ~(1<<5|1<<6)) | ((1<<5) << WP(w,facesel_d).gender);
|
||||||
|
@ -330,7 +330,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: DeleteWindow(w); break;
|
case 3: DeleteWindow(w); break;
|
||||||
case 4: /* ok click */
|
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);
|
||||||
|
@ -695,7 +695,7 @@ void ShowPlayerCompany(PlayerID player)
|
||||||
|
|
||||||
static void BuyCompanyWndProc(Window *w, WindowEvent *e)
|
static void BuyCompanyWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Player *p = GetPlayer(w->window_number);
|
Player *p = GetPlayer(w->window_number);
|
||||||
SetDParam(0, p->name_1);
|
SetDParam(0, p->name_1);
|
||||||
|
@ -712,7 +712,7 @@ static void BuyCompanyWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3:
|
case 3:
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
32
players.c
32
players.c
|
@ -376,8 +376,7 @@ static byte GeneratePlayerColor(void)
|
||||||
Player *p;
|
Player *p;
|
||||||
|
|
||||||
// Initialize array
|
// Initialize array
|
||||||
for(i=0; i!=16; i++)
|
for (i = 0; i != 16; i++) colors[i] = i;
|
||||||
colors[i] = i;
|
|
||||||
|
|
||||||
// And randomize it
|
// And randomize it
|
||||||
n = 100;
|
n = 100;
|
||||||
|
@ -389,9 +388,9 @@ static byte GeneratePlayerColor(void)
|
||||||
// Bubble sort it according to the values in table 1
|
// Bubble sort it according to the values in table 1
|
||||||
i = 16;
|
i = 16;
|
||||||
do {
|
do {
|
||||||
for(j=0; j!=15; j++) {
|
for (j = 0; j != 15; j++) {
|
||||||
if (_color_sort[colors[j]] < _color_sort[colors[j+1]]) {
|
if (_color_sort[colors[j]] < _color_sort[colors[j + 1]]) {
|
||||||
COLOR_SWAP(j,j+1);
|
COLOR_SWAP(j, j + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (--i);
|
} while (--i);
|
||||||
|
@ -399,12 +398,12 @@ static byte GeneratePlayerColor(void)
|
||||||
// Move the colors that look similar to each player's color to the side
|
// Move the colors that look similar to each player's color to the side
|
||||||
FOR_ALL_PLAYERS(p) if (p->is_active) {
|
FOR_ALL_PLAYERS(p) if (p->is_active) {
|
||||||
pcolor = p->player_color;
|
pcolor = p->player_color;
|
||||||
for(i=0; i!=16; i++) if (colors[i] == pcolor) {
|
for (i=0; i!=16; i++) if (colors[i] == pcolor) {
|
||||||
colors[i] = 0xFF;
|
colors[i] = 0xFF;
|
||||||
|
|
||||||
t2 = _color_similar_1[pcolor];
|
t2 = _color_similar_1[pcolor];
|
||||||
if (t2 == 0xFF) break;
|
if (t2 == 0xFF) break;
|
||||||
for(i=0; i!=15; i++) {
|
for (i=0; i!=15; i++) {
|
||||||
if (colors[i] == t2) {
|
if (colors[i] == t2) {
|
||||||
do COLOR_SWAP(i,i+1); while (++i != 15);
|
do COLOR_SWAP(i,i+1); while (++i != 15);
|
||||||
break;
|
break;
|
||||||
|
@ -413,9 +412,9 @@ static byte GeneratePlayerColor(void)
|
||||||
|
|
||||||
t2 = _color_similar_2[pcolor];
|
t2 = _color_similar_2[pcolor];
|
||||||
if (t2 == 0xFF) break;
|
if (t2 == 0xFF) break;
|
||||||
for(i=0; i!=15; i++) {
|
for (i = 0; i != 15; i++) {
|
||||||
if (colors[i] == t2) {
|
if (colors[i] == t2) {
|
||||||
do COLOR_SWAP(i,i+1); while (++i != 15);
|
do COLOR_SWAP(i, i + 1); while (++i != 15);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +424,7 @@ static byte GeneratePlayerColor(void)
|
||||||
|
|
||||||
// Return the first available color
|
// Return the first available color
|
||||||
i = 0;
|
i = 0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (colors[i] != 0xFF)
|
if (colors[i] != 0xFF)
|
||||||
return colors[i];
|
return colors[i];
|
||||||
i++;
|
i++;
|
||||||
|
@ -437,7 +436,7 @@ static void GeneratePresidentName(Player *p)
|
||||||
Player *pp;
|
Player *pp;
|
||||||
char buffer[100], buffer2[40];
|
char buffer[100], buffer2[40];
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
restart:;
|
restart:;
|
||||||
|
|
||||||
p->president_name_2 = Random();
|
p->president_name_2 = Random();
|
||||||
|
@ -551,7 +550,7 @@ void InitializePlayers(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
memset(_players, 0, sizeof(_players));
|
memset(_players, 0, sizeof(_players));
|
||||||
for(i = 0; i != MAX_PLAYERS; i++)
|
for (i = 0; i != MAX_PLAYERS; i++)
|
||||||
_players[i].index=i;
|
_players[i].index=i;
|
||||||
_cur_player_tick_index = 0;
|
_cur_player_tick_index = 0;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +728,7 @@ int32 CmdReplaceVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (new_engine_type != INVALID_ENGINE) {
|
if (new_engine_type != INVALID_ENGINE) {
|
||||||
/* First we make sure that it's a valid type the user requested
|
/* First we make sure that it's a valid type the user requested
|
||||||
* check that it's an engine that is in the engine array */
|
* check that it's an engine that is in the engine array */
|
||||||
if(!IsEngineIndex(new_engine_type))
|
if (!IsEngineIndex(new_engine_type))
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
|
|
||||||
// check that the new vehicle type is the same as the original one
|
// check that the new vehicle type is the same as the original one
|
||||||
|
@ -1253,7 +1252,8 @@ static const SaveLoad _player_ai_build_rec_desc[] = {
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static void SaveLoad_PLYR(Player *p) {
|
static void SaveLoad_PLYR(Player* p)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
SlObject(p, _player_desc);
|
SlObject(p, _player_desc);
|
||||||
|
@ -1261,7 +1261,7 @@ static void SaveLoad_PLYR(Player *p) {
|
||||||
// Write AI?
|
// Write AI?
|
||||||
if (!IS_HUMAN_PLAYER(p->index)) {
|
if (!IS_HUMAN_PLAYER(p->index)) {
|
||||||
SlObject(&p->ai, _player_ai_desc);
|
SlObject(&p->ai, _player_ai_desc);
|
||||||
for(i=0; i!=p->ai.num_build_rec; i++)
|
for (i = 0; i != p->ai.num_build_rec; i++)
|
||||||
SlObject(&p->ai.src + i, _player_ai_build_rec_desc);
|
SlObject(&p->ai.src + i, _player_ai_build_rec_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,7 +1271,7 @@ static void SaveLoad_PLYR(Player *p) {
|
||||||
// Write old economy entries.
|
// Write old economy entries.
|
||||||
{
|
{
|
||||||
PlayerEconomyEntry *pe;
|
PlayerEconomyEntry *pe;
|
||||||
for(i=p->num_valid_stat_ent,pe=p->old_economy; i!=0; i--,pe++)
|
for (i = p->num_valid_stat_ent, pe = p->old_economy; i != 0; i--, pe++)
|
||||||
SlObject(pe, _player_economy_desc);
|
SlObject(pe, _player_economy_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,7 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (!IsTileType(tile, MP_TUNNELBRIDGE) && !EnsureNoVehicle(tile))
|
if (!IsTileType(tile, MP_TUNNELBRIDGE) && !EnsureNoVehicle(tile))
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
|
|
||||||
switch(GetTileType(tile))
|
switch (GetTileType(tile))
|
||||||
{
|
{
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if (!EnsureNoVehicleZ(tile, TilePixelHeight(tile)))
|
if (!EnsureNoVehicleZ(tile, TilePixelHeight(tile)))
|
||||||
|
@ -592,7 +592,7 @@ static int32 CmdRailTrackHelper(int x, int y, uint32 flags, uint32 p1, uint32 p2
|
||||||
|
|
||||||
if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
|
if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
|
ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
|
||||||
|
|
||||||
if (CmdFailed(ret)) {
|
if (CmdFailed(ret)) {
|
||||||
|
|
|
@ -141,7 +141,7 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
static void PlaceRail_Station(TileIndex tile)
|
static void PlaceRail_Station(TileIndex tile)
|
||||||
{
|
{
|
||||||
if(_remove_button_clicked)
|
if (_remove_button_clicked)
|
||||||
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION));
|
DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_FROM_RAILROAD_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION));
|
||||||
else if (_railstation.dragdrop) {
|
else if (_railstation.dragdrop) {
|
||||||
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED);
|
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED);
|
||||||
|
@ -631,7 +631,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
int x = _railstation.numtracks;
|
int x = _railstation.numtracks;
|
||||||
int y = _railstation.platlength;
|
int y = _railstation.platlength;
|
||||||
if (_railstation.orientation == 0) intswap(x,y);
|
if (_railstation.orientation == 0) intswap(x,y);
|
||||||
if(!_remove_button_clicked)
|
if (!_remove_button_clicked)
|
||||||
SetTileSelectSize(x, y);
|
SetTileSelectSize(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ static void ShowStationBuilder(void)
|
||||||
|
|
||||||
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
|
static void BuildTrainDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
RailType r;
|
RailType r;
|
||||||
|
|
||||||
|
|
|
@ -222,8 +222,8 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
t2 = c;
|
t2 = c;
|
||||||
cost = 0;
|
cost = 0;
|
||||||
do {
|
do {
|
||||||
if (t2&1) cost += _price.remove_road;
|
if (t2 & 1) cost += _price.remove_road;
|
||||||
} while(t2>>=1);
|
} while (t2 >>= 1);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
|
ChangeTownRating(t, -road_remove_cost[(byte)edge_road], RATING_ROAD_MINIMUM);
|
||||||
|
@ -386,7 +386,7 @@ int32 CmdBuildRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (IsSteepTileh(ti.tileh)) // very steep tile
|
if (IsSteepTileh(ti.tileh)) // very steep tile
|
||||||
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||||
|
|
||||||
if(!_valid_tileh_slopes_road[2][ti.tileh]) // prevent certain slopes
|
if (!_valid_tileh_slopes_road[2][ti.tileh]) // prevent certain slopes
|
||||||
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
|
||||||
|
|
||||||
if (ti.map5 == 2) {
|
if (ti.map5 == 2) {
|
||||||
|
@ -890,7 +890,7 @@ void DrawRoadDepotSprite(int x, int y, int image)
|
||||||
|
|
||||||
DrawSprite(dtss++->image, x, y);
|
DrawSprite(dtss++->image, x, y);
|
||||||
|
|
||||||
for(; dtss->image != 0; dtss++) {
|
for (; dtss->image != 0; dtss++) {
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||||
|
|
||||||
image = dtss->image;
|
image = dtss->image;
|
||||||
|
|
|
@ -405,7 +405,7 @@ static void ShowRoadDepotPicker(void)
|
||||||
|
|
||||||
static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
|
static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int image;
|
int image;
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ static Depot *FindClosestRoadDepot(Vehicle *v)
|
||||||
rfdd.best_length = (uint)-1;
|
rfdd.best_length = (uint)-1;
|
||||||
|
|
||||||
/* search in all directions */
|
/* search in all directions */
|
||||||
for(i=0; i!=4; i++)
|
for (i = 0; i != 4; i++)
|
||||||
FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, i, (TPFEnumProc*)EnumRoadSignalFindDepot, NULL, &rfdd);
|
FollowTrack(tile, 0x2000 | TRANSPORT_ROAD, i, (TPFEnumProc*)EnumRoadSignalFindDepot, NULL, &rfdd);
|
||||||
|
|
||||||
if (rfdd.best_length == (uint)-1)
|
if (rfdd.best_length == (uint)-1)
|
||||||
|
|
|
@ -230,7 +230,7 @@ void CcCloneRoadVeh(bool success, uint tile, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
static void RoadVehViewWndProc(Window *w, WindowEvent *e)
|
static void RoadVehViewWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
StringID str;
|
StringID str;
|
||||||
|
@ -447,7 +447,7 @@ static void NewRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* listbox */
|
case 2: { /* listbox */
|
||||||
uint i = (e->click.pt.y - 14) / 14;
|
uint i = (e->click.pt.y - 14) / 14;
|
||||||
if (i < w->vscroll.cap) {
|
if (i < w->vscroll.cap) {
|
||||||
|
@ -679,13 +679,13 @@ static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||||
|
|
||||||
static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawRoadDepotWindow(w);
|
DrawRoadDepotWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5:
|
case 5:
|
||||||
RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y);
|
RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y);
|
||||||
break;
|
break;
|
||||||
|
@ -739,7 +739,7 @@ static void RoadDepotWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DRAGDROP:
|
case WE_DRAGDROP:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: {
|
case 5: {
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
VehicleID sel = WP(w,traindepot_d).sel;
|
VehicleID sel = WP(w,traindepot_d).sel;
|
||||||
|
@ -869,7 +869,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
PlayerID owner = GB(w->window_number, 0, 8);
|
PlayerID owner = GB(w->window_number, 0, 8);
|
||||||
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int x = 2;
|
int x = 2;
|
||||||
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
||||||
|
@ -938,7 +938,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: /* Flip sorting method ascending/descending */
|
case 3: /* Flip sorting method ascending/descending */
|
||||||
vl->flags ^= VL_DESC;
|
vl->flags ^= VL_DESC;
|
||||||
vl->flags |= VL_RESORT;
|
vl->flags |= VL_RESORT;
|
||||||
|
@ -984,7 +984,7 @@ static void PlayerRoadVehWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
tile = TILE_MASK(tile + 1);
|
tile = TILE_MASK(tile + 1);
|
||||||
} while(tile != _last_built_road_depot_tile);
|
} while (tile != _last_built_road_depot_tile);
|
||||||
|
|
||||||
ShowBuildRoadVehWindow(0);
|
ShowBuildRoadVehWindow(0);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -778,11 +778,9 @@ static const ChunkHandler *SlFindChunkHandler(uint32 id)
|
||||||
const ChunkHandler *ch;
|
const ChunkHandler *ch;
|
||||||
const ChunkHandler *const *chsc;
|
const ChunkHandler *const *chsc;
|
||||||
for (chsc = _sl.chs; (ch=*chsc++) != NULL;) {
|
for (chsc = _sl.chs; (ch=*chsc++) != NULL;) {
|
||||||
while(true) {
|
for (;;) {
|
||||||
if (ch->id == id)
|
if (ch->id == id) return ch;
|
||||||
return ch;
|
if (ch->flags & CH_LAST) break;
|
||||||
if (ch->flags & CH_LAST)
|
|
||||||
break;
|
|
||||||
ch++;
|
ch++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
51
settings.c
51
settings.c
|
@ -177,7 +177,7 @@ static IniFile *ini_load(const char *filename)
|
||||||
while (fgets(buffer, sizeof(buffer), in)) {
|
while (fgets(buffer, sizeof(buffer), in)) {
|
||||||
|
|
||||||
// trim whitespace from the left side
|
// trim whitespace from the left side
|
||||||
for(s=buffer; s[0] == ' ' || s[0] == '\t'; s++);
|
for (s = buffer; s[0] == ' ' || s[0] == '\t'; s++);
|
||||||
|
|
||||||
// trim whitespace from right side.
|
// trim whitespace from right side.
|
||||||
e = s + strlen(s);
|
e = s + strlen(s);
|
||||||
|
@ -216,7 +216,7 @@ static IniFile *ini_load(const char *filename)
|
||||||
}
|
}
|
||||||
} else if (group) {
|
} else if (group) {
|
||||||
// find end of keyname
|
// find end of keyname
|
||||||
for(t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {}
|
for (t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {}
|
||||||
|
|
||||||
// it's an item in an existing group
|
// it's an item in an existing group
|
||||||
item = ini_item_alloc(group, s, t-s);
|
item = ini_item_alloc(group, s, t-s);
|
||||||
|
@ -226,7 +226,7 @@ static IniFile *ini_load(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
// for list items, the name and value are the same:
|
// for list items, the name and value are the same:
|
||||||
if( group->type == IGT_LIST ) {
|
if (group->type == IGT_LIST) {
|
||||||
item->value = item->name;
|
item->value = item->name;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -236,10 +236,10 @@ static IniFile *ini_load(const char *filename)
|
||||||
|
|
||||||
|
|
||||||
// remove starting quotation marks
|
// remove starting quotation marks
|
||||||
if(*t=='\"') t++;
|
if (*t == '\"') t++;
|
||||||
// remove ending quotation marks
|
// remove ending quotation marks
|
||||||
e = t + strlen(t);
|
e = t + strlen(t);
|
||||||
if(e>t && e[-1] =='\"') e--;
|
if (e > t && e[-1] =='\"') e--;
|
||||||
*e = 0;
|
*e = 0;
|
||||||
|
|
||||||
item->value = pool_strdup(&ini->pool, t, e - t);
|
item->value = pool_strdup(&ini->pool, t, e - t);
|
||||||
|
@ -268,7 +268,7 @@ static IniGroup *ini_getgroup(IniFile *ini, const char *name, int len)
|
||||||
if (len == -1) len = strlen(name);
|
if (len == -1) len = strlen(name);
|
||||||
|
|
||||||
// does it exist already?
|
// does it exist already?
|
||||||
for(group = ini->group; group; group = group->next)
|
for (group = ini->group; group; group = group->next)
|
||||||
if (!memcmp(group->name, name, len) && group->name[len] == 0)
|
if (!memcmp(group->name, name, len) && group->name[len] == 0)
|
||||||
return group;
|
return group;
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ static IniItem *ini_getitem(IniGroup *group, const char *name, bool create)
|
||||||
IniItem *item;
|
IniItem *item;
|
||||||
uint len = strlen(name);
|
uint len = strlen(name);
|
||||||
|
|
||||||
for(item = group->item; item; item = item->next)
|
for (item = group->item; item; item = item->next)
|
||||||
if (!strcmp(item->name, name))
|
if (!strcmp(item->name, name))
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ static bool ini_save(const char *filename, IniFile *ini)
|
||||||
fprintf(f, "[%s]\n", group->name);
|
fprintf(f, "[%s]\n", group->name);
|
||||||
for (item = group->item; item != NULL; item = item->next) {
|
for (item = group->item; item != NULL; item = item->next) {
|
||||||
if (item->comment) fputs(item->comment, f);
|
if (item->comment) fputs(item->comment, f);
|
||||||
if(group->type==IGT_LIST)
|
if (group->type == IGT_LIST)
|
||||||
fprintf(f, "%s\n", item->value ? item->value : "");
|
fprintf(f, "%s\n", item->value ? item->value : "");
|
||||||
else
|
else
|
||||||
fprintf(f, "%s = %s\n", item->name, item->value ? item->value : "");
|
fprintf(f, "%s = %s\n", item->name, item->value ? item->value : "");
|
||||||
|
@ -339,7 +339,7 @@ static int lookup_oneofmany(const char *many, const char *one, int onelen)
|
||||||
return strtoul(one, NULL, 0);
|
return strtoul(one, NULL, 0);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// find end of item
|
// find end of item
|
||||||
s = many;
|
s = many;
|
||||||
while (*s != '|' && *s != 0) s++;
|
while (*s != '|' && *s != 0) s++;
|
||||||
|
@ -356,7 +356,7 @@ static uint32 lookup_manyofmany(const char *many, const char *str)
|
||||||
int r;
|
int r;
|
||||||
uint32 res = 0;
|
uint32 res = 0;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// skip "whitespace"
|
// skip "whitespace"
|
||||||
while (*str == ' ' || *str == '\t' || *str == '|') str++;
|
while (*str == ' ' || *str == '\t' || *str == '|') str++;
|
||||||
if (*str == 0) break;
|
if (*str == 0) break;
|
||||||
|
@ -379,7 +379,7 @@ static int parse_intlist(const char *p, int *items, int maxitems)
|
||||||
int n = 0, v;
|
int n = 0, v;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
v = strtol(p, &end, 0);
|
v = strtol(p, &end, 0);
|
||||||
if (p == end || n == maxitems) return -1;
|
if (p == end || n == maxitems) return -1;
|
||||||
p = end;
|
p = end;
|
||||||
|
@ -406,18 +406,18 @@ static bool load_intlist(const char *str, void *array, int nelems, int type)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case SDT_INT8 >> 4:
|
case SDT_INT8 >> 4:
|
||||||
case SDT_UINT8 >> 4:
|
case SDT_UINT8 >> 4:
|
||||||
for(i=0; i!=nitems; i++) ((byte*)array)[i] = items[i];
|
for (i = 0; i != nitems; i++) ((byte*)array)[i] = items[i];
|
||||||
break;
|
break;
|
||||||
case SDT_INT16 >> 4:
|
case SDT_INT16 >> 4:
|
||||||
case SDT_UINT16 >> 4:
|
case SDT_UINT16 >> 4:
|
||||||
for(i=0; i!=nitems; i++) ((uint16*)array)[i] = items[i];
|
for (i = 0; i != nitems; i++) ((uint16*)array)[i] = items[i];
|
||||||
break;
|
break;
|
||||||
case SDT_INT32 >> 4:
|
case SDT_INT32 >> 4:
|
||||||
case SDT_UINT32 >> 4:
|
case SDT_UINT32 >> 4:
|
||||||
for(i=0; i!=nitems; i++) ((uint32*)array)[i] = items[i];
|
for (i = 0; i != nitems; i++) ((uint32*)array)[i] = items[i];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
|
@ -430,8 +430,9 @@ static void make_intlist(char *buf, void *array, int nelems, int type)
|
||||||
{
|
{
|
||||||
int i, v = 0;
|
int i, v = 0;
|
||||||
byte *p = (byte*)array;
|
byte *p = (byte*)array;
|
||||||
for(i=0; i!=nelems; i++) {
|
|
||||||
switch(type) {
|
for (i = 0; i != nelems; i++) {
|
||||||
|
switch (type) {
|
||||||
case SDT_INT8 >> 4: v = *(int8*)p; p += 1; break;
|
case SDT_INT8 >> 4: v = *(int8*)p; p += 1; break;
|
||||||
case SDT_UINT8 >> 4:v = *(byte*)p; p += 1; break;
|
case SDT_UINT8 >> 4:v = *(byte*)p; p += 1; break;
|
||||||
case SDT_INT16 >> 4:v = *(int16*)p; p += 2; break;
|
case SDT_INT16 >> 4:v = *(int16*)p; p += 2; break;
|
||||||
|
@ -494,7 +495,7 @@ static const void *string_to_val(const SettingDesc *desc, const char *str)
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
switch(desc->flags & 0xF) {
|
switch (desc->flags & 0xF) {
|
||||||
case SDT_INTX:
|
case SDT_INTX:
|
||||||
val = strtoul(str, &end, 0);
|
val = strtoul(str, &end, 0);
|
||||||
if (*end != 0) ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name);
|
if (*end != 0) ShowInfoF("ini: trailing characters at end of setting '%s'", desc->name);
|
||||||
|
@ -558,13 +559,13 @@ static void load_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||||
// get ptr to array
|
// get ptr to array
|
||||||
ptr = desc->ptr;
|
ptr = desc->ptr;
|
||||||
|
|
||||||
switch(desc->flags & 0xF) {
|
switch (desc->flags & 0xF) {
|
||||||
// all these are stored in the same way
|
// all these are stored in the same way
|
||||||
case SDT_INTX:
|
case SDT_INTX:
|
||||||
case SDT_ONEOFMANY:
|
case SDT_ONEOFMANY:
|
||||||
case SDT_MANYOFMANY:
|
case SDT_MANYOFMANY:
|
||||||
case SDT_BOOLX:
|
case SDT_BOOLX:
|
||||||
switch(desc->flags >> 4 & 7) {
|
switch (desc->flags >> 4 & 7) {
|
||||||
case SDT_INT8 >> 4:
|
case SDT_INT8 >> 4:
|
||||||
case SDT_UINT8 >> 4:
|
case SDT_UINT8 >> 4:
|
||||||
*(byte*)ptr = (byte)(unsigned long)p;
|
*(byte*)ptr = (byte)(unsigned long)p;
|
||||||
|
@ -640,12 +641,12 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||||
// check if the value is the same as the old value
|
// check if the value is the same as the old value
|
||||||
p = string_to_val(desc, item->value);
|
p = string_to_val(desc, item->value);
|
||||||
|
|
||||||
switch(desc->flags & 0xF) {
|
switch (desc->flags & 0xF) {
|
||||||
case SDT_INTX:
|
case SDT_INTX:
|
||||||
case SDT_ONEOFMANY:
|
case SDT_ONEOFMANY:
|
||||||
case SDT_MANYOFMANY:
|
case SDT_MANYOFMANY:
|
||||||
case SDT_BOOLX:
|
case SDT_BOOLX:
|
||||||
switch(desc->flags >> 4 & 7) {
|
switch (desc->flags >> 4 & 7) {
|
||||||
case SDT_INT8 >> 4:
|
case SDT_INT8 >> 4:
|
||||||
case SDT_UINT8 >> 4:
|
case SDT_UINT8 >> 4:
|
||||||
if (*(byte*)ptr == (byte)(unsigned long)p)
|
if (*(byte*)ptr == (byte)(unsigned long)p)
|
||||||
|
@ -674,12 +675,12 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(desc->flags & 0xF) {
|
switch (desc->flags & 0xF) {
|
||||||
case SDT_INTX:
|
case SDT_INTX:
|
||||||
case SDT_ONEOFMANY:
|
case SDT_ONEOFMANY:
|
||||||
case SDT_MANYOFMANY:
|
case SDT_MANYOFMANY:
|
||||||
case SDT_BOOLX:
|
case SDT_BOOLX:
|
||||||
switch(desc->flags >> 4 & 7) {
|
switch (desc->flags >> 4 & 7) {
|
||||||
case SDT_INT8 >> 4: i = *(int8*)ptr; break;
|
case SDT_INT8 >> 4: i = *(int8*)ptr; break;
|
||||||
case SDT_UINT8 >> 4:i = *(byte*)ptr; break;
|
case SDT_UINT8 >> 4:i = *(byte*)ptr; break;
|
||||||
case SDT_INT16 >> 4:i = *(int16*)ptr; break;
|
case SDT_INT16 >> 4:i = *(int16*)ptr; break;
|
||||||
|
@ -689,7 +690,7 @@ static void save_setting_desc(IniFile *ini, const SettingDesc *desc, const void
|
||||||
default:
|
default:
|
||||||
NOT_REACHED();
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
switch(desc->flags & 0xF) {
|
switch (desc->flags & 0xF) {
|
||||||
case SDT_INTX:
|
case SDT_INTX:
|
||||||
sprintf(buf, "%u", i);
|
sprintf(buf, "%u", i);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -899,7 +899,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: {
|
case 3: {
|
||||||
int x,y;
|
int x,y;
|
||||||
uint btn;
|
uint btn;
|
||||||
|
@ -926,7 +926,7 @@ static void PatchesSelectionWndProc(Window *w, WindowEvent *e)
|
||||||
if (x < 21) { // clicked on the icon on the left side. Either scroller or bool on/off
|
if (x < 21) { // clicked on the icon on the left side. Either scroller or bool on/off
|
||||||
int32 val = ReadPE(pe), oval = val;
|
int32 val = ReadPE(pe), oval = val;
|
||||||
|
|
||||||
switch(pe->type) {
|
switch (pe->type) {
|
||||||
case PE_BOOL:
|
case PE_BOOL:
|
||||||
val ^= 1;
|
val ^= 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1216,7 +1216,7 @@ static void NewgrfWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: { // select a grf file
|
case 3: { // select a grf file
|
||||||
int y = (e->click.pt.y - NEWGRF_WND_PROC_OFFSET_TOP_WIDGET) / NEWGRF_WND_PROC_ROWSIZE;
|
int y = (e->click.pt.y - NEWGRF_WND_PROC_OFFSET_TOP_WIDGET) / NEWGRF_WND_PROC_ROWSIZE;
|
||||||
|
|
||||||
|
|
14
ship_gui.c
14
ship_gui.c
|
@ -369,7 +369,7 @@ static void NewShipWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* listbox */
|
case 2: { /* listbox */
|
||||||
uint i = (e->click.pt.y - 14) / 24;
|
uint i = (e->click.pt.y - 14) / 24;
|
||||||
if (i < w->vscroll.cap) {
|
if (i < w->vscroll.cap) {
|
||||||
|
@ -460,7 +460,7 @@ static void ShowBuildShipWindow(TileIndex tile)
|
||||||
|
|
||||||
|
|
||||||
static void ShipViewWndProc(Window *w, WindowEvent *e) {
|
static void ShipViewWndProc(Window *w, WindowEvent *e) {
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
uint32 disabled = 1<<8;
|
uint32 disabled = 1<<8;
|
||||||
|
@ -763,7 +763,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5:
|
case 5:
|
||||||
ShipDepotClick(w, e->click.pt.x, e->click.pt.y);
|
ShipDepotClick(w, e->click.pt.x, e->click.pt.y);
|
||||||
break;
|
break;
|
||||||
|
@ -817,7 +817,7 @@ static void ShipDepotWndProc(Window* w, WindowEvent* e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DRAGDROP:
|
case WE_DRAGDROP:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 5: {
|
case 5: {
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
VehicleID sel = WP(w,traindepot_d).sel;
|
VehicleID sel = WP(w,traindepot_d).sel;
|
||||||
|
@ -970,7 +970,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
|
||||||
PlayerID owner = GB(w->window_number, 0, 8);
|
PlayerID owner = GB(w->window_number, 0, 8);
|
||||||
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int x = 2;
|
int x = 2;
|
||||||
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
||||||
|
@ -1041,7 +1041,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: /* Flip sorting method ascending/descending */
|
case 3: /* Flip sorting method ascending/descending */
|
||||||
vl->flags ^= VL_DESC;
|
vl->flags ^= VL_DESC;
|
||||||
vl->flags |= VL_RESORT;
|
vl->flags |= VL_RESORT;
|
||||||
|
@ -1085,7 +1085,7 @@ static void PlayerShipsWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
tile = TILE_MASK(tile + 1);
|
tile = TILE_MASK(tile + 1);
|
||||||
} while(tile != _last_built_ship_depot_tile);
|
} while (tile != _last_built_ship_depot_tile);
|
||||||
|
|
||||||
ShowBuildShipWindow(0);
|
ShowBuildShipWindow(0);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -646,7 +646,7 @@ static void DrawSmallMap(DrawPixelInfo *dpi, Window *w, int type, bool show_town
|
||||||
x = - dx - 4;
|
x = - dx - 4;
|
||||||
y = 0;
|
y = 0;
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
uint32 mask;
|
uint32 mask;
|
||||||
int reps;
|
int reps;
|
||||||
int t;
|
int t;
|
||||||
|
|
|
@ -2706,7 +2706,7 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount)
|
||||||
st2 = st1 = NULL;
|
st2 = st1 = NULL;
|
||||||
best_rating = best_rating2 = 0;
|
best_rating = best_rating2 = 0;
|
||||||
|
|
||||||
for( i = 0; i != 8 && around[i] != INVALID_STATION; i++) {
|
for (i = 0; i != 8 && around[i] != INVALID_STATION; i++) {
|
||||||
if (around_ptr[i]->goods[type].rating >= best_rating) {
|
if (around_ptr[i]->goods[type].rating >= best_rating) {
|
||||||
best_rating2 = best_rating;
|
best_rating2 = best_rating;
|
||||||
st2 = st1;
|
st2 = st1;
|
||||||
|
|
|
@ -116,7 +116,7 @@ static int _cur_argidx;
|
||||||
static uint HashStr(const char *s)
|
static uint HashStr(const char *s)
|
||||||
{
|
{
|
||||||
uint hash = 0;
|
uint hash = 0;
|
||||||
for(; *s; s++)
|
for (; *s; s++)
|
||||||
hash = ((hash << 3) | (hash >> 29)) ^ *s;
|
hash = ((hash << 3) | (hash >> 29)) ^ *s;
|
||||||
return hash % HASH_SIZE;
|
return hash % HASH_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -270,7 +270,7 @@ char *ParseWord(char **buf)
|
||||||
if (*s == '"') {
|
if (*s == '"') {
|
||||||
r = ++s;
|
r = ++s;
|
||||||
// parse until next " or NUL
|
// parse until next " or NUL
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (*s == 0)
|
if (*s == 0)
|
||||||
break;
|
break;
|
||||||
if (*s == '"') {
|
if (*s == '"') {
|
||||||
|
@ -282,7 +282,7 @@ char *ParseWord(char **buf)
|
||||||
} else {
|
} else {
|
||||||
// proceed until whitespace or NUL
|
// proceed until whitespace or NUL
|
||||||
r = s;
|
r = s;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (*s == 0)
|
if (*s == 0)
|
||||||
break;
|
break;
|
||||||
if (*s == ' ' || *s == '\t') {
|
if (*s == ' ' || *s == '\t') {
|
||||||
|
@ -304,10 +304,9 @@ static void EmitWordList(char **words, int nw)
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
PutByte(nw);
|
PutByte(nw);
|
||||||
for(i=0; i<nw; i++)
|
for (i = 0; i < nw; i++) PutByte(strlen(words[i]));
|
||||||
PutByte(strlen(words[i]));
|
for (i = 0; i < nw; i++) {
|
||||||
for(i=0; i<nw; i++) {
|
for (j = 0; words[i][j]; j++)
|
||||||
for(j=0; words[i][j]; j++)
|
|
||||||
PutByte(words[i][j]);
|
PutByte(words[i][j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,7 +340,7 @@ static void EmitPlural(char *buf, int value)
|
||||||
if (nw > _plural_form_counts[_lang_pluralform]) {
|
if (nw > _plural_form_counts[_lang_pluralform]) {
|
||||||
nw = _plural_form_counts[_lang_pluralform];
|
nw = _plural_form_counts[_lang_pluralform];
|
||||||
} else {
|
} else {
|
||||||
for(; nw < _plural_form_counts[_lang_pluralform]; nw++) {
|
for (; nw < _plural_form_counts[_lang_pluralform]; nw++) {
|
||||||
words[nw] = words[nw - 1];
|
words[nw] = words[nw - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,9 +363,8 @@ static void EmitGender(char *buf, int value)
|
||||||
buf++;
|
buf++;
|
||||||
|
|
||||||
// This is a {G=DER} command
|
// This is a {G=DER} command
|
||||||
for(nw=0; ;nw++) {
|
for (nw = 0; ; nw++) {
|
||||||
if (nw >= 8)
|
if (nw >= 8) Fatal("G argument '%s' invalid", buf);
|
||||||
Fatal("G argument '%s' invalid", buf);
|
|
||||||
if (!strcmp(buf, _genders[nw]))
|
if (!strcmp(buf, _genders[nw]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -379,7 +377,7 @@ static void EmitGender(char *buf, int value)
|
||||||
// If no relative number exists, default to +0
|
// If no relative number exists, default to +0
|
||||||
if (!ParseRelNum(&buf, &argidx)) {}
|
if (!ParseRelNum(&buf, &argidx)) {}
|
||||||
|
|
||||||
for(nw=0; nw<8; nw++) {
|
for (nw = 0; nw < 8; nw++) {
|
||||||
words[nw] = ParseWord(&buf);
|
words[nw] = ParseWord(&buf);
|
||||||
if (!words[nw])
|
if (!words[nw])
|
||||||
break;
|
break;
|
||||||
|
@ -507,7 +505,7 @@ static const CmdStruct *FindCmd(const char *s, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
const CmdStruct *cs = _cmd_structs;
|
const CmdStruct *cs = _cmd_structs;
|
||||||
for(i=0; i != lengthof(_cmd_structs); i++, cs++) {
|
for (i=0; i != lengthof(_cmd_structs); i++, cs++) {
|
||||||
if (!strncmp(cs->cmd, s, len) && cs->cmd[len] == '\0')
|
if (!strncmp(cs->cmd, s, len) && cs->cmd[len] == '\0')
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
@ -517,7 +515,7 @@ static const CmdStruct *FindCmd(const char *s, int len)
|
||||||
static int ResolveCaseName(const char *str, int len)
|
static int ResolveCaseName(const char *str, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<MAX_NUM_CASES; i++)
|
for (i = 0; i < MAX_NUM_CASES; i++)
|
||||||
if (!memcmp(_cases[i], str, len) && _cases[i][len] == 0)
|
if (!memcmp(_cases[i], str, len) && _cases[i][len] == 0)
|
||||||
return i + 1;
|
return i + 1;
|
||||||
Fatal("Invalid case-name '%s'", str);
|
Fatal("Invalid case-name '%s'", str);
|
||||||
|
@ -536,7 +534,7 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
|
||||||
*casei = -1;
|
*casei = -1;
|
||||||
|
|
||||||
// Scan to the next command, exit if there's no next command.
|
// Scan to the next command, exit if there's no next command.
|
||||||
for(; *s != '{'; s++) {
|
for (; *s != '{'; s++) {
|
||||||
if (*s == '\0')
|
if (*s == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -583,7 +581,7 @@ static const CmdStruct *ParseCommandString(const char **str, char *param, int *a
|
||||||
if (c == '=') s--;
|
if (c == '=') s--;
|
||||||
// copy params
|
// copy params
|
||||||
start = s;
|
start = s;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
c = *s++;
|
c = *s++;
|
||||||
if (c == '}') break;
|
if (c == '}') break;
|
||||||
if (c == '\0') {
|
if (c == '\0') {
|
||||||
|
@ -619,7 +617,7 @@ static void HandlePragma(char *str)
|
||||||
Fatal("Invalid pluralform %d", _lang_pluralform);
|
Fatal("Invalid pluralform %d", _lang_pluralform);
|
||||||
} else if (!memcmp(str, "gender ", 7)) {
|
} else if (!memcmp(str, "gender ", 7)) {
|
||||||
char *buf = str + 7, *s;
|
char *buf = str + 7, *s;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
s = ParseWord(&buf);
|
s = ParseWord(&buf);
|
||||||
if (!s) break;
|
if (!s) break;
|
||||||
if (_numgenders >= MAX_NUM_GENDER) Fatal("Too many genders, max %d", MAX_NUM_GENDER);
|
if (_numgenders >= MAX_NUM_GENDER) Fatal("Too many genders, max %d", MAX_NUM_GENDER);
|
||||||
|
@ -628,7 +626,7 @@ static void HandlePragma(char *str)
|
||||||
}
|
}
|
||||||
} else if (!memcmp(str, "case ", 5)) {
|
} else if (!memcmp(str, "case ", 5)) {
|
||||||
char *buf = str + 5, *s;
|
char *buf = str + 5, *s;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
s = ParseWord(&buf);
|
s = ParseWord(&buf);
|
||||||
if (!s) break;
|
if (!s) break;
|
||||||
if (_numcases >= MAX_NUM_CASES) Fatal("Too many cases, max %d", MAX_NUM_CASES);
|
if (_numcases >= MAX_NUM_CASES) Fatal("Too many cases, max %d", MAX_NUM_CASES);
|
||||||
|
@ -650,7 +648,7 @@ static void ExtractCommandString(ParsedCommandStruct *p, char *s, bool warnings)
|
||||||
|
|
||||||
memset(p, 0, sizeof(*p));
|
memset(p, 0, sizeof(*p));
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
// read until next command from a.
|
// read until next command from a.
|
||||||
ar = ParseCommandString((const char **)&s, param, &argno, &casei);
|
ar = ParseCommandString((const char **)&s, param, &argno, &casei);
|
||||||
if (ar == NULL)
|
if (ar == NULL)
|
||||||
|
@ -710,10 +708,10 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name)
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < templ.np; i++) {
|
for (i = 0; i < templ.np; i++) {
|
||||||
// see if we find it in lang, and zero it out
|
// see if we find it in lang, and zero it out
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for(j = 0; j < lang.np; j++) {
|
for (j = 0; j < lang.np; j++) {
|
||||||
if (templ.pairs[i].a == lang.pairs[j].a &&
|
if (templ.pairs[i].a == lang.pairs[j].a &&
|
||||||
!strcmp(templ.pairs[i].v, lang.pairs[j].v)) {
|
!strcmp(templ.pairs[i].v, lang.pairs[j].v)) {
|
||||||
// it was found in both. zero it out from lang so we don't find it again
|
// it was found in both. zero it out from lang so we don't find it again
|
||||||
|
@ -731,7 +729,7 @@ static bool CheckCommandsMatch(char *a, char *b, const char *name)
|
||||||
|
|
||||||
// if we reach here, all non consumer commands match up.
|
// if we reach here, all non consumer commands match up.
|
||||||
// Check if the non consumer commands match up also.
|
// Check if the non consumer commands match up also.
|
||||||
for(i = 0; i < lengthof(templ.cmd); i++) {
|
for (i = 0; i < lengthof(templ.cmd); i++) {
|
||||||
if (TranslateCmdForCompare(templ.cmd[i]) != TranslateCmdForCompare(lang.cmd[i])) {
|
if (TranslateCmdForCompare(templ.cmd[i]) != TranslateCmdForCompare(lang.cmd[i])) {
|
||||||
Warning("%s: Param idx #%d '%s' doesn't match with template command '%s'", name, i,
|
Warning("%s: Param idx #%d '%s' doesn't match with template command '%s'", name, i,
|
||||||
!lang.cmd[i] ? "<empty>" : lang.cmd[i]->cmd,
|
!lang.cmd[i] ? "<empty>" : lang.cmd[i]->cmd,
|
||||||
|
@ -767,7 +765,7 @@ static void HandleString(char *str, bool master)
|
||||||
|
|
||||||
// Trim spaces.
|
// Trim spaces.
|
||||||
// After this str points to the command name, and s points to the command contents
|
// After this str points to the command name, and s points to the command contents
|
||||||
for(t = s; t > str && (t[-1]==' ' || t[-1]=='\t'); t--);
|
for (t = s; t > str && (t[-1] ==' ' || t[-1] == '\t'); t--);
|
||||||
*t = 0;
|
*t = 0;
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
|
@ -884,7 +882,7 @@ static void ParseFile(const char *file, bool english)
|
||||||
|
|
||||||
static uint32 MyHashStr(uint32 hash, const char *s)
|
static uint32 MyHashStr(uint32 hash, const char *s)
|
||||||
{
|
{
|
||||||
for(; *s; s++) {
|
for (; *s; s++) {
|
||||||
hash = ((hash << 3) | (hash >> 29)) ^ *s;
|
hash = ((hash << 3) | (hash >> 29)) ^ *s;
|
||||||
if (hash & 1) hash = (hash>>1) ^ 0xDEADBEEF; else hash >>= 1;
|
if (hash & 1) hash = (hash>>1) ^ 0xDEADBEEF; else hash >>= 1;
|
||||||
}
|
}
|
||||||
|
@ -904,7 +902,7 @@ static void MakeHashOfStrings(void)
|
||||||
int argno;
|
int argno;
|
||||||
int casei;
|
int casei;
|
||||||
|
|
||||||
for(i = 0; i != 65536; i++) {
|
for (i = 0; i != 65536; i++) {
|
||||||
if ((ls=_strings[i]) != NULL) {
|
if ((ls=_strings[i]) != NULL) {
|
||||||
s = ls->name;
|
s = ls->name;
|
||||||
hash ^= i * 0x717239;
|
hash ^= i * 0x717239;
|
||||||
|
@ -929,7 +927,7 @@ static int CountInUse(int grp)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 0x800; --i >= 0;) {
|
for (i = 0x800; --i >= 0;) {
|
||||||
if (_strings[(grp<<11)+i] != NULL)
|
if (_strings[(grp<<11)+i] != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -983,7 +981,7 @@ static void WriteStringsH(const char *filename)
|
||||||
|
|
||||||
lastgrp = 0;
|
lastgrp = 0;
|
||||||
|
|
||||||
for(i = 0; i != 65536; i++) {
|
for (i = 0; i != 65536; i++) {
|
||||||
if (_strings[i]) {
|
if (_strings[i]) {
|
||||||
if (lastgrp != (i >> 11)) {
|
if (lastgrp != (i >> 11)) {
|
||||||
lastgrp = (i >> 11);
|
lastgrp = (i >> 11);
|
||||||
|
@ -1025,7 +1023,7 @@ static int TranslateArgumentIdx(int argidx)
|
||||||
if (argidx < 0 || argidx >= lengthof(_cur_pcs.cmd))
|
if (argidx < 0 || argidx >= lengthof(_cur_pcs.cmd))
|
||||||
Fatal("invalid argidx %d", argidx);
|
Fatal("invalid argidx %d", argidx);
|
||||||
|
|
||||||
for(i = sum = 0; i < argidx; i++) {
|
for (i = sum = 0; i < argidx; i++) {
|
||||||
const CmdStruct *cs = _cur_pcs.cmd[i];
|
const CmdStruct *cs = _cur_pcs.cmd[i];
|
||||||
sum += cs ? cs->consumes : 1;
|
sum += cs ? cs->consumes : 1;
|
||||||
}
|
}
|
||||||
|
@ -1105,7 +1103,7 @@ static void WriteLangfile(const char *filename, int show_todo)
|
||||||
if (f == NULL) Fatal("can't open %s", filename);
|
if (f == NULL) Fatal("can't open %s", filename);
|
||||||
|
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
for(i = 0; i != 32; i++) {
|
for (i = 0; i != 32; i++) {
|
||||||
int n = CountInUse(i);
|
int n = CountInUse(i);
|
||||||
in_use[i] = n;
|
in_use[i] = n;
|
||||||
hdr.offsets[i] = TO_LE16(n);
|
hdr.offsets[i] = TO_LE16(n);
|
||||||
|
@ -1121,8 +1119,8 @@ static void WriteLangfile(const char *filename, int show_todo)
|
||||||
|
|
||||||
fwrite(&hdr, sizeof(hdr), 1, f);
|
fwrite(&hdr, sizeof(hdr), 1, f);
|
||||||
|
|
||||||
for(i = 0; i != 32; i++) {
|
for (i = 0; i != 32; i++) {
|
||||||
for(j = 0; j != in_use[i]; j++) {
|
for (j = 0; j != in_use[i]; j++) {
|
||||||
LangString *ls = _strings[(i<<11)+j];
|
LangString *ls = _strings[(i<<11)+j];
|
||||||
|
|
||||||
Case *casep;
|
Case *casep;
|
||||||
|
@ -1143,7 +1141,7 @@ static void WriteLangfile(const char *filename, int show_todo)
|
||||||
Warning("'%s' is untranslated", ls->name);
|
Warning("'%s' is untranslated", ls->name);
|
||||||
} else {
|
} else {
|
||||||
const char *s = "<TODO> ";
|
const char *s = "<TODO> ";
|
||||||
while(*s) PutByte(*s++);
|
while (*s) PutByte(*s++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,11 +1167,11 @@ static void WriteLangfile(const char *filename, int show_todo)
|
||||||
// Each LEN is printed using 2 bytes in big endian order.
|
// Each LEN is printed using 2 bytes in big endian order.
|
||||||
PutByte(0x9E);
|
PutByte(0x9E);
|
||||||
// Count the number of cases
|
// Count the number of cases
|
||||||
for(num=0,c=casep; c; c=c->next) num++;
|
for (num = 0, c = casep; c; c = c->next) num++;
|
||||||
PutByte(num);
|
PutByte(num);
|
||||||
|
|
||||||
// Write each case
|
// Write each case
|
||||||
for(c=casep; c; c=c->next) {
|
for (c = casep; c; c = c->next) {
|
||||||
int pos;
|
int pos;
|
||||||
PutByte(c->caseidx);
|
PutByte(c->caseidx);
|
||||||
// Make some space for the 16-bit length
|
// Make some space for the 16-bit length
|
||||||
|
|
|
@ -402,7 +402,7 @@ static int DeterminePluralForm(int32 n)
|
||||||
// The absolute value determines plurality
|
// The absolute value determines plurality
|
||||||
if (n < 0) n = -n;
|
if (n < 0) n = -n;
|
||||||
|
|
||||||
switch(_langpack->plural_form) {
|
switch (_langpack->plural_form) {
|
||||||
// Two forms, singular used for one only
|
// Two forms, singular used for one only
|
||||||
// Used in:
|
// Used in:
|
||||||
// Danish, Dutch, English, German, Norwegian, Swedish, Estonian, Finnish,
|
// Danish, Dutch, English, German, Norwegian, Swedish, Estonian, Finnish,
|
||||||
|
@ -466,7 +466,8 @@ static const char *ParseStringChoice(const char *b, uint form, char *dst, int *d
|
||||||
//<NUM> {Length of each string} {each string}
|
//<NUM> {Length of each string} {each string}
|
||||||
uint n = (byte)*b++;
|
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++) {
|
|
||||||
|
for (i = pos = 0; i != n; i++) {
|
||||||
uint len = (byte)*b++;
|
uint len = (byte)*b++;
|
||||||
if (i == form) {
|
if (i == form) {
|
||||||
mypos = pos;
|
mypos = pos;
|
||||||
|
|
|
@ -205,7 +205,7 @@ static OnButtonClick * const _terraform_button_proc[] = {
|
||||||
|
|
||||||
static void TerraformToolbWndProc(Window *w, WindowEvent *e)
|
static void TerraformToolbWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
break;
|
break;
|
||||||
|
|
19
town_cmd.c
19
town_cmd.c
|
@ -593,7 +593,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, uint mask, int block, Town *t1)
|
||||||
if (CHANCE16(1, 4)) {
|
if (CHANCE16(1, 4)) {
|
||||||
do {
|
do {
|
||||||
a = GB(Random(), 0, 2);
|
a = GB(Random(), 0, 2);
|
||||||
} while(a == b);
|
} while (a == b);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsRoadAllowedHere(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[a])), a)) {
|
if (!IsRoadAllowedHere(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[a])), a)) {
|
||||||
|
@ -702,7 +702,7 @@ build_road_and_exit:
|
||||||
// obviously, if building any bridge would fail, there is no need to try other bridge-types
|
// obviously, if building any bridge would fail, there is no need to try other bridge-types
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} while(--j != 0);
|
} while (--j != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef IS_WATER_TILE
|
#undef IS_WATER_TILE
|
||||||
|
@ -889,7 +889,7 @@ static bool CreateTownName(uint32 *townnameparts)
|
||||||
|
|
||||||
assert(townnameparts);
|
assert(townnameparts);
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
restart:
|
restart:
|
||||||
r = Random();
|
r = Random();
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts)
|
||||||
t->act_food = 0;
|
t->act_food = 0;
|
||||||
t->act_water = 0;
|
t->act_water = 0;
|
||||||
|
|
||||||
for(i = 0; i != MAX_PLAYERS; i++)
|
for (i = 0; i != MAX_PLAYERS; i++)
|
||||||
t->ratings[i] = 500;
|
t->ratings[i] = 500;
|
||||||
|
|
||||||
t->have_ratings = 0;
|
t->have_ratings = 0;
|
||||||
|
@ -1170,11 +1170,10 @@ static bool CheckFree2x2Area(Town *t1, TileIndex tile)
|
||||||
{1 - 1, 1 - 0}
|
{1 - 1, 1 - 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
for(i=0; i!=4; i++) {
|
for (i = 0; i != 4; i++) {
|
||||||
tile += ToTileIndexDiff(_tile_add[i]);
|
tile += ToTileIndexDiff(_tile_add[i]);
|
||||||
|
|
||||||
if (GetTileSlope(tile, NULL))
|
if (GetTileSlope(tile, NULL)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
if (CmdFailed(DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_FORCETEST, CMD_LANDSCAPE_CLEAR)))
|
if (CmdFailed(DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_FORCETEST, CMD_LANDSCAPE_CLEAR)))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1214,12 +1213,12 @@ static void DoBuildTownHouse(Town *t, TileIndex tile)
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
// Generate a list of all possible houses that can be built.
|
// Generate a list of all possible houses that can be built.
|
||||||
for(i=0; i!=lengthof(_housetype_flags); i++) {
|
for (i=0; i!=lengthof(_housetype_flags); i++) {
|
||||||
if ((~_housetype_flags[i] & bitmask) == 0)
|
if ((~_housetype_flags[i] & bitmask) == 0)
|
||||||
houses[num++] = (byte)i;
|
houses[num++] = (byte)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
house = houses[RandomRange(num)];
|
house = houses[RandomRange(num)];
|
||||||
|
|
||||||
if (_cur_year < _housetype_years[house].min || _cur_year > _housetype_years[house].max)
|
if (_cur_year < _housetype_years[house].min || _cur_year > _housetype_years[house].max)
|
||||||
|
@ -1919,7 +1918,7 @@ void TownsMonthlyLoop(void)
|
||||||
t->road_build_months--;
|
t->road_build_months--;
|
||||||
|
|
||||||
if (t->exclusive_counter != 0)
|
if (t->exclusive_counter != 0)
|
||||||
if(--t->exclusive_counter==0)
|
if (--t->exclusive_counter == 0)
|
||||||
t->exclusivity = (byte)-1;
|
t->exclusivity = (byte)-1;
|
||||||
|
|
||||||
UpdateTownGrowRate(t);
|
UpdateTownGrowRate(t);
|
||||||
|
|
|
@ -466,7 +466,7 @@ static void TownDirectoryWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: { /* Sort by Name ascending/descending */
|
case 3: { /* Sort by Name ascending/descending */
|
||||||
_town_sort_order = (_town_sort_order == 0) ? 1 : 0;
|
_town_sort_order = (_town_sort_order == 0) ? 1 : 0;
|
||||||
_town_sort_dirty = true;
|
_town_sort_dirty = true;
|
||||||
|
|
10
train_cmd.c
10
train_cmd.c
|
@ -894,11 +894,11 @@ static void NormaliseTrainConsist(Vehicle *v)
|
||||||
|
|
||||||
assert(IsFrontEngine(v));
|
assert(IsFrontEngine(v));
|
||||||
|
|
||||||
for(; v != NULL; v = GetNextVehicle(v)) {
|
for (; v != NULL; v = GetNextVehicle(v)) {
|
||||||
if (!IsMultiheaded(v) || !IsTrainEngine(v)) continue;
|
if (!IsMultiheaded(v) || !IsTrainEngine(v)) continue;
|
||||||
|
|
||||||
/* make sure that there are no free cars before next engine */
|
/* make sure that there are no free cars before next engine */
|
||||||
for(u = v; u->next != NULL && !IsTrainEngine(u->next); u = u->next);
|
for (u = v; u->next != NULL && !IsTrainEngine(u->next); u = u->next);
|
||||||
|
|
||||||
if (u == v->u.rail.other_multiheaded_part) continue;
|
if (u == v->u.rail.other_multiheaded_part) continue;
|
||||||
AddWagonToConsist(v->u.rail.other_multiheaded_part, u);
|
AddWagonToConsist(v->u.rail.other_multiheaded_part, u);
|
||||||
|
@ -974,7 +974,7 @@ int32 CmdMoveRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
/* we need to make sure that we didn't place it between a pair of multiheaded engines */
|
/* we need to make sure that we didn't place it between a pair of multiheaded engines */
|
||||||
Vehicle *u, *engine = NULL;
|
Vehicle *u, *engine = NULL;
|
||||||
|
|
||||||
for(u = dst_head; u != NULL; u = u->next) {
|
for (u = dst_head; u != NULL; u = u->next) {
|
||||||
if (IsTrainEngine(u) && IsMultiheaded(u) && u->u.rail.other_multiheaded_part != NULL) {
|
if (IsTrainEngine(u) && IsMultiheaded(u) && u->u.rail.other_multiheaded_part != NULL) {
|
||||||
engine = u;
|
engine = u;
|
||||||
}
|
}
|
||||||
|
@ -2214,7 +2214,7 @@ static bool CheckReverseTrain(Vehicle *v)
|
||||||
reverse_best = false;
|
reverse_best = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(true) {
|
for (;;) {
|
||||||
fd.best_bird_dist = (uint)-1;
|
fd.best_bird_dist = (uint)-1;
|
||||||
fd.best_track_dist = (uint)-1;
|
fd.best_track_dist = (uint)-1;
|
||||||
|
|
||||||
|
@ -3536,7 +3536,7 @@ void ConnectMultiheadedTrains(void)
|
||||||
{
|
{
|
||||||
Vehicle *w;
|
Vehicle *w;
|
||||||
|
|
||||||
for(w = u->next; w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w));
|
for (w = u->next; w != NULL && (w->engine_type != u->engine_type || w->u.rail.other_multiheaded_part != NULL); w = GetNextVehicle(w));
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
/* we found a car to partner with this engine. Now we will make sure it face the right way */
|
/* we found a car to partner with this engine. Now we will make sure it face the right way */
|
||||||
if (IsTrainEngine(w)) {
|
if (IsTrainEngine(w)) {
|
||||||
|
|
24
train_gui.c
24
train_gui.c
|
@ -194,7 +194,7 @@ static void engine_drawing_loop(int *x, int *y, int *pos, int *sel,
|
||||||
|
|
||||||
static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
|
static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
|
|
||||||
if (w->window_number == 0)
|
if (w->window_number == 0)
|
||||||
|
@ -250,7 +250,7 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: {
|
case 2: {
|
||||||
uint i = (e->click.pt.y - 14) / 14;
|
uint i = (e->click.pt.y - 14) / 14;
|
||||||
if (i < w->vscroll.cap) {
|
if (i < w->vscroll.cap) {
|
||||||
|
@ -570,7 +570,7 @@ static void TrainDepotClickTrain(Window *w, int x, int y)
|
||||||
|
|
||||||
v = gdvp.wagon;
|
v = gdvp.wagon;
|
||||||
|
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case 0: { // start dragging of vehicle
|
case 0: { // start dragging of vehicle
|
||||||
VehicleID sel = WP(w, traindepot_d).sel;
|
VehicleID sel = WP(w, traindepot_d).sel;
|
||||||
|
|
||||||
|
@ -627,13 +627,13 @@ static void ClonePlaceObj(TileIndex tile, const Window* w)
|
||||||
|
|
||||||
static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT:
|
case WE_PAINT:
|
||||||
DrawTrainDepotWindow(w);
|
DrawTrainDepotWindow(w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 8:
|
case 8:
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
ShowBuildTrainWindow(w->window_number);
|
ShowBuildTrainWindow(w->window_number);
|
||||||
|
@ -686,7 +686,7 @@ static void TrainDepotWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WE_DRAGDROP: {
|
case WE_DRAGDROP: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 4: case 5: {
|
case 4: case 5: {
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
int sell_cmd;
|
int sell_cmd;
|
||||||
|
@ -824,7 +824,7 @@ static void RailVehicleRefitWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WE_CLICK:
|
case WE_CLICK:
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 2: { /* listbox */
|
case 2: { /* listbox */
|
||||||
int y = e->click.pt.y - 25;
|
int y = e->click.pt.y - 25;
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
|
@ -985,7 +985,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
|
||||||
int wid = e->click.widget;
|
int wid = e->click.widget;
|
||||||
Vehicle *v = GetVehicle(w->window_number);
|
Vehicle *v = GetVehicle(w->window_number);
|
||||||
|
|
||||||
switch(wid) {
|
switch (wid) {
|
||||||
case 5: /* start/stop train */
|
case 5: /* start/stop train */
|
||||||
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
|
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
|
||||||
break;
|
break;
|
||||||
|
@ -1197,7 +1197,7 @@ static void DrawTrainDetailsWindow(Window *w)
|
||||||
// draw the first 3 details tabs
|
// draw the first 3 details tabs
|
||||||
if (det_tab != 3) {
|
if (det_tab != 3) {
|
||||||
x = 1;
|
x = 1;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (--sel < 0 && sel >= -6) {
|
if (--sel < 0 && sel >= -6) {
|
||||||
int dx = 0;
|
int dx = 0;
|
||||||
u = v;
|
u = v;
|
||||||
|
@ -1372,7 +1372,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||||
PlayerID owner = GB(w->window_number, 0, 8);
|
PlayerID owner = GB(w->window_number, 0, 8);
|
||||||
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
vehiclelist_d *vl = &WP(w, vehiclelist_d);
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int x = 2;
|
int x = 2;
|
||||||
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET;
|
||||||
|
@ -1442,7 +1442,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
case WE_CLICK: {
|
case WE_CLICK: {
|
||||||
switch(e->click.widget) {
|
switch (e->click.widget) {
|
||||||
case 3: /* Flip sorting method ascending/descending */
|
case 3: /* Flip sorting method ascending/descending */
|
||||||
vl->flags ^= VL_DESC;
|
vl->flags ^= VL_DESC;
|
||||||
vl->flags |= VL_RESORT;
|
vl->flags |= VL_RESORT;
|
||||||
|
@ -1490,7 +1490,7 @@ static void PlayerTrainsWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
tile = TILE_MASK(tile + 1);
|
tile = TILE_MASK(tile + 1);
|
||||||
} while(tile != _last_built_train_depot_tile);
|
} while (tile != _last_built_train_depot_tile);
|
||||||
|
|
||||||
ShowBuildTrainWindow(0);
|
ShowBuildTrainWindow(0);
|
||||||
} break;
|
} break;
|
||||||
|
|
|
@ -315,7 +315,7 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||||
} while (i);
|
} while (i);
|
||||||
|
|
||||||
/* draw them in a sorted way */
|
/* draw them in a sorted way */
|
||||||
for(;;) {
|
for (;;) {
|
||||||
byte min = 0xFF;
|
byte min = 0xFF;
|
||||||
TreeListEnt *tep = NULL;
|
TreeListEnt *tep = NULL;
|
||||||
|
|
||||||
|
|
|
@ -693,7 +693,7 @@ static TileIndex FindEdgesOfBridge(TileIndex tile, TileIndex *endtile)
|
||||||
TileIndex start;
|
TileIndex start;
|
||||||
|
|
||||||
// find start of bridge
|
// find start of bridge
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0x80)
|
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0x80)
|
||||||
break;
|
break;
|
||||||
tile += direction ? TileDiffXY(0, -1) : TileDiffXY(-1, 0);
|
tile += direction ? TileDiffXY(0, -1) : TileDiffXY(-1, 0);
|
||||||
|
@ -702,7 +702,7 @@ static TileIndex FindEdgesOfBridge(TileIndex tile, TileIndex *endtile)
|
||||||
start = tile;
|
start = tile;
|
||||||
|
|
||||||
// find end of bridge
|
// find end of bridge
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0xA0)
|
if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0xA0)
|
||||||
break;
|
break;
|
||||||
tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
|
tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
|
||||||
|
@ -1007,9 +1007,15 @@ static void DrawBridgePillars(const TileInfo *ti, int x, int y, int z)
|
||||||
if (!(ti->tileh & p[3])) back_height += 8;
|
if (!(ti->tileh & p[3])) back_height += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; z>=front_height || z>=back_height; z=z-8) {
|
for (; z >= front_height || z >= back_height; z = z - 8) {
|
||||||
if (z>=front_height) AddSortableSpriteToDraw(image, x,y, p[4], p[5], 0x28, z); // front facing pillar
|
if (z >= front_height) {
|
||||||
if (z>=back_height && z<i-8) AddSortableSpriteToDraw(image, x - p[6], y - p[7], p[4], p[5], 0x28, z); // back facing pillar
|
// front facing pillar
|
||||||
|
AddSortableSpriteToDraw(image, x,y, p[4], p[5], 0x28, z);
|
||||||
|
}
|
||||||
|
if (z >= back_height && z < i - 8) {
|
||||||
|
// back facing pillar
|
||||||
|
AddSortableSpriteToDraw(image, x - p[6], y - p[7], p[4], p[5], 0x28, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
unix.c
2
unix.c
|
@ -461,7 +461,7 @@ int CDECL main(int argc, char* argv[])
|
||||||
#ifdef WITH_COCOA
|
#ifdef WITH_COCOA
|
||||||
cocoaSetupAutoreleasePool();
|
cocoaSetupAutoreleasePool();
|
||||||
/* This is passed if we are launched by double-clicking */
|
/* This is passed if we are launched by double-clicking */
|
||||||
if(argc >= 2 && strncmp (argv[1], "-psn", 4) == 0) {
|
if (argc >= 2 && strncmp (argv[1], "-psn", 4) == 0) {
|
||||||
argv[1] = NULL;
|
argv[1] = NULL;
|
||||||
argc = 1;
|
argc = 1;
|
||||||
cocoaSetWorkingDirectory();
|
cocoaSetWorkingDirectory();
|
||||||
|
|
|
@ -341,7 +341,7 @@ bool AllocateVehicles(Vehicle **vl, int num)
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
VehicleID counter = 0;
|
VehicleID counter = 0;
|
||||||
|
|
||||||
for(i = 0; i != num; i++) {
|
for (i = 0; i != num; i++) {
|
||||||
v = AllocateSingleVehicle(&counter);
|
v = AllocateSingleVehicle(&counter);
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -715,9 +715,9 @@ void ViewportAddVehicles(DrawPixelInfo *dpi)
|
||||||
y = ((dpi->top - 70) & 0xFC0);
|
y = ((dpi->top - 70) & 0xFC0);
|
||||||
y2 = ((dpi->top + dpi->height) & 0xFC0);
|
y2 = ((dpi->top + dpi->height) & 0xFC0);
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
xb = x;
|
xb = x;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
veh = _vehicle_position_hash[(x + y) & 0xFFFF];
|
veh = _vehicle_position_hash[(x + y) & 0xFFFF];
|
||||||
while (veh != INVALID_VEHICLE) {
|
while (veh != INVALID_VEHICLE) {
|
||||||
v = GetVehicle(veh);
|
v = GetVehicle(veh);
|
||||||
|
@ -1945,8 +1945,7 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
|
||||||
{
|
{
|
||||||
if (v->vehstatus & VS_CRASHED) return 0xFF;
|
if (v->vehstatus & VS_CRASHED) return 0xFF;
|
||||||
|
|
||||||
switch(v->type)
|
switch (v->type) {
|
||||||
{
|
|
||||||
case VEH_Train:
|
case VEH_Train:
|
||||||
if (v->u.rail.track == 0x80) /* We'll assume the train is facing outwards */
|
if (v->u.rail.track == 0x80) /* We'll assume the train is facing outwards */
|
||||||
return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_RAIL)); /* Train in depot */
|
return DiagdirToDiagTrackdir(GetDepotDirection(v->tile, TRANSPORT_RAIL)); /* Train in depot */
|
||||||
|
|
|
@ -140,7 +140,7 @@ static int GetAvailableVideoMode(int *w, int *h)
|
||||||
|
|
||||||
// is the wanted mode among the available modes?
|
// is the wanted mode among the available modes?
|
||||||
for (i = 0; i != _num_resolutions; i++) {
|
for (i = 0; i != _num_resolutions; i++) {
|
||||||
if(*w == _resolutions[i][0] && *h == _resolutions[i][1])
|
if (*w == _resolutions[i][0] && *h == _resolutions[i][1])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ static int PollEvent(void)
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
// do not ask to quit on the main screen
|
// do not ask to quit on the main screen
|
||||||
if (_game_mode != GM_MENU) {
|
if (_game_mode != GM_MENU) {
|
||||||
if(_patches.autosave_on_exit) {
|
if (_patches.autosave_on_exit) {
|
||||||
DoExitSave();
|
DoExitSave();
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -709,7 +709,7 @@ static void Win32GdiMainLoop(void)
|
||||||
|
|
||||||
_wnd.running = true;
|
_wnd.running = true;
|
||||||
|
|
||||||
while(true) {
|
for (;;) {
|
||||||
while (PeekMessage(&mesg, NULL, 0, 0, PM_REMOVE)) {
|
while (PeekMessage(&mesg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
InteractiveRandom(); // randomness
|
InteractiveRandom(); // randomness
|
||||||
TranslateMessage(&mesg);
|
TranslateMessage(&mesg);
|
||||||
|
|
|
@ -571,7 +571,7 @@ void DebugMarkTile(TileIndex tile) {
|
||||||
void DebugClearMarkedTiles()
|
void DebugClearMarkedTiles()
|
||||||
{
|
{
|
||||||
uint size = MapSize(), i;
|
uint size = MapSize(), i;
|
||||||
for(i=0; i!=size; i++) {
|
for (i = 0; i != size; i++) {
|
||||||
if (_m[i].extra & 0x80) {
|
if (_m[i].extra & 0x80) {
|
||||||
_m[i].extra &= ~0x80;
|
_m[i].extra &= ~0x80;
|
||||||
MarkTileDirtyByTile(i);
|
MarkTileDirtyByTile(i);
|
||||||
|
@ -598,7 +598,7 @@ static bool IsPartOfAutoLine(int px, int py)
|
||||||
px -= _thd.selstart.x;
|
px -= _thd.selstart.x;
|
||||||
py -= _thd.selstart.y;
|
py -= _thd.selstart.y;
|
||||||
|
|
||||||
switch(_thd.drawstyle) {
|
switch (_thd.drawstyle) {
|
||||||
case HT_LINE | HT_DIR_X: return py == 0; // x direction
|
case HT_LINE | HT_DIR_X: return py == 0; // x direction
|
||||||
case HT_LINE | HT_DIR_Y: return px == 0; // y direction
|
case HT_LINE | HT_DIR_Y: return px == 0; // y direction
|
||||||
case HT_LINE | HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
|
case HT_LINE | HT_DIR_HU: return px == -py || px == -py - 16; // horizontal upper
|
||||||
|
@ -1954,7 +1954,7 @@ static byte Check2x1AutoRail(int mode)
|
||||||
int fxmy = _tile_fract_coords.x - _tile_fract_coords.y;
|
int fxmy = _tile_fract_coords.x - _tile_fract_coords.y;
|
||||||
int sxmy = (_thd.selend.x & 0xF) - (_thd.selend.y & 0xF);
|
int sxmy = (_thd.selend.x & 0xF) - (_thd.selend.y & 0xF);
|
||||||
|
|
||||||
switch(mode) {
|
switch (mode) {
|
||||||
case 0: // end piece is lower right
|
case 0: // end piece is lower right
|
||||||
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
|
if (fxpy >= 20 && sxpy <= 12) { /*SwapSelection(); DoRailroadTrack(0); */return 3; }
|
||||||
if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return 5; }
|
if (fxmy < -3 && sxmy > 3) {/* DoRailroadTrack(0); */return 5; }
|
||||||
|
|
2
widget.c
2
widget.c
|
@ -477,7 +477,7 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
int item;
|
int item;
|
||||||
|
|
||||||
switch(e->event) {
|
switch (e->event) {
|
||||||
case WE_PAINT: {
|
case WE_PAINT: {
|
||||||
int x,y,i,sel;
|
int x,y,i,sel;
|
||||||
|
|
||||||
|
|
6
win32.c
6
win32.c
|
@ -141,7 +141,7 @@ static void GetFileInfo(DebugFileInfo *dfi, const char *filename)
|
||||||
file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
|
file = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
|
||||||
OPEN_EXISTING, 0, 0);
|
OPEN_EXISTING, 0, 0);
|
||||||
if (file != INVALID_HANDLE_VALUE) {
|
if (file != INVALID_HANDLE_VALUE) {
|
||||||
while(true) {
|
for (;;) {
|
||||||
if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 ||
|
if (ReadFile(file, buffer, sizeof(buffer), &numread, NULL) == 0 ||
|
||||||
numread == 0)
|
numread == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -359,7 +359,7 @@ static bool DoEmergencySave(HWND wnd)
|
||||||
|
|
||||||
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) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
SetDlgItemText(wnd, 10, _crash_desc);
|
SetDlgItemText(wnd, 10, _crash_desc);
|
||||||
SetDlgItemText(wnd, 11, _crash_msg);
|
SetDlgItemText(wnd, 11, _crash_msg);
|
||||||
|
@ -367,7 +367,7 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM l
|
||||||
SetWndSize(wnd, -1);
|
SetWndSize(wnd, -1);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch(wParam) {
|
switch (wParam) {
|
||||||
case 12: // Close
|
case 12: // Close
|
||||||
ExitProcess(0);
|
ExitProcess(0);
|
||||||
case 13: { // Emergency save
|
case 13: { // Emergency save
|
||||||
|
|
2
window.c
2
window.c
|
@ -48,7 +48,7 @@ static void DispatchLeftClickEvent(Window* w, int x, int y)
|
||||||
|
|
||||||
if (wi->type & 0xE0) {
|
if (wi->type & 0xE0) {
|
||||||
/* special widget handling for buttons*/
|
/* special widget handling for buttons*/
|
||||||
switch(wi->type) {
|
switch (wi->type) {
|
||||||
case WWT_IMGBTN | WWB_PUSHBUTTON: /* WWT_PUSHIMGBTN */
|
case WWT_IMGBTN | WWB_PUSHBUTTON: /* WWT_PUSHIMGBTN */
|
||||||
case WWT_TEXTBTN | WWB_PUSHBUTTON: /* WWT_PUSHTXTBTN */
|
case WWT_TEXTBTN | WWB_PUSHBUTTON: /* WWT_PUSHTXTBTN */
|
||||||
HandleButtonClick(w, e.click.widget);
|
HandleButtonClick(w, e.click.widget);
|
||||||
|
|
Loading…
Reference in New Issue