1
0
Fork 0

Cleanup: Remove unneeded parameters.

pull/11320/head
frosch 2023-09-16 23:27:16 +02:00 committed by frosch
parent b5885295f0
commit 5733145c59
16 changed files with 45 additions and 53 deletions

View File

@ -340,13 +340,11 @@ std::vector<ICURun> ItemizeScript(UChar *buff, size_t length, std::vector<ICURun
* *
* Basically, this always returns the same or more runs than given. * Basically, this always returns the same or more runs than given.
* *
* @param buff The string to itemize.
* @param length The length of the string.
* @param runs_current The current runs. * @param runs_current The current runs.
* @param font_mapping The font mapping. * @param font_mapping The font mapping.
* @return The runs. * @return The runs.
*/ */
std::vector<ICURun> ItemizeStyle(UChar *buff, size_t length, std::vector<ICURun> &runs_current, FontMap &font_mapping) std::vector<ICURun> ItemizeStyle(std::vector<ICURun> &runs_current, FontMap &font_mapping)
{ {
std::vector<ICURun> runs; std::vector<ICURun> runs;
@ -380,7 +378,7 @@ std::vector<ICURun> ItemizeStyle(UChar *buff, size_t length, std::vector<ICURun>
auto runs = ItemizeBidi(buff, length); auto runs = ItemizeBidi(buff, length);
runs = ItemizeScript(buff, length, runs); runs = ItemizeScript(buff, length, runs);
runs = ItemizeStyle(buff, length, runs, font_mapping); runs = ItemizeStyle(runs, font_mapping);
if (runs.size() == 0) return nullptr; if (runs.size() == 0) return nullptr;

View File

@ -1585,7 +1585,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
* This function tries to flatten out the land below an industry, without * This function tries to flatten out the land below an industry, without
* damaging the surroundings too much. * damaging the surroundings too much.
*/ */
static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout, int type) static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout)
{ {
int max_x = 0; int max_x = 0;
int max_y = 0; int max_y = 0;
@ -1990,7 +1990,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world &&
!_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout, type)) { !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout)) {
return_cmd_error(STR_ERROR_SITE_UNSUITABLE); return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
} }
@ -1998,7 +1998,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
*ip = new Industry(tile); *ip = new Industry(tile);
if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout, type); if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout);
DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits); DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits);
} }

View File

@ -870,7 +870,7 @@ bool NetworkServerStart()
/* Check for the client and server names to be set, but only after the scripts had a chance to set them.*/ /* Check for the client and server names to be set, but only after the scripts had a chance to set them.*/
if (_network_dedicated) CheckClientAndServerName(); if (_network_dedicated) CheckClientAndServerName();
NetworkDisconnect(false, false); NetworkDisconnect(false);
NetworkInitialize(false); NetworkInitialize(false);
NetworkUDPInitialize(); NetworkUDPInitialize();
Debug(net, 5, "Starting listeners for clients"); Debug(net, 5, "Starting listeners for clients");
@ -938,10 +938,9 @@ void NetworkReboot()
/** /**
* We want to disconnect from the host/clients. * We want to disconnect from the host/clients.
* @param blocking whether to wait till everything has been closed.
* @param close_admins Whether the admin sockets need to be closed as well. * @param close_admins Whether the admin sockets need to be closed as well.
*/ */
void NetworkDisconnect(bool blocking, bool close_admins) void NetworkDisconnect(bool close_admins)
{ {
if (_network_server) { if (_network_server) {
for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) { for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) {
@ -1263,7 +1262,7 @@ void NetworkStartUp()
/** This shuts the network down */ /** This shuts the network down */
void NetworkShutDown() void NetworkShutDown()
{ {
NetworkDisconnect(true); NetworkDisconnect();
NetworkHTTPUninitialize(); NetworkHTTPUninitialize();
NetworkUDPClose(); NetworkUDPClose();

View File

@ -43,7 +43,7 @@ void NetworkUpdateServerGameType();
bool NetworkCompanyHasClients(CompanyID company); bool NetworkCompanyHasClients(CompanyID company);
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password); std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
void NetworkReboot(); void NetworkReboot();
void NetworkDisconnect(bool blocking = false, bool close_admins = true); void NetworkDisconnect(bool close_admins = true);
void NetworkGameLoop(); void NetworkGameLoop();
void NetworkBackgroundLoop(); void NetworkBackgroundLoop();
std::string_view ParseFullConnectionString(const std::string &connection_string, uint16_t &port, CompanyID *company_id = nullptr); std::string_view ParseFullConnectionString(const std::string &connection_string, uint16_t &port, CompanyID *company_id = nullptr);

View File

@ -237,7 +237,7 @@ uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t p
return object.ResolveCallback(); return object.ResolveCallback();
} }
static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour, StationGfx gfx) static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour)
{ {
const DrawTileSprites *dts = group->ProcessRegisters(nullptr); const DrawTileSprites *dts = group->ProcessRegisters(nullptr);
@ -255,7 +255,7 @@ static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGrou
DrawNewGRFTileSeq(ti, dts, TO_BUILDINGS, 0, GENERAL_SPRITE_COLOUR(colour)); DrawNewGRFTileSeq(ti, dts, TO_BUILDINGS, 0, GENERAL_SPRITE_COLOUR(colour));
} }
bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts) bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts)
{ {
if (ti->tileh != SLOPE_FLAT) { if (ti->tileh != SLOPE_FLAT) {
bool draw_old_one = true; bool draw_old_one = true;
@ -275,7 +275,7 @@ bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const Airport
} }
const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour, gfx); AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour);
return true; return true;
} }

View File

@ -87,6 +87,6 @@ private:
void AnimateAirportTile(TileIndex tile); void AnimateAirportTile(TileIndex tile);
void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID);
bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts); bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts);
#endif /* NEWGRF_AIRPORTTILES_H */ #endif /* NEWGRF_AIRPORTTILES_H */

View File

@ -155,7 +155,7 @@ uint32_t IndustryTileResolverObject::GetDebugID() const
return GetIndustryTileSpec(gfx)->grf_prop.local_id; return GetIndustryTileSpec(gfx)->grf_prop.local_id;
} }
static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx) static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage)
{ {
const DrawTileSprites *dts = group->ProcessRegisters(&stage); const DrawTileSprites *dts = group->ProcessRegisters(&stage);
@ -208,7 +208,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
/* Limit the building stage to the number of stages supplied. */ /* Limit the building stage to the number of stages supplied. */
const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
byte stage = GetIndustryConstructionStage(ti->tile); byte stage = GetIndustryConstructionStage(ti->tile);
IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage, gfx); IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage);
return true; return true;
} }

View File

@ -126,7 +126,7 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &, int winla
Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) : TrueTypeFontCache(fs, pixels), logfont(logfont) Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) : TrueTypeFontCache(fs, pixels), logfont(logfont)
{ {
this->dc = CreateCompatibleDC(nullptr); this->dc = CreateCompatibleDC(nullptr);
this->SetFontSize(fs, pixels); this->SetFontSize(pixels);
} }
Win32FontCache::~Win32FontCache() Win32FontCache::~Win32FontCache()
@ -136,7 +136,7 @@ Win32FontCache::~Win32FontCache()
DeleteObject(this->font); DeleteObject(this->font);
} }
void Win32FontCache::SetFontSize(FontSize fs, int pixels) void Win32FontCache::SetFontSize(int pixels)
{ {
if (pixels == 0) { if (pixels == 0) {
/* Try to determine a good height based on the minimal height recommended by the font. */ /* Try to determine a good height based on the minimal height recommended by the font. */
@ -202,7 +202,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels)
void Win32FontCache::ClearFontCache() void Win32FontCache::ClearFontCache()
{ {
/* GUI scaling might have changed, determine font size anew if it was automatically selected. */ /* GUI scaling might have changed, determine font size anew if it was automatically selected. */
if (this->font != nullptr) this->SetFontSize(this->fs, this->req_size); if (this->font != nullptr) this->SetFontSize(this->req_size);
this->TrueTypeFontCache::ClearFontCache(); this->TrueTypeFontCache::ClearFontCache();
} }

View File

@ -23,7 +23,7 @@ private:
SIZE glyph_size; ///< Maximum size of regular glyphs. SIZE glyph_size; ///< Maximum size of regular glyphs.
std::string fontname; ///< Cached copy of loaded font facename std::string fontname; ///< Cached copy of loaded font facename
void SetFontSize(FontSize fs, int pixels); void SetFontSize(int pixels);
protected: protected:
const void *InternalGetFontTable(uint32_t tag, size_t &length) override; const void *InternalGetFontTable(uint32_t tag, size_t &length) override;

View File

@ -236,10 +236,9 @@ static CommandCost EnsureNoTrainOnTrack(TileIndex tile, Track track)
* Check that the new track bits may be built. * Check that the new track bits may be built.
* @param tile %Tile to build on. * @param tile %Tile to build on.
* @param to_build New track bits. * @param to_build New track bits.
* @param flags Flags of the operation.
* @return Succeeded or failed command. * @return Succeeded or failed command.
*/ */
static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags) static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build)
{ {
if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION); if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION);
@ -442,7 +441,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai
if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION); if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION);
ret = CheckTrackCombination(tile, trackbit, flags); ret = CheckTrackCombination(tile, trackbit);
if (ret.Succeeded()) ret = EnsureNoTrainOnTrack(tile, track); if (ret.Succeeded()) ret = EnsureNoTrainOnTrack(tile, track);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;

View File

@ -319,10 +319,9 @@ CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, R
* @param flags operation to perform * @param flags operation to perform
* @param pieces roadbits to remove * @param pieces roadbits to remove
* @param rt roadtype to remove * @param rt roadtype to remove
* @param crossing_check should we check if there is a tram track when we are removing road from crossing?
* @param town_check should we check if the town allows removal? * @param town_check should we check if the town allows removal?
*/ */
static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool crossing_check, bool town_check = true) static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool town_check)
{ {
assert(pieces != ROAD_NONE); assert(pieces != ROAD_NONE);
@ -1110,7 +1109,7 @@ std::tuple<CommandCost, Money> CmdRemoveLongRoad(DoCommandFlag flags, TileIndex
if (money_spent > 0 && money_spent > money_available) { if (money_spent > 0 && money_spent > money_available) {
return { cost, std::get<0>(Command<CMD_REMOVE_LONG_ROAD>::Do(flags & ~DC_EXEC, end_tile, start_tile, rt, axis, start_half, end_half)).GetCost() }; return { cost, std::get<0>(Command<CMD_REMOVE_LONG_ROAD>::Do(flags & ~DC_EXEC, end_tile, start_tile, rt, axis, start_half, end_half)).GetCost() };
} }
RemoveRoad(tile, flags, bits, rtt, true, false); RemoveRoad(tile, flags, bits, rtt, false);
} }
cost.AddCost(ret); cost.AddCost(ret);
had_success = true; had_success = true;
@ -1261,7 +1260,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) { for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) {
if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue; if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue;
CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, false); CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, true);
if (tmp_ret.Failed()) return tmp_ret; if (tmp_ret.Failed()) return tmp_ret;
ret.AddCost(tmp_ret); ret.AddCost(tmp_ret);
} }
@ -2035,7 +2034,7 @@ static void TileLoop_Road(TileIndex tile)
/* Possibly change road type */ /* Possibly change road type */
if (GetRoadOwner(tile, RTT_ROAD) == OWNER_TOWN) { if (GetRoadOwner(tile, RTT_ROAD) == OWNER_TOWN) {
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
if (rt != GetRoadTypeRoad(tile)) { if (rt != GetRoadTypeRoad(tile)) {
SetRoadType(tile, RTT_ROAD, rt); SetRoadType(tile, RTT_ROAD, rt);
} }

View File

@ -1072,10 +1072,9 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
* Check whether we can expand the rail part of the given station. * Check whether we can expand the rail part of the given station.
* @param st the station to expand * @param st the station to expand
* @param new_ta the current (and if all is fine new) tile area of the rail part of the station * @param new_ta the current (and if all is fine new) tile area of the rail part of the station
* @param axis the axis of the newly build rail
* @return Succeeded or failed command. * @return Succeeded or failed command.
*/ */
CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis) CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta)
{ {
TileArea cur_ta = st->train_station; TileArea cur_ta = st->train_station;
@ -1355,7 +1354,7 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
if (st != nullptr && st->train_station.tile != INVALID_TILE) { if (st != nullptr && st->train_station.tile != INVALID_TILE) {
ret = CanExpandRailStation(st, new_location, axis); ret = CanExpandRailStation(st, new_location);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
} }
@ -2967,7 +2966,7 @@ static void DrawTile_Station(TileInfo *ti)
gfx = GetAirportGfx(ti->tile); gfx = GetAirportGfx(ti->tile);
if (gfx >= NEW_AIRPORTTILE_OFFSET) { if (gfx >= NEW_AIRPORTTILE_OFFSET) {
const AirportTileSpec *ats = AirportTileSpec::Get(gfx); const AirportTileSpec *ats = AirportTileSpec::Get(gfx);
if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), gfx, ats)) { if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), ats)) {
return; return;
} }
/* No sprite group (or no valid one) found, meaning no graphics associated. /* No sprite group (or no valid one) found, meaning no graphics associated.

View File

@ -309,6 +309,6 @@ static inline uint16_t TownTicksToGameTicks(uint16_t ticks) {
} }
RoadType GetTownRoadType(const Town *t); RoadType GetTownRoadType();
#endif /* TOWN_H */ #endif /* TOWN_H */

View File

@ -852,7 +852,7 @@ static RoadBits GetTownRoadBits(TileIndex tile)
return GetAnyRoadBits(tile, RTT_ROAD, true); return GetAnyRoadBits(tile, RTT_ROAD, true);
} }
RoadType GetTownRoadType(const Town *t) RoadType GetTownRoadType()
{ {
RoadType best_rt = ROADTYPE_ROAD; RoadType best_rt = ROADTYPE_ROAD;
const RoadTypeInfo *best = nullptr; const RoadTypeInfo *best = nullptr;
@ -939,7 +939,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir)
/* No, try if we are able to build a road piece there. /* No, try if we are able to build a road piece there.
* If that fails clear the land, and if that fails exit. * If that fails clear the land, and if that fails exit.
* This is to make sure that we can build a road here later. */ * This is to make sure that we can build a road here later. */
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
if (Command<CMD_BUILD_ROAD>::Do(DC_AUTO | DC_NO_WATER, tile, (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X, rt, DRD_NONE, 0).Failed() && if (Command<CMD_BUILD_ROAD>::Do(DC_AUTO | DC_NO_WATER, tile, (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X, rt, DRD_NONE, 0).Failed() &&
Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Failed()) { Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Failed()) {
return false; return false;
@ -1108,7 +1108,7 @@ static bool GrowTownWithExtraHouse(Town *t, TileIndex tile)
*/ */
static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd) static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd)
{ {
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
if (Command<CMD_BUILD_ROAD>::Do(DC_EXEC | DC_AUTO | DC_NO_WATER, tile, rcmd, rt, DRD_NONE, t->index).Succeeded()) { if (Command<CMD_BUILD_ROAD>::Do(DC_EXEC | DC_AUTO | DC_NO_WATER, tile, rcmd, rt, DRD_NONE, t->index).Succeeded()) {
_grow_town_result = GROWTH_SUCCEED; _grow_town_result = GROWTH_SUCCEED;
return true; return true;
@ -1130,7 +1130,7 @@ static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, con
const int delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road const int delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road
TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile
RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir)); RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir));
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
/* Before we try anything, make sure the tile is on the map and not the void. */ /* Before we try anything, make sure the tile is on the map and not the void. */
if (!IsValidTile(next_tile)) return false; if (!IsValidTile(next_tile)) return false;
@ -1250,7 +1250,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi
byte bridge_type = RandomRange(MAX_BRIDGES - 1); byte bridge_type = RandomRange(MAX_BRIDGES - 1);
/* Can we actually build the bridge? */ /* Can we actually build the bridge? */
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
if (Command<CMD_BUILD_BRIDGE>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_BRIDGE>()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt).Succeeded()) { if (Command<CMD_BUILD_BRIDGE>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_BRIDGE>()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt).Succeeded()) {
Command<CMD_BUILD_BRIDGE>::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_BRIDGE>()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt); Command<CMD_BUILD_BRIDGE>::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_BRIDGE>()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt);
_grow_town_result = GROWTH_SUCCEED; _grow_town_result = GROWTH_SUCCEED;
@ -1321,7 +1321,7 @@ static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDi
if (!CanRoadContinueIntoNextTile(t, tunnel_tile, tunnel_dir)) return false; if (!CanRoadContinueIntoNextTile(t, tunnel_tile, tunnel_dir)) return false;
/* Attempt to build the tunnel. Return false if it fails to let the town build a road instead. */ /* Attempt to build the tunnel. Return false if it fails to let the town build a road instead. */
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
if (Command<CMD_BUILD_TUNNEL>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_TUNNEL>()), tile, TRANSPORT_ROAD, rt).Succeeded()) { if (Command<CMD_BUILD_TUNNEL>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_TUNNEL>()), tile, TRANSPORT_ROAD, rt).Succeeded()) {
Command<CMD_BUILD_TUNNEL>::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_TUNNEL>()), tile, TRANSPORT_ROAD, rt); Command<CMD_BUILD_TUNNEL>::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_TUNNEL>()), tile, TRANSPORT_ROAD, rt);
_grow_town_result = GROWTH_SUCCEED; _grow_town_result = GROWTH_SUCCEED;
@ -1362,17 +1362,16 @@ static inline bool RoadTypesAllowHouseHere(TileIndex t)
} }
/** Test if town can grow road onto a specific tile. /** Test if town can grow road onto a specific tile.
* @param town Town that is building.
* @param tile Tile to build upon. * @param tile Tile to build upon.
* @return true iff the tile's road type don't prevent extending the road. * @return true iff the tile's road type don't prevent extending the road.
*/ */
static bool TownCanGrowRoad(const Town *town, TileIndex tile) static bool TownCanGrowRoad(TileIndex tile)
{ {
if (!IsTileType(tile, MP_ROAD)) return true; if (!IsTileType(tile, MP_ROAD)) return true;
/* Allow extending on roadtypes which can be built by town, or if the road type matches the type the town will build. */ /* Allow extending on roadtypes which can be built by town, or if the road type matches the type the town will build. */
RoadType rt = GetRoadTypeRoad(tile); RoadType rt = GetRoadTypeRoad(tile);
return HasBit(GetRoadTypeInfo(rt)->flags, ROTF_TOWN_BUILD) || GetTownRoadType(town) == rt; return HasBit(GetRoadTypeInfo(rt)->flags, ROTF_TOWN_BUILD) || GetTownRoadType() == rt;
} }
/** /**
@ -1451,7 +1450,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
} }
} else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) { } else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) {
if (!TownCanGrowRoad(t1, tile)) return; if (!TownCanGrowRoad(tile)) return;
/* Continue building on a partial road. /* Continue building on a partial road.
* Should be always OK, so we only generate * Should be always OK, so we only generate
@ -1572,7 +1571,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t
return; return;
} }
if (!TownCanGrowRoad(t1, tile)) return; if (!TownCanGrowRoad(tile)) return;
_grow_town_result = GROWTH_SEARCH_STOPPED; _grow_town_result = GROWTH_SEARCH_STOPPED;
} }
@ -1780,7 +1779,7 @@ static bool GrowTown(Town *t)
/* Only work with plain land that not already has a house */ /* Only work with plain land that not already has a house */
if (!IsTileType(tile, MP_HOUSE) && IsTileFlat(tile)) { if (!IsTileType(tile, MP_HOUSE) && IsTileFlat(tile)) {
if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Succeeded()) { if (Command<CMD_LANDSCAPE_CLEAR>::Do(DC_AUTO | DC_NO_WATER, tile).Succeeded()) {
RoadType rt = GetTownRoadType(t); RoadType rt = GetTownRoadType();
Command<CMD_BUILD_ROAD>::Do(DC_EXEC | DC_AUTO, tile, GenRandomRoadBits(), rt, DRD_NONE, t->index); Command<CMD_BUILD_ROAD>::Do(DC_EXEC | DC_AUTO, tile, GenRandomRoadBits(), rt, DRD_NONE, t->index);
cur_company.Restore(); cur_company.Restore();
return true; return true;

View File

@ -1237,10 +1237,9 @@ static OGLProc GetOGLProcAddressCallback(const char *proc)
/** /**
* Set the pixel format of a window- * Set the pixel format of a window-
* @param dc Device context to set the pixel format of. * @param dc Device context to set the pixel format of.
* @param fullscreen Should the pixel format be used for fullscreen drawing?
* @return nullptr on success, error message otherwise. * @return nullptr on success, error message otherwise.
*/ */
static const char *SelectPixelFormat(HDC dc, bool fullscreen) static const char *SelectPixelFormat(HDC dc)
{ {
PIXELFORMATDESCRIPTOR pfd = { PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), // Size of this struct. sizeof(PIXELFORMATDESCRIPTOR), // Size of this struct.
@ -1281,7 +1280,7 @@ static void LoadWGLExtensions()
HDC dc = GetDC(wnd); HDC dc = GetDC(wnd);
/* Set pixel format of the window. */ /* Set pixel format of the window. */
if (SelectPixelFormat(dc, false) == nullptr) { if (SelectPixelFormat(dc) == nullptr) {
/* Create rendering context. */ /* Create rendering context. */
HGLRC rc = wglCreateContext(dc); HGLRC rc = wglCreateContext(dc);
if (rc != nullptr) { if (rc != nullptr) {
@ -1396,7 +1395,7 @@ const char *VideoDriver_Win32OpenGL::AllocateContext()
{ {
this->dc = GetDC(this->main_wnd); this->dc = GetDC(this->main_wnd);
const char *err = SelectPixelFormat(this->dc, this->fullscreen); const char *err = SelectPixelFormat(this->dc);
if (err != nullptr) return err; if (err != nullptr) return err;
HGLRC rc = nullptr; HGLRC rc = nullptr;

View File

@ -156,7 +156,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID *
extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec); extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec);
extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp); extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp);
extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis); extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta);
/** /**
* Convert existing rail to waypoint. Eg build a waypoint station over * Convert existing rail to waypoint. Eg build a waypoint station over
@ -224,7 +224,7 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis
/* check if we want to expand an already existing waypoint? */ /* check if we want to expand an already existing waypoint? */
if (wp->train_station.tile != INVALID_TILE) { if (wp->train_station.tile != INVALID_TILE) {
ret = CanExpandRailStation(wp, new_location, axis); ret = CanExpandRailStation(wp, new_location);
if (ret.Failed()) return ret; if (ret.Failed()) return ret;
} }