From 79d938b9570be94381cf61190d60bfc847fb8c4c Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Thu, 7 Jan 2021 21:28:20 +0000 Subject: [PATCH 01/50] Fix 0125892: Warning about unsigned unary minus --- src/station_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index d06178fc40..5a4d13c478 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2031,7 +2031,7 @@ static CommandCost RemoveRoadStop(TileIndex tile, DoCommandFlag flags) /* Update company infrastructure counts. */ FOR_ALL_ROADTRAMTYPES(rtt) { RoadType rt = GetRoadType(tile, rtt); - UpdateCompanyRoadInfrastructure(rt, GetRoadOwner(tile, rtt), -ROAD_STOP_TRACKBIT_FACTOR); + UpdateCompanyRoadInfrastructure(rt, GetRoadOwner(tile, rtt), -static_cast(ROAD_STOP_TRACKBIT_FACTOR)); } Company::Get(st->owner)->infrastructure.station--; From 639cfa43d23aa142cabbf2f08ec20a2133b0503e Mon Sep 17 00:00:00 2001 From: milek7 Date: Fri, 8 Jan 2021 01:26:51 +0100 Subject: [PATCH 02/50] Codechange: Use access __attribute__ to silence warnings in GCC --- src/stdafx.h | 6 ++++++ src/string_func.h | 16 ++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/stdafx.h b/src/stdafx.h index 12d4fa81da..9e2eb2aef8 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -136,6 +136,12 @@ # endif #endif /* __GNUC__ || __clang__ */ +#if defined(__GNUC__) +# define NOACCESS(args) __attribute__ ((access (none, args))) +#else +# define NOACCESS(args) +#endif + #if defined(__WATCOMC__) # define NORETURN # define CDECL diff --git a/src/string_func.h b/src/string_func.h index 13e14f2d39..7a53710c23 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -30,25 +30,25 @@ #include "core/bitmath_func.hpp" #include "string_type.h" -char *strecat(char *dst, const char *src, const char *last); -char *strecpy(char *dst, const char *src, const char *last); -char *stredup(const char *src, const char *last = nullptr); +char *strecat(char *dst, const char *src, const char *last) NOACCESS(3); +char *strecpy(char *dst, const char *src, const char *last) NOACCESS(3); +char *stredup(const char *src, const char *last = nullptr) NOACCESS(2); -int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4); -int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) WARN_FORMAT(3, 0); +int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4) NOACCESS(2); +int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) WARN_FORMAT(3, 0) NOACCESS(2); char *CDECL str_fmt(const char *str, ...) WARN_FORMAT(1, 2); -void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); +void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK) NOACCESS(2); std::string str_validate(const std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); void ValidateString(const char *str); -void str_fix_scc_encoded(char *str, const char *last); +void str_fix_scc_encoded(char *str, const char *last) NOACCESS(2); void str_strip_colours(char *str); bool strtolower(char *str); bool strtolower(std::string &str, std::string::size_type offs = 0); -bool StrValid(const char *str, const char *last); +bool StrValid(const char *str, const char *last) NOACCESS(2); /** * Check if a string buffer is empty. From c1fddb9a6ae5c3af6865461a7295788a341011a2 Mon Sep 17 00:00:00 2001 From: milek7 Date: Fri, 8 Jan 2021 01:57:58 +0100 Subject: [PATCH 03/50] Codechange: Check if access __attribute__ is supported before trying to use it. --- src/stdafx.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/stdafx.h b/src/stdafx.h index 9e2eb2aef8..7d5a8754f6 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -136,8 +136,12 @@ # endif #endif /* __GNUC__ || __clang__ */ -#if defined(__GNUC__) -# define NOACCESS(args) __attribute__ ((access (none, args))) +#if defined __has_attribute +# if __has_attribute (access) +# define NOACCESS(args) __attribute__ ((access (none, args))) +# else +# define NOACCESS(args) +# endif #else # define NOACCESS(args) #endif From 9b800a96ed32720ff60b74e498a0e0a6351004f9 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Fri, 8 Jan 2021 10:16:18 +0000 Subject: [PATCH 04/50] Codechange: Remove min/max functions in favour of STL variants (#8502) --- src/3rdparty/squirrel/squirrel/sqbaselib.cpp | 5 - src/ai/ai_config.cpp | 4 +- src/ai/ai_gui.cpp | 10 +- src/aircraft_cmd.cpp | 16 +-- src/airport_gui.cpp | 2 +- src/autoreplace_cmd.cpp | 4 +- src/autoreplace_gui.cpp | 6 +- src/blitter/32bpp_anim.cpp | 4 +- src/blitter/32bpp_anim_sse2.cpp | 2 +- src/blitter/32bpp_base.cpp | 6 +- src/blitter/32bpp_optimized.cpp | 6 +- src/blitter/32bpp_simple.cpp | 2 +- src/blitter/32bpp_sse2.cpp | 2 +- src/blitter/8bpp_optimized.cpp | 2 +- src/blitter/common.hpp | 2 +- src/bridge_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 19 ++- src/cargopacket.cpp | 20 ++-- src/cargotype.cpp | 1 - src/cheat_gui.cpp | 16 +-- src/clear_cmd.cpp | 2 +- src/company_cmd.cpp | 12 +- src/company_gui.cpp | 120 +++++++++---------- src/console_cmds.cpp | 2 +- src/console_gui.cpp | 10 +- src/core/geometry_func.cpp | 4 +- src/core/kdtree.hpp | 3 +- src/core/math_func.hpp | 62 +--------- src/core/pool_func.hpp | 6 +- src/core/smallmatrix_type.hpp | 4 +- src/core/smallstack_type.hpp | 4 +- src/core/smallvec_type.hpp | 1 - src/date_gui.cpp | 4 +- src/depot_gui.cpp | 16 +-- src/disaster_vehicle.cpp | 2 +- src/dock_gui.cpp | 2 +- src/economy.cpp | 42 +++---- src/elrail.cpp | 3 +- src/engine.cpp | 8 +- src/engine_gui.cpp | 4 +- src/error_gui.cpp | 8 +- src/fileio.cpp | 5 +- src/fontcache.cpp | 16 +-- src/fontdetection.cpp | 2 +- src/framerate_gui.cpp | 26 ++-- src/gamelog.cpp | 2 +- src/genworld_gui.cpp | 4 +- src/gfx.cpp | 26 ++-- src/gfx_layout.cpp | 4 +- src/gfxinit.cpp | 2 +- src/goal_gui.cpp | 2 +- src/graph_gui.cpp | 30 ++--- src/ground_vehicle.cpp | 14 +-- src/ground_vehicle.hpp | 4 +- src/group_gui.cpp | 22 ++-- src/highscore.cpp | 6 +- src/highscore_gui.cpp | 2 +- src/industry.h | 1 - src/industry_cmd.cpp | 30 ++--- src/industry_gui.cpp | 30 ++--- src/ini_load.cpp | 2 +- src/landscape.cpp | 12 +- src/linkgraph/demands.cpp | 8 +- src/linkgraph/linkgraph.cpp | 9 +- src/linkgraph/linkgraph.h | 4 +- src/linkgraph/linkgraph_gui.cpp | 6 +- src/linkgraph/linkgraphjob.cpp | 6 +- src/linkgraph/linkgraphjob.h | 2 +- src/linkgraph/mcf.cpp | 4 +- src/map.cpp | 8 +- src/misc/str.hpp | 2 +- src/misc_cmd.cpp | 4 +- src/misc_gui.cpp | 18 +-- src/music/dmusic.cpp | 1 - src/music/midifile.cpp | 1 - src/music/win32_m.cpp | 2 +- src/music_gui.cpp | 2 +- src/network/core/tcp_http.cpp | 8 +- src/network/network_admin.cpp | 4 +- src/network/network_chat_gui.cpp | 6 +- src/network/network_client.cpp | 6 +- src/network/network_content.cpp | 4 +- src/network/network_content_gui.cpp | 6 +- src/network/network_gui.cpp | 26 ++-- src/network/network_server.cpp | 4 +- src/network/network_udp.cpp | 2 +- src/newgrf.cpp | 35 +++--- src/newgrf_config.cpp | 4 +- src/newgrf_debug_gui.cpp | 10 +- src/newgrf_engine.cpp | 4 +- src/newgrf_gui.cpp | 60 +++++----- src/newgrf_industries.cpp | 22 ++-- src/newgrf_object.cpp | 8 +- src/newgrf_profiling.cpp | 2 +- src/newgrf_spritegroup.cpp | 9 +- src/newgrf_station.cpp | 18 +-- src/newgrf_text.cpp | 7 +- src/news_gui.cpp | 8 +- src/object_cmd.cpp | 4 +- src/object_gui.cpp | 10 +- src/openttd.cpp | 4 +- src/order_cmd.cpp | 6 +- src/order_gui.cpp | 4 +- src/os/macosx/string_osx.cpp | 2 +- src/os/windows/crashlog_win.cpp | 2 +- src/os/windows/string_uniscribe.cpp | 4 +- src/osk_gui.cpp | 2 +- src/pathfinder/follow_track.hpp | 2 +- src/pathfinder/npf/npf.cpp | 2 +- src/pathfinder/yapf/yapf_common.hpp | 2 +- src/pathfinder/yapf/yapf_destrail.hpp | 2 +- src/pathfinder/yapf/yapf_road.cpp | 2 +- src/pathfinder/yapf/yapf_ship.cpp | 2 +- src/rail.h | 6 +- src/rail_cmd.cpp | 2 +- src/rail_gui.cpp | 22 ++-- src/roadveh_cmd.cpp | 4 +- src/saveload/afterload.cpp | 8 +- src/saveload/company_sl.cpp | 2 +- src/saveload/misc_sl.cpp | 2 +- src/saveload/oldloader_sl.cpp | 4 +- src/saveload/saveload.cpp | 4 +- src/screenshot.cpp | 8 +- src/script/api/script_bridge.cpp | 2 +- src/script/api/script_priorityqueue.cpp | 1 - src/script/api/script_rail.cpp | 13 +- src/script/api/script_town.cpp | 4 +- src/script/squirrel_std.cpp | 4 +- src/settings_gui.cpp | 18 +-- src/settingsgen/settingsgen.cpp | 2 +- src/ship.h | 2 +- src/ship_cmd.cpp | 4 +- src/signs_gui.cpp | 2 +- src/smallmap_gui.cpp | 36 +++--- src/sound.cpp | 4 +- src/sound/win32_s.cpp | 2 +- src/sound/xaudio2_s.cpp | 2 +- src/spritecache.cpp | 20 ++-- src/spriteloader/grf.cpp | 4 +- src/station.cpp | 20 ++-- src/station_cmd.cpp | 34 +++--- src/station_gui.cpp | 30 ++--- src/station_kdtree.h | 8 +- src/statusbar_gui.cpp | 6 +- src/stdafx.h | 1 + src/story_gui.cpp | 12 +- src/strgen/strgen.cpp | 2 +- src/strgen/strgen_base.cpp | 4 +- src/string.cpp | 2 +- src/strings.cpp | 4 +- src/terraform_cmd.cpp | 4 +- src/terraform_gui.cpp | 8 +- src/textfile_gui.cpp | 4 +- src/tgp.cpp | 24 ++-- src/tile_map.cpp | 56 ++++----- src/tilearea.cpp | 24 ++-- src/tilematrix_type.hpp | 12 +- src/timetable_cmd.cpp | 2 +- src/timetable_gui.cpp | 4 +- src/toolbar_gui.cpp | 16 +-- src/town.h | 2 +- src/town_cmd.cpp | 16 +-- src/town_gui.cpp | 4 +- src/train_cmd.cpp | 22 ++-- src/train_gui.cpp | 14 +-- src/tree_cmd.cpp | 4 +- src/tree_gui.cpp | 4 +- src/tunnelbridge_cmd.cpp | 8 +- src/vehicle.cpp | 22 ++-- src/vehicle_cmd.cpp | 4 +- src/vehicle_gui.cpp | 43 +++---- src/video/allegro_v.cpp | 1 - src/video/sdl2_v.cpp | 5 +- src/video/sdl_v.cpp | 5 +- src/video/win32_v.cpp | 9 +- src/viewport.cpp | 32 ++--- src/viewport_sprite_sorter_sse4.cpp | 2 +- src/widget.cpp | 64 +++++----- src/widget_type.h | 4 +- src/widgets/dropdown.cpp | 10 +- src/window.cpp | 52 ++++---- 181 files changed, 902 insertions(+), 956 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp index e5de01a635..232c27d2be 100644 --- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp +++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp @@ -1,14 +1,9 @@ /* * see copyright notice in squirrel.h */ -/* - * Needs to be first due to a squirrel header defining type() and type() - * being used in some versions of the headers included by algorithm. - */ #include "../../../stdafx.h" -#include #include "sqpcheader.h" #include "sqvm.h" #include "sqstring.h" diff --git a/src/ai/ai_config.cpp b/src/ai/ai_config.cpp index 2afa69d39e..98618feb20 100644 --- a/src/ai/ai_config.cpp +++ b/src/ai/ai_config.cpp @@ -39,7 +39,7 @@ AIConfig::AIConfig(const AIConfig *config) : ScriptConfig(config) * This is necessary because the ScriptConfig constructor will instead call * ScriptConfig::AddRandomDeviation(). */ int start_date = config->GetSetting("start_date"); - this->SetSetting("start_date", start_date != 0 ? max(1, this->GetSetting("start_date")) : 0); + this->SetSetting("start_date", start_date != 0 ? std::max(1, this->GetSetting("start_date")) : 0); } /* static */ AIConfig *AIConfig::GetConfig(CompanyID company, ScriptSettingSource source) @@ -134,5 +134,5 @@ void AIConfig::AddRandomDeviation() /* start_date = 0 is a special case, where random deviation does not occur. * If start_date was not already 0, then a minimum value of 1 must apply. */ - this->SetSetting("start_date", start_date != 0 ? max(1, this->GetSetting("start_date")) : 0); + this->SetSetting("start_date", start_date != 0 ? std::max(1, this->GetSetting("start_date")) : 0); } diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 9e16ec3ec1..30edc99407 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -236,7 +236,7 @@ struct AIListWindow : public Window { this->vscroll->SetCount((int)this->info_list->size() + 1); /* selected goes from -1 .. length of ai list - 1. */ - this->selected = min(this->selected, this->vscroll->GetCount() - 2); + this->selected = std::min(this->selected, this->vscroll->GetCount() - 2); } }; @@ -349,7 +349,7 @@ struct AISettingsWindow : public Window { void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget == WID_AIS_BACKGROUND) { - this->line_height = max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; + this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; resize->width = 1; resize->height = this->line_height; @@ -879,9 +879,9 @@ struct AIConfigWindow : public Window { case WID_AIC_INCREASE: { int new_value; if (widget == WID_AIC_DECREASE) { - new_value = max(0, GetGameSettings().difficulty.max_no_competitors - 1); + new_value = std::max(0, GetGameSettings().difficulty.max_no_competitors - 1); } else { - new_value = min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1); + new_value = std::min(MAX_COMPANIES - 1, GetGameSettings().difficulty.max_no_competitors + 1); } IConsoleSetSetting("difficulty.max_no_competitors", new_value); break; @@ -1176,7 +1176,7 @@ struct AIDebugWindow : public Window { this->autoscroll = this->vscroll->GetPosition() >= log->used - this->vscroll->GetCapacity(); } if (this->autoscroll) { - int scroll_pos = max(0, log->used - this->vscroll->GetCapacity()); + int scroll_pos = std::max(0, log->used - this->vscroll->GetCapacity()); if (scroll_pos != this->vscroll->GetPosition()) { this->vscroll->SetPosition(scroll_pos); diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 63252f5a3a..475bd7b12a 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -652,7 +652,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, /* adjust speed for broken vehicles */ if (v->vehstatus & VS_AIRCRAFT_BROKEN) { if (SPEED_LIMIT_BROKEN < speed_limit) hard_limit = false; - speed_limit = min(speed_limit, SPEED_LIMIT_BROKEN); + speed_limit = std::min(speed_limit, SPEED_LIMIT_BROKEN); } if (v->vcache.cached_max_speed < speed_limit) { @@ -669,10 +669,10 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, * speeds to that aircraft do not get to taxi speed straight after * touchdown. */ if (!hard_limit && v->cur_speed > speed_limit) { - speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed); + speed_limit = v->cur_speed - std::max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed); } - spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit); + spd = std::min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit); /* updates statusbar only if speed have changed to save CPU time */ if (spd != v->cur_speed) { @@ -737,7 +737,7 @@ void GetAircraftFlightLevelBounds(const Vehicle *v, int *min_level, int *max_lev } /* Make faster planes fly higher so that they can overtake slower ones */ - base_altitude += min(20 * (v->vcache.cached_max_speed / 200) - 90, 0); + base_altitude += std::min(20 * (v->vcache.cached_max_speed / 200) - 90, 0); if (min_level != nullptr) *min_level = base_altitude + AIRCRAFT_MIN_FLYING_ALTITUDE; if (max_level != nullptr) *max_level = base_altitude + AIRCRAFT_MAX_FLYING_ALTITUDE; @@ -929,7 +929,7 @@ static bool AircraftController(Aircraft *v) v->cur_speed = 0; return true; } - SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z_dest)); + SetAircraftPosition(v, v->x_pos, v->y_pos, std::min(v->z_pos + count, z_dest)); } } return false; @@ -975,9 +975,9 @@ static bool AircraftController(Aircraft *v) count = UpdateAircraftSpeed(v); if (count > 0) { if (v->z_pos > z) { - SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z)); + SetAircraftPosition(v, v->x_pos, v->y_pos, std::max(v->z_pos - count, z)); } else { - SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z)); + SetAircraftPosition(v, v->x_pos, v->y_pos, std::min(v->z_pos + count, z)); } } } @@ -1125,7 +1125,7 @@ static bool AircraftController(Aircraft *v) /* We're not flying below our destination, right? */ assert(airport_z <= z); - int t = max(1U, dist - 4); + int t = std::max(1U, dist - 4); int delta = z - airport_z; /* Only start lowering when we're sufficiently close for a 1:1 glide */ diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 464be03db1..8760e1f2a8 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -314,7 +314,7 @@ public: const AirportSpec *as = AirportSpec::Get(i); if (!as->enabled) continue; - size->width = max(size->width, GetStringBoundingBox(as->name).width); + size->width = std::max(size->width, GetStringBoundingBox(as->name).width); } this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index e3639742ff..313de99cf0 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -115,7 +115,7 @@ void CheckCargoCapacity(Vehicle *v) assert(dest->cargo.TotalCount() == dest->cargo.ActionCount(VehicleCargoList::MTA_KEEP)); if (dest->cargo.TotalCount() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue; - uint amount = min(to_spread, dest->cargo_cap - dest->cargo.TotalCount()); + uint amount = std::min(to_spread, dest->cargo_cap - dest->cargo.TotalCount()); src->cargo.Shift(amount, &dest->cargo); to_spread -= amount; } @@ -157,7 +157,7 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai } if (dest->cargo_type != src->cargo_type) continue; - uint amount = min(src->cargo.TotalCount(), dest->cargo_cap - dest->cargo.TotalCount()); + uint amount = std::min(src->cargo.TotalCount(), dest->cargo_cap - dest->cargo.TotalCount()); if (amount <= 0) continue; src->cargo.Shift(amount, &dest->cargo); diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 19df0f1d80..e952dcf190 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -416,8 +416,8 @@ public: case WID_RV_LEFT_MATRIX: case WID_RV_RIGHT_MATRIX: { int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1; - EngineID start = this->vscroll[side]->GetPosition(); // what is the offset for the start (scrolling) - EngineID end = min(this->vscroll[side]->GetCapacity() + start, (uint)this->engines[side].size()); + EngineID start = static_cast(this->vscroll[side]->GetPosition()); // what is the offset for the start (scrolling) + EngineID end = static_cast(std::min(this->vscroll[side]->GetCapacity() + start, this->engines[side].size())); /* Do the actual drawing */ DrawEngineList((VehicleType)this->window_number, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, @@ -475,7 +475,7 @@ public: NWidgetBase *nwi = this->GetWidget(side == 0 ? WID_RV_LEFT_DETAILS : WID_RV_RIGHT_DETAILS); int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT, nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side], ted); - needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); + needed_height = std::max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); } } if (needed_height != this->details_height) { // Details window are not high enough, enlarge them. diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index a5228bc327..c24f14bd92 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -74,7 +74,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel dst = dst_end - bp->skip_left; dst_end = dst + bp->width; - n = min(n - d, (uint)bp->width); + n = std::min(n - d, (uint)bp->width); goto draw; } dst += n; @@ -89,7 +89,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel dst_end += bp->width; while (dst < dst_end) { - n = min(*src_n++, (uint)(dst_end - dst)); + n = std::min(*src_n++, dst_end - dst); if (src_px->a == 0) { anim += n; diff --git a/src/blitter/32bpp_anim_sse2.cpp b/src/blitter/32bpp_anim_sse2.cpp index 5596d91af0..ee243cc21e 100644 --- a/src/blitter/32bpp_anim_sse2.cpp +++ b/src/blitter/32bpp_anim_sse2.cpp @@ -58,7 +58,7 @@ void Blitter_32bppSSE2_Anim::PaletteAnimate(const Palette &palette) if (x < 8 || colour_cmp_result != 0xFFFF || _mm_movemask_epi8(_mm_cmpeq_epi16(_mm_srli_epi16(data, 8), brightness_cmp)) != 0xFFFF) { /* slow path: < 8 pixels left or unexpected brightnesses */ - for (int z = min(x, 8); z != 0 ; z--) { + for (int z = std::min(x, 8); z != 0 ; z--) { int value = _mm_extract_epi16(data, 0); uint8 colour = GB(value, 0, 8); if (colour >= PALETTE_ANIM_START) { diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 6fe11c2350..0678fce38f 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -174,9 +174,9 @@ Colour Blitter_32bppBase::ReallyAdjustBrightness(Colour colour, uint8 brightness /* Reduce overbright strength */ ob /= 2; return Colour( - r >= 255 ? 255 : min(r + ob * (255 - r) / 256, 255), - g >= 255 ? 255 : min(g + ob * (255 - g) / 256, 255), - b >= 255 ? 255 : min(b + ob * (255 - b) / 256, 255), + r >= 255 ? 255 : std::min(r + ob * (255 - r) / 256, 255), + g >= 255 ? 255 : std::min(g + ob * (255 - g) / 256, 255), + b >= 255 ? 255 : std::min(b + ob * (255 - b) / 256, 255), colour.a); } diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index 59b857254d..ad15b8f811 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -83,7 +83,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL dst = dst_end - bp->skip_left; dst_end = dst + bp->width; - n = min(n - d, (uint)bp->width); + n = std::min(n - d, (uint)bp->width); goto draw; } dst += n; @@ -98,7 +98,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL dst_end += bp->width; while (dst < dst_end) { - n = min(*src_n++, (uint)(dst_end - dst)); + n = std::min(*src_n++, dst_end - dst); if (src_px->a == 0) { dst += n; @@ -324,7 +324,7 @@ Sprite *Blitter_32bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloc *dst_n = src->m; if (src->m != 0) { /* Get brightest value */ - uint8 rgb_max = max(src->r, max(src->g, src->b)); + uint8 rgb_max = std::max({src->r, src->g, src->b}); /* Black pixel (8bpp or old 32bpp image), so use default value */ if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS; diff --git a/src/blitter/32bpp_simple.cpp b/src/blitter/32bpp_simple.cpp index 7e7ef14530..a8096d801d 100644 --- a/src/blitter/32bpp_simple.cpp +++ b/src/blitter/32bpp_simple.cpp @@ -132,7 +132,7 @@ Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, Allocato dst[i].v = 0; } else { /* Get brightest value */ - uint8 rgb_max = max(src->r, max(src->g, src->b)); + uint8 rgb_max = std::max({src->r, src->g, src->b}); /* Black pixel (8bpp or old 32bpp image), so use default value */ if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS; diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index 2e5d32d655..f367161767 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -80,7 +80,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, Alloca if (src->m >= PALETTE_ANIM_START) has_anim = true; /* Get brightest value (or default brightness if it's a black pixel). */ - const uint8 rgb_max = max(src->r, max(src->g, src->b)); + const uint8 rgb_max = std::max({src->r, src->g, src->b}); dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max; /* Pre-convert the mapping channel to a RGB value. */ diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp index 5c34bf0674..2e7c142797 100644 --- a/src/blitter/8bpp_optimized.cpp +++ b/src/blitter/8bpp_optimized.cpp @@ -80,7 +80,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z dst += trans; width -= trans; if (width <= 0 || pixels == 0) continue; - pixels = min(pixels, (uint)width); + pixels = std::min(pixels, width); width -= pixels; switch (mode) { diff --git a/src/blitter/common.hpp b/src/blitter/common.hpp index b5040b1275..aaf63cd6a9 100644 --- a/src/blitter/common.hpp +++ b/src/blitter/common.hpp @@ -45,7 +45,7 @@ void Blitter::DrawLineGeneric(int x, int y, int x2, int y2, int screen_width, in return; } - int frac_diff = width * max(dx, dy); + int frac_diff = width * std::max(dx, dy); if (width > 1) { /* compute frac_diff = width * sqrt(dx*dx + dy*dy) * Start interval: diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index a69ed74489..c240fa8782 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -197,7 +197,7 @@ public: } sprite_dim.height++; // Sprite is rendered one pixel down in the matrix field. text_dim.height++; // Allowing the bottom row pixels to be rendered on the edge of the matrix field. - resize->height = max(sprite_dim.height, text_dim.height) + 2; // Max of both sizes + account for matrix edges. + resize->height = std::max(sprite_dim.height, text_dim.height) + 2; // Max of both sizes + account for matrix edges. this->bridgetext_offset = WD_MATRIX_LEFT + sprite_dim.width + 1; // Left edge of text, 1 pixel distance from the sprite. size->width = this->bridgetext_offset + text_dim.width + WD_MATRIX_RIGHT; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index a761e9b136..2a986c4a56 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -44,7 +44,7 @@ */ uint GetEngineListHeight(VehicleType type) { - return max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleImageCellSize(type, EIT_PURCHASE).height); + return std::max(FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM, GetVehicleImageCellSize(type, EIT_PURCHASE).height); } static const NWidgetPart _nested_build_vehicle_widgets[] = { @@ -1537,7 +1537,7 @@ struct BuildVehicleWindow : Window { case WID_BV_LIST: resize->height = GetEngineListHeight(this->vehicle_type); size->height = 3 * resize->height; - size->width = max(size->width, GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_left + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_right + 165); + size->width = std::max(size->width, GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_left + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_right + 165); break; case WID_BV_PANEL: @@ -1572,7 +1572,18 @@ struct BuildVehicleWindow : Window { { switch (widget) { case WID_BV_LIST: - DrawEngineList(this->vehicle_type, r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, &this->eng_list, this->vscroll->GetPosition(), min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->eng_list.size()), this->sel_engine, false, DEFAULT_GROUP); + DrawEngineList( + this->vehicle_type, + r.left + WD_FRAMERECT_LEFT, + r.right - WD_FRAMERECT_RIGHT, + r.top + WD_FRAMERECT_TOP, + &this->eng_list, + this->vscroll->GetPosition(), + static_cast(std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->eng_list.size())), + this->sel_engine, + false, + DEFAULT_GROUP + ); break; case WID_BV_SORT_ASCENDING_DESCENDING: @@ -1597,7 +1608,7 @@ struct BuildVehicleWindow : Window { NWidgetBase *nwi = this->GetWidget(WID_BV_PANEL); int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT, nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine, this->te); - needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); + needed_height = std::max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM); } if (needed_height != this->details_height) { // Details window are not high enough, enlarge them. int resize = needed_height - this->details_height; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index eafab6880e..86bba0261b 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -558,7 +558,7 @@ uint VehicleCargoList::Reassign(uint max_move, TileOrStationID) { static_assert(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER); static_assert(Tfrom - Tto == 1 || Tto - Tfrom == 1); - max_move = min(this->action_counts[Tfrom], max_move); + max_move = std::min(this->action_counts[Tfrom], max_move); this->action_counts[Tfrom] -= max_move; this->action_counts[Tto] += max_move; return max_move; @@ -574,7 +574,7 @@ uint VehicleCargoList::Reassign(uint max_move, TileOrStationID) template<> uint VehicleCargoList::Reassign(uint max_move, TileOrStationID next_station) { - max_move = min(this->action_counts[MTA_DELIVER], max_move); + max_move = std::min(this->action_counts[MTA_DELIVER], max_move); uint sum = 0; for (Iterator it(this->packets.begin()); sum < this->action_counts[MTA_TRANSFER] + max_move;) { @@ -603,7 +603,7 @@ uint VehicleCargoList::Reassignaction_counts[MTA_LOAD], max_move); + max_move = std::min(this->action_counts[MTA_LOAD], max_move); this->PopCargo(CargoReturn(this, dest, max_move, next)); return max_move; } @@ -616,7 +616,7 @@ uint VehicleCargoList::Return(uint max_move, StationCargoList *dest, StationID n */ uint VehicleCargoList::Shift(uint max_move, VehicleCargoList *dest) { - max_move = min(this->count, max_move); + max_move = std::min(this->count, max_move); this->PopCargo(CargoShift(this, dest, max_move)); return max_move; } @@ -633,12 +633,12 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen { uint moved = 0; if (this->action_counts[MTA_TRANSFER] > 0) { - uint move = min(this->action_counts[MTA_TRANSFER], max_move); + uint move = std::min(this->action_counts[MTA_TRANSFER], max_move); this->ShiftCargo(CargoTransfer(this, dest, move)); moved += move; } if (this->action_counts[MTA_TRANSFER] == 0 && this->action_counts[MTA_DELIVER] > 0 && moved < max_move) { - uint move = min(this->action_counts[MTA_DELIVER], max_move - moved); + uint move = std::min(this->action_counts[MTA_DELIVER], max_move - moved); this->ShiftCargo(CargoDelivery(this, move, payment)); moved += move; } @@ -653,7 +653,7 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen */ uint VehicleCargoList::Truncate(uint max_move) { - max_move = min(this->count, max_move); + max_move = std::min(this->count, max_move); this->PopCargo(CargoRemoval(this, max_move)); return max_move; } @@ -668,7 +668,7 @@ uint VehicleCargoList::Truncate(uint max_move) */ uint VehicleCargoList::Reroute(uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge) { - max_move = min(this->action_counts[MTA_TRANSFER], max_move); + max_move = std::min(this->action_counts[MTA_TRANSFER], max_move); this->ShiftCargo(VehicleCargoReroute(this, dest, max_move, avoid, avoid2, ge)); return max_move; } @@ -768,7 +768,7 @@ uint StationCargoList::ShiftCargo(Taction action, StationIDStack next, bool incl */ uint StationCargoList::Truncate(uint max_move, StationCargoAmountMap *cargo_per_source) { - max_move = min(max_move, this->count); + max_move = std::min(max_move, this->count); uint prev_count = this->count; uint moved = 0; uint loop = 0; @@ -839,7 +839,7 @@ uint StationCargoList::Reserve(uint max_move, VehicleCargoList *dest, TileIndex */ uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex load_place, StationIDStack next_station) { - uint move = min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); + uint move = std::min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move); if (move > 0) { this->reserved_count -= move; dest->Reassign(move); diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 8421c482ed..e30b9899f1 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -12,7 +12,6 @@ #include "newgrf_cargo.h" #include "string_func.h" #include "strings_func.h" -#include #include "table/sprites.h" #include "table/strings.h" diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 344e15e636..d83cd3996f 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -291,9 +291,9 @@ struct CheatWindow : Window { switch (ce->type) { case SLE_BOOL: SetDParam(0, STR_CONFIG_SETTING_ON); - width = max(width, GetStringBoundingBox(ce->str).width); + width = std::max(width, GetStringBoundingBox(ce->str).width); SetDParam(0, STR_CONFIG_SETTING_OFF); - width = max(width, GetStringBoundingBox(ce->str).width); + width = std::max(width, GetStringBoundingBox(ce->str).width); break; default: @@ -301,27 +301,27 @@ struct CheatWindow : Window { /* Display date for change date cheat */ case STR_CHEAT_CHANGE_DATE: SetDParam(0, ConvertYMDToDate(MAX_YEAR, 11, 31)); - width = max(width, GetStringBoundingBox(ce->str).width); + width = std::max(width, GetStringBoundingBox(ce->str).width); break; /* Draw coloured flag for change company cheat */ case STR_CHEAT_CHANGE_COMPANY: SetDParamMaxValue(0, MAX_COMPANIES); - width = max(width, GetStringBoundingBox(ce->str).width + 10 + 10); + width = std::max(width, GetStringBoundingBox(ce->str).width + 10 + 10); break; default: SetDParam(0, INT64_MAX); - width = max(width, GetStringBoundingBox(ce->str).width); + width = std::max(width, GetStringBoundingBox(ce->str).width); break; } break; } } - this->line_height = max(GetSpriteSize(SPR_BOX_CHECKED).height, GetSpriteSize(SPR_BOX_EMPTY).height); - this->line_height = max(this->line_height, SETTING_BUTTON_HEIGHT); - this->line_height = max(this->line_height, FONT_HEIGHT_NORMAL) + WD_PAR_VSEP_NORMAL; + this->line_height = std::max(GetSpriteSize(SPR_BOX_CHECKED).height, GetSpriteSize(SPR_BOX_EMPTY).height); + this->line_height = std::max(this->line_height, SETTING_BUTTON_HEIGHT); + this->line_height = std::max(this->line_height, FONT_HEIGHT_NORMAL) + WD_PAR_VSEP_NORMAL; size->width = width + 20 + this->box_width + SETTING_BUTTON_WIDTH /* stuff on the left */ + 10 /* extra spacing on right */; this->header_height = GetStringHeight(STR_CHEATS_WARNING, size->width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT) + WD_PAR_VSEP_WIDE; diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 06953884e1..6d3167e5a2 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -191,7 +191,7 @@ static void TileLoopClearAlps(TileIndex tile) } /* Update snow density. */ uint current_density = GetClearDensity(tile); - uint req_density = (k < 0) ? 0u : min((uint)k, 3); + uint req_density = (k < 0) ? 0u : std::min(k, 3u); if (current_density < req_density) { AddClearDensity(tile, 1); diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp index 1ecdaf89a0..5a6a114e75 100644 --- a/src/company_cmd.cpp +++ b/src/company_cmd.cpp @@ -265,9 +265,9 @@ void SubtractMoneyFromCompanyFract(CompanyID company, const CommandCost &cst) void UpdateLandscapingLimits() { for (Company *c : Company::Iterate()) { - c->terraform_limit = min(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, (uint32)_settings_game.construction.terraform_frame_burst << 16); - c->clear_limit = min(c->clear_limit + _settings_game.construction.clear_per_64k_frames, (uint32)_settings_game.construction.clear_frame_burst << 16); - c->tree_limit = min(c->tree_limit + _settings_game.construction.tree_per_64k_frames, (uint32)_settings_game.construction.tree_frame_burst << 16); + c->terraform_limit = std::min(c->terraform_limit + _settings_game.construction.terraform_per_64k_frames, _settings_game.construction.terraform_frame_burst << 16); + c->clear_limit = std::min(c->clear_limit + _settings_game.construction.clear_per_64k_frames, _settings_game.construction.clear_frame_burst << 16); + c->tree_limit = std::min(c->tree_limit + _settings_game.construction.tree_per_64k_frames, _settings_game.construction.tree_frame_burst << 16); } } @@ -554,7 +554,7 @@ Company *DoStartupNewCompany(bool is_ai, CompanyID company = INVALID_COMPANY) ResetCompanyLivery(c); _company_colours[c->index] = (Colours)c->colour; - c->money = c->current_loan = (min(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000; + c->money = c->current_loan = (std::min(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000; c->share_owners[0] = c->share_owners[1] = c->share_owners[2] = c->share_owners[3] = INVALID_OWNER; @@ -708,7 +708,7 @@ void OnTick_Companies() if (_next_competitor_start == 0) { /* AI::GetStartNextTime() can return 0. */ - _next_competitor_start = max(1, AI::GetStartNextTime() * DAY_TICKS); + _next_competitor_start = std::max(1, AI::GetStartNextTime() * DAY_TICKS); } if (_game_mode != GM_MENU && AI::CanStartNew() && --_next_competitor_start == 0) { @@ -1198,7 +1198,7 @@ CommandCost CmdGiveMoney(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 if (!_settings_game.economy.give_money) return CMD_ERROR; const Company *c = Company::Get(_current_company); - CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); + CommandCost amount(EXPENSES_OTHER, std::min(p1, 20000000LL)); CompanyID dest_company = (CompanyID)p2; /* You can only transfer funds that is in excess of your loan */ diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 7102c7662a..29701b5144 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -112,11 +112,11 @@ struct ExpensesList { ExpensesType et = this->et[i]; if (et == INVALID_EXPENSES) { if (!invalid_expenses_measured) { - width = max(width, GetStringBoundingBox(STR_FINANCES_TOTAL_CAPTION).width); + width = std::max(width, GetStringBoundingBox(STR_FINANCES_TOTAL_CAPTION).width); invalid_expenses_measured = true; } } else { - width = max(width, GetStringBoundingBox(STR_FINANCES_SECTION_CONSTRUCTION + et).width); + width = std::max(width, GetStringBoundingBox(STR_FINANCES_SECTION_CONSTRUCTION + et).width); } } return width; @@ -322,7 +322,7 @@ struct CompanyFinancesWindow : Window { case WID_CF_LOAN_VALUE: case WID_CF_TOTAL_VALUE: SetDParamMaxValue(0, CompanyFinancesWindow::max_money); - size->width = max(GetStringBoundingBox(STR_FINANCES_NEGATIVE_INCOME).width, GetStringBoundingBox(STR_FINANCES_POSITIVE_INCOME).width) + padding.width; + size->width = std::max(GetStringBoundingBox(STR_FINANCES_NEGATIVE_INCOME).width, GetStringBoundingBox(STR_FINANCES_POSITIVE_INCOME).width) + padding.width; break; case WID_CF_MAXLOAN_GAP: @@ -342,7 +342,7 @@ struct CompanyFinancesWindow : Window { case WID_CF_EXPS_PRICE2: case WID_CF_EXPS_PRICE3: { const Company *c = Company::Get((CompanyID)this->window_number); - int age = min(_cur_year - c->inaugurated_year, 2); + int age = std::min(_cur_year - c->inaugurated_year, 2); int wid_offset = widget - WID_CF_EXPS_PRICE1; if (wid_offset <= age) { DrawYearColumn(r, _cur_year - (age - wid_offset), c->yearly_expenses + (age - wid_offset)); @@ -455,7 +455,7 @@ struct CompanyFinancesWindow : Window { { const Company *c = Company::Get((CompanyID)this->window_number); if (c->money > CompanyFinancesWindow::max_money) { - CompanyFinancesWindow::max_money = max(c->money * 2, CompanyFinancesWindow::max_money * 4); + CompanyFinancesWindow::max_money = std::max(c->money * 2, CompanyFinancesWindow::max_money * 4); this->SetupWidgets(); this->ReInit(); } @@ -526,7 +526,7 @@ public: uint Height(uint width) const override { - return max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2); + return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2); } bool Selectable() const override @@ -731,7 +731,7 @@ public: /* Position scrollbar to selected group */ for (uint i = 0; i < this->rows; i++) { if (this->groups[i]->index == sel) { - this->vscroll->SetPosition(Clamp(i - this->vscroll->GetCapacity() / 2, 0, max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0))); + this->vscroll->SetPosition(Clamp(i - this->vscroll->GetCapacity() / 2, 0, std::max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0))); break; } } @@ -755,14 +755,14 @@ public: } } - size->width = max(size->width, 5 + d.width + WD_FRAMERECT_RIGHT); + size->width = std::max(size->width, 5 + d.width + WD_FRAMERECT_RIGHT); break; } case WID_SCL_MATRIX: { /* 11 items in the default rail class */ this->square = GetSpriteSize(SPR_SQUARE); - this->line_height = max(this->square.height, (uint)FONT_HEIGHT_NORMAL) + 4; + this->line_height = std::max(this->square.height, (uint)FONT_HEIGHT_NORMAL) + 4; size->height = 11 * this->line_height; resize->width = 1; @@ -781,9 +781,9 @@ public: this->square = GetSpriteSize(SPR_SQUARE); int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10; for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) { - size->width = max(size->width, GetStringBoundingBox(*id).width + padding); + size->width = std::max(size->width, GetStringBoundingBox(*id).width + padding); } - size->width = max(size->width, GetStringBoundingBox(STR_COLOUR_DEFAULT).width + padding); + size->width = std::max(size->width, GetStringBoundingBox(STR_COLOUR_DEFAULT).width + padding); break; } } @@ -898,7 +898,7 @@ public: } } } else { - uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->groups.size()); + uint max = static_cast(std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->groups.size())); for (uint i = this->vscroll->GetPosition(); i < max; ++i) { const Group *g = this->groups[i]; SetDParam(0, g->index); @@ -1380,7 +1380,7 @@ public: number_dim.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT + arrows_width; number_dim.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; /* Compute width of both buttons. */ - yesno_dim.width = max(yesno_dim.width, number_dim.width); + yesno_dim.width = std::max(yesno_dim.width, number_dim.width); number_dim.width = yesno_dim.width - arrows_width; this->yesno_dim = yesno_dim; @@ -1392,8 +1392,8 @@ public: switch (widget) { case WID_SCMF_FACE: { Dimension face_size = GetSpriteSize(SPR_GRADIENT); - size->width = max(size->width, face_size.width); - size->height = max(size->height, face_size.height); + size->width = std::max(size->width, face_size.width); + size->height = std::max(size->height, face_size.height); break; } @@ -1885,22 +1885,22 @@ struct CompanyInfrastructureWindow : Window case WID_CI_RAIL_DESC: { uint lines = 1; // Starts at 1 because a line is also required for the section title - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_RAIL_SECT).width); RailType rt; FOR_ALL_SORTED_RAILTYPES(rt) { if (HasBit(this->railtypes, rt)) { lines++; SetDParam(0, GetRailTypeInfo(rt)->strings.name); - size->width = max(size->width, GetStringBoundingBox(STR_WHITE_STRING).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_WHITE_STRING).width + WD_FRAMERECT_LEFT); } } if (this->railtypes != RAILTYPES_NONE) { lines++; - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_SIGNALS).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_SIGNALS).width + WD_FRAMERECT_LEFT); } - size->height = max(size->height, lines * FONT_HEIGHT_NORMAL); + size->height = std::max(size->height, lines * FONT_HEIGHT_NORMAL); break; } @@ -1908,30 +1908,30 @@ struct CompanyInfrastructureWindow : Window case WID_CI_TRAM_DESC: { uint lines = 1; // Starts at 1 because a line is also required for the section title - size->width = max(size->width, GetStringBoundingBox(widget == WID_CI_ROAD_DESC ? STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT : STR_COMPANY_INFRASTRUCTURE_VIEW_TRAM_SECT).width); + size->width = std::max(size->width, GetStringBoundingBox(widget == WID_CI_ROAD_DESC ? STR_COMPANY_INFRASTRUCTURE_VIEW_ROAD_SECT : STR_COMPANY_INFRASTRUCTURE_VIEW_TRAM_SECT).width); RoadType rt; FOR_ALL_SORTED_ROADTYPES(rt) { if (HasBit(this->roadtypes, rt) && RoadTypeIsRoad(rt) == (widget == WID_CI_ROAD_DESC)) { lines++; SetDParam(0, GetRoadTypeInfo(rt)->strings.name); - size->width = max(size->width, GetStringBoundingBox(STR_WHITE_STRING).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_WHITE_STRING).width + WD_FRAMERECT_LEFT); } } - size->height = max(size->height, lines * FONT_HEIGHT_NORMAL); + size->height = std::max(size->height, lines * FONT_HEIGHT_NORMAL); break; } case WID_CI_WATER_DESC: - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_WATER_SECT).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_CANALS).width + WD_FRAMERECT_LEFT); break; case WID_CI_STATION_DESC: - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS).width + WD_FRAMERECT_LEFT); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATION_SECT).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_STATIONS).width + WD_FRAMERECT_LEFT); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_AIRPORTS).width + WD_FRAMERECT_LEFT); break; case WID_CI_RAIL_COUNT: @@ -1945,24 +1945,24 @@ struct CompanyInfrastructureWindow : Window Money max_cost = 10000; // Some random number to reserve enough space. uint32 rail_total = c->infrastructure.GetRailTotal(); for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) { - max_val = max(max_val, c->infrastructure.rail[rt]); - max_cost = max(max_cost, RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total)); + max_val = std::max(max_val, c->infrastructure.rail[rt]); + max_cost = std::max(max_cost, RailMaintenanceCost(rt, c->infrastructure.rail[rt], rail_total)); } - max_val = max(max_val, c->infrastructure.signal); - max_cost = max(max_cost, SignalMaintenanceCost(c->infrastructure.signal)); + max_val = std::max(max_val, c->infrastructure.signal); + max_cost = std::max(max_cost, SignalMaintenanceCost(c->infrastructure.signal)); uint32 road_total = c->infrastructure.GetRoadTotal(); uint32 tram_total = c->infrastructure.GetTramTotal(); for (RoadType rt = ROADTYPE_BEGIN; rt < ROADTYPE_END; rt++) { - max_val = max(max_val, c->infrastructure.road[rt]); - max_cost = max(max_cost, RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total)); + max_val = std::max(max_val, c->infrastructure.road[rt]); + max_cost = std::max(max_cost, RoadMaintenanceCost(rt, c->infrastructure.road[rt], RoadTypeIsRoad(rt) ? road_total : tram_total)); } - max_val = max(max_val, c->infrastructure.water); - max_cost = max(max_cost, CanalMaintenanceCost(c->infrastructure.water)); - max_val = max(max_val, c->infrastructure.station); - max_cost = max(max_cost, StationMaintenanceCost(c->infrastructure.station)); - max_val = max(max_val, c->infrastructure.airport); - max_cost = max(max_cost, AirportMaintenanceCost(c->index)); + max_val = std::max(max_val, c->infrastructure.water); + max_cost = std::max(max_cost, CanalMaintenanceCost(c->infrastructure.water)); + max_val = std::max(max_val, c->infrastructure.station); + max_cost = std::max(max_cost, StationMaintenanceCost(c->infrastructure.station)); + max_val = std::max(max_val, c->infrastructure.airport); + max_cost = std::max(max_cost, AirportMaintenanceCost(c->index)); SetDParamMaxValue(0, max_val); uint count_width = GetStringBoundingBox(STR_WHITE_COMMA).width + 20; // Reserve some wiggle room @@ -1970,17 +1970,17 @@ struct CompanyInfrastructureWindow : Window if (_settings_game.economy.infrastructure_maintenance) { SetDParamMaxValue(0, this->GetTotalMaintenanceCost() * 12); // Convert to per year this->total_width = GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL).width + 20; - size->width = max(size->width, this->total_width); + size->width = std::max(size->width, this->total_width); SetDParamMaxValue(0, max_cost * 12); // Convert to per year - count_width += max(this->total_width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL).width); + count_width += std::max(this->total_width, GetStringBoundingBox(STR_COMPANY_INFRASTRUCTURE_VIEW_TOTAL).width); } - size->width = max(size->width, count_width); + size->width = std::max(size->width, count_width); /* Set height of the total line. */ if (widget == WID_CI_TOTAL) { - size->height = _settings_game.economy.infrastructure_maintenance ? max(size->height, EXP_LINESPACE + FONT_HEIGHT_NORMAL) : 0; + size->height = _settings_game.economy.infrastructure_maintenance ? std::max(size->height, EXP_LINESPACE + FONT_HEIGHT_NORMAL) : 0; } break; } @@ -2367,8 +2367,8 @@ struct CompanyWindow : Window switch (widget) { case WID_C_FACE: { Dimension face_size = GetSpriteSize(SPR_GRADIENT); - size->width = max(size->width, face_size.width); - size->height = max(size->height, face_size.height); + size->width = std::max(size->width, face_size.width); + size->height = std::max(size->height, face_size.height); break; } @@ -2389,18 +2389,18 @@ struct CompanyWindow : Window case WID_C_DESC_VEHICLE_COUNTS: SetDParamMaxValue(0, 5000); // Maximum number of vehicles for (uint i = 0; i < lengthof(_company_view_vehicle_count_strings); i++) { - size->width = max(size->width, GetStringBoundingBox(_company_view_vehicle_count_strings[i]).width); + size->width = std::max(size->width, GetStringBoundingBox(_company_view_vehicle_count_strings[i]).width); } break; case WID_C_DESC_INFRASTRUCTURE_COUNTS: SetDParamMaxValue(0, UINT_MAX); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_WATER).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_STATION).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_AIRPORT).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_NONE).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_RAIL).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_ROAD).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_WATER).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_STATION).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_AIRPORT).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_NONE).width); break; case WID_C_DESC_OWNERS: { @@ -2408,7 +2408,7 @@ struct CompanyWindow : Window SetDParamMaxValue(0, 75); SetDParam(1, c2->index); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_SHARES_OWNED_BY).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_SHARES_OWNED_BY).width); } break; } @@ -2420,13 +2420,13 @@ struct CompanyWindow : Window case WID_C_GIVE_MONEY: case WID_C_COMPANY_PASSWORD: case WID_C_COMPANY_JOIN: - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_VIEW_HQ_BUTTON).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_BUILD_HQ_BUTTON).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_RELOCATE_HQ).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_PASSWORD).width); - size->width = max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_JOIN).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_VIEW_HQ_BUTTON).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_BUILD_HQ_BUTTON).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_RELOCATE_HQ).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_PASSWORD).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_COMPANY_VIEW_JOIN).width); break; case WID_C_HAS_PASSWORD: diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index d2066df2b7..356cfc7ab4 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -2015,7 +2015,7 @@ DEF_CONSOLE_CMD(ConNewGRFProfile) if (started > 0) { IConsolePrintF(CC_DEBUG, "Started profiling for GRFID%s %s", (started > 1) ? "s" : "", grfids.c_str()); if (argc >= 3) { - int days = max(atoi(argv[2]), 1); + int days = std::max(atoi(argv[2]), 1); _newgrf_profile_end_date = _date + days; char datestrbuf[32]{ 0 }; diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 3841a59544..c8ad5fbdbf 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -194,7 +194,7 @@ struct IConsoleWindow : Window */ void Scroll(int amount) { - int max_scroll = max(0, IConsoleLine::size + 1 - this->height / this->line_height); + int max_scroll = std::max(0, IConsoleLine::size + 1 - this->height / this->line_height); IConsoleWindow::scroll = Clamp(IConsoleWindow::scroll + amount, 0, max_scroll); this->SetDirty(); } @@ -231,7 +231,7 @@ struct IConsoleWindow : Window { if (IConsoleLine::Truncate() && (IConsoleWindow::scroll > IConsoleLine::size)) { - IConsoleWindow::scroll = max(0, IConsoleLine::size - (this->height / this->line_height) + 1); + IConsoleWindow::scroll = std::max(0, IConsoleLine::size - (this->height / this->line_height) + 1); this->SetDirty(); } } @@ -341,7 +341,7 @@ struct IConsoleWindow : Window Point GetCaretPosition() const override { - int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); + int delta = std::min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); Point pt = {this->line_offset + delta + _iconsole_cmdline.caretxoffs, this->height - this->line_height}; return pt; @@ -349,7 +349,7 @@ struct IConsoleWindow : Window Rect GetTextBoundingRect(const char *from, const char *to) const override { - int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); + int delta = std::min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); Point p1 = GetCharPosInString(_iconsole_cmdline.buf, from, FS_NORMAL); Point p2 = from != to ? GetCharPosInString(_iconsole_cmdline.buf, from) : p1; @@ -360,7 +360,7 @@ struct IConsoleWindow : Window const char *GetTextCharacterAtPosition(const Point &pt) const override { - int delta = min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); + int delta = std::min(this->width - this->line_offset - _iconsole_cmdline.pixels - ICON_RIGHT_BORDERWIDTH, 0); if (!IsInsideMM(pt.y, this->height - this->line_height, this->height)) return nullptr; diff --git a/src/core/geometry_func.cpp b/src/core/geometry_func.cpp index 162f2eae57..89e70fb5bb 100644 --- a/src/core/geometry_func.cpp +++ b/src/core/geometry_func.cpp @@ -22,7 +22,7 @@ Dimension maxdim(const Dimension &d1, const Dimension &d2) { Dimension d; - d.width = max(d1.width, d2.width); - d.height = max(d1.height, d2.height); + d.width = std::max(d1.width, d2.width); + d.height = std::max(d1.height, d2.height); return d; } diff --git a/src/core/kdtree.hpp b/src/core/kdtree.hpp index c37ab8eea2..392e31b8ec 100644 --- a/src/core/kdtree.hpp +++ b/src/core/kdtree.hpp @@ -12,7 +12,6 @@ #include "../stdafx.h" #include -#include #include /** @@ -261,7 +260,7 @@ class Kdtree { best = SelectNearestNodeDistance(best, this->FindNearestRecursive(xy, next, level + 1)); } - limit = min(best.second, limit); + limit = std::min(best.second, limit); /* Check if the distance from current best is worse than distance from target to splitting line, * if it is we also need to check the other side of the split. */ diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index 55061066a5..222b4120e3 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -10,66 +10,6 @@ #ifndef MATH_FUNC_HPP #define MATH_FUNC_HPP -/** - * Returns the maximum of two values. - * - * This function returns the greater value of two given values. - * If they are equal the value of a is returned. - * - * @param a The first value - * @param b The second value - * @return The greater value or a if equals - */ -template -static inline T max(const T a, const T b) -{ - return (a >= b) ? a : b; -} - -/** - * Returns the minimum of two values. - * - * This function returns the smaller value of two given values. - * If they are equal the value of b is returned. - * - * @param a The first value - * @param b The second value - * @return The smaller value or b if equals - */ -template -static inline T min(const T a, const T b) -{ - return (a < b) ? a : b; -} - -/** - * Returns the minimum of two integer. - * - * This function returns the smaller value of two given integers. - * - * @param a The first integer - * @param b The second integer - * @return The smaller value - */ -static inline int min(const int a, const int b) -{ - return min(a, b); -} - -/** - * Returns the minimum of two unsigned integers. - * - * This function returns the smaller value of two given unsigned integers. - * - * @param a The first unsigned integer - * @param b The second unsigned integer - * @return The smaller value - */ -static inline uint minu(const uint a, const uint b) -{ - return min(a, b); -} - /** * Returns the absolute value of (scalar) variable. * @@ -216,7 +156,7 @@ static inline uint16 ClampToU16(const uint64 a) * match for min(uint64, uint) than uint64 min(uint64, uint64). As such we * need to cast the UINT16_MAX to prevent MSVC from displaying its * infinite loads of warnings. */ - return static_cast(min(a, static_cast(UINT16_MAX))); + return static_cast(std::min(a, static_cast(UINT16_MAX))); } /** diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp index db79ab2857..dea108f08d 100644 --- a/src/core/pool_func.hpp +++ b/src/core/pool_func.hpp @@ -52,7 +52,7 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index) assert(index >= this->size); assert(index < Tmax_size); - size_t new_size = min(Tmax_size, Align(index + 1, Tgrowth_step)); + size_t new_size = std::min(Tmax_size, Align(index + 1, Tgrowth_step)); this->data = ReallocT(this->data, new_size); MemSetT(this->data + this->size, 0, new_size - this->size); @@ -100,7 +100,7 @@ DEFINE_POOL_METHOD(inline void *)::AllocateItem(size_t size, size_t index) { assert(this->data[index] == nullptr); - this->first_unused = max(this->first_unused, index + 1); + this->first_unused = std::max(this->first_unused, index + 1); this->items++; Titem *item; @@ -187,7 +187,7 @@ DEFINE_POOL_METHOD(void)::FreeItem(size_t index) free(this->data[index]); } this->data[index] = nullptr; - this->first_free = min(this->first_free, index); + this->first_free = std::min(this->first_free, index); this->items--; if (!this->cleaning) Titem::PostDestructor(index); } diff --git a/src/core/smallmatrix_type.hpp b/src/core/smallmatrix_type.hpp index 0aeac10e13..03fd1b7908 100644 --- a/src/core/smallmatrix_type.hpp +++ b/src/core/smallmatrix_type.hpp @@ -234,7 +234,7 @@ public: if (x * new_height > new_capacity) continue; (*copy)(new_data + (x - 1) * new_height, this->data + (x - 1) * this->height, - min(this->height, new_height)); + std::min(this->height, new_height)); } } else { /* If matrix is shrinking copy from the front. */ @@ -242,7 +242,7 @@ public: if ((x + 1) * new_height > new_capacity) break; (*copy)(new_data + x * new_height, this->data + x * this->height, - min(this->height, new_height)); + std::min(this->height, new_height)); } } } diff --git a/src/core/smallstack_type.hpp b/src/core/smallstack_type.hpp index bf44f00c8f..c05454b8ae 100644 --- a/src/core/smallstack_type.hpp +++ b/src/core/smallstack_type.hpp @@ -46,7 +46,7 @@ public: if (index < Tmax_size) { this->data[index].valid = true; this->first_free = index + 1; - this->first_unused = max(this->first_unused, this->first_free); + this->first_unused = std::max(this->first_unused, this->first_free); } return index; } @@ -58,7 +58,7 @@ public: inline void Destroy(Tindex index) { this->data[index].valid = false; - this->first_free = min(this->first_free, index); + this->first_free = std::min(this->first_free, index); } private: diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index 2f65f02926..92fd938be5 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -13,7 +13,6 @@ #include "alloc_func.hpp" #include "mem_func.hpp" #include -#include /** * Helper function to append an item to a vector if it is not already contained diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 4d8ff2a89e..8feb3f8adf 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -41,8 +41,8 @@ struct SetDateWindow : Window { SetDateWindow(WindowDesc *desc, WindowNumber window_number, Window *parent, Date initial_date, Year min_year, Year max_year, SetDateCallback *callback) : Window(desc), callback(callback), - min_year(max(MIN_YEAR, min_year)), - max_year(min(MAX_YEAR, max_year)) + min_year(std::max(MIN_YEAR, min_year)), + max_year(std::min(MAX_YEAR, max_year)) { assert(this->min_year <= this->max_year); this->parent = parent; diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index e4663c6023..026382b282 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -194,12 +194,12 @@ static void InitBlocksizeForVehicles(VehicleType type, EngineImageType image_typ switch (image_type) { case EIT_IN_DEPOT: - _base_block_sizes_depot[type].height = max(ScaleGUITrad(GetVehicleHeight(type)), max_height); + _base_block_sizes_depot[type].height = std::max(ScaleGUITrad(GetVehicleHeight(type)), max_height); _base_block_sizes_depot[type].extend_left = Clamp(max_extend_left, min_extend, max_extend); _base_block_sizes_depot[type].extend_right = Clamp(max_extend_right, min_extend, max_extend); break; case EIT_PURCHASE: - _base_block_sizes_purchase[type].height = max(ScaleGUITrad(GetVehicleHeight(type)), max_height); + _base_block_sizes_purchase[type].height = std::max(ScaleGUITrad(GetVehicleHeight(type)), max_height); _base_block_sizes_purchase[type].extend_left = Clamp(max_extend_left, min_extend, max_extend); _base_block_sizes_purchase[type].extend_right = Clamp(max_extend_right, min_extend, max_extend); break; @@ -395,7 +395,7 @@ struct DepotWindow : Window { uint16 rows_in_display = wid->current_y / wid->resize_y; uint16 num = this->vscroll->GetPosition() * this->num_columns; - int maxval = min((uint)this->vehicle_list.size(), num + (rows_in_display * this->num_columns)); + uint maxval = static_cast(std::min(this->vehicle_list.size(), num + (rows_in_display * this->num_columns))); int y; for (y = r.top + 1; num < maxval; y += this->resize.step_height) { // Draw the rows for (byte i = 0; i < this->num_columns && num < maxval; i++, num++) { @@ -410,7 +410,7 @@ struct DepotWindow : Window { } } - maxval = min((uint)this->vehicle_list.size() + (uint)this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns)); + maxval = static_cast(std::min(this->vehicle_list.size() + this->wagon_list.size(), (this->vscroll->GetPosition() * this->num_columns) + (rows_in_display * this->num_columns))); /* Draw the train wagons without an engine in front. */ for (; num < maxval; num++, y += this->resize.step_height) { @@ -668,15 +668,15 @@ struct DepotWindow : Window { this->flag_height = UnScaleGUI(spr->height); if (this->type == VEH_TRAIN || this->type == VEH_ROAD) { - min_height = max(unumber.height + WD_MATRIX_TOP, UnScaleGUI(spr->height)); + min_height = std::max(unumber.height + WD_MATRIX_TOP, UnScaleGUI(spr->height)); this->header_width = unumber.width + this->flag_width + WD_FRAMERECT_LEFT; } else { min_height = unumber.height + UnScaleGUI(spr->height) + WD_MATRIX_TOP + WD_PAR_VSEP_NORMAL + WD_MATRIX_BOTTOM; - this->header_width = max(unumber.width, this->flag_width) + WD_FRAMERECT_RIGHT; + this->header_width = std::max(unumber.width, this->flag_width) + WD_FRAMERECT_RIGHT; } int base_width = this->count_width + this->header_width; - resize->height = max(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height); + resize->height = std::max(GetVehicleImageCellSize(this->type, EIT_IN_DEPOT).height, min_height); if (this->type == VEH_TRAIN) { resize->width = 1; size->width = base_width + 2 * ScaleGUITrad(29); // about 2 parts @@ -728,7 +728,7 @@ struct DepotWindow : Window { for (const Train *v = Train::From(this->vehicle_list[num]); v != nullptr; v = v->Next()) { width += v->GetDisplayImageWidth(); } - max_width = max(max_width, width); + max_width = std::max(max_width, width); } /* Always have 1 empty row, so people can change the setting of the train */ this->vscroll->SetCount((uint)this->vehicle_list.size() + (uint)this->wagon_list.size() + 1); diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp index 12217bb612..c5d76877cc 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -193,7 +193,7 @@ void DisasterVehicle::UpdatePosition(int x, int y, int z) int safe_y = Clamp(y - 1, 0, MapMaxY() * TILE_SIZE); u->x_pos = x; - u->y_pos = y - 1 - (max(z - GetSlopePixelZ(safe_x, safe_y), 0) >> 3); + u->y_pos = y - 1 - (std::max(z - GetSlopePixelZ(safe_x, safe_y), 0) >> 3); safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE); u->z_pos = GetSlopePixelZ(safe_x, safe_y); u->direction = this->direction; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 07c072d35a..30a60e74f7 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -72,7 +72,7 @@ static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = n /* Direction the aqueduct is built to. */ TileIndexDiff offset = TileOffsByDiagDir(ReverseDiagDir(dir)); /* The maximum length of the aqueduct. */ - int max_length = min(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1); + int max_length = std::min(_settings_game.construction.max_bridge_length, DistanceFromEdgeDir(tile_from, ReverseDiagDir(dir)) - 1); TileIndex endtile = tile_from; for (int length = 0; IsValidTile(endtile) && TileX(endtile) != 0 && TileY(endtile) != 0; length++) { diff --git a/src/economy.cpp b/src/economy.cpp index c73012096a..d5c7797d5f 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -135,7 +135,7 @@ Money CalculateCompanyValue(const Company *c, bool including_loan) if (including_loan) value -= c->current_loan; value += c->money; - return max(value, (Money)1); + return std::max(value, 1); } /** @@ -194,15 +194,15 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) /* Generate statistics depending on recent income statistics */ { - int numec = min(c->num_valid_stat_ent, 12); + int numec = std::min(c->num_valid_stat_ent, 12u); if (numec != 0) { const CompanyEconomyEntry *cee = c->old_economy; Money min_income = cee->income + cee->expenses; Money max_income = cee->income + cee->expenses; do { - min_income = min(min_income, cee->income + cee->expenses); - max_income = max(max_income, cee->income + cee->expenses); + min_income = std::min(min_income, cee->income + cee->expenses); + max_income = std::max(max_income, cee->income + cee->expenses); } while (++cee, --numec); if (min_income > 0) { @@ -215,7 +215,7 @@ int UpdateCompanyRatingAndValue(Company *c, bool update) /* Generate score depending on amount of transported cargo */ { - int numec = min(c->num_valid_stat_ent, 4); + int numec = std::min(c->num_valid_stat_ent, 4u); if (numec != 0) { const CompanyEconomyEntry *cee = c->old_economy; OverflowSafeInt64 total_delivered = 0; @@ -361,7 +361,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) if (HasBit(t->have_ratings, old_owner)) { if (HasBit(t->have_ratings, new_owner)) { /* use max of the two ratings. */ - t->ratings[new_owner] = max(t->ratings[new_owner], t->ratings[old_owner]); + t->ratings[new_owner] = std::max(t->ratings[new_owner], t->ratings[old_owner]); } else { SetBit(t->have_ratings, new_owner); t->ratings[new_owner] = t->ratings[old_owner]; @@ -911,12 +911,12 @@ void StartupEconomy() { _economy.interest_rate = _settings_game.difficulty.initial_interest; _economy.infl_amount = _settings_game.difficulty.initial_interest; - _economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1); + _economy.infl_amount_pr = std::max(0, _settings_game.difficulty.initial_interest - 1); _economy.fluct = GB(Random(), 0, 8) + 168; if (_settings_game.economy.inflation) { /* Apply inflation that happened before our game start year. */ - int months = (min(_cur_year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12; + int months = (std::min(_cur_year, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR) * 12; for (int i = 0; i < months; i++) { AddInflation(false); } @@ -973,7 +973,7 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C /* Use callback to calculate cargo profit, if available */ if (HasBit(cs->callback_mask, CBM_CARGO_PROFIT_CALC)) { - uint32 var18 = min(dist, 0xFFFF) | (min(num_pieces, 0xFF) << 16) | (transit_days << 24); + uint32 var18 = std::min(dist, 0xFFFFu) | (std::min(num_pieces, 0xFFu) << 16) | (transit_days << 24); uint16 callback = GetCargoCallback(CBID_CARGO_PROFIT_CALC, 0, var18, cs); if (callback != CALLBACK_FAILED) { int result = GB(callback, 0, 14); @@ -993,8 +993,8 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C const int days1 = cs->transit_days[0]; const int days2 = cs->transit_days[1]; - const int days_over_days1 = max( transit_days - days1, 0); - const int days_over_days2 = max(days_over_days1 - days2, 0); + const int days_over_days1 = std::max( transit_days - days1, 0); + const int days_over_days2 = std::max(days_over_days1 - days2, 0); /* * The time factor is calculated based on the time it took @@ -1006,7 +1006,7 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C * - linear decreasing with time with a slope of -2 for slow transports * */ - const int time_factor = max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR); + const int time_factor = std::max(MAX_TIME_FACTOR - days_over_days1 - days_over_days2, MIN_TIME_FACTOR); return BigMulS(dist * time_factor * num_pieces, cs->current_payment, 21); } @@ -1055,7 +1055,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n /* Insert the industry into _cargo_delivery_destinations, if not yet contained */ include(_cargo_delivery_destinations, ind); - uint amount = min(num_pieces, 0xFFFFU - ind->incoming_cargo_waiting[cargo_index]); + uint amount = std::min(num_pieces, 0xFFFFu - ind->incoming_cargo_waiting[cargo_index]); ind->incoming_cargo_waiting[cargo_index] += amount; ind->last_cargo_accepted_at[cargo_index] = _date; num_pieces -= amount; @@ -1150,7 +1150,7 @@ static void TriggerIndustryProduction(Industry *i) if (cargo_waiting == 0) continue; for (uint ci_out = 0; ci_out < lengthof(i->produced_cargo_waiting); ci_out++) { - i->produced_cargo_waiting[ci_out] = min(i->produced_cargo_waiting[ci_out] + (cargo_waiting * indspec->input_cargo_multiplier[ci_in][ci_out] / 256), 0xFFFF); + i->produced_cargo_waiting[ci_out] = std::min(i->produced_cargo_waiting[ci_out] + (cargo_waiting * indspec->input_cargo_multiplier[ci_in][ci_out] / 256), 0xFFFFu); } i->incoming_cargo_waiting[ci_in] = 0; @@ -1317,7 +1317,7 @@ static uint GetLoadAmount(Vehicle *v) if (HasBit(e->info.misc_flags, EF_NO_DEFAULT_CARGO_MULTIPLIER) && !air_mail) load_amount = CeilDiv(load_amount * CargoSpec::Get(v->cargo_type)->multiplier, 0x100); /* Zero load amount breaks a lot of things. */ - return max(1u, load_amount); + return std::max(1u, load_amount); } /** @@ -1596,7 +1596,7 @@ static void UpdateLoadUnloadTicks(Vehicle *front, const Station *st, int ticks) } } /* Always wait at least 1, otherwise we'll wait 'infinitively' long. */ - front->load_unload_ticks = max(1, ticks); + front->load_unload_ticks = std::max(1, ticks); } /** @@ -1657,7 +1657,7 @@ static void LoadUnloadVehicle(Vehicle *front) if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (front->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) { uint cargo_count = v->cargo.UnloadCount(); - uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, GetLoadAmount(v)) : cargo_count; + uint amount_unloaded = _settings_game.order.gradual_loading ? std::min(cargo_count, GetLoadAmount(v)) : cargo_count; bool remaining = false; // Are there cargo entities in this vehicle that can still be unloaded here? assert(payment != nullptr); @@ -1753,8 +1753,8 @@ static void LoadUnloadVehicle(Vehicle *front) } /* if last speed is 0, we treat that as if no vehicle has ever visited the station. */ - ge->last_speed = min(t, 255); - ge->last_age = min(_cur_year - front->build_year, 255); + ge->last_speed = std::min(t, 255); + ge->last_age = std::min(_cur_year - front->build_year, 255); assert(v->cargo_cap >= v->cargo.StoredCount()); /* Capacity available for loading more cargo. */ @@ -1768,7 +1768,7 @@ static void LoadUnloadVehicle(Vehicle *front) * has capacity for it, load it on the vehicle. */ if ((v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0 || ge->cargo.AvailableCount() > 0) && MayLoadUnderExclusiveRights(st, v)) { if (v->cargo.StoredCount() == 0) TriggerVehicle(v, VEHICLE_TRIGGER_NEW_CARGO); - if (_settings_game.order.gradual_loading) cap_left = min(cap_left, GetLoadAmount(v)); + if (_settings_game.order.gradual_loading) cap_left = std::min(cap_left, GetLoadAmount(v)); uint loaded = ge->cargo.Load(cap_left, &v->cargo, st->xy, next_station); if (v->cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) { @@ -1842,7 +1842,7 @@ static void LoadUnloadVehicle(Vehicle *front) /* We loaded less cargo than possible for all cargo types and it's not full * load and we're not supposed to wait any longer: stop loading. */ if (!anything_unloaded && full_load_amount == 0 && reservation_left == 0 && !(front->current_order.GetLoadType() & OLFB_FULL_LOAD) && - front->current_order_time >= (uint)max(front->current_order.GetTimetabledWait() - front->lateness_counter, 0)) { + front->current_order_time >= (uint)std::max(front->current_order.GetTimetabledWait() - front->lateness_counter, 0)) { SetBit(front->vehicle_flags, VF_STOP_LOADING); } diff --git a/src/elrail.cpp b/src/elrail.cpp index 1e35978af6..5d8f2b8f32 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -229,7 +229,8 @@ static int GetPCPElevation(TileIndex tile, DiagDirection PCPpos) * Also note that the result of GetSlopePixelZ() is very special on bridge-ramps. */ - int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1)); + int z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + std::min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), + TileY(tile) * TILE_SIZE + std::min(y_pcp_offsets[PCPpos], TILE_SIZE - 1)); return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2); } diff --git a/src/engine.cpp b/src/engine.cpp index 72da8702fd..2681b8fa62 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -578,7 +578,7 @@ static void CalcEngineReliability(Engine *e) /* Check for early retirement */ if (e->company_avail != 0 && !_settings_game.vehicle.never_expire_vehicles && e->info.base_life != 0xFF) { int retire_early = e->info.retire_early; - uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12); + uint retire_early_max_age = std::max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12); if (retire_early != 0 && age >= retire_early_max_age) { /* Early retirement is enabled and we're past the date... */ e->company_avail = 0; @@ -625,7 +625,7 @@ void SetYearEngineAgingStops() YearMonthDay ymd; ConvertDateToYMD(ei->base_intro + (ei->lifelength * DAYS_IN_LEAP_YEAR) / 2, &ymd); - _year_engine_aging_stops = max(_year_engine_aging_stops, ymd.year); + _year_engine_aging_stops = std::max(_year_engine_aging_stops, ymd.year); } } @@ -693,7 +693,7 @@ void StartupOneEngine(Engine *e, Date aging_date) void StartupEngines() { /* Aging of vehicles stops, so account for that when starting late */ - const Date aging_date = min(_date, ConvertYMDToDate(_year_engine_aging_stops, 0, 1)); + const Date aging_date = std::min(_date, ConvertYMDToDate(_year_engine_aging_stops, 0, 1)); for (Engine *e : Engine::Iterate()) { StartupOneEngine(e, aging_date); @@ -1196,7 +1196,7 @@ void CheckEngines() if ((e->flags & ENGINE_AVAILABLE) != 0 && e->company_avail != 0) return; /* Okay, try to find the earliest date. */ - min_date = min(min_date, e->info.base_intro); + min_date = std::min(min_date, e->info.base_intro); } if (min_date < INT32_MAX) { diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index b71fa7a6bd..77ce954130 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -93,9 +93,9 @@ struct EnginePreviewWindow : Window { case VEH_SHIP: GetShipSpriteSize( engine, x, y, x_offs, y_offs, image_type); break; case VEH_AIRCRAFT: GetAircraftSpriteSize(engine, x, y, x_offs, y_offs, image_type); break; } - this->vehicle_space = max(40, y - y_offs); + this->vehicle_space = std::max(40, y - y_offs); - size->width = max(size->width, x - x_offs); + size->width = std::max(size->width, x - x_offs); SetDParam(0, GetEngineCategoryName(engine)); size->height = GetStringHeight(STR_ENGINE_PREVIEW_MESSAGE, size->width) + WD_PAR_VSEP_WIDE + FONT_HEIGHT_NORMAL + this->vehicle_space; SetDParam(0, engine); diff --git a/src/error_gui.cpp b/src/error_gui.cpp index 381d67a962..f9d88a1993 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -189,7 +189,7 @@ public: CopyInDParam(0, this->decode_params, lengthof(this->decode_params)); if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack); - int text_width = max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT); + int text_width = std::max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT); this->height_summary = GetStringHeight(this->summary_msg, text_width); this->height_detailed = (this->detailed_msg == INVALID_STRING_ID) ? 0 : GetStringHeight(this->detailed_msg, text_width); @@ -198,13 +198,13 @@ public: uint panel_height = WD_FRAMERECT_TOP + this->height_summary + WD_FRAMERECT_BOTTOM; if (this->detailed_msg != INVALID_STRING_ID) panel_height += this->height_detailed + WD_PAR_VSEP_WIDE; - size->height = max(size->height, panel_height); + size->height = std::max(size->height, panel_height); break; } case WID_EM_FACE: { Dimension face_size = GetSpriteSize(SPR_GRADIENT); - size->width = max(size->width, face_size.width); - size->height = max(size->height, face_size.height); + size->width = std::max(size->width, face_size.width); + size->height = std::max(size->height, face_size.height); break; } } diff --git a/src/fileio.cpp b/src/fileio.cpp index e49cee58d6..d6dee0a3fd 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -24,7 +24,6 @@ #include #endif #include -#include #include #include @@ -125,7 +124,7 @@ byte FioReadByte() void FioSkipBytes(int n) { for (;;) { - int m = min(_fio.buffer_end - _fio.buffer, n); + int m = std::min(_fio.buffer_end - _fio.buffer, n); _fio.buffer += m; n -= m; if (n == 0) break; @@ -892,7 +891,7 @@ bool ExtractTar(const std::string &tar_filename, Subdirectory subdir) char buffer[4096]; size_t read; for (; to_copy != 0; to_copy -= read) { - read = fread(buffer, 1, min(to_copy, lengthof(buffer)), in.get()); + read = fread(buffer, 1, std::min(to_copy, lengthof(buffer)), in.get()); if (read <= 0 || fwrite(buffer, 1, read, out.get()) != read) break; } diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 4a34a48d4b..ec336612a4 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -492,7 +492,7 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels) /* Font height is minimum height plus the difference between the default * height for this font size and the small size. */ int diff = scaled_height - ScaleFontTrad(_default_font_height[FS_SMALL]); - pixels = Clamp(min(head->Lowest_Rec_PPEM, 20) + diff, scaled_height, MAX_FONT_SIZE); + pixels = Clamp(std::min(head->Lowest_Rec_PPEM, 20u) + diff, scaled_height, MAX_FONT_SIZE); } } else { pixels = ScaleFontTrad(pixels); @@ -656,8 +656,8 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa) aa = (slot->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY); /* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel */ - uint width = max(1U, (uint)slot->bitmap.width + (this->fs == FS_NORMAL)); - uint height = max(1U, (uint)slot->bitmap.rows + (this->fs == FS_NORMAL)); + uint width = std::max(1U, (uint)slot->bitmap.width + (this->fs == FS_NORMAL)); + uint height = std::max(1U, (uint)slot->bitmap.rows + (this->fs == FS_NORMAL)); /* Limit glyph size to prevent overflows later on. */ if (width > 256 || height > 256) usererror("Font glyph is too large"); @@ -797,7 +797,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) /* Font height is minimum height plus the difference between the default * height for this font size and the small size. */ int diff = scaled_height - ScaleFontTrad(_default_font_height[FS_SMALL]); - pixels = Clamp(min(otm->otmusMinimumPPEM, 20) + diff, scaled_height, MAX_FONT_SIZE); + pixels = Clamp(std::min(otm->otmusMinimumPPEM, 20u) + diff, scaled_height, MAX_FONT_SIZE); SelectObject(dc, old); DeleteObject(temp); @@ -851,7 +851,7 @@ void Win32FontCache::ClearFontCache() MAT2 mat = { {0, 1}, {0, 0}, {0, 0}, {0, 1} }; /* Make a guess for the needed memory size. */ - DWORD size = this->glyph_size.cy * Align(aa ? this->glyph_size.cx : max(this->glyph_size.cx / 8l, 1l), 4); // Bitmap data is DWORD-aligned rows. + DWORD size = this->glyph_size.cy * Align(aa ? this->glyph_size.cx : std::max(this->glyph_size.cx / 8l, 1l), 4); // Bitmap data is DWORD-aligned rows. byte *bmp = AllocaM(byte, size); size = GetGlyphOutline(this->dc, key, GGO_GLYPH_INDEX | (aa ? GGO_GRAY8_BITMAP : GGO_BITMAP), &gm, size, bmp, &mat); @@ -868,8 +868,8 @@ void Win32FontCache::ClearFontCache() } /* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel. */ - uint width = max(1U, (uint)gm.gmBlackBoxX + (this->fs == FS_NORMAL)); - uint height = max(1U, (uint)gm.gmBlackBoxY + (this->fs == FS_NORMAL)); + uint width = std::max(1U, (uint)gm.gmBlackBoxX + (this->fs == FS_NORMAL)); + uint height = std::max(1U, (uint)gm.gmBlackBoxY + (this->fs == FS_NORMAL)); /* Limit glyph size to prevent overflows later on. */ if (width > 256 || height > 256) usererror("Font glyph is too large"); @@ -889,7 +889,7 @@ void Win32FontCache::ClearFontCache() * For anti-aliased rendering, GDI uses the strange value range of 0 to 64, * inclusively. To map this to 0 to 255, we shift left by two and then * subtract one. */ - uint pitch = Align(aa ? gm.gmBlackBoxX : max(gm.gmBlackBoxX / 8u, 1u), 4); + uint pitch = Align(aa ? gm.gmBlackBoxX : std::max(gm.gmBlackBoxX / 8u, 1u), 4); /* Draw shadow for medium size. */ if (this->fs == FS_NORMAL && !aa) { diff --git a/src/fontdetection.cpp b/src/fontdetection.cpp index 1b1f9d689e..fd48bd801b 100644 --- a/src/fontdetection.cpp +++ b/src/fontdetection.cpp @@ -222,7 +222,7 @@ static const char *GetEnglishFontName(const ENUMLOGFONTEX *logfont) offset += buf[pos++]; /* Don't buffer overflow */ - length = min(length, MAX_PATH - 1); + length = std::min(length, MAX_PATH - 1); for (uint j = 0; j < length; j++) font_name[j] = buf[stringOffset + offset + j]; font_name[length] = '\0'; diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index d34f59e09f..c324fde2e3 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -76,7 +76,7 @@ namespace { this->prev_index = this->next_index; this->next_index += 1; if (this->next_index >= NUM_FRAMERATE_POINTS) this->next_index = 0; - this->num_valid = min(NUM_FRAMERATE_POINTS, this->num_valid + 1); + this->num_valid = std::min(NUM_FRAMERATE_POINTS, this->num_valid + 1); } /** Begin an accumulation of multiple measurements into a single value, from a given start time */ @@ -87,7 +87,7 @@ namespace { this->prev_index = this->next_index; this->next_index += 1; if (this->next_index >= NUM_FRAMERATE_POINTS) this->next_index = 0; - this->num_valid = min(NUM_FRAMERATE_POINTS, this->num_valid + 1); + this->num_valid = std::min(NUM_FRAMERATE_POINTS, this->num_valid + 1); this->acc_duration = 0; this->acc_timestamp = start_time; @@ -115,7 +115,7 @@ namespace { /** Get average cycle processing time over a number of data points */ double GetAverageDurationMilliseconds(int count) { - count = min(count, this->num_valid); + count = std::min(count, this->num_valid); int first_point = this->prev_index - count; if (first_point < 0) first_point += NUM_FRAMERATE_POINTS; @@ -395,7 +395,7 @@ struct FramerateWindow : Window { { const double threshold_good = target * 0.95; const double threshold_bad = target * 2 / 3; - value = min(9999.99, value); + value = std::min(9999.99, value); this->value = (uint32)(value * 100); this->strid = (value > threshold_good) ? STR_FRAMERATE_FPS_GOOD : (value < threshold_bad) ? STR_FRAMERATE_FPS_BAD : STR_FRAMERATE_FPS_WARN; } @@ -404,7 +404,7 @@ struct FramerateWindow : Window { { const double threshold_good = target / 3; const double threshold_bad = target; - value = min(9999.99, value); + value = std::min(9999.99, value); this->value = (uint32)(value * 100); this->strid = (value < threshold_good) ? STR_FRAMERATE_MS_GOOD : (value > threshold_bad) ? STR_FRAMERATE_MS_BAD : STR_FRAMERATE_MS_WARN; } @@ -422,8 +422,8 @@ struct FramerateWindow : Window { CachedDecimal times_shortterm[PFE_MAX]; ///< cached short term average times CachedDecimal times_longterm[PFE_MAX]; ///< cached long term average times - static const int VSPACING = 3; ///< space between column heading and values - static const int MIN_ELEMENTS = 5; ///< smallest number of elements to display + static constexpr int VSPACING = 3; ///< space between column heading and values + static constexpr int MIN_ELEMENTS = 5; ///< smallest number of elements to display FramerateWindow(WindowDesc *desc, WindowNumber number) : Window(desc) { @@ -435,7 +435,7 @@ struct FramerateWindow : Window { this->next_update.SetInterval(100); /* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */ - ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); + ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); } void OnRealtimeTick(uint delta_ms) override @@ -486,7 +486,7 @@ struct FramerateWindow : Window { this->num_active = new_active; Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR); sb->SetCount(this->num_active); - sb->SetCapacity(min(this->num_displayed, this->num_active)); + sb->SetCapacity(std::min(this->num_displayed, this->num_active)); this->ReInit(); } } @@ -555,7 +555,7 @@ struct FramerateWindow : Window { SetDParamStr(1, GetAIName(e - PFE_AI0)); line_size = GetStringBoundingBox(STR_FRAMERATE_AI); } - size->width = max(size->width, line_size.width); + size->width = std::max(size->width, line_size.width); } break; } @@ -567,7 +567,7 @@ struct FramerateWindow : Window { SetDParam(0, 999999); SetDParam(1, 2); Dimension item_size = GetStringBoundingBox(STR_FRAMERATE_MS_GOOD); - size->width = max(size->width, item_size.width); + size->width = std::max(size->width, item_size.width); size->height += FONT_HEIGHT_NORMAL * MIN_ELEMENTS + VSPACING; resize->width = 0; resize->height = FONT_HEIGHT_NORMAL; @@ -769,7 +769,7 @@ struct FrametimeGraphWindow : Window { Dimension size_s_label = GetStringBoundingBox(STR_FRAMERATE_GRAPH_SECONDS); /* Size graph in height to fit at least 10 vertical labels with space between, or at least 100 pixels */ - graph_size.height = max(100, 10 * (size_ms_label.height + 1)); + graph_size.height = std::max(100u, 10 * (size_ms_label.height + 1)); /* Always 2:1 graph area */ graph_size.width = 2 * graph_size.height; *size = graph_size; @@ -980,7 +980,7 @@ struct FrametimeGraphWindow : Window { TextColour tc_peak = (TextColour)(TC_IS_PALETTE_COLOUR | c_peak); GfxFillRect(peak_point.x - 1, peak_point.y - 1, peak_point.x + 1, peak_point.y + 1, c_peak); SetDParam(0, peak_value * 1000 / TIMESTAMP_PRECISION); - int label_y = max(y_max, peak_point.y - FONT_HEIGHT_SMALL); + int label_y = std::max(y_max, peak_point.y - FONT_HEIGHT_SMALL); if (peak_point.x - x_zero > (int)this->graph_size.width / 2) { DrawString(x_zero, peak_point.x - 2, label_y, STR_FRAMERATE_GRAPH_MILLISECONDS, tc_peak, SA_RIGHT | SA_FORCE, false, FS_SMALL); } else { diff --git a/src/gamelog.cpp b/src/gamelog.cpp index d1a9ab038f..1a4998e40e 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -814,7 +814,7 @@ void GamelogInfo(LoggedAction *gamelog_action, uint gamelog_actions, uint32 *las case GLCT_REVISION: *last_ottd_rev = lc->revision.newgrf; - *ever_modified = max(*ever_modified, lc->revision.modified); + *ever_modified = std::max(*ever_modified, lc->revision.modified); break; case GLCT_GRFREM: diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 37f3962ec6..54ca0bc865 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -513,7 +513,7 @@ struct GenerateLandscapeWindow : public Window { } } size->width += padding.width; - size->height = max(size->height, (uint)(FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM)); + size->height = std::max(size->height, (uint)(FONT_HEIGHT_NORMAL + WD_DROPDOWNTEXT_TOP + WD_DROPDOWNTEXT_BOTTOM)); } void DrawWidget(const Rect &r, int widget) const override @@ -1214,7 +1214,7 @@ struct GenerateProgressWindow : public Window { case WID_GP_PROGRESS_TEXT: for (uint i = 0; i < GWP_CLASS_COUNT; i++) { - size->width = max(size->width, GetStringBoundingBox(_generation_class_table[i]).width); + size->width = std::max(size->width, GetStringBoundingBox(_generation_class_table[i]).width); } size->height = FONT_HEIGHT_NORMAL * 2 + WD_PAR_VSEP_NORMAL; break; diff --git a/src/gfx.cpp b/src/gfx.cpp index c0a2efc315..54851d375f 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -263,8 +263,8 @@ void GfxFillPolygon(const std::vector &shape, int colour, FillRectMode mo std::sort(intersections.begin(), intersections.end()); for (size_t i = 1; i < intersections.size(); i += 2) { /* Check clipping. */ - const int x1 = max(0, intersections[i - 1]); - const int x2 = min(intersections[i], dpi->width); + const int x1 = std::max(0, intersections[i - 1]); + const int x2 = std::min(intersections[i], dpi->width); if (x2 < 0) continue; if (x1 >= dpi->width) continue; @@ -327,7 +327,7 @@ static inline void GfxDoDrawLine(void *video, int x, int y, int x2, int y2, int /* prevent integer overflows. */ int margin = 1; - while (INT_MAX / abs(grade_y) < max(abs(clip.left - x), abs(clip.right - x))) { + while (INT_MAX / abs(grade_y) < std::max(abs(clip.left - x), abs(clip.right - x))) { grade_y /= 2; grade_x /= 2; margin *= 2; // account for rounding errors @@ -636,7 +636,7 @@ static int DrawLayoutLine(const ParagraphLayouter::Line &line, int y, int left, int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize) { /* The string may contain control chars to change the font, just use the biggest font for clipping. */ - int max_height = max(max(FONT_HEIGHT_SMALL, FONT_HEIGHT_NORMAL), max(FONT_HEIGHT_LARGE, FONT_HEIGHT_MONO)); + int max_height = std::max({FONT_HEIGHT_SMALL, FONT_HEIGHT_NORMAL, FONT_HEIGHT_LARGE, FONT_HEIGHT_MONO}); /* Funny glyphs may extent outside the usual bounds, so relax the clipping somewhat. */ int extra = max_height / 2; @@ -916,8 +916,8 @@ Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom) } Dimension d; - d.width = max(0, UnScaleByZoom(sprite->x_offs + sprite->width, zoom)); - d.height = max(0, UnScaleByZoom(sprite->y_offs + sprite->height, zoom)); + d.width = std::max(0, UnScaleByZoom(sprite->x_offs + sprite->width, zoom)); + d.height = std::max(0, UnScaleByZoom(sprite->y_offs + sprite->height, zoom)); return d; } @@ -1024,10 +1024,10 @@ static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mo bp.height = UnScaleByZoom(sprite->height, zoom); } else { /* Amount of pixels to clip from the source sprite */ - int clip_left = max(0, -sprite->x_offs + sub->left * ZOOM_BASE ); - int clip_top = max(0, -sprite->y_offs + sub->top * ZOOM_BASE ); - int clip_right = max(0, sprite->width - (-sprite->x_offs + (sub->right + 1) * ZOOM_BASE)); - int clip_bottom = max(0, sprite->height - (-sprite->y_offs + (sub->bottom + 1) * ZOOM_BASE)); + int clip_left = std::max(0, -sprite->x_offs + sub->left * ZOOM_BASE ); + int clip_top = std::max(0, -sprite->y_offs + sub->top * ZOOM_BASE ); + int clip_right = std::max(0, sprite->width - (-sprite->x_offs + (sub->right + 1) * ZOOM_BASE)); + int clip_bottom = std::max(0, sprite->height - (-sprite->y_offs + (sub->bottom + 1) * ZOOM_BASE)); if (clip_left + clip_right >= sprite->width) return; if (clip_top + clip_bottom >= sprite->height) return; @@ -1305,7 +1305,7 @@ byte GetDigitWidth(FontSize size) { byte width = 0; for (char c = '0'; c <= '9'; c++) { - width = max(GetCharacterWidth(size, c), width); + width = std::max(GetCharacterWidth(size, c), width); } return width; } @@ -1695,8 +1695,8 @@ void UpdateCursorSize() _cursor.total_offs = offs; _cursor.total_size = size; } else { - int right = max(_cursor.total_offs.x + _cursor.total_size.x, offs.x + size.x); - int bottom = max(_cursor.total_offs.y + _cursor.total_size.y, offs.y + size.y); + int right = std::max(_cursor.total_offs.x + _cursor.total_size.x, offs.x + size.x); + int bottom = std::max(_cursor.total_offs.y + _cursor.total_size.y, offs.y + size.y); if (offs.x < _cursor.total_offs.x) _cursor.total_offs.x = offs.x; if (offs.y < _cursor.total_offs.y) _cursor.total_offs.y = offs.y; _cursor.total_size.x = right - _cursor.total_offs.x; diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index ebd1afaa80..9f1f2742ad 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -431,7 +431,7 @@ int FallbackParagraphLayout::FallbackLine::GetLeading() const { int leading = 0; for (const auto &run : *this) { - leading = max(leading, run.GetLeading()); + leading = std::max(leading, run.GetLeading()); } return leading; @@ -747,7 +747,7 @@ Dimension Layouter::GetBounds() { Dimension d = { 0, 0 }; for (const auto &l : *this) { - d.width = max(d.width, l->GetWidth()); + d.width = std::max(d.width, l->GetWidth()); d.height += l->GetLeading(); } return d; diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index f4d1a7b03f..7c4b49cdf0 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -405,7 +405,7 @@ MD5File::ChecksumResult MD5File::CheckMD5(Subdirectory subdir, size_t max_size) if (f == nullptr) return CR_NO_FILE; - size = min(size, max_size); + size = std::min(size, max_size); Md5 checksum; uint8 buffer[1024]; diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index 554ac56304..b51c488a14 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -291,7 +291,7 @@ struct GoalListWindow : public Window { } NWidgetBase *wid = this->GetWidget(WID_GOAL_LIST); - uint progress_col_width = min(max_width, wid->current_x); + uint progress_col_width = std::min(max_width, wid->current_x); /* Draw goal list. */ this->DrawListColumn(GC_PROGRESS, wid, progress_col_width); diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 3d6d2a3a36..2578c73f38 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -110,7 +110,7 @@ struct GraphLegendWindow : Window { static NWidgetBase *MakeNWidgetCompanyLines(int *biggest_index) { NWidgetVertical *vert = new NWidgetVertical(); - uint line_height = max(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; + uint line_height = std::max(GetSpriteSize(SPR_COMPANY_ICON).height, FONT_HEIGHT_NORMAL) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; for (int widnum = WID_GL_FIRST_COMPANY; widnum <= WID_GL_LAST_COMPANY; widnum++) { NWidgetBackground *panel = new NWidgetBackground(WWT_PANEL, COLOUR_GREY, widnum); @@ -212,8 +212,8 @@ protected: OverflowSafeInt64 datapoint = this->cost[i][j]; if (datapoint != INVALID_DATAPOINT) { - current_interval.highest = max(current_interval.highest, datapoint); - current_interval.lowest = min(current_interval.lowest, datapoint); + current_interval.highest = std::max(current_interval.highest, datapoint); + current_interval.lowest = std::min(current_interval.lowest, datapoint); } } } @@ -240,7 +240,7 @@ protected: /* Get the required grid size for each side and use the maximum one. */ int64 grid_size_higher = (abs_higher > 0) ? ((int64)abs_higher + num_pos_grids - 1) / num_pos_grids : 0; int64 grid_size_lower = (abs_lower > 0) ? ((int64)abs_lower + num_hori_lines - num_pos_grids - 1) / (num_hori_lines - num_pos_grids) : 0; - grid_size = max(grid_size_higher, grid_size_lower); + grid_size = std::max(grid_size_higher, grid_size_lower); } else { /* If both values are zero, show an empty graph. */ num_pos_grids = num_hori_lines / 2; @@ -435,7 +435,7 @@ protected: * least significant bits are removed. */ int mult_range = FindLastBit(x_axis_offset) + FindLastBit(abs(datapoint)); - int reduce_range = max(mult_range - 31, 0); + int reduce_range = std::max(mult_range - 31, 0); /* Handle negative values differently (don't shift sign) */ if (datapoint < 0) { @@ -496,7 +496,7 @@ public: SetDParam(0, month + STR_MONTH_ABBREV_JAN); SetDParam(1, month + STR_MONTH_ABBREV_JAN + 2); SetDParam(2, year); - x_label_width = max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width); + x_label_width = std::max(x_label_width, GetStringBoundingBox(month == 0 ? STR_GRAPH_X_LABEL_MONTH_YEAR : STR_GRAPH_X_LABEL_MONTH).width); month += 3; if (month >= 12) { @@ -514,9 +514,9 @@ public: SetDParam(1, INT64_MAX); uint y_label_width = GetStringBoundingBox(STR_GRAPH_Y_LABEL).width; - size->width = max(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9); - size->height = max(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4); - size->height = max(size->height, size->width / 3); + size->width = std::max(size->width, 5 + y_label_width + this->num_on_x_axis * (x_label_width + 5) + 9); + size->height = std::max(size->height, 5 + (1 + MIN_GRAPH_NUM_LINES_Y * 2 + (this->month != 0xFF ? 3 : 1)) * FONT_HEIGHT_SMALL + 4); + size->height = std::max(size->height, size->width / 3); } void DrawWidget(const Rect &r, int widget) const override @@ -568,7 +568,7 @@ public: byte nums = 0; for (const Company *c : Company::Iterate()) { - nums = min(this->num_vert_lines, max(nums, c->num_valid_stat_ent)); + nums = std::min(this->num_vert_lines, std::max(nums, c->num_valid_stat_ent)); } int mo = (_cur_month / 3 - nums) * 3; @@ -1115,7 +1115,7 @@ static const StringID _performance_titles[] = { static inline StringID GetPerformanceTitleFromValue(uint value) { - return _performance_titles[minu(value, 1000) >> 6]; + return _performance_titles[std::min(value, 1000u) >> 6]; } class CompanyLeagueWindow : public Window { @@ -1199,7 +1199,7 @@ public: this->ordinal_width = 0; for (uint i = 0; i < MAX_COMPANIES; i++) { - this->ordinal_width = max(this->ordinal_width, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i).width); + this->ordinal_width = std::max(this->ordinal_width, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i).width); } this->ordinal_width += 5; // Keep some extra spacing @@ -1215,13 +1215,13 @@ public: Dimension d = GetSpriteSize(SPR_COMPANY_ICON); this->icon_width = d.width + 2; - this->line_height = max(d.height + 2, FONT_HEIGHT_NORMAL); + this->line_height = std::max(d.height + 2, FONT_HEIGHT_NORMAL); for (const Company *c : Company::Iterate()) { SetDParam(0, c->index); SetDParam(1, c->index); SetDParam(2, _performance_titles[widest_title]); - widest_width = max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width); + widest_width = std::max(widest_width, GetStringBoundingBox(STR_COMPANY_LEAGUE_COMPANY_NAME).width); } this->text_width = widest_width + 30; // Keep some extra spacing @@ -1321,7 +1321,7 @@ struct PerformanceRatingDetailWindow : Window { uint score_info_width = 0; for (uint i = SCORE_BEGIN; i < SCORE_END; i++) { - score_info_width = max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width); + score_info_width = std::max(score_info_width, GetStringBoundingBox(STR_PERFORMANCE_DETAIL_VEHICLES + i).width); } SetDParamMaxValue(0, 1000); score_info_width += GetStringBoundingBox(STR_BLACK_COMMA).width + WD_FRAMERECT_LEFT; diff --git a/src/ground_vehicle.cpp b/src/ground_vehicle.cpp index 0f1915c964..f6e44c2e29 100644 --- a/src/ground_vehicle.cpp +++ b/src/ground_vehicle.cpp @@ -38,7 +38,7 @@ void GroundVehicle::PowerChanged() /* Get minimum max speed for this track. */ uint16 track_speed = u->GetMaxTrackSpeed(); - if (track_speed > 0) max_track_speed = min(max_track_speed, track_speed); + if (track_speed > 0) max_track_speed = std::min(max_track_speed, track_speed); } byte air_drag; @@ -48,7 +48,7 @@ void GroundVehicle::PowerChanged() if (air_drag_value == 0) { uint16 max_speed = v->GetDisplayMaxSpeed(); /* Simplification of the method used in TTDPatch. It uses <= 10 to change more steadily from 128 to 196. */ - air_drag = (max_speed <= 10) ? 192 : max(2048 / max_speed, 1); + air_drag = (max_speed <= 10) ? 192 : std::max(2048 / max_speed, 1); } else { /* According to the specs, a value of 0x01 in the air drag property means "no air drag". */ air_drag = (air_drag_value == 1) ? 0 : air_drag_value; @@ -89,7 +89,7 @@ void GroundVehicle::CargoChanged() } /* Store consist weight in cache. */ - this->gcache.cached_weight = max(1, weight); + this->gcache.cached_weight = std::max(1u, weight); /* Friction in bearings and other mechanical parts is 0.1% of the weight (result in N). */ this->gcache.cached_axle_resistance = 10 * weight; @@ -162,8 +162,8 @@ int GroundVehicle::GetAcceleration() const } } else { /* "Kickoff" acceleration. */ - force = (mode == AS_ACCEL && !maglev) ? min(max_te, power) : power; - force = max(force, (mass * 8) + resistance); + force = (mode == AS_ACCEL && !maglev) ? std::min(max_te, power) : power; + force = std::max(force, (mass * 8) + resistance); } if (mode == AS_ACCEL) { @@ -176,9 +176,9 @@ int GroundVehicle::GetAcceleration() const * a hill will never speed up enough to (eventually) get back to the * same (maximum) speed. */ int accel = ClampToI32((force - resistance) / (mass * 4)); - return force < resistance ? min(-1, accel) : max(1, accel); + return force < resistance ? std::min(-1, accel) : std::max(1, accel); } else { - return ClampToI32(min(-force - resistance, -10000) / mass); + return ClampToI32(std::min(-force - resistance, -10000) / mass); } } diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp index af6e25c806..15aac1f369 100644 --- a/src/ground_vehicle.hpp +++ b/src/ground_vehicle.hpp @@ -369,7 +369,7 @@ protected: * somewhat gradually. But never lower than the maximum speed. */ int tempmax = max_speed; if (this->cur_speed > max_speed) { - tempmax = max(this->cur_speed - (this->cur_speed / 10) - 1, max_speed); + tempmax = std::max(this->cur_speed - (this->cur_speed / 10) - 1, max_speed); } /* Enforce a maximum and minimum speed. Normally we would use something like @@ -377,7 +377,7 @@ protected: * threshold for some reason. That makes acceleration fail and assertions * happen in Clamp. So make it explicit that min_speed overrules the maximum * speed by explicit ordering of min and max. */ - this->cur_speed = spd = max(min(this->cur_speed + ((int)spd >> 8), tempmax), min_speed); + this->cur_speed = spd = std::max(std::min(this->cur_speed + ((int)spd >> 8), tempmax), min_speed); int scaled_spd = this->GetAdvanceSpeed(spd); diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 8ef6a2a1bc..2ab2a5b51a 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -205,14 +205,14 @@ private: this->tiny_step_height = this->column_size[VGC_FOLD].height; this->column_size[VGC_NAME] = maxdim(GetStringBoundingBox(STR_GROUP_DEFAULT_TRAINS + this->vli.vtype), GetStringBoundingBox(STR_GROUP_ALL_TRAINS + this->vli.vtype)); - this->column_size[VGC_NAME].width = max(170u, this->column_size[VGC_NAME].width); - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_NAME].height); + this->column_size[VGC_NAME].width = std::max(170u, this->column_size[VGC_NAME].width); + this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_NAME].height); this->column_size[VGC_PROTECT] = GetSpriteSize(SPR_GROUP_REPLACE_PROTECT); - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_PROTECT].height); + this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_PROTECT].height); this->column_size[VGC_AUTOREPLACE] = GetSpriteSize(SPR_GROUP_REPLACE_ACTIVE); - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_AUTOREPLACE].height); + this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_AUTOREPLACE].height); this->column_size[VGC_PROFIT].width = 0; this->column_size[VGC_PROFIT].height = 0; @@ -221,13 +221,13 @@ private: Dimension d = GetSpriteSize(profit_sprites[i]); this->column_size[VGC_PROFIT] = maxdim(this->column_size[VGC_PROFIT], d); } - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_PROFIT].height); + this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_PROFIT].height); int num_vehicle = GetGroupNumVehicle(this->vli.company, ALL_GROUP, this->vli.vtype); SetDParamMaxValue(0, num_vehicle, 3, FS_SMALL); SetDParamMaxValue(1, num_vehicle, 3, FS_SMALL); this->column_size[VGC_NUMBER] = GetStringBoundingBox(STR_GROUP_COUNT_WITH_SUBGROUP); - this->tiny_step_height = max(this->tiny_step_height, this->column_size[VGC_NUMBER].height); + this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[VGC_NUMBER].height); this->tiny_step_height += WD_MATRIX_TOP; @@ -390,9 +390,9 @@ public: /* ... minus the buttons at the bottom ... */ uint max_icon_height = GetSpriteSize(this->GetWidget(WID_GL_CREATE_GROUP)->widget_data).height; - max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_RENAME_GROUP)->widget_data).height); - max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_DELETE_GROUP)->widget_data).height); - max_icon_height = max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_REPLACE_PROTECTION)->widget_data).height); + max_icon_height = std::max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_RENAME_GROUP)->widget_data).height); + max_icon_height = std::max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_DELETE_GROUP)->widget_data).height); + max_icon_height = std::max(max_icon_height, GetSpriteSize(this->GetWidget(WID_GL_REPLACE_PROTECTION)->widget_data).height); /* ... minus the height of the group info ... */ max_icon_height += (FONT_HEIGHT_NORMAL * 3) + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; @@ -601,7 +601,7 @@ public: case WID_GL_LIST_GROUP: { int y1 = r.top + WD_FRAMERECT_TOP; - int max = min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), (uint)this->groups.size()); + int max = std::min(this->group_sb->GetPosition() + this->group_sb->GetCapacity(), this->groups.size()); for (int i = this->group_sb->GetPosition(); i < max; ++i) { const Group *g = this->groups[i]; @@ -625,7 +625,7 @@ public: if (this->vli.index != ALL_GROUP && this->grouping == GB_NONE) { /* Mark vehicles which are in sub-groups (only if we are not using shared order coalescing) */ int y = r.top; - uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), static_cast(this->vehgroups.size())); + uint max = static_cast(std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->vehgroups.size())); for (uint i = this->vscroll->GetPosition(); i < max; ++i) { const Vehicle *v = this->vehgroups[i].GetSingleVehicle(); if (v->group_id != this->vli.index) { diff --git a/src/highscore.cpp b/src/highscore.cpp index 187df028bd..4c5b6b1aa2 100644 --- a/src/highscore.cpp +++ b/src/highscore.cpp @@ -43,7 +43,7 @@ static const StringID _endgame_perf_titles[] = { StringID EndGameGetPerformanceTitleFromValue(uint value) { - value = minu(value / 64, lengthof(_endgame_perf_titles) - 1); + value = std::min(value / 64, lengthof(_endgame_perf_titles) - 1); return _endgame_perf_titles[value]; } @@ -132,7 +132,7 @@ void SaveToHighScore() for (i = 0; i < SP_SAVED_HIGHSCORE_END; i++) { for (hs = _highscore_table[i]; hs != endof(_highscore_table[i]); hs++) { /* First character is a command character, so strlen will fail on that */ - byte length = min(sizeof(hs->company), StrEmpty(hs->company) ? 0 : (int)strlen(&hs->company[1]) + 1); + byte length = std::min(sizeof(hs->company), StrEmpty(hs->company) ? 0 : strlen(&hs->company[1]) + 1); if (fwrite(&length, sizeof(length), 1, fp) != 1 || // write away string length fwrite(hs->company, length, 1, fp) > 1 || // Yes... could be 0 bytes too @@ -163,7 +163,7 @@ void LoadFromHighScore() for (hs = _highscore_table[i]; hs != endof(_highscore_table[i]); hs++) { byte length; if (fread(&length, sizeof(length), 1, fp) != 1 || - fread(hs->company, min(lengthof(hs->company), length), 1, fp) > 1 || // Yes... could be 0 bytes too + fread(hs->company, std::min(lengthof(hs->company), length), 1, fp) > 1 || // Yes... could be 0 bytes too fread(&hs->score, sizeof(hs->score), 1, fp) != 1 || fseek(fp, 2, SEEK_CUR) == -1) { // XXX - placeholder for hs->title, not saved anymore; compatibility DEBUG(misc, 1, "Highscore corrupted"); diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index 68b823966f..cc27501afa 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -58,7 +58,7 @@ struct EndGameHighScoreBaseWindow : Window { /** Return the coordinate of the screen such that a window of 640x480 is centered at the screen. */ Point GetTopLeft(int x, int y) { - Point pt = {max(0, (_screen.width / 2) - (x / 2)), max(0, (_screen.height / 2) - (y / 2))}; + Point pt = {std::max(0, (_screen.width / 2) - (x / 2)), std::max(0, (_screen.height / 2) - (y / 2))}; return pt; } diff --git a/src/industry.h b/src/industry.h index ea4d704a87..401051d5a2 100644 --- a/src/industry.h +++ b/src/industry.h @@ -10,7 +10,6 @@ #ifndef INDUSTRY_H #define INDUSTRY_H -#include #include "newgrf_storage.h" #include "subsidy_type.h" #include "industry_map.h" diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 816146212f..8696e34400 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -531,7 +531,7 @@ static bool TransportIndustryGoods(TileIndex tile) bool moved_cargo = false; for (uint j = 0; j < lengthof(i->produced_cargo_waiting); j++) { - uint cw = min(i->produced_cargo_waiting[j], 255); + uint cw = std::min(i->produced_cargo_waiting[j], 255u); if (cw > indspec->minimal_cargo && i->produced_cargo[j] != CT_INVALID) { i->produced_cargo_waiting[j] -= cw; @@ -1032,7 +1032,7 @@ static void PlantFarmField(TileIndex tile, IndustryID industry) uint size_x = GB(r, 0, 8); uint size_y = GB(r, 8, 8); - TileArea ta(tile - TileDiffXY(min(TileX(tile), size_x / 2), min(TileY(tile), size_y / 2)), size_x, size_y); + TileArea ta(tile - TileDiffXY(std::min(TileX(tile), size_x / 2), std::min(TileY(tile), size_y / 2)), size_x, size_y); ta.ClampToMap(); if (ta.w == 0 || ta.h == 0) return; @@ -1121,7 +1121,7 @@ static void ChopLumberMillTrees(Industry *i) TileIndex tile = i->location.tile; if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, nullptr)) { // 40x40 tiles to search. - i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); // Found a tree, add according value to waiting cargo. + i->produced_cargo_waiting[0] = std::min(0xffff, i->produced_cargo_waiting[0] + 45); // Found a tree, add according value to waiting cargo. } } @@ -1153,7 +1153,7 @@ static void ProduceIndustryGoods(Industry *i) IndustryBehaviour indbehav = indsp->behaviour; for (size_t j = 0; j < lengthof(i->produced_cargo_waiting); j++) { - i->produced_cargo_waiting[j] = min(0xffff, i->produced_cargo_waiting[j] + i->production_rate[j]); + i->produced_cargo_waiting[j] = std::min(0xffff, i->produced_cargo_waiting[j] + i->production_rate[j]); } if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) { @@ -1743,7 +1743,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, /* Randomize inital production if non-original economy is used and there are no production related callbacks. */ if (!indspec->UsesOriginalEconomy()) { for (size_t ci = 0; ci < lengthof(i->production_rate); ci++) { - i->production_rate[ci] = min((RandomRange(256) + 128) * i->production_rate[ci] >> 8, 255); + i->production_rate[ci] = std::min((RandomRange(256) + 128) * i->production_rate[ci] >> 8, 255u); } } @@ -2208,7 +2208,7 @@ static uint GetNumberOfIndustries() assert(lengthof(numof_industry_table) == ID_END); uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.industry_density : (uint)ID_VERY_LOW; - return min(IndustryPool::MAX_SIZE, ScaleByMapSize(numof_industry_table[difficulty])); + return std::min(IndustryPool::MAX_SIZE, ScaleByMapSize(numof_industry_table[difficulty])); } /** @@ -2284,7 +2284,7 @@ void IndustryBuildData::MonthlyLoop() /* To prevent running out of unused industries for the player to connect, * add a fraction of new industries each month, but only if the manager can keep up. */ - uint max_behind = 1 + min(99u, ScaleByMapSize(3)); // At most 2 industries for small maps, and 100 at the biggest map (about 6 months industry build attempts). + uint max_behind = 1 + std::min(99u, ScaleByMapSize(3)); // At most 2 industries for small maps, and 100 at the biggest map (about 6 months industry build attempts). if (GetCurrentTotalNumberOfIndustries() + max_behind >= (this->wanted_inds >> 16)) { this->wanted_inds += ScaleByMapSize(NEWINDS_PER_MONTH); } @@ -2352,7 +2352,7 @@ static void UpdateIndustryStatistics(Industry *i) byte pct = 0; if (i->this_month_production[j] != 0) { i->last_prod_year = _cur_year; - pct = min(i->this_month_transported[j] * 256 / i->this_month_production[j], 255); + pct = std::min(i->this_month_transported[j] * 256 / i->this_month_production[j], 255); } i->last_month_pct_transported[j] = pct; @@ -2376,7 +2376,7 @@ void Industry::RecomputeProductionMultipliers() /* Rates are rounded up, so e.g. oilrig always produces some passengers */ for (size_t i = 0; i < lengthof(this->production_rate); i++) { - this->production_rate[i] = min(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT), 0xFF); + this->production_rate[i] = std::min(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT), 0xFFu); } } @@ -2509,10 +2509,10 @@ void IndustryBuildData::TryBuildNewIndustry() const Industry *ind = PlaceIndustry(it, IACT_RANDOMCREATION, false); if (ind == nullptr) { this->builddata[it].wait_count = this->builddata[it].max_wait + 1; // Compensate for decrementing below. - this->builddata[it].max_wait = min(1000, this->builddata[it].max_wait + 2); + this->builddata[it].max_wait = std::min(1000, this->builddata[it].max_wait + 2); } else { AdvertiseIndustryOpening(ind); - this->builddata[it].max_wait = max(this->builddata[it].max_wait / 2, 1); // Reduce waiting time of the industry type. + this->builddata[it].max_wait = std::max(this->builddata[it].max_wait / 2, 1); // Reduce waiting time of the industry type. } } @@ -2749,7 +2749,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly) /* 4.5% chance for 3-23% (or 1 unit for very low productions) production change, * determined by mult value. If mult = 1 prod. increases, else (-1) it decreases. */ if (Chance16I(1, 22, r >> 16)) { - new_prod += mult * (max(((RandomRange(50) + 10) * old_prod) >> 8, 1U)); + new_prod += mult * (std::max(((RandomRange(50) + 10) * old_prod) >> 8, 1U)); } /* Prevent production to overflow or Oil Rig passengers to be over-"produced" */ @@ -2794,7 +2794,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly) /* Increase if needed */ while (mul-- != 0 && i->prod_level < PRODLEVEL_MAXIMUM) { - i->prod_level = min(i->prod_level * 2, PRODLEVEL_MAXIMUM); + i->prod_level = std::min(i->prod_level * 2, PRODLEVEL_MAXIMUM); recalculate_multipliers = true; if (str == STR_NULL) str = indspec->production_up_text; } @@ -2805,7 +2805,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly) closeit = true; break; } else { - i->prod_level = max(i->prod_level / 2, (int)PRODLEVEL_MINIMUM); // typecast to int required to please MSVC + i->prod_level = std::max(i->prod_level / 2, PRODLEVEL_MINIMUM); recalculate_multipliers = true; if (str == STR_NULL) str = indspec->production_down_text; } @@ -2897,7 +2897,7 @@ void IndustryDailyLoop() uint perc = 3; // Between 3% and 9% chance of creating a new industry. if ((_industry_builder.wanted_inds >> 16) > GetCurrentTotalNumberOfIndustries()) { - perc = min(9u, perc + (_industry_builder.wanted_inds >> 16) - GetCurrentTotalNumberOfIndustries()); + perc = std::min(9u, perc + (_industry_builder.wanted_inds >> 16) - GetCurrentTotalNumberOfIndustries()); } for (uint16 j = 0; j < change_loop; j++) { if (Chance16(perc, 100)) { diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index ed770ed043..4c59105b3a 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -434,7 +434,7 @@ public: std::string cargostring = this->MakeCargoListString(indsp->accepts_cargo, cargo_suffix, lengthof(indsp->accepts_cargo), STR_INDUSTRY_VIEW_REQUIRES_N_CARGO); Dimension strdim = GetStringBoundingBox(cargostring.c_str()); if (strdim.width > max_minwidth) { - extra_lines_req = max(extra_lines_req, strdim.width / max_minwidth + 1); + extra_lines_req = std::max(extra_lines_req, strdim.width / max_minwidth + 1); strdim.width = max_minwidth; } d = maxdim(d, strdim); @@ -444,7 +444,7 @@ public: cargostring = this->MakeCargoListString(indsp->produced_cargo, cargo_suffix, lengthof(indsp->produced_cargo), STR_INDUSTRY_VIEW_PRODUCES_N_CARGO); strdim = GetStringBoundingBox(cargostring.c_str()); if (strdim.width > max_minwidth) { - extra_lines_prd = max(extra_lines_prd, strdim.width / max_minwidth + 1); + extra_lines_prd = std::max(extra_lines_prd, strdim.width / max_minwidth + 1); strdim.width = max_minwidth; } d = maxdim(d, strdim); @@ -966,22 +966,22 @@ public: case EA_MULTIPLIER: if (button == 1) { if (i->prod_level <= PRODLEVEL_MINIMUM) return; - i->prod_level = max(i->prod_level / 2, PRODLEVEL_MINIMUM); + i->prod_level = std::max(i->prod_level / 2, PRODLEVEL_MINIMUM); } else { if (i->prod_level >= PRODLEVEL_MAXIMUM) return; - i->prod_level = minu(i->prod_level * 2, PRODLEVEL_MAXIMUM); + i->prod_level = std::min(i->prod_level * 2, PRODLEVEL_MAXIMUM); } break; case EA_RATE: if (button == 1) { if (i->production_rate[line - IL_RATE1] <= 0) return; - i->production_rate[line - IL_RATE1] = max(i->production_rate[line - IL_RATE1] / 2, 0); + i->production_rate[line - IL_RATE1] = std::max(i->production_rate[line - IL_RATE1] / 2, 0); } else { if (i->production_rate[line - IL_RATE1] >= 255) return; /* a zero production industry is unlikely to give anything but zero, so push it a little bit */ int new_prod = i->production_rate[line - IL_RATE1] == 0 ? 1 : i->production_rate[line - IL_RATE1] * 2; - i->production_rate[line - IL_RATE1] = minu(new_prod, 255); + i->production_rate[line - IL_RATE1] = std::min(new_prod, 255); } break; @@ -1468,7 +1468,7 @@ protected: } /* Display first 3 cargos */ - for (size_t j = 0; j < min(3, cargos.size()); j++) { + for (size_t j = 0; j < std::min(3, cargos.size()); j++) { CargoInfo ci = cargos[j]; SetDParam(p++, STR_INDUSTRY_DIRECTORY_ITEM_INFO); SetDParam(p++, std::get<0>(ci)); @@ -2399,10 +2399,10 @@ struct IndustryCargoesWindow : public Window { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; this->ind_textsize = maxdim(this->ind_textsize, GetStringBoundingBox(indsp->name)); - CargoesField::max_cargoes = max(CargoesField::max_cargoes, std::count_if(indsp->accepts_cargo, endof(indsp->accepts_cargo), IsCargoIDValid)); - CargoesField::max_cargoes = max(CargoesField::max_cargoes, std::count_if(indsp->produced_cargo, endof(indsp->produced_cargo), IsCargoIDValid)); + CargoesField::max_cargoes = std::max(CargoesField::max_cargoes, std::count_if(indsp->accepts_cargo, endof(indsp->accepts_cargo), IsCargoIDValid)); + CargoesField::max_cargoes = std::max(CargoesField::max_cargoes, std::count_if(indsp->produced_cargo, endof(indsp->produced_cargo), IsCargoIDValid)); } - d.width = max(d.width, this->ind_textsize.width); + d.width = std::max(d.width, this->ind_textsize.width); d.height = this->ind_textsize.height; this->ind_textsize = maxdim(this->ind_textsize, GetStringBoundingBox(STR_INDUSTRY_CARGOES_SELECT_INDUSTRY)); @@ -2420,7 +2420,7 @@ struct IndustryCargoesWindow : public Window { d.width += 2 * HOR_TEXT_PADDING; /* Ensure the height is enough for the industry type text, for the horizontal connections, and for the cargo labels. */ uint min_ind_height = CargoesField::VERT_CARGO_EDGE * 2 + CargoesField::max_cargoes * FONT_HEIGHT_NORMAL + (CargoesField::max_cargoes - 1) * CargoesField::VERT_CARGO_SPACE; - d.height = max(d.height + 2 * VERT_TEXT_PADDING, min_ind_height); + d.height = std::max(d.height + 2 * VERT_TEXT_PADDING, min_ind_height); CargoesField::industry_width = d.width; CargoesField::normal_height = d.height + CargoesField::VERT_INTER_INDUSTRY_SPACE; @@ -2437,11 +2437,11 @@ struct IndustryCargoesWindow : public Window { break; case WID_IC_IND_DROPDOWN: - size->width = max(size->width, this->ind_textsize.width + padding.width); + size->width = std::max(size->width, this->ind_textsize.width + padding.width); break; case WID_IC_CARGO_DROPDOWN: - size->width = max(size->width, this->cargo_textsize.width + padding.width); + size->width = std::max(size->width, this->cargo_textsize.width + padding.width); break; } } @@ -2638,7 +2638,7 @@ struct IndustryCargoesWindow : public Window { /* Make a field consisting of two cargo columns. */ int num_supp = CountMatchingProducingIndustries(central_sp->accepts_cargo, lengthof(central_sp->accepts_cargo)) + houses_supply; int num_cust = CountMatchingAcceptingIndustries(central_sp->produced_cargo, lengthof(central_sp->produced_cargo)) + houses_accept; - int num_indrows = max(3, max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels. + int num_indrows = std::max(3, std::max(num_supp, num_cust)); // One is needed for the 'it' industry, and 2 for the cargo labels. for (int i = 0; i < num_indrows; i++) { CargoesRow &row = this->fields.emplace_back(); row.columns[0].MakeEmpty(CFT_EMPTY); @@ -2714,7 +2714,7 @@ struct IndustryCargoesWindow : public Window { bool houses_accept = HousesCanAccept(&cid, 1); int num_supp = CountMatchingProducingIndustries(&cid, 1) + houses_supply + 1; // Ensure room for the cargo label. int num_cust = CountMatchingAcceptingIndustries(&cid, 1) + houses_accept; - int num_indrows = max(num_supp, num_cust); + int num_indrows = std::max(num_supp, num_cust); for (int i = 0; i < num_indrows; i++) { CargoesRow &row = this->fields.emplace_back(); row.columns[0].MakeEmpty(CFT_EMPTY); diff --git a/src/ini_load.cpp b/src/ini_load.cpp index 022e2bf180..5c208548f3 100644 --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -226,7 +226,7 @@ void IniLoadFile::LoadFromDisk(const std::string &filename, Subdirectory subdir) uint a = comment_alloc; /* add to comment */ if (ns > a) { - a = max(a, 128U); + a = std::max(a, 128U); do a *= 2; while (a < ns); comment = ReallocT(comment, comment_alloc = a); } diff --git a/src/landscape.cpp b/src/landscape.cpp index 9f4116a232..80ba516ac7 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -130,12 +130,12 @@ Point InverseRemapCoords2(int x, int y, bool clamp_to_map, bool *clamped) * So give it a z-malus of 4 in the first iterations. */ int z = 0; if (clamp_to_map) { - for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(pt.x + max(z, 4) - 4, min_coord, max_x), Clamp(pt.y + max(z, 4) - 4, min_coord, max_y)) / 2; - for (int m = 3; m > 0; m--) z = GetSlopePixelZ(Clamp(pt.x + max(z, m) - m, min_coord, max_x), Clamp(pt.y + max(z, m) - m, min_coord, max_y)) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(pt.x + std::max(z, 4) - 4, min_coord, max_x), Clamp(pt.y + std::max(z, 4) - 4, min_coord, max_y)) / 2; + for (int m = 3; m > 0; m--) z = GetSlopePixelZ(Clamp(pt.x + std::max(z, m) - m, min_coord, max_x), Clamp(pt.y + std::max(z, m) - m, min_coord, max_y)) / 2; for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(pt.x + z, min_coord, max_x), Clamp(pt.y + z, min_coord, max_y)) / 2; } else { - for (int i = 0; i < 5; i++) z = GetSlopePixelZOutsideMap(pt.x + max(z, 4) - 4, pt.y + max(z, 4) - 4) / 2; - for (int m = 3; m > 0; m--) z = GetSlopePixelZOutsideMap(pt.x + max(z, m) - m, pt.y + max(z, m) - m) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZOutsideMap(pt.x + std::max(z, 4) - 4, pt.y + std::max(z, 4) - 4) / 2; + for (int m = 3; m > 0; m--) z = GetSlopePixelZOutsideMap(pt.x + std::max(z, m) - m, pt.y + std::max(z, m) - m) / 2; for (int i = 0; i < 5; i++) z = GetSlopePixelZOutsideMap(pt.x + z, pt.y + z ) / 2; } @@ -630,8 +630,8 @@ void SetSnowLine(byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS]) for (uint i = 0; i < SNOW_LINE_MONTHS; i++) { for (uint j = 0; j < SNOW_LINE_DAYS; j++) { - _snow_line->highest_value = max(_snow_line->highest_value, table[i][j]); - _snow_line->lowest_value = min(_snow_line->lowest_value, table[i][j]); + _snow_line->highest_value = std::max(_snow_line->highest_value, table[i][j]); + _snow_line->lowest_value = std::min(_snow_line->lowest_value, table[i][j]); } } } diff --git a/src/linkgraph/demands.cpp b/src/linkgraph/demands.cpp index f1b714820b..c31e8896f6 100644 --- a/src/linkgraph/demands.cpp +++ b/src/linkgraph/demands.cpp @@ -45,7 +45,7 @@ public: */ inline void SetDemandPerNode(uint num_demands) { - this->demand_per_node = max(this->supply_sum / num_demands, 1U); + this->demand_per_node = std::max(this->supply_sum / num_demands, 1U); } /** @@ -57,7 +57,7 @@ public: */ inline uint EffectiveSupply(const Node &from, const Node &to) { - return max(from.Supply() * max(1U, to.Supply()) * this->mod_size / 100 / this->demand_per_node, 1U); + return std::max(from.Supply() * std::max(1U, to.Supply()) * this->mod_size / 100 / this->demand_per_node, 1U); } /** @@ -134,7 +134,7 @@ void SymmetricScaler::SetDemands(LinkGraphJob &job, NodeID from_id, NodeID to_id uint undelivered = job[to_id].UndeliveredSupply(); if (demand_back > undelivered) { demand_back = undelivered; - demand_forw = max(1U, demand_back * 100 / this->mod_size); + demand_forw = std::max(1U, demand_back * 100 / this->mod_size); } this->Scaler::SetDemands(job, to_id, from_id, demand_back); } @@ -230,7 +230,7 @@ void DemandCalculator::CalcDemand(LinkGraphJob &job, Tscaler scaler) demand_forw = 1; } - demand_forw = min(demand_forw, job[from_id].UndeliveredSupply()); + demand_forw = std::min(demand_forw, job[from_id].UndeliveredSupply()); scaler.SetDemands(job, from_id, to_id, demand_forw); diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index 5185d07b7b..93af907fc0 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -71,7 +71,7 @@ void LinkGraph::Compress() for (NodeID node2 = 0; node2 < this->Size(); ++node2) { BaseEdge &edge = this->edges[node1][node2]; if (edge.capacity > 0) { - edge.capacity = max(1U, edge.capacity / 2); + edge.capacity = std::max(1U, edge.capacity / 2); edge.usage /= 2; } } @@ -163,8 +163,7 @@ NodeID LinkGraph::AddNode(const Station *st) this->nodes.emplace_back(); /* Avoid reducing the height of the matrix as that is expensive and we * most likely will increase it again later which is again expensive. */ - this->edges.Resize(new_node + 1U, - max(new_node + 1U, this->edges.Height())); + this->edges.Resize(new_node + 1U, std::max(new_node + 1U, this->edges.Height())); this->nodes[new_node].Init(st->xy, st->index, HasBit(good.status, GoodsEntry::GES_ACCEPTANCE)); @@ -266,8 +265,8 @@ void LinkGraph::Edge::Update(uint capacity, uint usage, EdgeUpdateMode mode) this->edge.capacity += capacity; this->edge.usage += usage; } else if (mode & EUM_REFRESH) { - this->edge.capacity = max(this->edge.capacity, capacity); - this->edge.usage = max(this->edge.usage, usage); + this->edge.capacity = std::max(this->edge.capacity, capacity); + this->edge.usage = std::max(this->edge.usage, usage); } if (mode & EUM_UNRESTRICTED) this->edge.last_unrestricted_update = _date; if (mode & EUM_RESTRICTED) this->edge.last_restricted_update = _date; diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index 7362b7d568..99348daa1c 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -113,7 +113,7 @@ public: * Get the date of the last update to any part of the edge's capacity. * @return Last update. */ - Date LastUpdate() const { return max(this->edge.last_unrestricted_update, this->edge.last_restricted_update); } + Date LastUpdate() const { return std::max(this->edge.last_unrestricted_update, this->edge.last_restricted_update); } }; /** @@ -453,7 +453,7 @@ public: */ inline static uint Scale(uint val, uint target_age, uint orig_age) { - return val > 0 ? max(1U, val * target_age / orig_age) : 0; + return val > 0 ? std::max(1U, val * target_age / orig_age) : 0; } /** Bare constructor, only for save/load. */ diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index fa4002e2b8..efdf425da1 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -224,7 +224,7 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to) { /* multiply the numbers by 32 in order to avoid comparing to 0 too often. */ if (cargo.capacity == 0 || - max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < max(new_usg, new_plan) * 32 / (new_cap + 1)) { + std::max(cargo.usage, cargo.planned) * 32 / (cargo.capacity + 1) < std::max(new_usg, new_plan) * 32 / (new_cap + 1)) { cargo.capacity = new_cap; cargo.usage = new_usg; cargo.planned = new_plan; @@ -272,7 +272,7 @@ void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const */ void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const { - uint usage_or_plan = min(cargo.capacity * 2 + 1, max(cargo.usage, cargo.planned)); + uint usage_or_plan = std::min(cargo.capacity * 2 + 1, std::max(cargo.usage, cargo.planned)); int colour = LinkGraphOverlay::LINK_COLOURS[usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS) / (cargo.capacity * 2 + 2)]; int dash = cargo.shared ? this->scale * 4 : 0; @@ -302,7 +302,7 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const Point pt = this->GetStationMiddle(st); if (!this->IsPointVisible(pt, dpi, 3 * this->scale)) continue; - uint r = this->scale * 2 + this->scale * 2 * min(200, i->second) / 200; + uint r = this->scale * 2 + this->scale * 2 * std::min(200U, i->second) / 200; LinkGraphOverlay::DrawVertex(pt.x, pt.y, r, _colour_gradient[st->owner != OWNER_NONE ? diff --git a/src/linkgraph/linkgraphjob.cpp b/src/linkgraph/linkgraphjob.cpp index e23c23b479..5e69dbeba0 100644 --- a/src/linkgraph/linkgraphjob.cpp +++ b/src/linkgraph/linkgraphjob.cpp @@ -223,8 +223,8 @@ void LinkGraphJob::NodeAnnotation::Init(uint supply) */ void Path::Fork(Path *base, uint cap, int free_cap, uint dist) { - this->capacity = min(base->capacity, cap); - this->free_capacity = min(base->free_capacity, free_cap); + this->capacity = std::min(base->capacity, cap); + this->free_capacity = std::min(base->free_capacity, free_cap); this->distance = base->distance + dist; assert(this->distance > 0); if (this->parent != base) { @@ -250,7 +250,7 @@ uint Path::AddFlow(uint new_flow, LinkGraphJob &job, uint max_saturation) if (max_saturation != UINT_MAX) { uint usable_cap = edge.Capacity() * max_saturation / 100; if (usable_cap > edge.Flow()) { - new_flow = min(new_flow, usable_cap - edge.Flow()); + new_flow = std::min(new_flow, usable_cap - edge.Flow()); } else { return 0; } diff --git a/src/linkgraph/linkgraphjob.h b/src/linkgraph/linkgraphjob.h index 7643659212..caeacd19de 100644 --- a/src/linkgraph/linkgraphjob.h +++ b/src/linkgraph/linkgraphjob.h @@ -392,7 +392,7 @@ public: */ inline static int GetCapacityRatio(int free, uint total) { - return Clamp(free, PATH_CAP_MIN_FREE, PATH_CAP_MAX_FREE) * PATH_CAP_MULTIPLIER / max(total, 1U); + return Clamp(free, PATH_CAP_MIN_FREE, PATH_CAP_MAX_FREE) * PATH_CAP_MULTIPLIER / std::max(total, 1U); } /** diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp index ea10409417..003412850c 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -235,7 +235,7 @@ bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint cap, bool CapacityAnnotation::IsBetter(const CapacityAnnotation *base, uint cap, int free_cap, uint dist) const { - int min_cap = Path::GetCapacityRatio(min(base->free_capacity, free_cap), min(base->capacity, cap)); + int min_cap = Path::GetCapacityRatio(std::min(base->free_capacity, free_cap), std::min(base->capacity, cap)); int this_cap = this->GetCapacityRatio(); if (min_cap == this_cap) { /* If the capacities are the same and the other path isn't disconnected @@ -354,7 +354,7 @@ uint MCF1stPass::FindCycleFlow(const PathVector &path, const Path *cycle_begin) uint flow = UINT_MAX; const Path *cycle_end = cycle_begin; do { - flow = min(flow, cycle_begin->GetFlow()); + flow = std::min(flow, cycle_begin->GetFlow()); cycle_begin = path[cycle_begin->GetNode()]; } while (cycle_begin != cycle_end); return flow; diff --git a/src/map.cpp b/src/map.cpp index 679c445ee1..47b89983e3 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -190,7 +190,7 @@ uint DistanceMax(TileIndex t0, TileIndex t1) { const uint dx = Delta(TileX(t0), TileX(t1)); const uint dy = Delta(TileY(t0), TileY(t1)); - return max(dx, dy); + return std::max(dx, dy); } @@ -220,9 +220,9 @@ uint DistanceFromEdge(TileIndex tile) const uint yl = TileY(tile); const uint xh = MapSizeX() - 1 - xl; const uint yh = MapSizeY() - 1 - yl; - const uint minl = min(xl, yl); - const uint minh = min(xh, yh); - return min(minl, minh); + const uint minl = std::min(xl, yl); + const uint minh = std::min(xh, yh); + return std::min(minl, minh); } /** diff --git a/src/misc/str.hpp b/src/misc/str.hpp index 9555681dfa..05a79786b8 100644 --- a/src/misc/str.hpp +++ b/src/misc/str.hpp @@ -92,7 +92,7 @@ struct CStrA : public CBlobT /** Add formatted string (like vsprintf) at the end of existing contents. */ int AddFormatL(const char *format, va_list args) WARN_FORMAT(2, 0) { - size_t addSize = max(strlen(format), 16); + size_t addSize = std::max(strlen(format), 16); addSize += addSize / 2; int ret; int err = 0; diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 42f800351f..c943a2027f 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -98,10 +98,10 @@ CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint switch (p2 & 3) { default: return CMD_ERROR; // Invalid method case 0: // Pay back one step - loan = min(c->current_loan, (Money)LOAN_INTERVAL); + loan = std::min(c->current_loan, (Money)LOAN_INTERVAL); break; case 1: // Pay back as much as possible - loan = max(min(c->current_loan, c->money), (Money)LOAN_INTERVAL); + loan = std::max(std::min(c->current_loan, c->money), (Money)LOAN_INTERVAL); loan -= loan % LOAN_INTERVAL; break; case 2: // Repay the given amount of loan diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index c78bd05efb..1c7b768bd8 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -99,7 +99,7 @@ public: if (StrEmpty(this->landinfo_data[i])) break; uint width = GetStringBoundingBox(this->landinfo_data[i]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT; - size->width = max(size->width, width); + size->width = std::max(size->width, width); size->height += FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL; if (i == 0) size->height += 4; @@ -107,7 +107,7 @@ public: if (!StrEmpty(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])) { uint width = GetStringBoundingBox(this->landinfo_data[LAND_INFO_MULTICENTER_LINE]).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT; - size->width = max(size->width, min(300u, width)); + size->width = std::max(size->width, std::min(300u, width)); SetDParamStr(0, this->landinfo_data[LAND_INFO_MULTICENTER_LINE]); size->height += GetStringHeight(STR_JUST_RAW_STRING, size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT); } @@ -510,7 +510,7 @@ struct AboutWindow : public Window { d.width = 0; for (uint i = 0; i < lengthof(_credits); i++) { - d.width = max(d.width, GetStringBoundingBox(_credits[i]).width); + d.width = std::max(d.width, GetStringBoundingBox(_credits[i]).width); } *size = maxdim(*size, d); } @@ -706,7 +706,7 @@ struct TooltipsWindow : public Window * Clamp value to below main toolbar and above statusbar. If tooltip would * go below window, flip it so it is shown above the cursor */ pt.y = Clamp(_cursor.pos.y + _cursor.total_size.y + _cursor.total_offs.y + 5, scr_top, scr_bot); - if (pt.y + sm_height > scr_bot) pt.y = min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height; + if (pt.y + sm_height > scr_bot) pt.y = std::min(_cursor.pos.y + _cursor.total_offs.y - 5, scr_bot) - sm_height; pt.x = sm_width >= _screen.width ? 0 : Clamp(_cursor.pos.x - (sm_width >> 1), 0, _screen.width - sm_width); return pt; @@ -717,7 +717,7 @@ struct TooltipsWindow : public Window /* There is only one widget. */ for (uint i = 0; i != this->paramcount; i++) SetDParam(i, this->params[i]); - size->width = min(GetStringBoundingBox(this->string_id).width, ScaleGUITrad(194)); + size->width = std::min(GetStringBoundingBox(this->string_id).width, ScaleGUITrad(194)); size->height = GetStringHeight(this->string_id, size->width); /* Increase slightly to have some space around the box. */ @@ -817,7 +817,7 @@ void QueryString::DrawEditBox(const Window *w, int wid) const /* We will take the current widget length as maximum width, with a small * space reserved at the end for the caret to show */ const Textbuf *tb = &this->text; - int delta = min(0, (right - left) - tb->pixels - 10); + int delta = std::min(0, (right - left) - tb->pixels - 10); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; @@ -855,7 +855,7 @@ Point QueryString::GetCaretPosition(const Window *w, int wid) const /* Clamp caret position to be inside out current width. */ const Textbuf *tb = &this->text; - int delta = min(0, (right - left) - tb->pixels - 10); + int delta = std::min(0, (right - left) - tb->pixels - 10); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; Point pt = {left + WD_FRAMERECT_LEFT + tb->caretxoffs + delta, (int)wi->pos_y + WD_FRAMERECT_TOP}; @@ -888,7 +888,7 @@ Rect QueryString::GetBoundingRect(const Window *w, int wid, const char *from, co /* Clamp caret position to be inside our current width. */ const Textbuf *tb = &this->text; - int delta = min(0, (right - left) - tb->pixels - 10); + int delta = std::min(0, (right - left) - tb->pixels - 10); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; /* Get location of first and last character. */ @@ -927,7 +927,7 @@ const char *QueryString::GetCharAtPosition(const Window *w, int wid, const Point /* Clamp caret position to be inside our current width. */ const Textbuf *tb = &this->text; - int delta = min(0, (right - left) - tb->pixels - 10); + int delta = std::min(0, (right - left) - tb->pixels - 10); if (tb->caretxoffs + delta < 0) delta = -tb->caretxoffs; return ::GetCharAtPosition(tb->buf, pt.x - delta - left); diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index e8b0952252..3843f4df11 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "../safeguards.h" diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp index 59cc2a631f..4bdd3e4e39 100644 --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -14,7 +14,6 @@ #include "../core/endian_func.hpp" #include "../base_media_base.h" #include "midi.h" -#include #include "../console_func.h" #include "../console_internal.h" diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index 249fc5b6d7..792cff5aff 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -407,7 +407,7 @@ const char *MusicDriver_Win32::Start(const StringList &parm) /* prepare multimedia timer */ TIMECAPS timecaps; if (timeGetDevCaps(&timecaps, sizeof(timecaps)) == MMSYSERR_NOERROR) { - _midi.time_period = min(max((UINT)resolution, timecaps.wPeriodMin), timecaps.wPeriodMax); + _midi.time_period = std::min(std::max((UINT)resolution, timecaps.wPeriodMin), timecaps.wPeriodMax); if (timeBeginPeriod(_midi.time_period) == MMSYSERR_NOERROR) { /* success */ DEBUG(driver, 2, "Win32-MIDI: Start: timer resolution is %d", (int)_midi.time_period); diff --git a/src/music_gui.cpp b/src/music_gui.cpp index dad5c2ba71..7e2aaac1d6 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -505,7 +505,7 @@ struct MusicTrackSelectionWindow : public Window { SetDParam(1, 2); SetDParamStr(2, song->songname); Dimension d2 = GetStringBoundingBox(STR_PLAYLIST_TRACK_NAME); - d.width = max(d.width, d2.width); + d.width = std::max(d.width, d2.width); d.height += d2.height; } d.width += padding.width; diff --git a/src/network/core/tcp_http.cpp b/src/network/core/tcp_http.cpp index b2a6b0c040..be5a2c39a7 100644 --- a/src/network/core/tcp_http.cpp +++ b/src/network/core/tcp_http.cpp @@ -250,8 +250,8 @@ int NetworkHTTPSocketHandler::Receive() /* Wait till we read the end-of-header identifier */ if (this->recv_length == 0) { - int read = this->recv_pos + res; - int end = min(read, lengthof(this->recv_buffer) - 1); + ssize_t read = this->recv_pos + res; + ssize_t end = std::min(read, lengthof(this->recv_buffer) - 1); /* Do a 'safe' search for the end of the header. */ char prev = this->recv_buffer[end]; @@ -272,7 +272,7 @@ int NetworkHTTPSocketHandler::Receive() this->recv_length = ret; end_of_header += strlen(END_OF_HEADER); - int len = min(read - (end_of_header - this->recv_buffer), res); + int len = std::min(read - (end_of_header - this->recv_buffer), res); if (len != 0) { this->callback->OnReceiveData(end_of_header, len); this->recv_length -= len; @@ -281,7 +281,7 @@ int NetworkHTTPSocketHandler::Receive() this->recv_pos = 0; } } else { - res = min(this->recv_length, res); + res = std::min(this->recv_length, res); /* Receive whatever we're expecting. */ this->callback->OnReceiveData(this->recv_buffer, res); this->recv_length -= res; diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp index 007722ec69..20bd25f8f2 100644 --- a/src/network/network_admin.cpp +++ b/src/network/network_admin.cpp @@ -413,13 +413,13 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendCompanyEconomy() p->Send_uint64(company->money); p->Send_uint64(company->current_loan); p->Send_uint64(income); - p->Send_uint16(min(UINT16_MAX, company->cur_economy.delivered_cargo.GetSum())); + p->Send_uint16(static_cast(std::min(UINT16_MAX, company->cur_economy.delivered_cargo.GetSum()))); /* Send stats for the last 2 quarters. */ for (uint i = 0; i < 2; i++) { p->Send_uint64(company->old_economy[i].company_value); p->Send_uint16(company->old_economy[i].performance_history); - p->Send_uint16(min(UINT16_MAX, company->old_economy[i].delivered_cargo.GetSum())); + p->Send_uint16(static_cast(std::min(UINT16_MAX, company->old_economy[i].delivered_cargo.GetSum()))); } this->SendPacket(p); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index e0f3bf57c3..83824e126f 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -154,7 +154,7 @@ void NetworkUndrawChatMessage() int width = _chatmsg_box.width; int height = _chatmsg_box.height; if (y < 0) { - height = max(height + y, min(_chatmsg_box.height, _screen.height)); + height = std::max(height + y, std::min(_chatmsg_box.height, _screen.height)); y = 0; } if (x + width >= _screen.width) { @@ -214,7 +214,7 @@ void NetworkDrawChatMessage() int width = _chatmsg_box.width; int height = _chatmsg_box.height; if (y < 0) { - height = max(height + y, min(_chatmsg_box.height, _screen.height)); + height = std::max(height + y, std::min(_chatmsg_box.height, _screen.height)); y = 0; } if (x + width >= _screen.width) { @@ -235,7 +235,7 @@ void NetworkDrawChatMessage() string_height += GetStringLineCount(STR_JUST_RAW_STRING, width - 1) * FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING; } - string_height = min(string_height, MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING)); + string_height = std::min(string_height, MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING)); int top = _screen.height - _chatmsg_box.y - string_height - 2; int bottom = _screen.height - _chatmsg_box.y - 2; diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 343f71eb79..7a7ec9f219 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -68,7 +68,7 @@ struct PacketReader : LoadFilter { assert(this->read_bytes == 0); size_t in_packet = p->size - p->pos; - size_t to_write = min((size_t)(this->bufe - this->buf), in_packet); + size_t to_write = std::min(this->bufe - this->buf, in_packet); const byte *pbuf = p->buffer + p->pos; this->written_bytes += in_packet; @@ -93,7 +93,7 @@ struct PacketReader : LoadFilter { size_t Read(byte *rbuf, size_t size) override { /* Limit the amount to read to whatever we still have. */ - size_t ret_size = size = min(this->written_bytes - this->read_bytes, size); + size_t ret_size = size = std::min(this->written_bytes - this->read_bytes, size); this->read_bytes += ret_size; const byte *rbufe = rbuf + ret_size; @@ -103,7 +103,7 @@ struct PacketReader : LoadFilter { this->bufe = this->buf + CHUNK; } - size_t to_write = min(this->bufe - this->buf, rbufe - rbuf); + size_t to_write = std::min(this->bufe - this->buf, rbufe - rbuf); memcpy(rbuf, this->buf, to_write); rbuf += to_write; this->buf += to_write; diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 46e371e6ff..1c19a2b526 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -221,7 +221,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16 for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); + uint p_count = std::min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); Packet *p = new Packet(PACKET_CONTENT_CLIENT_INFO_ID); p->Send_uint16(p_count); @@ -363,7 +363,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContentFallback(const Co * A packet begins with the packet size and a byte for the type. * Then this packet adds a uint16 for the count in this packet. * The rest of the packet can be used for the IDs. */ - uint p_count = min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); + uint p_count = std::min(count, (SEND_MTU - sizeof(PacketSize) - sizeof(byte) - sizeof(uint16)) / sizeof(uint32)); Packet *p = new Packet(PACKET_CONTENT_CLIENT_CONTENT); p->Send_uint16(p_count); diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index dd87a4948b..06e57a2ac2 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -575,7 +575,7 @@ public: } case WID_NCL_MATRIX: - resize->height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; + resize->height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = 10 * resize->height; break; } @@ -626,7 +626,7 @@ public: const NWidgetBase *nwi_name = this->GetWidget(WID_NCL_NAME); const NWidgetBase *nwi_type = this->GetWidget(WID_NCL_TYPE); - int line_height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL); + int line_height = std::max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL); /* Fill the matrix with the information */ int sprite_y_offset = WD_MATRIX_TOP + (line_height - this->checkbox_size.height) / 2 - 1; @@ -877,7 +877,7 @@ public: break; case WKC_PAGEDOWN: /* scroll down a page */ - this->list_pos = min(this->list_pos + this->vscroll->GetCapacity(), (int)this->content.size() - 1); + this->list_pos = std::min(this->list_pos + this->vscroll->GetCapacity(), (int)this->content.size() - 1); break; case WKC_HOME: /* jump to beginning */ diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 13e6fbe8f1..a2c2cac196 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -123,7 +123,7 @@ public: /* First initialise some variables... */ for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) { child_wid->SetupSmallestSize(w, init_array); - this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); + this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); } /* ... then in a second pass make sure the 'current' sizes are set. Won't change for most widgets. */ @@ -498,12 +498,12 @@ public: { switch (widget) { case WID_NG_MATRIX: - resize->height = WD_MATRIX_TOP + max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; + resize->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; size->height = 12 * resize->height; break; case WID_NG_LASTJOINED: - size->height = WD_MATRIX_TOP + max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; + size->height = WD_MATRIX_TOP + std::max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM; break; case WID_NG_LASTJOINED_SPACER: @@ -545,7 +545,7 @@ public: case WID_NG_MATRIX: { uint16 y = r.top; - const int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (int)this->servers.size()); + const int max = std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (int)this->servers.size()); for (int i = this->vscroll->GetPosition(); i < max; ++i) { const NetworkGameList *ngl = this->servers[i]; @@ -812,7 +812,7 @@ public: case WKC_PAGEDOWN: /* scroll down a page */ if (this->list_pos == SLP_INVALID) return ES_HANDLED; - this->list_pos = min(this->list_pos + this->vscroll->GetCapacity(), (int)this->servers.size() - 1); + this->list_pos = std::min(this->list_pos + this->vscroll->GetCapacity(), (int)this->servers.size() - 1); break; case WKC_HOME: /* jump to beginning */ @@ -904,7 +904,7 @@ GUIGameServerList::FilterFunction * const NetworkGameWindow::filter_funcs[] = { static NWidgetBase *MakeResizableHeader(int *biggest_index) { - *biggest_index = max(*biggest_index, WID_NG_INFO); + *biggest_index = std::max(*biggest_index, WID_NG_INFO); return new NWidgetServerListHeader(); } @@ -1861,13 +1861,13 @@ struct NetworkClientListWindow : Window { { if (widget != WID_CL_PANEL) return; - this->server_client_width = max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT; + this->server_client_width = std::max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT; this->icon_size = GetSpriteSize(SPR_COMPANY_ICON); - this->line_height = max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL); + this->line_height = std::max(this->icon_size.height + 2U, (uint)FONT_HEIGHT_NORMAL); uint width = 100; // Default width for (const NetworkClientInfo *ci : NetworkClientInfo::Iterate()) { - width = max(width, GetStringBoundingBox(ci->client_name).width); + width = std::max(width, GetStringBoundingBox(ci->client_name).width); } size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->icon_size.width + WD_FRAMERECT_LEFT + width + WD_FRAMERECT_RIGHT; @@ -2028,18 +2028,18 @@ struct NetworkJoinStatusWindow : Window { /* Account for the statuses */ uint width = 0; for (uint i = 0; i < NETWORK_JOIN_STATUS_END; i++) { - width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width); + width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width); } /* For the number of waiting (other) players */ SetDParamMaxValue(0, MAX_CLIENTS); - width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width); + width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width); /* Account for downloading ~ 10 MiB */ SetDParamMaxDigits(0, 8); SetDParamMaxDigits(1, 8); - width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width); - width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width); + width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_1).width); + width = std::max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING_2).width); /* Give a bit more clearing for the widest strings than strictly needed */ size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10; diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 067ffd09d3..6ae8e7cdc2 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -174,7 +174,7 @@ struct PacketWriter : SaveFilter { byte *bufe = buf + size; while (buf != bufe) { - size_t to_write = min(SEND_MTU - this->current->size, bufe - buf); + size_t to_write = std::min(SEND_MTU - this->current->size, bufe - buf); memcpy(this->current->buffer + this->current->size, buf, to_write); this->current->size += (PacketSize)to_write; buf += to_write; @@ -1807,7 +1807,7 @@ void NetworkServer_Tick(bool send_frame) for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) { /* We allow a number of bytes per frame, but only to the burst amount * to be available for packet receiving at any particular time. */ - cs->receive_limit = min(cs->receive_limit + _settings_client.network.bytes_per_frame, + cs->receive_limit = std::min(cs->receive_limit + _settings_client.network.bytes_per_frame, _settings_client.network.bytes_per_frame_burst); /* Check if the speed of the client is what we can expect from a client */ diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 0fd20b5f45..771f51fbe7 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -263,7 +263,7 @@ void ServerNetworkUDPSocketHandler::Receive_CLIENT_GET_NEWGRFS(Packet *p, Networ * the current list and do not send the other data. * The name could be an empty string, if so take the filename. */ packet_len += sizeof(c.grfid) + sizeof(c.md5sum) + - min(strlen(f->GetName()) + 1, (size_t)NETWORK_GRF_NAME_LENGTH); + std::min(strlen(f->GetName()) + 1, (size_t)NETWORK_GRF_NAME_LENGTH); if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply break; } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 2663a34705..b854c2801c 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -10,7 +10,6 @@ #include "stdafx.h" #include -#include #include "debug.h" #include "fileio_func.h" @@ -663,7 +662,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern scope_grfid, // Note: this is INVALID_GRFID if dynamic_engines is disabled, so no reservation internal_id, type, - static_cast(min(internal_id, _engine_counts[type])) // substitute_id == _engine_counts[subtype] means "no substitute" + std::min(internal_id, _engine_counts[type]) // substitute_id == _engine_counts[subtype] means "no substitute" }); if (engine_pool_size != Engine::GetPoolSize()) { @@ -2460,7 +2459,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt } case 0x16: // Periodic refresh multiplier - housespec->processing_time = min(buf->ReadByte(), 63); + housespec->processing_time = std::min(buf->ReadByte(), 63u); break; case 0x17: // Four random colours to use @@ -2642,7 +2641,7 @@ static ChangeInfoResult GlobalVarChangeInfo(uint gvid, int numinfo, int prop, By uint price = gvid + i; if (price < PR_END) { - _cur.grffile->price_base_multipliers[price] = min(factor - 8, MAX_PRICE_MODIFIER); + _cur.grffile->price_base_multipliers[price] = std::min(factor - 8, MAX_PRICE_MODIFIER); } else { grfmsg(1, "GlobalVarChangeInfo: Price %d out of range, ignoring", price); } @@ -3029,7 +3028,7 @@ static ChangeInfoResult CargoChangeInfo(uint cid, int numinfo, int prop, ByteRea break; case 0x1D: // Vehicle capacity muliplier - cs->multiplier = max(1u, buf->ReadWord()); + cs->multiplier = std::max(1u, buf->ReadWord()); break; default: @@ -3911,11 +3910,11 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, B } if (as->rotation[j] == DIR_E || as->rotation[j] == DIR_W) { - as->size_x = max(as->size_x, att[k].ti.y + 1); - as->size_y = max(as->size_y, att[k].ti.x + 1); + as->size_x = std::max(as->size_x, att[k].ti.y + 1); + as->size_y = std::max(as->size_y, att[k].ti.x + 1); } else { - as->size_x = max(as->size_x, att[k].ti.x + 1); - as->size_y = max(as->size_y, att[k].ti.y + 1); + as->size_x = std::max(as->size_x, att[k].ti.x + 1); + as->size_y = std::max(as->size_y, att[k].ti.y + 1); } } tile_table[j] = CallocT(size); @@ -5197,7 +5196,7 @@ static void NewSpriteGroup(ByteReader *buf) case GSF_AIRPORTTILES: case GSF_OBJECTS: case GSF_INDUSTRYTILES: { - byte num_building_sprites = max((uint8)1, type); + byte num_building_sprites = std::max((uint8)1, type); assert(TileLayoutSpriteGroup::CanAllocateItem()); TileLayoutSpriteGroup *group = new TileLayoutSpriteGroup(); @@ -6072,7 +6071,7 @@ static uint16 SanitizeSpriteOffset(uint16& num, uint16 offset, int max_sprites, if (offset + num > max_sprites) { grfmsg(4, "GraphicsNew: %s sprite overflow, truncating...", name); uint orig_num = num; - num = max(max_sprites - offset, 0); + num = std::max(max_sprites - offset, 0); return orig_num - num; } @@ -6233,7 +6232,7 @@ bool GetGlobalVariable(byte param, uint32 *value, const GRFFile *grffile) { switch (param) { case 0x00: // current date - *value = max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); + *value = std::max(_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0); return true; case 0x01: // current year @@ -6954,7 +6953,7 @@ static uint32 GetPatchVariable(uint8 param) { switch (param) { /* start year - 1920 */ - case 0x0B: return max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR; + case 0x0B: return std::max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR; /* freight trains weight factor */ case 0x0E: return _settings_game.vehicle.freight_trains; @@ -6993,7 +6992,7 @@ static uint32 GetPatchVariable(uint8 param) byte map_bits = 0; byte log_X = MapLogX() - 6; // subtraction is required to make the minimal size (64) zero based byte log_Y = MapLogY() - 6; - byte max_edge = max(log_X, log_Y); + byte max_edge = std::max(log_X, log_Y); if (log_X == log_Y) { // we have a squared map, since both edges are identical SetBit(map_bits, 0); @@ -7001,7 +7000,7 @@ static uint32 GetPatchVariable(uint8 param) if (max_edge == log_Y) SetBit(map_bits, 1); // edge Y been the biggest, mark it } - return (map_bits << 24) | (min(log_X, log_Y) << 20) | (max_edge << 16) | + return (map_bits << 24) | (std::min(log_X, log_Y) << 20) | (max_edge << 16) | (log_X << 12) | (log_Y << 8) | (log_X + log_Y); } @@ -7825,7 +7824,7 @@ static bool ChangeGRFNumUsedParams(size_t len, ByteReader *buf) grfmsg(2, "StaticGRFInfo: expected only 1 byte for 'INFO'->'NPAR' but got " PRINTF_SIZE ", ignoring this field", len); buf->Skip(len); } else { - _cur.grfconfig->num_valid_params = min(buf->ReadByte(), lengthof(_cur.grfconfig->param)); + _cur.grfconfig->num_valid_params = std::min(buf->ReadByte(), lengthof(_cur.grfconfig->param)); } return true; } @@ -7979,8 +7978,8 @@ static bool ChangeGRFParamMask(size_t len, ByteReader *buf) buf->Skip(len - 1); } else { _cur_parameter->param_nr = param_nr; - if (len >= 2) _cur_parameter->first_bit = min(buf->ReadByte(), 31); - if (len >= 3) _cur_parameter->num_bit = min(buf->ReadByte(), 32 - _cur_parameter->first_bit); + if (len >= 2) _cur_parameter->first_bit = std::min(buf->ReadByte(), 31); + if (len >= 3) _cur_parameter->num_bit = std::min(buf->ReadByte(), 32 - _cur_parameter->first_bit); } } diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 5ba54f26cf..cd95a4b8a8 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -260,7 +260,7 @@ void GRFParameterInfo::SetValue(struct GRFConfig *config, uint32 value) } else { SB(config->param[this->param_nr], this->first_bit, this->num_bit, value); } - config->num_params = max(config->num_params, this->param_nr + 1); + config->num_params = std::max(config->num_params, this->param_nr + 1); SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_NEWGRF_STATE); } @@ -339,7 +339,7 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir) if (f == nullptr) return false; long start = ftell(f); - size = min(size, GRFGetSizeOfDataSection(f)); + size = std::min(size, GRFGetSizeOfDataSection(f)); if (start < 0 || fseek(f, start, SEEK_SET) < 0) { FioFCloseFile(f); diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 511436b27e..da3ddff0aa 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -374,12 +374,12 @@ struct NewGRFInspectWindow : Window { case WID_NGRFI_VEH_CHAIN: { assert(this->HasChainIndex()); GrfSpecFeature f = GetFeatureNum(this->window_number); - size->height = max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM); + size->height = std::max(size->height, GetVehicleImageCellSize((VehicleType)(VEH_TRAIN + (f - GSF_TRAINS)), EIT_IN_DEPOT).height + 2 + WD_BEVEL_TOP + WD_BEVEL_BOTTOM); break; } case WID_NGRFI_MAINPANEL: - resize->height = max(11, FONT_HEIGHT_NORMAL + 1); + resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1); resize->width = 1; size->height = 5 * resize->height + TOP_OFFSET + BOTTOM_OFFSET; @@ -430,7 +430,7 @@ struct NewGRFInspectWindow : Window { int skip = 0; if (total_width > width) { int sel_center = (sel_start + sel_end) / 2; - if (sel_center > width / 2) skip = min(total_width - width, sel_center - width / 2); + if (sel_center > width / 2) skip = std::min(total_width - width, sel_center - width / 2); } GrfSpecFeature f = GetFeatureNum(this->window_number); @@ -861,7 +861,7 @@ struct SpriteAlignerWindow : Window { size->height = ScaleGUITrad(200); break; case WID_SA_LIST: - resize->height = max(11, FONT_HEIGHT_NORMAL + 1); + resize->height = std::max(11, FONT_HEIGHT_NORMAL + 1); resize->width = 1; break; default: @@ -897,7 +897,7 @@ struct SpriteAlignerWindow : Window { int step_size = nwid->resize_y; std::vector &list = _newgrf_debug_sprite_picker.sprites; - int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size()); + int max = std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)list.size()); int y = r.top + WD_FRAMERECT_TOP; for (int i = this->vscroll->GetPosition(); i < max; i++) { diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index efc9873af4..8066ea4324 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -940,8 +940,8 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, if (totalsets == 0) return nullptr; - uint set = (v->cargo.StoredCount() * totalsets) / max((uint16)1, v->cargo_cap); - set = min(set, totalsets - 1); + uint set = (v->cargo.StoredCount() * totalsets) / std::max(1u, v->cargo_cap); + set = std::min(set, totalsets - 1); return in_motion ? group->loaded[set] : group->loading[set]; } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 284e5737eb..9e340654c5 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -193,8 +193,8 @@ struct NewGRFParametersWindow : public Window { switch (widget) { case WID_NP_NUMPAR_DEC: case WID_NP_NUMPAR_INC: { - size->width = max(SETTING_BUTTON_WIDTH / 2, FONT_HEIGHT_NORMAL); - size->height = max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL); + size->width = std::max(SETTING_BUTTON_WIDTH / 2, FONT_HEIGHT_NORMAL); + size->height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL); break; } @@ -208,7 +208,7 @@ struct NewGRFParametersWindow : public Window { } case WID_NP_BACKGROUND: - this->line_height = max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; + this->line_height = std::max(SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; resize->width = 1; resize->height = this->line_height; @@ -721,25 +721,25 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WID_NS_FILE_LIST: { Dimension d = maxdim(GetSpriteSize(SPR_SQUARE), GetSpriteSize(SPR_WARNING_SIGN)); - resize->height = max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U); - size->height = max(size->height, WD_FRAMERECT_TOP + 6 * resize->height + WD_FRAMERECT_BOTTOM); + resize->height = std::max(d.height + 2U, FONT_HEIGHT_NORMAL + 2U); + size->height = std::max(size->height, WD_FRAMERECT_TOP + 6 * resize->height + WD_FRAMERECT_BOTTOM); break; } case WID_NS_AVAIL_LIST: - resize->height = max(12, FONT_HEIGHT_NORMAL + 2); - size->height = max(size->height, WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM); + resize->height = std::max(12, FONT_HEIGHT_NORMAL + 2); + size->height = std::max(size->height, WD_FRAMERECT_TOP + 8 * resize->height + WD_FRAMERECT_BOTTOM); break; case WID_NS_NEWGRF_INFO_TITLE: { Dimension dim = GetStringBoundingBox(STR_NEWGRF_SETTINGS_INFO_TITLE); - size->height = max(size->height, dim.height + WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM); - size->width = max(size->width, dim.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); + size->height = std::max(size->height, dim.height + WD_FRAMETEXT_TOP + WD_FRAMETEXT_BOTTOM); + size->width = std::max(size->width, dim.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); break; } case WID_NS_NEWGRF_INFO: - size->height = max(size->height, WD_FRAMERECT_TOP + 10 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM + padding.height + 2); + size->height = std::max(size->height, WD_FRAMERECT_TOP + 10 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM + padding.height + 2); break; case WID_NS_PRESET_LIST: { @@ -877,7 +877,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2; uint y = r.top + WD_FRAMERECT_TOP; uint min_index = this->vscroll2->GetPosition(); - uint max_index = min(min_index + this->vscroll2->GetCapacity(), (uint)this->avails.size()); + uint max_index = std::min(min_index + this->vscroll2->GetCapacity(), (uint)this->avails.size()); for (uint i = min_index; i < max_index; i++) { const GRFConfig *c = this->avails[i]; @@ -1311,7 +1311,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WKC_PAGEDOWN: /* scroll down a page */ - this->avail_pos = min(this->avail_pos + this->vscroll2->GetCapacity(), (int)this->avails.size() - 1); + this->avail_pos = std::min(this->avail_pos + this->vscroll2->GetCapacity(), (int)this->avails.size() - 1); break; case WKC_HOME: @@ -1363,7 +1363,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { for (from_prev = &this->actives; *from_prev != this->active_sel; from_prev = &(*from_prev)->next, from_pos++) {} /* Gets the drag-and-drop destination offset. Ignore the last dummy line. */ - int to_pos = min(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NS_FILE_LIST), this->vscroll->GetCount() - 2); + int to_pos = std::min(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NS_FILE_LIST), this->vscroll->GetCount() - 2); if (to_pos != from_pos) { // Don't move NewGRF file over itself. /* Get pointer to destination position. */ GRFConfig **to_prev = &this->actives; @@ -1381,7 +1381,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->InvalidateData(); } } else if (this->avail_sel != nullptr) { - int to_pos = min(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NS_FILE_LIST), this->vscroll->GetCount() - 1); + int to_pos = std::min(this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NS_FILE_LIST), this->vscroll->GetCount() - 1); this->AddGRFToActive(to_pos); } } else if (widget == WID_NS_AVAIL_LIST && this->active_sel != nullptr) { @@ -1407,7 +1407,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { /* An NewGRF file is dragged over the active list. */ int to_pos = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_NS_FILE_LIST); /* Skip the last dummy line if the source is from the active list. */ - to_pos = min(to_pos, this->vscroll->GetCount() - (this->active_sel != nullptr ? 2 : 1)); + to_pos = std::min(to_pos, this->vscroll->GetCount() - (this->active_sel != nullptr ? 2 : 1)); if (to_pos != this->active_over) { this->active_over = to_pos; @@ -1620,8 +1620,8 @@ public: uint min_inf_height = this->inf->smallest_y + this->inf->padding_top + this->inf->padding_bottom; /* Smallest window is in two column mode. */ - this->smallest_x = max(min_avs_width, min_acs_width) + INTER_COLUMN_SPACING + min_inf_width; - this->smallest_y = max(min_inf_height, min_acs_height + INTER_LIST_SPACING + min_avs_height); + this->smallest_x = std::max(min_avs_width, min_acs_width) + INTER_COLUMN_SPACING + min_inf_width; + this->smallest_y = std::max(min_inf_height, min_acs_height + INTER_LIST_SPACING + min_avs_height); /* Filling. */ this->fill_x = LeastCommonMultiple(this->avs->fill_x, this->acs->fill_x); @@ -1651,7 +1651,7 @@ public: uint min_acs_width = this->acs->smallest_x + this->acs->padding_left + this->acs->padding_right; uint min_inf_width = this->inf->smallest_x + this->inf->padding_left + this->inf->padding_right; - uint min_list_width = max(min_avs_width, min_acs_width); // Smallest width of the lists such that they have equal width (incl padding). + uint min_list_width = std::max(min_avs_width, min_acs_width); // Smallest width of the lists such that they have equal width (incl padding). uint avs_extra_width = min_list_width - min_avs_width; // Additional width needed for avs to reach min_list_width. uint acs_extra_width = min_list_width - min_acs_width; // Additional width needed for acs to reach min_list_width. @@ -1664,10 +1664,10 @@ public: uint extra_width, inf_width; if (use_three_columns) { extra_width = given_width - min_three_columns; - inf_width = min(MAX_EXTRA_INFO_WIDTH, extra_width / 2); + inf_width = std::min(MAX_EXTRA_INFO_WIDTH, extra_width / 2); } else { extra_width = given_width - min_two_columns; - inf_width = min(MAX_EXTRA_INFO_WIDTH, extra_width / 2); + inf_width = std::min(MAX_EXTRA_INFO_WIDTH, extra_width / 2); } inf_width = ComputeMaxSize(this->inf->smallest_x, this->inf->smallest_x + inf_width, this->inf->GetHorizontalStepSize(sizing)); extra_width -= inf_width - this->inf->smallest_x; @@ -1677,9 +1677,9 @@ public: if (use_three_columns) { /* Three column display, first make both lists equally wide, then divide whatever is left between both lists. * Only keep track of what avs gets, all other space goes to acs. */ - uint avs_width = min(avs_extra_width, extra_width); + uint avs_width = std::min(avs_extra_width, extra_width); extra_width -= avs_width; - extra_width -= min(acs_extra_width, extra_width); + extra_width -= std::min(acs_extra_width, extra_width); avs_width += extra_width / 2; avs_width = ComputeMaxSize(this->avs->smallest_x, this->avs->smallest_x + avs_width, this->avs->GetHorizontalStepSize(sizing)); @@ -1754,7 +1754,7 @@ public: } uint dx = this->acs->current_x + this->acs->padding_left + this->acs->padding_right; if (this->editable) { - dx = max(dx, this->avs->current_x + this->avs->padding_left + this->avs->padding_right); + dx = std::max(dx, this->avs->current_x + this->avs->padding_left + this->avs->padding_right); } x += dx + INTER_COLUMN_SPACING + this->inf->padding_left; this->inf->AssignSizePosition(sizing, x, y + this->inf->padding_top, inf_width, inf_height, rtl); @@ -1914,10 +1914,10 @@ NWidgetBase* NewGRFDisplay(int *biggest_index) int biggest2; NWidgetBase *acs = MakeNWidgets(_nested_newgrf_actives_widgets, lengthof(_nested_newgrf_actives_widgets), &biggest2, nullptr); - *biggest_index = max(*biggest_index, biggest2); + *biggest_index = std::max(*biggest_index, biggest2); NWidgetBase *inf = MakeNWidgets(_nested_newgrf_infopanel_widgets, lengthof(_nested_newgrf_infopanel_widgets), &biggest2, nullptr); - *biggest_index = max(*biggest_index, biggest2); + *biggest_index = std::max(*biggest_index, biggest2); return new NWidgetNewGRFDisplay(avs, acs, inf); } @@ -2077,8 +2077,8 @@ struct SavePresetWindow : public Window { size->height = 0; for (uint i = 0; i < this->presets.size(); i++) { Dimension d = GetStringBoundingBox(this->presets[i].c_str()); - size->width = max(size->width, d.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); - resize->height = max(resize->height, d.height); + size->width = std::max(size->width, d.width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); + resize->height = std::max(resize->height, d.height); } size->height = ClampU((uint)this->presets.size(), 5, 20) * resize->height + 1; break; @@ -2096,7 +2096,7 @@ struct SavePresetWindow : public Window { int offset_y = (step_height - FONT_HEIGHT_NORMAL) / 2; uint y = r.top + WD_FRAMERECT_TOP; uint min_index = this->vscroll->GetPosition(); - uint max_index = min(min_index + this->vscroll->GetCapacity(), (uint)this->presets.size()); + uint max_index = std::min(min_index + this->vscroll->GetCapacity(), (uint)this->presets.size()); for (uint i = min_index; i < max_index; i++) { if ((int)i == this->selected) GfxFillRect(r.left + 1, y, r.right - 1, y + step_height - 2, PC_DARK_BLUE); @@ -2209,7 +2209,7 @@ struct ScanProgressWindow : public Window { SetDParamMaxDigits(1, 4); /* We really don't know the width. We could determine it by scanning the NewGRFs, * but this is the status window for scanning them... */ - size->width = max(400U, GetStringBoundingBox(STR_NEWGRF_SCAN_STATUS).width); + size->width = std::max(400U, GetStringBoundingBox(STR_NEWGRF_SCAN_STATUS).width); size->height = FONT_HEIGHT_NORMAL * 2 + WD_PAR_VSEP_NORMAL; break; } @@ -2221,7 +2221,7 @@ struct ScanProgressWindow : public Window { case WID_SP_PROGRESS_BAR: { /* Draw the % complete with a bar and a text */ DrawFrameRect(r.left, r.top, r.right, r.bottom, COLOUR_GREY, FR_BORDERONLY); - uint percent = scanned * 100 / max(1U, _settings_client.gui.last_newgrf_count); + uint percent = scanned * 100 / std::max(1U, _settings_client.gui.last_newgrf_count); DrawFrameRect(r.left + 1, r.top + 1, (int)((r.right - r.left - 2) * percent / 100) + r.left + 1, r.bottom - 1, COLOUR_MAUVE, FR_NONE); SetDParam(0, percent); DrawString(r.left, r.right, r.top + 5, STR_GENERATION_PROGRESS, TC_FROMSTRING, SA_HOR_CENTER); diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 2dbe907dee..6579c5b09d 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -94,7 +94,7 @@ static uint32 GetClosestIndustry(TileIndex tile, IndustryType type, const Indust for (const Industry *i : Industry::Iterate()) { if (i->type != type || i == current) continue; - best_dist = min(best_dist, DistanceManhattan(tile, i->location.tile)); + best_dist = std::min(best_dist, DistanceManhattan(tile, i->location.tile)); } return best_dist; @@ -140,13 +140,13 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout /* If the filter is 0, it could be because none was specified as well as being really a 0. * In either case, just do the regular var67 */ closest_dist = GetClosestIndustry(current->location.tile, ind_index, current); - count = min(Industry::GetIndustryTypeCount(ind_index), UINT8_MAX); // clamp to 8 bit + count = std::min(Industry::GetIndustryTypeCount(ind_index), UINT8_MAX); // clamp to 8 bit } else { /* Count only those who match the same industry type and layout filter * Unfortunately, we have to do it manually */ for (const Industry *i : Industry::Iterate()) { if (i->type == ind_index && i != current && (i->selected_layout == layout_filter || layout_filter == 0) && (!town_filter || i->town == current->town)) { - closest_dist = min(closest_dist, DistanceManhattan(current->location.tile, i->location.tile)); + closest_dist = std::min(closest_dist, DistanceManhattan(current->location.tile, i->location.tile)); count++; } } @@ -180,7 +180,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout case 0x88: return GetTownRadiusGroup(this->industry->town, this->tile); /* Manhattan distance of the closest town */ - case 0x89: return min(DistanceManhattan(this->industry->town->xy, this->tile), 255); + case 0x89: return std::min(DistanceManhattan(this->industry->town->xy, this->tile), 255u); /* Lowest height of the tile */ case 0x8A: return Clamp(GetTileZ(this->tile) * (this->ro.grffile->grf_version >= 8 ? 1 : TILE_HEIGHT), 0, 0xFF); @@ -189,7 +189,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout case 0x8B: return GetClosestWaterDistance(this->tile, (GetIndustrySpec(this->industry->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0); /* Square of Euclidian distance from town */ - case 0x8D: return min(DistanceSquare(this->industry->town->xy, this->tile), 65535); + case 0x8D: return std::min(DistanceSquare(this->industry->town->xy, this->tile), 65535u); /* 32 random bits */ case 0x8F: return this->random_bits; @@ -213,9 +213,9 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) { if ((indspec->behaviour & INDUSTRYBEH_PROD_MULTI_HNDLING) != 0) { if (this->industry->prod_level == 0) return 0; - return min(this->industry->incoming_cargo_waiting[variable - 0x40] / this->industry->prod_level, (uint16)0xFFFF); + return std::min(this->industry->incoming_cargo_waiting[variable - 0x40] / this->industry->prod_level, 0xFFFFu); } else { - return min(this->industry->incoming_cargo_waiting[variable - 0x40], (uint16)0xFFFF); + return std::min(this->industry->incoming_cargo_waiting[variable - 0x40], 0xFFFFu); } } else { return 0; @@ -283,11 +283,11 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout /* Get town zone and Manhattan distance of closest town */ case 0x65: if (this->tile == INVALID_TILE) break; - return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | min(DistanceManhattan(this->tile, this->industry->town->xy), 0xFFFF); + return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | std::min(DistanceManhattan(this->tile, this->industry->town->xy), 0xFFFFu); /* Get square of Euclidian distance of closes town */ case 0x66: if (this->tile == INVALID_TILE) break; - return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | min(DistanceSquare(this->tile, this->industry->town->xy), 0xFFFF); + return GetTownRadiusGroup(this->industry->town, this->tile) << 16 | std::min(DistanceSquare(this->tile, this->industry->town->xy), 0xFFFFu); /* Count of industry, distance of closest instance * 68 is the same as 67, but with a filtering on selected layout */ @@ -639,7 +639,7 @@ void IndustryProductionCallback(Industry *ind, int reason) ind->incoming_cargo_waiting[i] = Clamp(ind->incoming_cargo_waiting[i] - DerefIndProd(group->subtract_input[i], deref) * multiplier, 0, 0xFFFF); } for (uint i = 0; i < group->num_output; i++) { - ind->produced_cargo_waiting[i] = Clamp(ind->produced_cargo_waiting[i] + max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); + ind->produced_cargo_waiting[i] = Clamp(ind->produced_cargo_waiting[i] + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); } } else { /* Callback receives list of cargos to apply for, which need to have their cargo slots in industry looked up */ @@ -651,7 +651,7 @@ void IndustryProductionCallback(Industry *ind, int reason) for (uint i = 0; i < group->num_output; i++) { int cargo_index = ind->GetCargoProducedIndex(group->cargo_output[i]); if (cargo_index < 0) continue; - ind->produced_cargo_waiting[cargo_index] = Clamp(ind->produced_cargo_waiting[cargo_index] + max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); + ind->produced_cargo_waiting[cargo_index] = Clamp(ind->produced_cargo_waiting[cargo_index] + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); } } diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 8827245d36..649a4b58a1 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -189,7 +189,7 @@ static uint32 GetClosestObject(TileIndex tile, ObjectType type, const Object *cu for (const Object *o : Object::Iterate()) { if (o->type != type || o == current) continue; - best_dist = min(best_dist, DistanceManhattan(tile, o->location.tile)); + best_dist = std::min(best_dist, DistanceManhattan(tile, o->location.tile)); } return best_dist; @@ -226,7 +226,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid, /* If the object type is invalid, there is none and the closest is far away. */ if (idx >= NUM_OBJECTS) return 0 | 0xFFFF; - return Object::GetTypeCount(idx) << 16 | min(GetClosestObject(tile, idx, current), 0xFFFF); + return Object::GetTypeCount(idx) << 16 | std::min(GetClosestObject(tile, idx, current), 0xFFFFu); } /** Used by the resolver to get values for feature 0F deterministic spritegroups. */ @@ -301,10 +301,10 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid, case 0x44: return GetTileOwner(this->tile); /* Get town zone and Manhattan distance of closest town */ - case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | min(DistanceManhattan(this->tile, t->xy), 0xFFFF); + case 0x45: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceManhattan(this->tile, t->xy), 0xFFFFu); /* Get square of Euclidian distance of closes town */ - case 0x46: return GetTownRadiusGroup(t, this->tile) << 16 | min(DistanceSquare(this->tile, t->xy), 0xFFFF); + case 0x46: return GetTownRadiusGroup(t, this->tile) << 16 | std::min(DistanceSquare(this->tile, t->xy), 0xFFFFu); /* Object colour */ case 0x47: return this->obj->colour; diff --git a/src/newgrf_profiling.cpp b/src/newgrf_profiling.cpp index b7848fa671..8ec8cff546 100644 --- a/src/newgrf_profiling.cpp +++ b/src/newgrf_profiling.cpp @@ -148,7 +148,7 @@ uint32 NewGRFProfiler::FinishAll() for (NewGRFProfiler &pr : _newgrf_profilers) { if (pr.active) { total_microseconds += pr.Finish(); - max_ticks = max(max_ticks, _tick_counter - pr.start_tick); + max_ticks = std::max(max_ticks, _tick_counter - pr.start_tick); } } diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 824ba0439e..871108ec47 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -8,7 +8,6 @@ /** @file newgrf_spritegroup.cpp Handling of primarily NewGRF action 2. */ #include "stdafx.h" -#include #include "debug.h" #include "newgrf_spritegroup.h" #include "newgrf_profiling.h" @@ -173,10 +172,10 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ScopeResolver switch (adjust->operation) { case DSGA_OP_ADD: return last_value + value; case DSGA_OP_SUB: return last_value - value; - case DSGA_OP_SMIN: return min((S)last_value, (S)value); - case DSGA_OP_SMAX: return max((S)last_value, (S)value); - case DSGA_OP_UMIN: return min((U)last_value, (U)value); - case DSGA_OP_UMAX: return max((U)last_value, (U)value); + case DSGA_OP_SMIN: return std::min(last_value, value); + case DSGA_OP_SMAX: return std::max(last_value, value); + case DSGA_OP_UMIN: return std::min(last_value, value); + case DSGA_OP_UMAX: return std::max(last_value, value); case DSGA_OP_SDIV: return value == 0 ? (S)last_value : (S)last_value / (S)value; case DSGA_OP_SMOD: return value == 0 ? (S)last_value : (S)last_value % (S)value; case DSGA_OP_UDIV: return value == 0 ? (U)last_value : (U)last_value / (U)value; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index d607f8bd05..a127d54c9b 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -119,13 +119,13 @@ uint32 GetPlatformInfo(Axis axis, byte tile, int platforms, int length, int x, i SB(retval, 0, 4, y & 0xF); SB(retval, 4, 4, x & 0xF); } else { - SB(retval, 0, 4, min(15, y)); - SB(retval, 4, 4, min(15, length - y - 1)); - SB(retval, 8, 4, min(15, x)); - SB(retval, 12, 4, min(15, platforms - x - 1)); + SB(retval, 0, 4, std::min(15, y)); + SB(retval, 4, 4, std::min(15, length - y - 1)); + SB(retval, 8, 4, std::min(15, x)); + SB(retval, 12, 4, std::min(15, platforms - x - 1)); } - SB(retval, 16, 4, min(15, length)); - SB(retval, 20, 4, min(15, platforms)); + SB(retval, 16, 4, std::min(15, length)); + SB(retval, 20, 4, std::min(15, platforms)); SB(retval, 24, 4, tile); return retval; @@ -424,7 +424,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, b const GoodsEntry *ge = &this->goods[c]; switch (variable) { - case 0x60: return min(ge->cargo.TotalCount(), 4095); + case 0x60: return std::min(ge->cargo.TotalCount(), 4095u); case 0x61: return ge->HasVehicleEverTriedLoading() ? ge->time_since_pickup : 0; case 0x62: return ge->HasRating() ? ge->rating : 0xFFFFFFFF; case 0x63: return ge->cargo.DaysInTransit(); @@ -444,7 +444,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, byte variable, b const GoodsEntry *g = &this->goods[GB(variable - 0x8C, 3, 4)]; switch (GB(variable - 0x8C, 0, 3)) { case 0: return g->cargo.TotalCount(); - case 1: return GB(min(g->cargo.TotalCount(), 4095), 0, 4) | (GB(g->status, GoodsEntry::GES_ACCEPTANCE, 1) << 7); + case 1: return GB(std::min(g->cargo.TotalCount(), 4095u), 0, 4) | (GB(g->status, GoodsEntry::GES_ACCEPTANCE, 1) << 7); case 2: return g->time_since_pickup; case 3: return g->rating; case 4: return g->cargo.Source(); @@ -520,7 +520,7 @@ uint32 Waypoint::GetNewGRFVariable(const ResolverObject &object, byte variable, } if (HasBit(this->station_scope.statspec->flags, SSF_DIV_BY_STATION_SIZE)) cargo /= (st->train_station.w + st->train_station.h); - cargo = min(0xfff, cargo); + cargo = std::min(0xfffu, cargo); if (cargo > this->station_scope.statspec->cargo_threshold) { if (group->num_loading > 0) { diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index b6a0e48912..fcbca12b69 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -17,7 +17,6 @@ #include "stdafx.h" -#include #include #include "newgrf.h" @@ -179,7 +178,7 @@ struct UnmappedChoiceList { *d++ = i + 1; /* "": Limit the length of the string to 0xFFFE to leave space for the '\0'. */ - size_t len = min(0xFFFE, str.size()); + size_t len = std::min(0xFFFE, str.size()); *d++ = GB(len + 1, 8, 8); *d++ = GB(len + 1, 0, 8); @@ -222,7 +221,7 @@ struct UnmappedChoiceList { const auto &str = this->strings[this->strings.find(idx) != this->strings.end() ? idx : 0].str(); /* Limit the length of the string we copy to 0xFE. The length is written above * as a byte and we need room for the final '\0'. */ - size_t len = min(0xFE, str.size()); + size_t len = std::min(0xFE, str.size()); dest.write(str.c_str(), len); *d++ = '\0'; } @@ -936,7 +935,7 @@ uint RemapNewGRFStringControlCode(uint scc, char *buf_start, char **buff, const case SCC_NEWGRF_ROTATE_TOP_4_WORDS: _newgrf_textrefstack.RotateTop4Words(); break; case SCC_NEWGRF_PUSH_WORD: _newgrf_textrefstack.PushWord(Utf8Consume(str)); break; - case SCC_NEWGRF_UNPRINT: *buff = max(*buff - Utf8Consume(str), buf_start); break; + case SCC_NEWGRF_UNPRINT: *buff = std::max(*buff - Utf8Consume(str), buf_start); break; case SCC_NEWGRF_PRINT_WORD_CARGO_LONG: case SCC_NEWGRF_PRINT_WORD_CARGO_SHORT: diff --git a/src/news_gui.cpp b/src/news_gui.cpp index e98f76da9d..639c075746 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -538,7 +538,7 @@ struct NewsWindow : Window { int count = this->timer.CountElapsed(delta_ms); if (count > 0) { /* Scroll up newsmessages from the bottom */ - int newtop = max(this->top - 2 * count, _screen.height - this->height - this->status_height - this->chat_height); + int newtop = std::max(this->top - 2 * count, _screen.height - this->height - this->status_height - this->chat_height); this->SetWindowTop(newtop); } @@ -556,8 +556,8 @@ private: { if (this->top == newtop) return; - int mintop = min(newtop, this->top); - int maxtop = max(newtop, this->top); + int mintop = std::min(newtop, this->top); + int maxtop = std::max(newtop, this->top); if (this->viewport != nullptr) this->viewport->top += newtop - this->top; this->top = newtop; @@ -1148,7 +1148,7 @@ struct MessageHistoryWindow : Window { this->date_width = GetStringBoundingBox(STR_SHORT_DATE).width; size->height = 4 * resize->height + this->top_spacing + this->bottom_spacing; // At least 4 lines are visible. - size->width = max(200u, size->width); // At least 200 pixels wide. + size->width = std::max(200u, size->width); // At least 200 pixels wide. } } diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 479f3b0d10..943d89322c 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -552,14 +552,14 @@ static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, Carg /* Top town building generates 10, so to make HQ interesting, the top * type makes 20. */ - acceptance[CT_PASSENGERS] += max(1U, level); + acceptance[CT_PASSENGERS] += std::max(1U, level); SetBit(*always_accepted, CT_PASSENGERS); /* Top town building generates 4, HQ can make up to 8. The * proportion passengers:mail is different because such a huge * commercial building generates unusually high amount of mail * correspondence per physical visitor. */ - acceptance[CT_MAIL] += max(1U, level / 2); + acceptance[CT_MAIL] += std::max(1U, level / 2); SetBit(*always_accepted, CT_MAIL); } diff --git a/src/object_gui.cpp b/src/object_gui.cpp index bbd224fead..09e9ba53c0 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -125,7 +125,7 @@ public: for (uint i = 0; i < ObjectClass::GetClassCount(); i++) { ObjectClass *objclass = ObjectClass::Get((ObjectClassID)i); if (objclass->GetUISpecCount() == 0) continue; - size->width = max(size->width, GetStringBoundingBox(objclass->name).width); + size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width); } size->width += padding.width; this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; @@ -161,7 +161,7 @@ public: const ObjectSpec *spec = ObjectSpec::Get(i); if (!spec->IsEverAvailable()) continue; two_wide |= spec->views >= 2; - height[spec->views / 4] = max(ObjectSpec::Get(i)->height, height[spec->views / 4]); + height[spec->views / 4] = std::max(ObjectSpec::Get(i)->height, height[spec->views / 4]); } /* Determine the pixel heights. */ @@ -174,7 +174,7 @@ public: * we want these columns to be slightly less wide. When there are two rows, then * determine the size of the widgets based on the maximum size for a single row * of widgets, or just the twice the widget height of the two row ones. */ - size->height = max(height[0], height[1] * 2 + 2); + size->height = std::max(height[0], height[1] * 2 + 2); if (two_wide) { size->width = (3 * ScaleGUITrad(TILE_PIXELS) + 2 * OBJECT_MARGIN) * 2 + 2; } else { @@ -274,7 +274,7 @@ public: DrawOrigTileSeqInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), dts, PAL_NONE); } else { DrawNewObjectTileInGUI((r.right - r.left) / 2 - 1, r.bottom - r.top - OBJECT_MARGIN - ScaleGUITrad(TILE_PIXELS), spec, - min(_selected_object_view, spec->views - 1)); + std::min(_selected_object_view, spec->views - 1)); } _cur_dpi = old_dpi; } @@ -332,7 +332,7 @@ public: _selected_object_index = object_index; if (_selected_object_index != -1) { const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index); - _selected_object_view = min(_selected_object_view, spec->views - 1); + _selected_object_view = std::min(_selected_object_view, spec->views - 1); this->ReInit(); } else { _selected_object_view = 0; diff --git a/src/openttd.cpp b/src/openttd.cpp index 6315b8fa15..41900933a4 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -290,8 +290,8 @@ static void ParseResolution(Dimension *res, const char *s) return; } - res->width = max(strtoul(s, nullptr, 0), 64UL); - res->height = max(strtoul(t + 1, nullptr, 0), 64UL); + res->width = std::max(strtoul(s, nullptr, 0), 64UL); + res->height = std::max(strtoul(t + 1, nullptr, 0), 64UL); } diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index b8ba7ab901..082ec1ae33 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -713,7 +713,7 @@ uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int int dist1 = GetOrderDistance(prev, v->GetOrder(cur->GetConditionSkipToOrder()), v, conditional_depth); int dist2 = GetOrderDistance(prev, cur->next == nullptr ? v->orders.list->GetFirstOrder() : cur->next, v, conditional_depth); - return max(dist1, dist2); + return std::max(dist1, dist2); } TileIndex prev_tile = prev->GetLocation(v, true); @@ -1093,7 +1093,7 @@ void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord) if (order->IsType(OT_CONDITIONAL)) { VehicleOrderID order_id = order->GetConditionSkipToOrder(); if (order_id >= sel_ord) { - order_id = max(order_id - 1, 0); + order_id = std::max(order_id - 1, 0); } if (order_id == cur_order_id) { order_id = (order_id + 1) % v->GetNumOrders(); @@ -1985,7 +1985,7 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v) case OCV_AGE: skip_order = OrderConditionCompare(occ, v->age / DAYS_IN_LEAP_YEAR, value); break; case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(), value); break; case OCV_UNCONDITIONALLY: skip_order = true; break; - case OCV_REMAINING_LIFETIME: skip_order = OrderConditionCompare(occ, max(v->max_age - v->age + DAYS_IN_LEAP_YEAR - 1, 0) / DAYS_IN_LEAP_YEAR, value); break; + case OCV_REMAINING_LIFETIME: skip_order = OrderConditionCompare(occ, std::max(v->max_age - v->age + DAYS_IN_LEAP_YEAR - 1, 0) / DAYS_IN_LEAP_YEAR, value); break; default: NOT_REACHED(); } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 5529a8331e..d26d00278a 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1107,8 +1107,8 @@ public: if (i != this->selected_order && i == this->order_over) { /* Highlight dragged order destination. */ int top = (this->order_over < this->selected_order ? y : y + line_height) - WD_FRAMERECT_TOP; - int bottom = min(top + 2, r.bottom - WD_FRAMERECT_BOTTOM); - top = max(top - 3, r.top + WD_FRAMERECT_TOP); + int bottom = std::min(top + 2, r.bottom - WD_FRAMERECT_BOTTOM); + top = std::max(top - 3, r.top + WD_FRAMERECT_TOP); GfxFillRect(r.left + WD_FRAMETEXT_LEFT, top, r.right - WD_FRAMETEXT_RIGHT, bottom, _colour_gradient[COLOUR_GREY][7]); break; } diff --git a/src/os/macosx/string_osx.cpp b/src/os/macosx/string_osx.cpp index a36bed6be1..12440e1e1c 100644 --- a/src/os/macosx/string_osx.cpp +++ b/src/os/macosx/string_osx.cpp @@ -260,7 +260,7 @@ int CoreTextParagraphLayout::CoreTextLine::GetLeading() const { int leading = 0; for (const auto &run : *this) { - leading = max(leading, run.GetLeading()); + leading = std::max(leading, run.GetLeading()); } return leading; diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index c96c4cf7c2..872e472d5e 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -219,7 +219,7 @@ static char *PrintModuleInfo(char *output, const char *last, HMODULE mod) res = EnumProcessModules(proc, modules, sizeof(modules), &needed); CloseHandle(proc); if (res) { - size_t count = min(needed / sizeof(HMODULE), lengthof(modules)); + size_t count = std::min(needed / sizeof(HMODULE), lengthof(modules)); for (size_t i = 0; i != count; i++) output = PrintModuleInfo(output, last, modules[i]); return output + seprintf(output, last, "\n"); diff --git a/src/os/windows/string_uniscribe.cpp b/src/os/windows/string_uniscribe.cpp index 42a003ae17..ad37548662 100644 --- a/src/os/windows/string_uniscribe.cpp +++ b/src/os/windows/string_uniscribe.cpp @@ -302,7 +302,7 @@ static std::vector UniscribeItemizeString(UniscribeParagraphLayoutF for (auto const &i : fontMapping) { while (cur_pos < i.first && cur_item != items.end() - 1) { /* Add a range that spans the intersection of the remaining item and font run. */ - int stop_pos = min(i.first, (cur_item + 1)->iCharPos); + int stop_pos = std::min(i.first, (cur_item + 1)->iCharPos); assert(stop_pos - cur_pos > 0); ranges.push_back(UniscribeRun(cur_pos, stop_pos - cur_pos, i.second, cur_item->a)); @@ -452,7 +452,7 @@ int UniscribeParagraphLayout::UniscribeLine::GetLeading() const { int leading = 0; for (const auto &run : *this) { - leading = max(leading, run.GetLeading()); + leading = std::max(leading, run.GetLeading()); } return leading; diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 2fca3feecc..45ff2d238c 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -243,7 +243,7 @@ static void AddKey(NWidgetHorizontal *hor, int height, int num_half, WidgetType hor->Add(leaf); } - *biggest_index = max(*biggest_index, widnum); + *biggest_index = std::max(*biggest_index, widnum); } /** Construct the top row keys (cancel, ok, backspace). */ diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 2cfe4d9e4a..5bc9ab03cd 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -471,7 +471,7 @@ public: /* Check for speed limit imposed by railtype */ if (IsRailTT()) { uint16 rail_speed = GetRailTypeInfo(GetRailType(m_old_tile))->max_speed; - if (rail_speed > 0) max_speed = min(max_speed, rail_speed); + if (rail_speed > 0) max_speed = std::min(max_speed, rail_speed); } /* if min speed was requested, return it */ diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 34b85791bd..5a5ff927e4 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -117,7 +117,7 @@ static uint NPFDistanceTrack(TileIndex t0, TileIndex t1) const uint dx = Delta(TileX(t0), TileX(t1)); const uint dy = Delta(TileY(t0), TileY(t1)); - const uint straightTracks = 2 * min(dx, dy); // The number of straight (not full length) tracks + const uint straightTracks = 2 * std::min(dx, dy); // The number of straight (not full length) tracks /* OPTIMISATION: * Original: diagTracks = max(dx, dy) - min(dx,dy); * Proof: diff --git a/src/pathfinder/yapf/yapf_common.hpp b/src/pathfinder/yapf/yapf_common.hpp index c6f7e6e5fb..e0e43c4689 100644 --- a/src/pathfinder/yapf/yapf_common.hpp +++ b/src/pathfinder/yapf/yapf_common.hpp @@ -164,7 +164,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp index 05a1235778..7f89639bf2 100644 --- a/src/pathfinder/yapf/yapf_destrail.hpp +++ b/src/pathfinder/yapf/yapf_destrail.hpp @@ -194,7 +194,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 1b85c8d4ec..9d42f622dc 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -303,7 +303,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/pathfinder/yapf/yapf_ship.cpp b/src/pathfinder/yapf/yapf_ship.cpp index 2f2ed7e441..ec4348e832 100644 --- a/src/pathfinder/yapf/yapf_ship.cpp +++ b/src/pathfinder/yapf/yapf_ship.cpp @@ -89,7 +89,7 @@ public: int y2 = 2 * TileY(m_destTile); int dx = abs(x1 - x2); int dy = abs(y1 - y2); - int dmin = min(dx, dy); + int dmin = std::min(dx, dy); int dxy = abs(dx - dy); int d = dmin * YAPF_TILE_CORNER_LENGTH + (dxy - 1) * (YAPF_TILE_LENGTH / 2); n.m_estimate = n.m_cost + d; diff --git a/src/rail.h b/src/rail.h index d9121d545a..c5775b9467 100644 --- a/src/rail.h +++ b/src/rail.h @@ -388,7 +388,7 @@ static inline Money RailClearCost(RailType railtype) * cost. */ assert(railtype < RAILTYPE_END); - return max(_price[PR_CLEAR_RAIL], -RailBuildCost(railtype) * 3 / 4); + return std::max(_price[PR_CLEAR_RAIL], -RailBuildCost(railtype) * 3 / 4); } /** @@ -408,8 +408,8 @@ static inline Money RailConvertCost(RailType from, RailType to) * build costs, if the target type is more expensive (material upgrade costs). * Upgrade can never be more expensive than re-building. */ if (HasPowerOnRail(from, to) || HasPowerOnRail(to, from)) { - Money upgradecost = RailBuildCost(to) / 8 + max((Money)0, RailBuildCost(to) - RailBuildCost(from)); - return min(upgradecost, rebuildcost); + Money upgradecost = RailBuildCost(to) / 8 + std::max((Money)0, RailBuildCost(to) - RailBuildCost(from)); + return std::min(upgradecost, rebuildcost); } /* make the price the same as remove + build new type for rail types diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 8af7871fca..133f596437 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2885,7 +2885,7 @@ static void GetTileDesc_Track(TileIndex tile, TileDesc *td) td->str = STR_LAI_RAIL_DESCRIPTION_TRAIN_DEPOT; if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL) { if (td->rail_speed > 0) { - td->rail_speed = min(td->rail_speed, 61); + td->rail_speed = std::min(td->rail_speed, 61); } else { td->rail_speed = 61; } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 7529efcec9..177f72accb 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -977,7 +977,7 @@ public: } if (newstation) { _railstation.station_count = StationClass::Get(_railstation.station_class)->GetSpecCount(); - _railstation.station_type = min(_railstation.station_type, _railstation.station_count - 1); + _railstation.station_type = std::min(_railstation.station_type, _railstation.station_count - 1); int count = 0; for (uint i = 0; i < StationClass::GetClassCount(); i++) { @@ -985,7 +985,7 @@ public: count++; } this->vscroll->SetCount(count); - this->vscroll->SetPosition(Clamp(_railstation.station_class - 2, 0, max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0))); + this->vscroll->SetPosition(Clamp(_railstation.station_class - 2, 0, std::max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0))); NWidgetMatrix *matrix = this->GetWidget(WID_BRAS_MATRIX); matrix->SetScrollbar(this->vscroll2); @@ -1059,7 +1059,7 @@ public: if (i == STAT_CLASS_WAYP) continue; d = maxdim(d, GetStringBoundingBox(StationClass::Get((StationClassID)i)->name)); } - size->width = max(size->width, d.width + padding.width); + size->width = std::max(size->width, d.width + padding.width); this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM; size->height = 5 * this->line_height; resize->height = this->line_height; @@ -1085,7 +1085,7 @@ public: d = maxdim(d, GetStringBoundingBox(str)); } } - size->width = max(size->width, d.width + padding.width); + size->width = std::max(size->width, d.width + padding.width); break; } @@ -1334,7 +1334,7 @@ public: _railstation.station_class = (StationClassID)i; StationClass *stclass = StationClass::Get(_railstation.station_class); _railstation.station_count = stclass->GetSpecCount(); - _railstation.station_type = min((int)_railstation.station_type, max(0, (int)_railstation.station_count - 1)); + _railstation.station_type = std::min((int)_railstation.station_type, std::max(0, (int)_railstation.station_count - 1)); this->CheckSelectedSize(stclass->GetSpec(_railstation.station_type)); @@ -1539,9 +1539,9 @@ public: for (uint lowered = 0; lowered < 2; lowered++) { Point offset; Dimension sprite_size = GetSpriteSize(rti->gui_sprites.signals[type][variant][lowered], &offset); - this->sig_sprite_bottom_offset = max(this->sig_sprite_bottom_offset, sprite_size.height); - this->sig_sprite_size.width = max(this->sig_sprite_size.width, sprite_size.width - offset.x); - this->sig_sprite_size.height = max(this->sig_sprite_size.height, sprite_size.height - offset.y); + this->sig_sprite_bottom_offset = std::max(this->sig_sprite_bottom_offset, sprite_size.height); + this->sig_sprite_size.width = std::max(this->sig_sprite_size.width, sprite_size.width - offset.x); + this->sig_sprite_size.height = std::max(this->sig_sprite_size.height, sprite_size.height - offset.y); } } } @@ -1551,10 +1551,10 @@ public: { if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) { /* Two digits for signals density. */ - size->width = max(size->width, 2 * GetDigitWidth() + padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT); + size->width = std::max(size->width, 2 * GetDigitWidth() + padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT); } else if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) { - size->width = max(size->width, this->sig_sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT); - size->height = max(size->height, this->sig_sprite_size.height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); + size->width = std::max(size->width, this->sig_sprite_size.width + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT); + size->height = std::max(size->height, this->sig_sprite_size.height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); } } diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 14fa8d79d8..17c9c39e96 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -453,11 +453,11 @@ inline int RoadVehicle::GetCurrentMaxSpeed() const /* Vehicle is on the middle part of a bridge. */ if (u->state == RVSB_WORMHOLE && !(u->vehstatus & VS_HIDDEN)) { - max_speed = min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed * 2); + max_speed = std::min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed * 2); } } - return min(max_speed, this->current_order.GetMaxSpeed() * 2); + return std::min(max_speed, this->current_order.GetMaxSpeed() * 2); } /** diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 329152ab27..c3aef307b2 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -599,8 +599,8 @@ bool AfterLoadGame() int dx = TileX(t) - TileX(st->train_station.tile); int dy = TileY(t) - TileY(st->train_station.tile); assert(dx >= 0 && dy >= 0); - st->train_station.w = max(st->train_station.w, dx + 1); - st->train_station.h = max(st->train_station.h, dy + 1); + st->train_station.w = std::max(st->train_station.w, dx + 1); + st->train_station.h = std::max(st->train_station.h, dy + 1); } } @@ -2457,7 +2457,7 @@ bool AfterLoadGame() uint per_proc = _me[t].m7; _me[t].m7 = GB(_me[t].m6, 2, 6) | (GB(_m[t].m3, 5, 1) << 6); SB(_m[t].m3, 5, 1, 0); - SB(_me[t].m6, 2, 6, min(per_proc, 63)); + SB(_me[t].m6, 2, 6, std::min(per_proc, 63U)); } break; @@ -2713,7 +2713,7 @@ bool AfterLoadGame() _settings_game.pf.reverse_at_signals = IsSavegameVersionBefore(SLV_100) || (_settings_game.pf.wait_oneway_signal != 255 && _settings_game.pf.wait_twoway_signal != 255 && _settings_game.pf.wait_for_pbs_path != 255); for (Train *t : Train::Iterate()) { - _settings_game.vehicle.max_train_length = max(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE)); + _settings_game.vehicle.max_train_length = std::max(_settings_game.vehicle.max_train_length, CeilDiv(t->gcache.cached_total_length, TILE_SIZE)); } } diff --git a/src/saveload/company_sl.cpp b/src/saveload/company_sl.cpp index 6f98c7afa1..fb2742a186 100644 --- a/src/saveload/company_sl.cpp +++ b/src/saveload/company_sl.cpp @@ -61,7 +61,7 @@ CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face) uint lips = GB(face, 10, 4); if (!HasBit(ge, GENDER_FEMALE) && lips < 4) { SetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge, true); - SetCompanyManagerFaceBits(cmf, CMFV_MOUSTACHE, ge, max(lips, 1U) - 1); + SetCompanyManagerFaceBits(cmf, CMFV_MOUSTACHE, ge, std::max(lips, 1U) - 1); } else { if (!HasBit(ge, GENDER_FEMALE)) { lips = lips * 15 / 16; diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp index f17883eb44..0d760c9d5c 100644 --- a/src/saveload/misc_sl.cpp +++ b/src/saveload/misc_sl.cpp @@ -51,7 +51,7 @@ void ResetViewportAfterLoadGame() w->viewport->dest_scrollpos_y = _saved_scrollpos_y; Viewport *vp = w->viewport; - vp->zoom = (ZoomLevel)min(_saved_scrollpos_zoom, ZOOM_LVL_MAX); + vp->zoom = std::min(_saved_scrollpos_zoom, ZOOM_LVL_MAX); vp->virtual_width = ScaleByZoom(vp->width, vp->zoom); vp->virtual_height = ScaleByZoom(vp->height, vp->zoom); diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index ff4e6191e9..d9926aa609 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -392,7 +392,7 @@ static bool FixTTOEngines() for (uint i = 0; i < lengthof(_orig_ship_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_SHIP, i); for (uint i = 0; i < lengthof(_orig_aircraft_vehicle_info); i++, j++) new (GetTempDataEngine(j)) Engine(VEH_AIRCRAFT, i); - Date aging_date = min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1)); + Date aging_date = std::min(_date + DAYS_TILL_ORIGINAL_BASE_YEAR, ConvertYMDToDate(2050, 0, 1)); for (EngineID i = 0; i < 256; i++) { int oi = ttd_to_tto[i]; @@ -1823,7 +1823,7 @@ bool LoadTTOMain(LoadgameState *ls) * "increase them to compensate for the faster time advance in TTD compared to TTO * which otherwise would cause much less income while the annual running costs of * the vehicles stay the same" */ - _economy.inflation_payment = min(_economy.inflation_payment * 124 / 74, MAX_INFLATION); + _economy.inflation_payment = std::min(_economy.inflation_payment * 124 / 74, MAX_INFLATION); DEBUG(oldloader, 3, "Finished converting game data"); DEBUG(oldloader, 1, "TTO savegame successfully converted"); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 1b79ad926b..18f7a17b1c 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -170,7 +170,7 @@ struct MemoryDumper { size_t t = this->GetSize(); while (t > 0) { - size_t to_write = min(MEMORY_CHUNK_SIZE, t); + size_t to_write = std::min(MEMORY_CHUNK_SIZE, t); writer->Write(this->blocks[i++], to_write); t -= to_write; @@ -856,7 +856,7 @@ static void SlSaveLoadConv(void *ptr, VarType conv) static inline size_t SlCalcNetStringLen(const char *ptr, size_t length) { if (ptr == nullptr) return 0; - return min(strlen(ptr), length - 1); + return std::min(strlen(ptr), length - 1); } /** diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 1274a4c50f..ef76b9f0e7 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -182,7 +182,7 @@ static bool MakeBMPImage(const char *name, ScreenshotCallback *callb, void *user /* Start at the bottom, since bitmaps are stored bottom up */ do { - uint n = min(h, maxlines); + uint n = std::min(h, maxlines); h -= n; /* Render the pixels */ @@ -375,7 +375,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user y = 0; do { /* determine # lines to write */ - n = min(h - y, maxlines); + n = std::min(h - y, maxlines); /* render the pixels into the buffer */ callb(userdata, buff, y, w, n); @@ -482,7 +482,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user y = 0; do { /* determine # lines to write */ - uint n = min(h - y, maxlines); + uint n = std::min(h - y, maxlines); uint i; /* render the pixels into the buffer */ @@ -640,7 +640,7 @@ static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, ui /* Render viewport in blocks of 1600 pixels width */ left = 0; while (vp->width - left != 0) { - wx = min(vp->width - left, 1600); + wx = std::min(vp->width - left, 1600); left += wx; ViewportDoDraw(vp, diff --git a/src/script/api/script_bridge.cpp b/src/script/api/script_bridge.cpp index 0a7c185524..4d685ca21f 100644 --- a/src/script/api/script_bridge.cpp +++ b/src/script/api/script_bridge.cpp @@ -160,7 +160,7 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance) { if (!IsValidBridge(bridge_id)) return -1; - return min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2; + return std::min(::GetBridgeSpec(bridge_id)->max_length, _settings_game.construction.max_bridge_length) + 2; } /* static */ int32 ScriptBridge::GetMinLength(BridgeID bridge_id) diff --git a/src/script/api/script_priorityqueue.cpp b/src/script/api/script_priorityqueue.cpp index 3130084126..fda452096a 100644 --- a/src/script/api/script_priorityqueue.cpp +++ b/src/script/api/script_priorityqueue.cpp @@ -13,7 +13,6 @@ #include "../squirrel_helper.hpp" #include "../script_instance.hpp" #include "../../debug.h" -#include #include "../../safeguards.h" diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp index aedb4a364a..01916c8c57 100644 --- a/src/script/api/script_rail.cpp +++ b/src/script/api/script_rail.cpp @@ -178,7 +178,18 @@ if (station_id != ScriptStation::STATION_JOIN_ADJACENT) p1 |= (1 << 24); const GRFFile *file; - uint16 res = GetAiPurchaseCallbackResult(GSF_STATIONS, cargo_id, 0, source_industry, goal_industry, min(255, distance / 2), AICE_STATION_GET_STATION_ID, source_station ? 0 : 1, min(15, num_platforms) << 4 | min(15, platform_length), &file); + uint16 res = GetAiPurchaseCallbackResult( + GSF_STATIONS, + cargo_id, + 0, + source_industry, + goal_industry, + std::min(255, distance / 2), + AICE_STATION_GET_STATION_ID, + source_station ? 0 : 1, + std::min(15u, num_platforms) << 4 | std::min(15u, platform_length), + &file + ); uint32 p2 = (ScriptStation::IsValidStation(station_id) ? station_id : INVALID_STATION) << 16; if (res != CALLBACK_FAILED) { int index = 0; diff --git a/src/script/api/script_town.cpp b/src/script/api/script_town.cpp index afe5614566..161cf74fd8 100644 --- a/src/script/api/script_town.cpp +++ b/src/script/api/script_town.cpp @@ -172,7 +172,7 @@ default: EnforcePrecondition(false, (days_between_town_growth * DAY_TICKS / TOWN_GROWTH_TICKS) <= MAX_TOWN_GROWTH_TICKS); /* Don't use growth_rate 0 as it means GROWTH_NORMAL */ - growth_rate = max(days_between_town_growth * DAY_TICKS, 2u) - 1; + growth_rate = std::max(days_between_town_growth * DAY_TICKS, 2u) - 1; break; } @@ -376,7 +376,7 @@ for (const Station *st : Station::Iterate()) { if (st->town == t && (st->facilities & FACIL_AIRPORT) && st->airport.type != AT_OILRIG) num++; } - return max(0, 2 - num); + return std::max(0, 2 - num); } /* static */ ScriptTown::RoadLayout ScriptTown::GetRoadLayout(TownID town_id) diff --git a/src/script/squirrel_std.cpp b/src/script/squirrel_std.cpp index 9a01dc5d60..502721f36f 100644 --- a/src/script/squirrel_std.cpp +++ b/src/script/squirrel_std.cpp @@ -25,7 +25,7 @@ SQInteger SquirrelStd::min(HSQUIRRELVM vm) sq_getinteger(vm, 2, &tmp1); sq_getinteger(vm, 3, &tmp2); - sq_pushinteger(vm, ::min(tmp1, tmp2)); + sq_pushinteger(vm, std::min(tmp1, tmp2)); return 1; } @@ -35,7 +35,7 @@ SQInteger SquirrelStd::max(HSQUIRRELVM vm) sq_getinteger(vm, 2, &tmp1); sq_getinteger(vm, 3, &tmp2); - sq_pushinteger(vm, ::max(tmp1, tmp2)); + sq_pushinteger(vm, std::max(tmp1, tmp2)); return 1; } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 751cf1a7df..f0d9b7f3ba 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -370,7 +370,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseGraphics::GetNumSets(); i++) { SetDParamStr(0, BaseGraphics::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -389,7 +389,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseSounds::GetNumSets(); i++) { SetDParamStr(0, BaseSounds::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -397,7 +397,7 @@ struct GameOptionsWindow : Window { /* Find the biggest description for the default size. */ for (int i = 0; i < BaseMusic::GetNumSets(); i++) { SetDParamStr(0, BaseMusic::GetSet(i)->GetDescription(GetCurrentLanguageIsoCode())); - size->height = max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); + size->height = std::max(size->height, (uint)GetStringHeight(STR_BLACK_RAW_STRING, size->width)); } break; @@ -1273,7 +1273,7 @@ uint SettingsContainer::GetMaxHelpHeight(int maxw) { uint biggest = 0; for (EntryVector::const_iterator it = this->entries.begin(); it != this->entries.end(); ++it) { - biggest = max(biggest, (*it)->GetMaxHelpHeight(maxw)); + biggest = std::max(biggest, (*it)->GetMaxHelpHeight(maxw)); } return biggest; } @@ -1852,7 +1852,7 @@ struct GameSettingsWindow : Window { { switch (widget) { case WID_GS_OPTIONSPANEL: - resize->height = SETTING_HEIGHT = max(max(_circle_size.height, SETTING_BUTTON_HEIGHT), FONT_HEIGHT_NORMAL) + 1; + resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, FONT_HEIGHT_NORMAL}) + 1; resize->width = 1; size->height = 5 * resize->height + SETTINGTREE_TOP_OFFSET + SETTINGTREE_BOTTOM_OFFSET; @@ -1866,16 +1866,16 @@ struct GameSettingsWindow : Window { }; for (uint i = 0; i < lengthof(setting_types); i++) { SetDParam(0, setting_types[i]); - size->width = max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width); } size->height = 2 * FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL + - max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width)); + std::max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width)); break; } case WID_GS_RESTRICT_CATEGORY: case WID_GS_RESTRICT_TYPE: - size->width = max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width); + size->width = std::max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width); break; default: @@ -2631,7 +2631,7 @@ struct CustomCurrencyWindow : Window { case WID_CC_YEAR: { // Year to switch to euro int val = atoi(str); - _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : min(val, MAX_YEAR)); + _custom_currency.to_euro = (val < 2000 ? CF_NOEURO : std::min(val, MAX_YEAR)); break; } } diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index 513b4c7544..ac3a2a85ac 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -58,7 +58,7 @@ public: */ size_t Add(const char *text, size_t length) { - size_t store_size = min(length, OUTPUT_BLOCK_SIZE - this->size); + size_t store_size = std::min(length, OUTPUT_BLOCK_SIZE - this->size); assert(store_size <= OUTPUT_BLOCK_SIZE); MemCpyT(this->data + this->size, text, store_size); this->size += store_size; diff --git a/src/ship.h b/src/ship.h index f3e56c39fe..b5578d1afb 100644 --- a/src/ship.h +++ b/src/ship.h @@ -43,7 +43,7 @@ struct Ship FINAL : public SpecializedVehicle { void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; int GetDisplaySpeed() const { return this->cur_speed / 2; } int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; } - int GetCurrentMaxSpeed() const { return min(this->vcache.cached_max_speed, this->current_order.GetMaxSpeed() * 2); } + int GetCurrentMaxSpeed() const { return std::min(this->vcache.cached_max_speed, this->current_order.GetMaxSpeed() * 2); } Money GetRunningCost() const; bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; } bool Tick(); diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index f507724700..e839941cfd 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -405,8 +405,8 @@ static bool ShipAccelerate(Vehicle *v) uint spd; byte t; - spd = min(v->cur_speed + 1, v->vcache.cached_max_speed); - spd = min(spd, v->current_order.GetMaxSpeed() * 2); + spd = std::min(v->cur_speed + 1, v->vcache.cached_max_speed); + spd = std::min(spd, v->current_order.GetMaxSpeed() * 2); /* updates statusbar only if speed have changed to save CPU time */ if (spd != v->cur_speed) { diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 0bb1a0909b..39f209a36b 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -263,7 +263,7 @@ struct SignListWindow : Window, SignList { case WID_SIL_LIST: { Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON); this->text_offset = WD_FRAMETEXT_LEFT + spr_dim.width + 2; // 2 pixels space between icon and the sign text. - resize->height = max(FONT_HEIGHT_NORMAL, spr_dim.height); + resize->height = std::max(FONT_HEIGHT_NORMAL, spr_dim.height); Dimension d = {(uint)(this->text_offset + WD_FRAMETEXT_RIGHT), WD_FRAMERECT_TOP + 5 * resize->height + WD_FRAMERECT_BOTTOM}; *size = maxdim(*size, d); break; diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 61b8bfd6aa..8ece48d93f 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -845,7 +845,7 @@ void SmallMapWindow::DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, if (min_xy == 1 && (xc == 0 || yc == 0)) { if (this->zoom == 1) continue; // The tile area is empty, don't draw anything. - ta = TileArea(TileXY(max(min_xy, xc), max(min_xy, yc)), this->zoom - (xc == 0), this->zoom - (yc == 0)); + ta = TileArea(TileXY(std::max(min_xy, xc), std::max(min_xy, yc)), this->zoom - (xc == 0), this->zoom - (yc == 0)); } else { ta = TileArea(TileXY(xc, yc), this->zoom, this->zoom); } @@ -853,8 +853,8 @@ void SmallMapWindow::DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, uint32 val = this->GetTileColours(ta); uint8 *val8 = (uint8 *)&val; - int idx = max(0, -start_pos); - for (int pos = max(0, start_pos); pos < end_pos; pos++) { + int idx = std::max(0, -start_pos); + for (int pos = std::max(0, start_pos); pos < end_pos; pos++) { blitter->SetPixel(dst, idx, 0, val8[idx]); idx++; } @@ -986,7 +986,7 @@ void SmallMapWindow::DrawSmallMap(DrawPixelInfo *dpi) const if (x >= -3) { if (x >= dpi->width) break; // Exit the loop. - int end_pos = min(dpi->width, x + 4); + int end_pos = std::min(dpi->width, x + 4); int reps = (dpi->height - y + 1) / 2; // Number of lines. if (reps > 0) { this->DrawSmallMapColumn(ptr, tile_x, tile_y, dpi->pitch * 2, reps, x, end_pos, blitter); @@ -1159,17 +1159,17 @@ void SmallMapWindow::RebuildColourIndexIfNecessary() } } else { if (tbl->col_break) { - this->min_number_of_fixed_rows = max(this->min_number_of_fixed_rows, height); + this->min_number_of_fixed_rows = std::max(this->min_number_of_fixed_rows, height); height = 0; num_columns++; } height++; str = tbl->legend; } - min_width = max(GetStringBoundingBox(str).width, min_width); + min_width = std::max(GetStringBoundingBox(str).width, min_width); } - this->min_number_of_fixed_rows = max(this->min_number_of_fixed_rows, height); - this->min_number_of_columns = max(this->min_number_of_columns, num_columns); + this->min_number_of_fixed_rows = std::max(this->min_number_of_fixed_rows, height); + this->min_number_of_columns = std::max(this->min_number_of_columns, num_columns); } /* The width of a column is the minimum width of all texts + the size of the blob + some spacing */ @@ -1317,8 +1317,8 @@ inline uint SmallMapWindow::GetNumberRowsLegend(uint columns) const { /* Reserve one column for link colours */ uint num_rows_linkstats = CeilDiv(_smallmap_cargo_count, columns - 1); - uint num_rows_others = CeilDiv(max(_smallmap_industry_count, _smallmap_company_count), columns); - return max(this->min_number_of_fixed_rows, max(num_rows_linkstats, num_rows_others)); + uint num_rows_others = CeilDiv(std::max(_smallmap_industry_count, _smallmap_company_count), columns); + return std::max({this->min_number_of_fixed_rows, num_rows_linkstats, num_rows_others}); } /** @@ -1652,7 +1652,7 @@ void SmallMapWindow::SmallMapCenterOnCurrentPos() int sub; const NWidgetBase *wid = this->GetWidget(WID_SM_MAP); Point sxy = this->ComputeScroll(viewport_center.x / (int)TILE_SIZE, viewport_center.y / (int)TILE_SIZE, - max(0, (int)wid->current_x / 2 - 2), wid->current_y / 2, &sub); + std::max(0, (int)wid->current_x / 2 - 2), wid->current_y / 2, &sub); this->SetNewScroll(sxy.x, sxy.y, sub); this->SetDirty(); } @@ -1705,12 +1705,12 @@ public: this->smallmap_window = dynamic_cast(w); assert(this->smallmap_window != nullptr); - this->smallest_x = max(display->smallest_x, bar->smallest_x + smallmap_window->GetMinLegendWidth()); - this->smallest_y = display->smallest_y + max(bar->smallest_y, smallmap_window->GetLegendHeight(smallmap_window->min_number_of_columns)); - this->fill_x = max(display->fill_x, bar->fill_x); - this->fill_y = (display->fill_y == 0 && bar->fill_y == 0) ? 0 : min(display->fill_y, bar->fill_y); - this->resize_x = max(display->resize_x, bar->resize_x); - this->resize_y = min(display->resize_y, bar->resize_y); + this->smallest_x = std::max(display->smallest_x, bar->smallest_x + smallmap_window->GetMinLegendWidth()); + this->smallest_y = display->smallest_y + std::max(bar->smallest_y, smallmap_window->GetLegendHeight(smallmap_window->min_number_of_columns)); + this->fill_x = std::max(display->fill_x, bar->fill_x); + this->fill_y = (display->fill_y == 0 && bar->fill_y == 0) ? 0 : std::min(display->fill_y, bar->fill_y); + this->resize_x = std::max(display->resize_x, bar->resize_x); + this->resize_y = std::min(display->resize_y, bar->resize_y); } void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override @@ -1731,7 +1731,7 @@ public: bar->AssignSizePosition(ST_SMALLEST, x, y + display->smallest_y, bar->smallest_x, bar->smallest_y, rtl); } - uint bar_height = max(bar->smallest_y, this->smallmap_window->GetLegendHeight(this->smallmap_window->GetNumberColumnsLegend(given_width - bar->smallest_x))); + uint bar_height = std::max(bar->smallest_y, this->smallmap_window->GetLegendHeight(this->smallmap_window->GetNumberColumnsLegend(given_width - bar->smallest_x))); uint display_height = given_height - bar_height; display->AssignSizePosition(ST_RESIZE, x, y, given_width, display_height, rtl); bar->AssignSizePosition(ST_RESIZE, x, y + display_height, given_width, bar_height, rtl); diff --git a/src/sound.cpp b/src/sound.cpp index 73c0b22e37..e6c1cb07c8 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -262,8 +262,8 @@ static void SndPlayScreenCoordFx(SoundID sound, int left, int right, int top, in void SndPlayTileFx(SoundID sound, TileIndex tile) { /* emits sound from center of the tile */ - int x = min(MapMaxX() - 1, TileX(tile)) * TILE_SIZE + TILE_SIZE / 2; - int y = min(MapMaxY() - 1, TileY(tile)) * TILE_SIZE - TILE_SIZE / 2; + int x = std::min(MapMaxX() - 1, TileX(tile)) * TILE_SIZE + TILE_SIZE / 2; + int y = std::min(MapMaxY() - 1, TileY(tile)) * TILE_SIZE - TILE_SIZE / 2; int z = (y < 0 ? 0 : GetSlopePixelZ(x, y)); Point pt = RemapCoords(x, y, z); y += 2 * TILE_SIZE; diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp index 4551778bd6..0e6ce66813 100644 --- a/src/sound/win32_s.cpp +++ b/src/sound/win32_s.cpp @@ -70,7 +70,7 @@ const char *SoundDriver_Win32::Start(const StringList &parm) /* Limit buffer size to prevent overflows. */ _bufsize = GetDriverParamInt(parm, "bufsize", (GB(GetVersion(), 0, 8) > 5) ? 8192 : 4096); - _bufsize = min(_bufsize, UINT16_MAX); + _bufsize = std::min(_bufsize, UINT16_MAX); try { if (nullptr == (_event = CreateEvent(nullptr, FALSE, FALSE, nullptr))) throw "Failed to create event"; diff --git a/src/sound/xaudio2_s.cpp b/src/sound/xaudio2_s.cpp index bd47b2065a..e08b917a83 100644 --- a/src/sound/xaudio2_s.cpp +++ b/src/sound/xaudio2_s.cpp @@ -193,7 +193,7 @@ const char *SoundDriver_XAudio2::Start(const StringList &parm) // Limit buffer size to prevent overflows int bufsize = GetDriverParamInt(parm, "bufsize", 8192); - bufsize = min(bufsize, UINT16_MAX); + bufsize = std::min(bufsize, UINT16_MAX); _voice_context = new StreamingVoiceContext(bufsize * 4); diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 3eceb38de5..3029a02535 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -302,8 +302,8 @@ static bool PadSprites(SpriteLoader::Sprite *sprite, uint8 sprite_avail) int min_yoffs = INT32_MAX; for (ZoomLevel zoom = ZOOM_LVL_BEGIN; zoom != ZOOM_LVL_END; zoom++) { if (HasBit(sprite_avail, zoom)) { - min_xoffs = min(min_xoffs, ScaleByZoom(sprite[zoom].x_offs, zoom)); - min_yoffs = min(min_yoffs, ScaleByZoom(sprite[zoom].y_offs, zoom)); + min_xoffs = std::min(min_xoffs, ScaleByZoom(sprite[zoom].x_offs, zoom)); + min_yoffs = std::min(min_yoffs, ScaleByZoom(sprite[zoom].y_offs, zoom)); } } @@ -312,8 +312,8 @@ static bool PadSprites(SpriteLoader::Sprite *sprite, uint8 sprite_avail) int max_height = INT32_MIN; for (ZoomLevel zoom = ZOOM_LVL_BEGIN; zoom != ZOOM_LVL_END; zoom++) { if (HasBit(sprite_avail, zoom)) { - max_width = max(max_width, ScaleByZoom(sprite[zoom].width + sprite[zoom].x_offs - UnScaleByZoom(min_xoffs, zoom), zoom)); - max_height = max(max_height, ScaleByZoom(sprite[zoom].height + sprite[zoom].y_offs - UnScaleByZoom(min_yoffs, zoom), zoom)); + max_width = std::max(max_width, ScaleByZoom(sprite[zoom].width + sprite[zoom].x_offs - UnScaleByZoom(min_xoffs, zoom), zoom)); + max_height = std::max(max_height, ScaleByZoom(sprite[zoom].height + sprite[zoom].y_offs - UnScaleByZoom(min_yoffs, zoom), zoom)); } } @@ -322,10 +322,10 @@ static bool PadSprites(SpriteLoader::Sprite *sprite, uint8 sprite_avail) if (HasBit(sprite_avail, zoom)) { /* Scaling the sprite dimensions in the blitter is done with rounding up, * so a negative padding here is not an error. */ - int pad_left = max(0, sprite[zoom].x_offs - UnScaleByZoom(min_xoffs, zoom)); - int pad_top = max(0, sprite[zoom].y_offs - UnScaleByZoom(min_yoffs, zoom)); - int pad_right = max(0, UnScaleByZoom(max_width, zoom) - sprite[zoom].width - pad_left); - int pad_bottom = max(0, UnScaleByZoom(max_height, zoom) - sprite[zoom].height - pad_top); + int pad_left = std::max(0, sprite[zoom].x_offs - UnScaleByZoom(min_xoffs, zoom)); + int pad_top = std::max(0, sprite[zoom].y_offs - UnScaleByZoom(min_yoffs, zoom)); + int pad_right = std::max(0, UnScaleByZoom(max_width, zoom) - sprite[zoom].width - pad_left); + int pad_bottom = std::max(0, UnScaleByZoom(max_height, zoom) - sprite[zoom].height - pad_top); if (pad_left > 0 || pad_right > 0 || pad_top > 0 || pad_bottom > 0) { if (!PadSingleSprite(&sprite[zoom], zoom, pad_left, pad_top, pad_right, pad_bottom)) return false; @@ -378,10 +378,10 @@ static void *ReadRecolourSprite(uint16 file_slot, uint num) * GRFs which are the same as 257 byte recolour sprites, but with the last * 240 bytes zeroed. */ static const uint RECOLOUR_SPRITE_SIZE = 257; - byte *dest = (byte *)AllocSprite(max(RECOLOUR_SPRITE_SIZE, num)); + byte *dest = (byte *)AllocSprite(std::max(RECOLOUR_SPRITE_SIZE, num)); if (_palette_remap_grf[file_slot]) { - byte *dest_tmp = AllocaM(byte, max(RECOLOUR_SPRITE_SIZE, num)); + byte *dest_tmp = AllocaM(byte, std::max(RECOLOUR_SPRITE_SIZE, num)); /* Only a few recolour sprites are less than 257 bytes */ if (num < RECOLOUR_SPRITE_SIZE) memset(dest_tmp, 0, RECOLOUR_SPRITE_SIZE); diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index 058193c34c..5e540450dd 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -164,7 +164,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t fi if (colour_fmt & SCC_PAL) { switch (sprite_type) { case ST_NORMAL: data->m = _palette_remap_grf[file_slot] ? _palmap_w2d[*dest] : *dest; break; - case ST_FONT: data->m = min(*dest, 2u); break; + case ST_FONT: data->m = std::min(*dest, 2u); break; default: data->m = *dest; break; } /* Magic blue. */ @@ -200,7 +200,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t fi if (colour_fmt & SCC_PAL) { switch (sprite_type) { case ST_NORMAL: sprite->data[i].m = _palette_remap_grf[file_slot] ? _palmap_w2d[*pixel] : *pixel; break; - case ST_FONT: sprite->data[i].m = min(*pixel, 2u); break; + case ST_FONT: sprite->data[i].m = std::min(*pixel, 2u); break; default: sprite->data[i].m = *pixel; break; } /* Magic blue. */ diff --git a/src/station.cpp b/src/station.cpp index 6f55574acf..f859495d19 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -320,11 +320,11 @@ uint Station::GetCatchmentRadius() const uint ret = CA_NONE; if (_settings_game.station.modified_catchment) { - if (this->bus_stops != nullptr) ret = max(ret, CA_BUS); - if (this->truck_stops != nullptr) ret = max(ret, CA_TRUCK); - if (this->train_station.tile != INVALID_TILE) ret = max(ret, CA_TRAIN); - if (this->ship_station.tile != INVALID_TILE) ret = max(ret, CA_DOCK); - if (this->airport.tile != INVALID_TILE) ret = max(ret, this->airport.GetSpec()->catchment); + if (this->bus_stops != nullptr) ret = std::max(ret, CA_BUS); + if (this->truck_stops != nullptr) ret = std::max(ret, CA_TRUCK); + if (this->train_station.tile != INVALID_TILE) ret = std::max(ret, CA_TRAIN); + if (this->ship_station.tile != INVALID_TILE) ret = std::max(ret, CA_DOCK); + if (this->airport.tile != INVALID_TILE) ret = std::max(ret, this->airport.GetSpec()->catchment); } else { if (this->bus_stops != nullptr || this->truck_stops != nullptr || this->train_station.tile != INVALID_TILE || this->ship_station.tile != INVALID_TILE || this->airport.tile != INVALID_TILE) { ret = CA_UNMODIFIED; @@ -346,10 +346,10 @@ Rect Station::GetCatchmentRect() const int catchment_radius = this->GetCatchmentRadius(); Rect ret = { - max(this->rect.left - catchment_radius, 0), - max(this->rect.top - catchment_radius, 0), - min(this->rect.right + catchment_radius, MapMaxX()), - min(this->rect.bottom + catchment_radius, MapMaxY()) + std::max(this->rect.left - catchment_radius, 0), + std::max(this->rect.top - catchment_radius, 0), + std::min(this->rect.right + catchment_radius, MapMaxX()), + std::min(this->rect.bottom + catchment_radius, MapMaxY()) }; return ret; @@ -523,7 +523,7 @@ CommandCost StationRect::BeforeAddTile(TileIndex tile, StationRectMode mode) } else if (!this->PtInExtendedRect(x, y)) { /* current rect is not empty and new point is outside this rect * make new spread-out rectangle */ - Rect new_rect = {min(x, this->left), min(y, this->top), max(x, this->right), max(y, this->bottom)}; + Rect new_rect = {std::min(x, this->left), std::min(y, this->top), std::max(x, this->right), std::max(y, this->bottom)}; /* check new rect dimensions against preset max */ int w = new_rect.right - new_rect.left + 1; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 5a4d13c478..7bd124f065 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1069,10 +1069,10 @@ CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis a TileArea cur_ta = st->train_station; /* determine new size of train station region.. */ - int x = min(TileX(cur_ta.tile), TileX(new_ta.tile)); - int y = min(TileY(cur_ta.tile), TileY(new_ta.tile)); - new_ta.w = max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x; - new_ta.h = max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y; + int x = std::min(TileX(cur_ta.tile), TileX(new_ta.tile)); + int y = std::min(TileY(cur_ta.tile), TileY(new_ta.tile)); + new_ta.w = std::max(TileX(cur_ta.tile) + cur_ta.w, TileX(new_ta.tile) + new_ta.w) - x; + new_ta.h = std::max(TileY(cur_ta.tile) + cur_ta.h, TileY(new_ta.tile) + new_ta.h) - y; new_ta.tile = TileXY(x, y); /* make sure the final size is not too big. */ @@ -1325,7 +1325,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 /* Perform NewStation checks */ /* Check if the station size is permitted */ - if (HasBit(statspec->disallowed_platforms, min(numtracks - 1, 7)) || HasBit(statspec->disallowed_lengths, min(plat_len - 1, 7))) { + if (HasBit(statspec->disallowed_platforms, std::min(numtracks - 1, 7)) || HasBit(statspec->disallowed_lengths, std::min(plat_len - 1, 7))) { return CMD_ERROR; } @@ -3364,7 +3364,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); // enter station } else if (x < stop) { v->vehstatus |= VS_TRAIN_SLOWING; - uint16 spd = max(0, (stop - x) * 20 - 15); + uint16 spd = std::max(0, (stop - x) * 20 - 15); if (spd < v->cur_speed) v->cur_speed = spd; } } @@ -3456,7 +3456,7 @@ static void TruncateCargo(const CargoSpec *cs, GoodsEntry *ge, uint amount = UIN if (source_station == nullptr) continue; GoodsEntry &source_ge = source_station->goods[cs->Index()]; - source_ge.max_waiting_cargo = max(source_ge.max_waiting_cargo, i->second); + source_ge.max_waiting_cargo = std::max(source_ge.max_waiting_cargo, i->second); } } @@ -3512,7 +3512,9 @@ static void UpdateStationRating(Station *st) /* NewGRFs expect last speed to be 0xFF when no vehicle has arrived yet. */ uint last_speed = ge->HasVehicleEverTriedLoading() ? ge->last_speed : 0xFF; - uint32 var18 = min(ge->time_since_pickup, 0xFF) | (min(ge->max_waiting_cargo, 0xFFFF) << 8) | (min(last_speed, 0xFF) << 24); + uint32 var18 = std::min(ge->time_since_pickup, 0xFFu) + | (std::min(ge->max_waiting_cargo, 0xFFFFu) << 8) + | (std::min(last_speed, 0xFFu) << 24); /* Convert to the 'old' vehicle types */ uint32 var10 = (st->last_vehicle_type == VEH_INVALID) ? 0x0 : (st->last_vehicle_type + 0x10); uint16 callback = GetCargoCallback(CBID_CARGO_STATION_RATING_CALC, var10, var18, cs); @@ -3571,7 +3573,7 @@ static void UpdateStationRating(Station *st) uint32 r = Random(); if (rating <= (int)GB(r, 0, 7)) { /* Need to have int, otherwise it will just overflow etc. */ - waiting = max((int)waiting - (int)((GB(r, 8, 2) - 1) * num_dests), 0); + waiting = std::max((int)waiting - (int)((GB(r, 8, 2) - 1) * num_dests), 0); waiting_changed = true; } } @@ -3587,7 +3589,7 @@ static void UpdateStationRating(Station *st) uint difference = waiting - WAITING_CARGO_THRESHOLD; waiting -= (difference / WAITING_CARGO_CUT_FACTOR); - waiting = min(waiting, MAX_WAITING_CARGO); + waiting = std::min(waiting, MAX_WAITING_CARGO); waiting_changed = true; } @@ -3801,7 +3803,7 @@ void IncreaseStats(Station *st, const Vehicle *front, StationID next_station_id) * As usage is not such an important figure anyway we just * ignore the additional cargo then.*/ IncreaseStats(st, v->cargo_type, next_station_id, v->refit_cap, - min(v->refit_cap, v->cargo.StoredCount()), EUM_INCREASE); + std::min(v->refit_cap, v->cargo.StoredCount()), EUM_INCREASE); } } } @@ -4113,11 +4115,11 @@ void UpdateStationDockingTiles(Station *st) /* Expand the area by a tile on each side while * making sure that we remain inside the map. */ - int x2 = min(x + area->w + 1, MapSizeX()); - int x1 = max(x - 1, 0); + int x2 = std::min(x + area->w + 1, MapSizeX()); + int x1 = std::max(x - 1, 0); - int y2 = min(y + area->h + 1, MapSizeY()); - int y1 = max(y - 1, 0); + int y2 = std::min(y + area->h + 1, MapSizeY()); + int y1 = std::max(y - 1, 0); TileArea ta(TileXY(x1, y1), TileXY(x2 - 1, y2 - 1)); TILE_AREA_LOOP(tile, ta) { @@ -4586,7 +4588,7 @@ void FlowStat::ScaleToMonthly(uint runtime) SharesMap new_shares; uint share = 0; for (SharesMap::iterator i = this->shares.begin(); i != this->shares.end(); ++i) { - share = max(share + 1, i->first * 30 / runtime); + share = std::max(share + 1, i->first * 30 / runtime); new_shares[share] = i->second; if (this->unrestricted == i->first) this->unrestricted = share; } diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 3cd4a42916..b4507a9fc4 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -98,7 +98,7 @@ static void FindStationsAroundSelection() uint y = TileY(location.tile); int max_c = 1; - TileArea ta(TileXY(max(0, x - max_c), max(0, y - max_c)), TileXY(min(MapMaxX(), x + location.w + max_c), min(MapMaxY(), y + location.h + max_c))); + TileArea ta(TileXY(std::max(0, x - max_c), std::max(0, y - max_c)), TileXY(std::min(MapMaxX(), x + location.w + max_c), std::min(MapMaxY(), y + location.h + max_c))); Station *adjacent = nullptr; @@ -167,7 +167,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ int colour = cs->rating_colour; TextColour tc = GetContrastColour(colour); - uint w = (minu(amount, units_full) + 5) / 36; + uint w = (std::min(amount, units_full) + 5) / 36; int height = GetCharacterHeight(FS_SMALL); @@ -189,7 +189,7 @@ static void StationsWndShowStationRating(int left, int right, int y, CargoID typ /* Draw green/red ratings bar (fits into 14 pixels) */ y += height + 2; GfxFillRect(left + 1, y, left + 14, y, PC_RED); - rating = minu(rating, rating_full) / 16; + rating = std::min(rating, rating_full) / 16; if (rating != 0) GfxFillRect(left + 1, y, left + rating, y, PC_GREEN); } @@ -303,8 +303,8 @@ protected: CargoID j; FOR_EACH_SET_CARGO_ID(j, cargo_filter) { - if (a->goods[j].HasRating()) maxr1 = max(maxr1, a->goods[j].rating); - if (b->goods[j].HasRating()) maxr2 = max(maxr2, b->goods[j].rating); + if (a->goods[j].HasRating()) maxr1 = std::max(maxr1, a->goods[j].rating); + if (b->goods[j].HasRating()) maxr2 = std::max(maxr2, b->goods[j].rating); } return maxr1 < maxr2; @@ -318,8 +318,8 @@ protected: for (CargoID j = 0; j < NUM_CARGO; j++) { if (!HasBit(cargo_filter, j)) continue; - if (a->goods[j].HasRating()) minr1 = min(minr1, a->goods[j].rating); - if (b->goods[j].HasRating()) minr2 = min(minr2, b->goods[j].rating); + if (a->goods[j].HasRating()) minr1 = std::min(minr1, a->goods[j].rating); + if (b->goods[j].HasRating()) minr2 = std::min(minr2, b->goods[j].rating); } return minr1 > minr2; @@ -401,7 +401,7 @@ public: case WID_STL_BUS: case WID_STL_AIRPLANE: case WID_STL_SHIP: - size->height = max(FONT_HEIGHT_SMALL, 10) + padding.height; + size->height = std::max(FONT_HEIGHT_SMALL, 10) + padding.height; break; case WID_STL_CARGOALL: @@ -443,7 +443,7 @@ public: case WID_STL_LIST: { bool rtl = _current_text_dir == TD_RTL; - int max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), (uint)this->stations.size()); + int max = std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->stations.size()); int y = r.top + WD_FRAMERECT_TOP; for (int i = this->vscroll->GetPosition(); i < max; ++i) { // do until max number of stations of owner const Station *st = this->stations[i]; @@ -837,7 +837,7 @@ static const NWidgetPart _nested_station_view_widgets[] = { static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y) { int width = ScaleGUITrad(10); - uint num = min((waiting + (width / 2)) / width, (right - left) / width); // maximum is width / 10 icons so it won't overflow + uint num = std::min((waiting + (width / 2)) / width, (right - left) / width); // maximum is width / 10 icons so it won't overflow if (num == 0) return; SpriteID sprite = CargoSpec::Get(i)->GetCargoIcon(); @@ -1393,7 +1393,7 @@ struct StationViewWindow : public Window { case WID_SV_WAITING: resize->height = FONT_HEIGHT_NORMAL; size->height = WD_FRAMERECT_TOP + 4 * resize->height + WD_FRAMERECT_BOTTOM; - this->expand_shrink_width = max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + this->expand_shrink_width = std::max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; break; case WID_SV_ACCEPT_RATING_LIST: @@ -2219,7 +2219,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join) for (const BaseStation *st : BaseStation::Iterate()) { if (T::IsExpected(st) && !st->IsInUse() && st->owner == _local_company) { /* Include only within station spread (yes, it is strictly less than) */ - if (max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) { + if (std::max(DistanceMax(ta.tile, st->xy), DistanceMax(TILE_ADDXY(ta.tile, ta.w - 1, ta.h - 1), st->xy)) < _settings_game.station.station_spread) { _deleted_stations_nearby.push_back({st->xy, st->index}); /* Add the station when it's within where we're going to build */ @@ -2234,8 +2234,8 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join) /* Only search tiles where we have a chance to stay within the station spread. * The complete check needs to be done in the callback as we don't know the * extent of the found station, yet. */ - if (distant_join && min(ta.w, ta.h) >= _settings_game.station.station_spread) return nullptr; - uint max_dist = distant_join ? _settings_game.station.station_spread - min(ta.w, ta.h) : 1; + if (distant_join && std::min(ta.w, ta.h) >= _settings_game.station.station_spread) return nullptr; + uint max_dist = distant_join ? _settings_game.station.station_spread - std::min(ta.w, ta.h) : 1; TileIndex tile = TileAddByDir(ctx.tile, DIR_N); CircularTileSearch(&tile, max_dist, ta.w, ta.h, AddNearbyStation, &ctx); @@ -2319,7 +2319,7 @@ struct SelectStationWindow : Window { y += this->resize.step_height; } - for (uint i = max(1, this->vscroll->GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) { + for (uint i = std::max(1, this->vscroll->GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) { /* Don't draw anything if it extends past the end of the window. */ if (i - this->vscroll->GetPosition() >= this->vscroll->GetCapacity()) break; diff --git a/src/station_kdtree.h b/src/station_kdtree.h index 321bbacc6f..1c91ed3d2c 100644 --- a/src/station_kdtree.h +++ b/src/station_kdtree.h @@ -29,10 +29,10 @@ template void ForAllStationsRadius(TileIndex center, uint radius, Func func) { uint16 x1, y1, x2, y2; - x1 = (uint16)max(0, TileX(center) - radius); - x2 = (uint16)min(TileX(center) + radius + 1, MapSizeX()); - y1 = (uint16)max(0, TileY(center) - radius); - y2 = (uint16)min(TileY(center) + radius + 1, MapSizeY()); + x1 = (uint16)std::max(0, TileX(center) - radius); + x2 = (uint16)std::min(TileX(center) + radius + 1, MapSizeX()); + y1 = (uint16)std::max(0, TileY(center) - radius); + y2 = (uint16)std::min(TileY(center) + radius + 1, MapSizeY()); _station_kdtree.FindContained(x1, y1, x2, y2, [&](StationID id) { func(Station::Get(id)); diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index f97d0d4311..52b972086d 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -120,7 +120,7 @@ struct StatusBarWindow : Window { case WID_S_RIGHT: { int64 max_money = UINT32_MAX; - for (const Company *c : Company::Iterate()) max_money = max(c->money, max_money); + for (const Company *c : Company::Iterate()) max_money = std::max(c->money, max_money); SetDParam(0, 100LL * max_money); d = GetStringBoundingBox(STR_COMPANY_MONEY); break; @@ -137,7 +137,7 @@ struct StatusBarWindow : Window { void DrawWidget(const Rect &r, int widget) const override { - int text_offset = max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered + int text_offset = std::max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered int text_top = r.top + text_offset; switch (widget) { case WID_S_LEFT: @@ -185,7 +185,7 @@ struct StatusBarWindow : Window { if (!this->reminder_timeout.HasElapsed()) { Dimension icon_size = GetSpriteSize(SPR_UNREAD_NEWS); - DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + max(0, ((int)(r.bottom - r.top + 1) - (int)icon_size.height) / 2)); + DrawSprite(SPR_UNREAD_NEWS, PAL_NONE, r.right - WD_FRAMERECT_RIGHT - icon_size.width, r.top + std::max(0, ((int)(r.bottom - r.top + 1) - (int)icon_size.height) / 2)); } break; } diff --git a/src/stdafx.h b/src/stdafx.h index 7d5a8754f6..0244e567d3 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -85,6 +85,7 @@ # define INT8_MIN (-INT8_MAX - 1) #endif +#include #include #include #include diff --git a/src/story_gui.cpp b/src/story_gui.cpp index 21429994c4..0ed39ba045 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -437,8 +437,8 @@ protected: int right_offset = (right_width == 0) ? 0 : (right_width + element_dist); if (left_offset + right_offset + min_required_width >= max_width) { /* Width of floats leave too little for main content, push down */ - main_y = max(main_y, left_y); - main_y = max(main_y, right_y); + main_y = std::max(main_y, left_y); + main_y = std::max(main_y, right_y); left_width = right_width = 0; left_offset = right_offset = 0; /* Do not add element_dist here, to keep together elements which were supposed to float besides each other. */ @@ -469,7 +469,7 @@ protected: main_y += element_dist; /* Clear all floats */ left_width = right_width = 0; - left_y = right_y = main_y = max(main_y, max(left_y, right_y)); + left_y = right_y = main_y = std::max({main_y, left_y, right_y}); left_floats.clear(); right_floats.clear(); } else { @@ -478,7 +478,7 @@ protected: int &cur_y = (fl == ElementFloat::Left) ? left_y : right_y; std::vector &cur_floats = (fl == ElementFloat::Left) ? left_floats : right_floats; /* Position element */ - cur_width = max(cur_width, this->GetPageElementFloatWidth(*pe)); + cur_width = std::max(cur_width, this->GetPageElementFloatWidth(*pe)); LayoutCacheElement ce{ pe, {} }; ce.bounds.left = (fl == ElementFloat::Left) ? 0 : (max_width - cur_width); ce.bounds.right = (fl == ElementFloat::Left) ? cur_width : max_width; @@ -507,7 +507,7 @@ protected: this->EnsureStoryPageElementLayout(); /* The largest bottom coordinate of any element is the height of the content */ - uint max_y = std::accumulate(this->layout_cache.begin(), this->layout_cache.end(), 0, [](uint max_y, const LayoutCacheElement &ce) -> uint { return max(max_y, ce.bounds.bottom); }); + uint max_y = std::accumulate(this->layout_cache.begin(), this->layout_cache.end(), 0, [](uint max_y, const LayoutCacheElement &ce) -> uint { return std::max(max_y, ce.bounds.bottom); }); return max_y; } @@ -526,7 +526,7 @@ protected: void DrawActionElement(int &y_offset, int width, int line_height, SpriteID action_sprite, StringID string_id = STR_JUST_RAW_STRING) const { Dimension sprite_dim = GetSpriteSize(action_sprite); - uint element_height = max(sprite_dim.height, (uint)line_height); + uint element_height = std::max(sprite_dim.height, (uint)line_height); uint sprite_top = y_offset + (element_height - sprite_dim.height) / 2; uint text_top = y_offset + (element_height - line_height) / 2; diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 87bac5ab63..9377e63622 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -304,7 +304,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { /* Find the plural form with the most amount of cases. */ int max_plural_forms = 0; for (uint i = 0; i < lengthof(_plural_forms); i++) { - max_plural_forms = max(max_plural_forms, _plural_forms[i].plural_count); + max_plural_forms = std::max(max_plural_forms, _plural_forms[i].plural_count); } fprintf(this->fh, diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp index 7e43471b26..60e27e752b 100644 --- a/src/strgen/strgen_base.cpp +++ b/src/strgen/strgen_base.cpp @@ -388,7 +388,7 @@ void EmitPlural(Buffer *buffer, char *buf, int value) int argidx = _cur_argidx; int offset = -1; int expected = _plural_forms[_lang.plural_form].plural_count; - const char **words = AllocaM(const char *, max(expected, MAX_PLURALS)); + const char **words = AllocaM(const char *, std::max(expected, MAX_PLURALS)); int nw = 0; /* Parse out the number, if one exists. Otherwise default to prev arg. */ @@ -489,7 +489,7 @@ static uint ResolveCaseName(const char *str, size_t len) { /* First get a clean copy of only the case name, then resolve it. */ char case_str[CASE_GENDER_LEN]; - len = min(lengthof(case_str) - 1, len); + len = std::min(lengthof(case_str) - 1, len); memcpy(case_str, str, len); case_str[len] = '\0'; diff --git a/src/string.cpp b/src/string.cpp index 91c1aa147d..adc757b871 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -62,7 +62,7 @@ int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) { ptrdiff_t diff = last - str; if (diff < 0) return 0; - return min((int)diff, vsnprintf(str, diff + 1, format, ap)); + return std::min(static_cast(diff), vsnprintf(str, diff + 1, format, ap)); } /** diff --git a/src/strings.cpp b/src/strings.cpp index adb874ba14..0f270ca8b8 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -108,7 +108,7 @@ void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size) num_digits++; max_value /= 10; } - SetDParamMaxDigits(n, max(min_count, num_digits), size); + SetDParamMaxDigits(n, std::max(min_count, num_digits), size); } /** @@ -1663,7 +1663,7 @@ static char *GetSpecialNameString(char *buff, int ind, StringParameters *args, c { switch (ind) { case 1: // not used - return strecpy(buff, _silly_company_names[min(args->GetInt32() & 0xFFFF, lengthof(_silly_company_names) - 1)], last); + return strecpy(buff, _silly_company_names[std::min(args->GetInt32() & 0xFFFF, lengthof(_silly_company_names) - 1)], last); case 2: // used for Foobar & Co company names return GenAndCoName(buff, args->GetInt32(), last); diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp index 85edb73128..1bc4cb1e2e 100644 --- a/src/terraform_cmd.cpp +++ b/src/terraform_cmd.cpp @@ -240,8 +240,8 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin int z_E = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 1)); /* Find min and max height of tile */ - int z_min = min(min(z_N, z_W), min(z_S, z_E)); - int z_max = max(max(z_N, z_W), max(z_S, z_E)); + int z_min = std::min({z_N, z_W, z_S, z_E}); + int z_max = std::max({z_N, z_W, z_S, z_E}); /* Compute tile slope */ Slope tileh = (z_max > z_min + 1 ? SLOPE_STEEP : SLOPE_FLAT); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 9f727ce729..2f017e6b1b 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -409,13 +409,13 @@ static void CommonRaiseLowerBigLand(TileIndex tile, int mode) /* Raise land */ h = MAX_TILE_HEIGHT; TILE_AREA_LOOP(tile2, ta) { - h = min(h, TileHeight(tile2)); + h = std::min(h, TileHeight(tile2)); } } else { /* Lower land */ h = 0; TILE_AREA_LOOP(tile2, ta) { - h = max(h, TileHeight(tile2)); + h = std::max(h, TileHeight(tile2)); } } @@ -547,8 +547,8 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { { if (widget != WID_ETT_DOTS) return; - size->width = max(size->width, ScaleGUITrad(59)); - size->height = max(size->height, ScaleGUITrad(31)); + size->width = std::max(size->width, ScaleGUITrad(59)); + size->height = std::max(size->height, ScaleGUITrad(31)); } void DrawWidget(const Rect &r, int widget) const override diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 7b728e9b2c..b83e38187f 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -98,7 +98,7 @@ uint TextfileWindow::GetContentHeight() resize->height = 1; size->height = 4 * resize->height + TOP_SPACING + BOTTOM_SPACING; // At least 4 lines are visible. - size->width = max(200u, size->width); // At least 200 pixels wide. + size->width = std::max(200u, size->width); // At least 200 pixels wide. break; } } @@ -112,7 +112,7 @@ void TextfileWindow::SetupScrollbars() } else { uint max_length = 0; for (uint i = 0; i < this->lines.size(); i++) { - max_length = max(max_length, GetStringBoundingBox(this->lines[i], FS_MONO).width); + max_length = std::max(max_length, GetStringBoundingBox(this->lines[i], FS_MONO).width); } this->vscroll->SetCount((uint)this->lines.size() * FONT_HEIGHT_MONO); this->hscroll->SetCount(max_length + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); diff --git a/src/tgp.cpp b/src/tgp.cpp index fb5c69cf75..f6d902255d 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -234,8 +234,8 @@ static height_t TGPGetMaxHeight() { 12, 19, 25, 31, 67, 75, 87 }, ///< Alpinist }; - int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS]; - return I2H(min(max_height_from_table, _settings_game.construction.max_heightlevel)); + int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS]; + return I2H(std::min(max_height_from_table, _settings_game.construction.max_heightlevel)); } /** @@ -270,7 +270,7 @@ static amplitude_t GetAmplitude(int frequency) /* Get the table index, and return that value if possible. */ int index = frequency - MAX_TGP_FREQUENCIES + lengthof(amplitudes[smoothness]); - amplitude_t amplitude = amplitudes[smoothness][max(0, index)]; + amplitude_t amplitude = amplitudes[smoothness][std::max(0, index)]; if (index >= 0) return amplitude; /* We need to extrapolate the amplitude. */ @@ -349,7 +349,7 @@ static void HeightMapGenerate() /* Trying to apply noise to uninitialized height map */ assert(_height_map.h != nullptr); - int start = max(MAX_TGP_FREQUENCIES - (int)min(MapLogX(), MapLogY()), 0); + int start = std::max(MAX_TGP_FREQUENCIES - (int)std::min(MapLogX(), MapLogY()), 0); bool first = true; for (int frequency = start; frequency < MAX_TGP_FREQUENCIES; frequency++) { @@ -725,7 +725,7 @@ static double perlin_coast_noise_2D(const double x, const double y, const double */ static void HeightMapCoastLines(uint8 water_borders) { - int smallest_size = min(_settings_game.game_creation.map_x, _settings_game.game_creation.map_y); + int smallest_size = std::min(_settings_game.game_creation.map_x, _settings_game.game_creation.map_y); const int margin = 4; int y, x; double max_x; @@ -736,7 +736,7 @@ static void HeightMapCoastLines(uint8 water_borders) if (HasBit(water_borders, BORDER_NE)) { /* Top right */ max_x = abs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12); - max_x = max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x); + max_x = std::max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x); if (smallest_size < 8 && max_x > 5) max_x /= 1.5; for (x = 0; x < max_x; x++) { _height_map.height(x, y) = 0; @@ -746,7 +746,7 @@ static void HeightMapCoastLines(uint8 water_borders) if (HasBit(water_borders, BORDER_SW)) { /* Bottom left */ max_x = abs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45, 67) + 0.75) * 8); - max_x = max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x); + max_x = std::max((smallest_size * smallest_size / 64) + max_x, (smallest_size * smallest_size / 64) + margin - max_x); if (smallest_size < 8 && max_x > 5) max_x /= 1.5; for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) { _height_map.height(x, y) = 0; @@ -759,7 +759,7 @@ static void HeightMapCoastLines(uint8 water_borders) if (HasBit(water_borders, BORDER_NW)) { /* Top left */ max_y = abs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9); - max_y = max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y); + max_y = std::max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y); if (smallest_size < 8 && max_y > 5) max_y /= 1.5; for (y = 0; y < max_y; y++) { _height_map.height(x, y) = 0; @@ -769,7 +769,7 @@ static void HeightMapCoastLines(uint8 water_borders) if (HasBit(water_borders, BORDER_SE)) { /* Bottom right */ max_y = abs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12); - max_y = max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y); + max_y = std::max((smallest_size * smallest_size / 64) + max_y, (smallest_size * smallest_size / 64) + margin - max_y); if (smallest_size < 8 && max_y > 5) max_y /= 1.5; for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) { _height_map.height(x, y) = 0; @@ -809,7 +809,7 @@ static void HeightMapSmoothCoastInDirection(int org_x, int org_y, int dir_x, int * Soften the coast slope */ for (depth = 0; IsValidXY(x, y) && depth <= max_coast_Smooth_depth; depth++, x += dir_x, y += dir_y) { h = _height_map.height(x, y); - h = min(h, h_prev + (4 + depth)); // coast softening formula + h = std::min(h, h_prev + (4 + depth)); // coast softening formula _height_map.height(x, y) = h; h_prev = h; } @@ -842,13 +842,13 @@ static void HeightMapSmoothSlopes(height_t dh_max) { for (int y = 0; y <= (int)_height_map.size_y; y++) { for (int x = 0; x <= (int)_height_map.size_x; x++) { - height_t h_max = min(_height_map.height(x > 0 ? x - 1 : x, y), _height_map.height(x, y > 0 ? y - 1 : y)) + dh_max; + height_t h_max = std::min(_height_map.height(x > 0 ? x - 1 : x, y), _height_map.height(x, y > 0 ? y - 1 : y)) + dh_max; if (_height_map.height(x, y) > h_max) _height_map.height(x, y) = h_max; } } for (int y = _height_map.size_y; y >= 0; y--) { for (int x = _height_map.size_x; x >= 0; x--) { - height_t h_max = min(_height_map.height(x < _height_map.size_x ? x + 1 : x, y), _height_map.height(x, y < _height_map.size_y ? y + 1 : y)) + dh_max; + height_t h_max = std::min(_height_map.height(x < _height_map.size_x ? x + 1 : x, y), _height_map.height(x, y < _height_map.size_y ? y + 1 : y)) + dh_max; if (_height_map.height(x, y) > h_max) _height_map.height(x, y) = h_max; } } diff --git a/src/tile_map.cpp b/src/tile_map.cpp index 0b5c8e070b..2b8db5e24d 100644 --- a/src/tile_map.cpp +++ b/src/tile_map.cpp @@ -28,15 +28,15 @@ static Slope GetTileSlopeGivenHeight(int hnorth, int hwest, int heast, int hsout * * Also, there is at most 1 corner with height difference of 2. */ - int hminnw = min(hnorth, hwest); - int hmines = min(heast, hsouth); - int hmin = min(hminnw, hmines); + int hminnw = std::min(hnorth, hwest); + int hmines = std::min(heast, hsouth); + int hmin = std::min(hminnw, hmines); if (h != nullptr) *h = hmin; - int hmaxnw = max(hnorth, hwest); - int hmaxes = max(heast, hsouth); - int hmax = max(hmaxnw, hmaxes); + int hmaxnw = std::max(hnorth, hwest); + int hmaxes = std::max(heast, hsouth); + int hmax = std::max(hmaxnw, hmaxes); Slope r = SLOPE_FLAT; @@ -60,8 +60,8 @@ Slope GetTileSlope(TileIndex tile, int *h) { uint x1 = TileX(tile); uint y1 = TileY(tile); - uint x2 = min(x1 + 1, MapMaxX()); - uint y2 = min(y1 + 1, MapMaxY()); + uint x2 = std::min(x1 + 1, MapMaxX()); + uint y2 = std::min(y1 + 1, MapMaxY()); int hnorth = TileHeight(tile); // Height of the North corner. int hwest = TileHeight(TileXY(x2, y1)); // Height of the West corner. @@ -101,8 +101,8 @@ bool IsTileFlat(TileIndex tile, int *h) { uint x1 = TileX(tile); uint y1 = TileY(tile); - uint x2 = min(x1 + 1, MapMaxX()); - uint y2 = min(y1 + 1, MapMaxY()); + uint x2 = std::min(x1 + 1, MapMaxX()); + uint y2 = std::min(y1 + 1, MapMaxY()); uint z = TileHeight(tile); if (TileHeight(TileXY(x2, y1)) != z) return false; @@ -122,15 +122,15 @@ int GetTileZ(TileIndex tile) { uint x1 = TileX(tile); uint y1 = TileY(tile); - uint x2 = min(x1 + 1, MapMaxX()); - uint y2 = min(y1 + 1, MapMaxY()); - - int h = TileHeight(tile); // N corner - h = min(h, TileHeight(TileXY(x2, y1))); // W corner - h = min(h, TileHeight(TileXY(x1, y2))); // E corner - h = min(h, TileHeight(TileXY(x2, y2))); // S corner - - return h; + uint x2 = std::min(x1 + 1, MapMaxX()); + uint y2 = std::min(y1 + 1, MapMaxY()); + + return std::min({ + TileHeight(tile), // N corner + TileHeight(TileXY(x2, y1)), // W corner + TileHeight(TileXY(x1, y2)), // E corner + TileHeight(TileXY(x2, y2)), // S corner + }); } /** @@ -142,13 +142,13 @@ int GetTileMaxZ(TileIndex t) { uint x1 = TileX(t); uint y1 = TileY(t); - uint x2 = min(x1 + 1, MapMaxX()); - uint y2 = min(y1 + 1, MapMaxY()); - - int h = TileHeight(t); // N corner - h = max(h, TileHeight(TileXY(x2, y1))); // W corner - h = max(h, TileHeight(TileXY(x1, y2))); // E corner - h = max(h, TileHeight(TileXY(x2, y2))); // S corner - - return h; + uint x2 = std::min(x1 + 1, MapMaxX()); + uint y2 = std::min(y1 + 1, MapMaxY()); + + return std::max({ + TileHeight(t), // N corner + TileHeight(TileXY(x2, y1)), // W corner + TileHeight(TileXY(x1, y2)), // E corner + TileHeight(TileXY(x2, y2)), // S corner + }); } diff --git a/src/tilearea.cpp b/src/tilearea.cpp index 3f240feb40..84ac7a90ff 100644 --- a/src/tilearea.cpp +++ b/src/tilearea.cpp @@ -57,10 +57,10 @@ void OrthogonalTileArea::Add(TileIndex to_add) uint ax = TileX(to_add); uint ay = TileY(to_add); - sx = min(ax, sx); - sy = min(ay, sy); - ex = max(ax, ex); - ey = max(ay, ey); + sx = std::min(ax, sx); + sy = std::min(ay, sy); + ex = std::max(ax, ex); + ey = std::max(ay, ey); this->tile = TileXY(sx, sy); this->w = ex - sx + 1; @@ -125,10 +125,10 @@ OrthogonalTileArea &OrthogonalTileArea::Expand(int rad) int x = TileX(this->tile); int y = TileY(this->tile); - int sx = max(x - rad, 0); - int sy = max(y - rad, 0); - int ex = min(x + this->w + rad, MapSizeX()); - int ey = min(y + this->h + rad, MapSizeY()); + int sx = std::max(x - rad, 0); + int sy = std::max(y - rad, 0); + int ex = std::min(x + this->w + rad, MapSizeX()); + int ey = std::min(y + this->h + rad, MapSizeY()); this->tile = TileXY(sx, sy); this->w = ex - sx; @@ -142,8 +142,8 @@ OrthogonalTileArea &OrthogonalTileArea::Expand(int rad) void OrthogonalTileArea::ClampToMap() { assert(this->tile < MapSize()); - this->w = min(this->w, MapSizeX() - TileX(this->tile)); - this->h = min(this->h, MapSizeY() - TileY(this->tile)); + this->w = std::min(this->w, MapSizeX() - TileX(this->tile)); + this->h = std::min(this->h, MapSizeY() - TileY(this->tile)); } /** @@ -225,9 +225,9 @@ TileIterator &DiagonalTileIterator::operator++() /* Special case: Every second column has zero length, skip them completely */ this->a_cur = 0; if (this->b_max > 0) { - this->b_cur = min(this->b_cur + 2, this->b_max); + this->b_cur = std::min(this->b_cur + 2, this->b_max); } else { - this->b_cur = max(this->b_cur - 2, this->b_max); + this->b_cur = std::max(this->b_cur - 2, this->b_max); } } else { /* Every column has at least one tile to process */ diff --git a/src/tilematrix_type.hpp b/src/tilematrix_type.hpp index 118c994cd5..2ca165dc03 100644 --- a/src/tilematrix_type.hpp +++ b/src/tilematrix_type.hpp @@ -95,14 +95,14 @@ public: uint tile_y = (TileY(tile) / N) * N; uint w = N, h = N; - w += min(extend * N, tile_x); - h += min(extend * N, tile_y); + w += std::min(extend * N, tile_x); + h += std::min(extend * N, tile_y); - tile_x -= min(extend * N, tile_x); - tile_y -= min(extend * N, tile_y); + tile_x -= std::min(extend * N, tile_x); + tile_y -= std::min(extend * N, tile_y); - w += min(extend * N, MapSizeX() - tile_x - w); - h += min(extend * N, MapSizeY() - tile_y - h); + w += std::min(extend * N, MapSizeX() - tile_x - w); + h += std::min(extend * N, MapSizeY() - tile_y - h); return TileArea(TileXY(tile_x, tile_y), w, h); } diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp index 58cf8d46b7..76f8d3d2fd 100644 --- a/src/timetable_cmd.cpp +++ b/src/timetable_cmd.cpp @@ -430,7 +430,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling) * the timetable entry like is done for road vehicles/ships. * Thus always make sure at least one tick is used between the * processing of different orders when filling the timetable. */ - uint time_to_set = CeilDiv(max(time_taken, 1U), DAY_TICKS) * DAY_TICKS; + uint time_to_set = CeilDiv(std::max(time_taken, 1U), DAY_TICKS) * DAY_TICKS; if (travelling && (autofilling || !real_current_order->IsTravelTimetabled())) { ChangeTimetable(v, v->cur_real_order_index, time_to_set, MTF_TRAVEL_TIME, autofilling); diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 9e23ebabc9..af90adc448 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -193,7 +193,7 @@ struct TimetableWindow : Window { case WID_VT_ARRIVAL_DEPARTURE_PANEL: SetDParamMaxValue(0, MAX_YEAR * DAYS_IN_YEAR, 0, FS_SMALL); this->deparr_time_width = GetStringBoundingBox(STR_JUST_DATE_TINY).width; - this->deparr_abbr_width = max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_ABBREVIATION).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_ABBREVIATION).width); + this->deparr_abbr_width = std::max(GetStringBoundingBox(STR_TIMETABLE_ARRIVAL_ABBREVIATION).width, GetStringBoundingBox(STR_TIMETABLE_DEPARTURE_ABBREVIATION).width); size->width = WD_FRAMERECT_LEFT + this->deparr_abbr_width + 10 + this->deparr_time_width + WD_FRAMERECT_RIGHT; FALLTHROUGH; @@ -627,7 +627,7 @@ struct TimetableWindow : Window { if (!_settings_client.gui.timetable_in_ticks) val *= DAY_TICKS; } - uint32 p2 = minu(val, UINT16_MAX); + uint32 p2 = std::min(val, UINT16_MAX); DoCommandP(0, p1, p2, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_ERROR_CAN_T_TIMETABLE_VEHICLE)); } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 632025ddb4..224c8ccdb1 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -141,7 +141,7 @@ public: uint Height(uint width) const override { - return max(max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL); + return std::max(std::max(this->icon_size.height, this->lock_size.height) + 2U, (uint)FONT_HEIGHT_NORMAL); } void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override @@ -1356,10 +1356,10 @@ public: /* First initialise some variables... */ for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) { child_wid->SetupSmallestSize(w, init_array); - this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); + this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); if (this->IsButton(child_wid->type)) { nbuttons++; - this->smallest_x = max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); + this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); } else if (child_wid->type == NWID_SPACER) { this->spacers++; } @@ -1401,7 +1401,7 @@ public: /* Now assign the widgets to their rightful place */ uint position = 0; // Place to put next child relative to origin of the container. - uint spacer_space = max(0, (int)given_width - (int)(button_count * this->smallest_x)); // Remaining spacing for 'spacer' widgets + uint spacer_space = std::max(0, (int)given_width - (int)(button_count * this->smallest_x)); // Remaining spacing for 'spacer' widgets uint button_space = given_width - spacer_space; // Remaining spacing for the buttons uint spacer_i = 0; uint button_i = 0; @@ -1784,7 +1784,7 @@ class NWidgetMainToolbarContainer : public NWidgetToolbarContainer { }; /* If at least BIGGEST_ARRANGEMENT fit, just spread all the buttons nicely */ - uint full_buttons = max(CeilDiv(width, this->smallest_x), SMALLEST_ARRANGEMENT); + uint full_buttons = std::max(CeilDiv(width, this->smallest_x), SMALLEST_ARRANGEMENT); if (full_buttons > BIGGEST_ARRANGEMENT) { button_count = arrangable_count = lengthof(arrange_all); spacer_count = this->spacers; @@ -2266,7 +2266,7 @@ static NWidgetBase *MakeMainToolbar(int *biggest_index) hor->Add(new NWidgetLeaf(i == WID_TN_SAVE ? WWT_IMGBTN_2 : WWT_IMGBTN, COLOUR_GREY, i, toolbar_button_sprites[i], STR_TOOLBAR_TOOLTIP_PAUSE_GAME + i)); } - *biggest_index = max(*biggest_index, WID_TN_SWITCH_BAR); + *biggest_index = std::max(*biggest_index, WID_TN_SWITCH_BAR); return hor; } @@ -2418,13 +2418,13 @@ struct ScenarioEditorToolbarWindow : Window { { switch (widget) { case WID_TE_SPACER: - size->width = max(GetStringBoundingBox(STR_SCENEDIT_TOOLBAR_OPENTTD).width, GetStringBoundingBox(STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR).width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + size->width = std::max(GetStringBoundingBox(STR_SCENEDIT_TOOLBAR_OPENTTD).width, GetStringBoundingBox(STR_SCENEDIT_TOOLBAR_SCENARIO_EDITOR).width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; break; case WID_TE_DATE: SetDParam(0, ConvertYMDToDate(MAX_YEAR, 0, 1)); *size = GetStringBoundingBox(STR_WHITE_DATE_LONG); - size->height = max(size->height, GetSpriteSize(SPR_IMG_SAVE).height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); + size->height = std::max(size->height, GetSpriteSize(SPR_IMG_SAVE).height + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); break; } } diff --git a/src/town.h b/src/town.h index 3bb9e10d66..e186951e63 100644 --- a/src/town.h +++ b/src/town.h @@ -299,7 +299,7 @@ void MakeDefaultName(T *obj) * tick 0 is a valid tick so actual amount is one more than the counter value. */ static inline uint16 TownTicksToGameTicks(uint16 ticks) { - return (min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1; + return (std::min(ticks, MAX_TOWN_GROWTH_TICKS) + 1) * TOWN_GROWTH_TICKS - 1; } diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index ea13ff061a..6bd78ff0d0 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -813,7 +813,7 @@ static void TownTickHandler(Town *t) i = t->growth_rate; } else { /* If growth failed wait a bit before retrying */ - i = min(t->growth_rate, TOWN_GROWTH_TICKS - 1); + i = std::min(t->growth_rate, TOWN_GROWTH_TICKS - 1); } } t->grow_counter = i; @@ -2136,7 +2136,7 @@ bool GenerateTowns(TownLayout layout) uint current_number = 0; uint difficulty = (_game_mode != GM_EDITOR) ? _settings_game.difficulty.number_towns : 0; uint total = (difficulty == (uint)CUSTOM_TOWN_NUMBER_DIFFICULTY) ? _settings_game.game_creation.custom_town_number : ScaleByMapSize(_num_initial_towns[difficulty] + (Random() & 7)); - total = min(TownPool::MAX_SIZE, total); + total = std::min(TownPool::MAX_SIZE, total); uint32 townnameparts; TownNames town_names; @@ -3143,7 +3143,7 @@ static CommandCost TownActionFundBuildings(Town *t, DoCommandFlag flags) * tick-perfect and gives player some time window where he can * spam funding with the exact same efficiency. */ - t->grow_counter = min(t->grow_counter, 2 * TOWN_GROWTH_TICKS - (t->growth_rate - t->grow_counter) % TOWN_GROWTH_TICKS); + t->grow_counter = std::min(t->grow_counter, 2 * TOWN_GROWTH_TICKS - (t->growth_rate - t->grow_counter) % TOWN_GROWTH_TICKS); SetWindowDirty(WC_TOWN_VIEW, t->index); } @@ -3321,7 +3321,7 @@ static void UpdateTownRating(Town *t) /* Increase company ratings if they're low */ for (const Company *c : Company::Iterate()) { if (t->ratings[c->index] < RATING_GROWTH_MAXIMUM) { - t->ratings[c->index] = min((int)RATING_GROWTH_MAXIMUM, t->ratings[c->index] + RATING_GROWTH_UP_STEP); + t->ratings[c->index] = std::min((int)RATING_GROWTH_MAXIMUM, t->ratings[c->index] + RATING_GROWTH_UP_STEP); } } @@ -3329,12 +3329,12 @@ static void UpdateTownRating(Town *t) if (st->time_since_load <= 20 || st->time_since_unload <= 20) { if (Company::IsValidID(st->owner)) { int new_rating = t->ratings[st->owner] + RATING_STATION_UP_STEP; - t->ratings[st->owner] = min(new_rating, INT16_MAX); // do not let it overflow + t->ratings[st->owner] = std::min(new_rating, INT16_MAX); // do not let it overflow } } else { if (Company::IsValidID(st->owner)) { int new_rating = t->ratings[st->owner] + RATING_STATION_DOWN_STEP; - t->ratings[st->owner] = max(new_rating, INT16_MIN); + t->ratings[st->owner] = std::max(new_rating, INT16_MIN); } } }); @@ -3358,7 +3358,7 @@ static void UpdateTownGrowCounter(Town *t, uint16 prev_growth_rate) { if (t->growth_rate == TOWN_GROWTH_RATE_NONE) return; if (prev_growth_rate == TOWN_GROWTH_RATE_NONE) { - t->grow_counter = min(t->growth_rate, t->grow_counter); + t->grow_counter = std::min(t->growth_rate, t->grow_counter); return; } t->grow_counter = RoundDivSU((uint32)t->grow_counter * (t->growth_rate + 1), prev_growth_rate + 1); @@ -3399,7 +3399,7 @@ static uint GetNormalGrowthRate(Town *t) }; int n = CountActiveStations(t); - uint16 m = _grow_count_values[t->fund_buildings_months != 0 ? 0 : 1][min(n, 5)]; + uint16 m = _grow_count_values[t->fund_buildings_months != 0 ? 0 : 1][std::min(n, 5)]; uint growth_multiplier = _settings_game.economy.town_growth_rate != 0 ? _settings_game.economy.town_growth_rate - 1 : 1; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index f199d8a978..0f143701c4 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -245,7 +245,7 @@ public: size->height = WD_FRAMERECT_TOP + 5 * FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM; size->width = GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTIONS_TITLE).width; for (uint i = 0; i < TACT_COUNT; i++ ) { - size->width = max(size->width, GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i).width); + size->width = std::max(size->width, GetStringBoundingBox(STR_LOCAL_AUTHORITY_ACTION_SMALL_ADVERTISING_CAMPAIGN + i).width); } size->width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; break; @@ -866,7 +866,7 @@ public: } Dimension icon_size = GetSpriteSize(SPR_TOWN_RATING_GOOD); d.width += icon_size.width + 2; - d.height = max(d.height, icon_size.height); + d.height = std::max(d.height, icon_size.height); resize->height = d.height; d.height *= 5; d.width += padding.width + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index ae9cb45de3..ddd8cafc7b 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -78,7 +78,7 @@ void CheckTrainsLengths() for (const Train *u = v, *w = v->Next(); w != nullptr; u = w, w = w->Next()) { if (u->track != TRACK_BIT_DEPOT) { if ((w->track != TRACK_BIT_DEPOT && - max(abs(u->x_pos - w->x_pos), abs(u->y_pos - w->y_pos)) != u->CalcNextVehicleOffset()) || + std::max(abs(u->x_pos - w->x_pos), abs(u->y_pos - w->y_pos)) != u->CalcNextVehicleOffset()) || (w->track == TRACK_BIT_DEPOT && TicksToLeaveDepot(u) <= 0)) { SetDParam(0, v->index); SetDParam(1, v->owner); @@ -181,7 +181,7 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes) /* max speed is the minimum of the speed limits of all vehicles in the consist */ if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings_game.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) { uint16 speed = GetVehicleProperty(u, PROP_TRAIN_SPEED, rvi_u->max_speed); - if (speed != 0) max_speed = min(speed, max_speed); + if (speed != 0) max_speed = std::min(speed, max_speed); } } @@ -189,7 +189,7 @@ void Train::ConsistChanged(ConsistChangeFlags allowed_changes) if (allowed_changes & CCF_CAPACITY) { /* Update vehicle capacity. */ if (u->cargo_cap > new_cap) u->cargo.Truncate(new_cap); - u->refit_cap = min(new_cap, u->refit_cap); + u->refit_cap = std::min(new_cap, u->refit_cap); u->cargo_cap = new_cap; } else { /* Verify capacity hasn't changed. */ @@ -391,26 +391,26 @@ int Train::GetCurrentMaxSpeed() const st_max_speed = this->cur_speed - (delta_v / 10); } - st_max_speed = max(st_max_speed, 25 * distance_to_go); - max_speed = min(max_speed, st_max_speed); + st_max_speed = std::max(st_max_speed, 25 * distance_to_go); + max_speed = std::min(max_speed, st_max_speed); } } } for (const Train *u = this; u != nullptr; u = u->Next()) { if (_settings_game.vehicle.train_acceleration_model == AM_REALISTIC && u->track == TRACK_BIT_DEPOT) { - max_speed = min(max_speed, 61); + max_speed = std::min(max_speed, 61); break; } /* Vehicle is on the middle part of a bridge. */ if (u->track == TRACK_BIT_WORMHOLE && !(u->vehstatus & VS_HIDDEN)) { - max_speed = min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed); + max_speed = std::min(max_speed, GetBridgeSpec(GetBridgeType(u->tile))->speed); } } - max_speed = min(max_speed, this->current_order.GetMaxSpeed()); - return min(max_speed, this->gcache.cached_max_track_speed); + max_speed = std::min(max_speed, this->current_order.GetMaxSpeed()); + return std::min(max_speed, this->gcache.cached_max_track_speed); } /** Update acceleration of the train from the cached power and weight. */ @@ -567,9 +567,9 @@ void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, /* Calculate values relative to an imaginary center between the two sprites. */ width = ScaleGUITrad(TRAININFO_DEFAULT_VEHICLE_WIDTH) + UnScaleGUI(rect.right) - xoffs; - height = max(height, UnScaleGUI(rect.bottom - rect.top + 1)); + height = std::max(height, UnScaleGUI(rect.bottom - rect.top + 1)); xoffs = xoffs - ScaleGUITrad(TRAININFO_DEFAULT_VEHICLE_WIDTH) / 2; - yoffs = min(yoffs, UnScaleGUI(rect.top)); + yoffs = std::min(yoffs, UnScaleGUI(rect.top)); } } diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 476c8f9cdf..c8995f9b74 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -67,9 +67,9 @@ static int HighlightDragPosition(int px, int max_width, VehicleID selection, boo dragged_width += t->GetDisplayImageWidth(nullptr); } - int drag_hlight_left = rtl ? max(px - dragged_width + 1, 0) : px; - int drag_hlight_right = rtl ? px : min(px + dragged_width, max_width) - 1; - int drag_hlight_width = max(drag_hlight_right - drag_hlight_left + 1, 0); + int drag_hlight_left = rtl ? std::max(px - dragged_width + 1, 0) : px; + int drag_hlight_right = rtl ? px : std::min(px + dragged_width, max_width) - 1; + int drag_hlight_width = std::max(drag_hlight_right - drag_hlight_left + 1, 0); if (drag_hlight_width > 0) { GfxFillRect(drag_hlight_left + WD_FRAMERECT_LEFT, WD_FRAMERECT_TOP + 1, @@ -337,7 +337,7 @@ int GetTrainDetailsWndVScroll(VehicleID veh_id, TrainDetailsWindowTabs det_tab) } else { for (const Train *v = Train::Get(veh_id); v != nullptr; v = v->GetNextVehicle()) { GetCargoSummaryOfArticulatedVehicle(v, &_cargo_summary); - num += max(1u, (unsigned)_cargo_summary.size()); + num += std::max(1u, (unsigned)_cargo_summary.size()); uint length = GetLengthOfArticulatedVehicle(v); if (length > TRAIN_DETAILS_MAX_INDENT) num++; @@ -364,7 +364,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po y -= WD_MATRIX_TOP; int sprite_height = ScaleGUITrad(GetVehicleHeight(VEH_TRAIN)); - int line_height = max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); + int line_height = std::max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); int sprite_y_offset = line_height / 2; int text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2; @@ -405,9 +405,9 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po dx = 0; } - uint num_lines = max(1u, (unsigned)_cargo_summary.size()); + uint num_lines = std::max(1u, (unsigned)_cargo_summary.size()); for (uint i = 0; i < num_lines; i++) { - int sprite_width = max(dx, ScaleGUITrad(TRAIN_DETAILS_MIN_INDENT)) + 3; + int sprite_width = std::max(dx, ScaleGUITrad(TRAIN_DETAILS_MIN_INDENT)) + 3; int data_left = left + (rtl ? 0 : sprite_width); int data_right = right - (rtl ? sprite_width : 0); if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) { diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index 60eb781f58..f4610b5699 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -163,7 +163,7 @@ static void PlaceTree(TileIndex tile, uint32 r) TreeType tree = GetRandomTreeType(tile, GB(r, 24, 8)); if (tree != TREE_INVALID) { - PlantTreesOnTile(tile, tree, GB(r, 22, 2), min(GB(r, 16, 3), 6)); + PlantTreesOnTile(tile, tree, GB(r, 22, 2), std::min(GB(r, 16, 3), 6)); /* Rerandomize ground, if neither snow nor shore */ TreeGround ground = GetTreeGround(tile); @@ -658,7 +658,7 @@ static void TileLoopTreesAlps(TileIndex tile) default: return; } } else { - uint density = min(k, 3); + uint density = std::min(k, 3); if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT && GetTreeGround(tile) != TREE_GROUND_ROUGH_SNOW) { TreeGround tg = GetTreeGround(tile) == TREE_GROUND_ROUGH ? TREE_GROUND_ROUGH_SNOW : TREE_GROUND_SNOW_DESERT; diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index ee94c35afa..3dab92a201 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -65,8 +65,8 @@ static Dimension GetMaxTreeSpriteSize() for (int i = base; i < base + count; i++) { if (i >= (int)lengthof(tree_sprites)) return size; this_size = GetSpriteSize(tree_sprites[i].sprite, &offset); - size.width = max(size.width, 2 * max(this_size.width, -offset.x)); - size.height = max(size.height, max(this_size.height, -offset.y)); + size.width = std::max(size.width, 2 * std::max(this_size.width, -offset.x)); + size.height = std::max(size.height, std::max(this_size.height, -offset.y)); } return size; diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 0423cde1f9..e19b64c507 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -206,7 +206,7 @@ CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoC const BridgeSpec *b = GetBridgeSpec(bridge_type); if (b->avail_year > _cur_year) return CMD_ERROR; - uint max = min(b->max_length, _settings_game.construction.max_bridge_length); + uint max = std::min(b->max_length, _settings_game.construction.max_bridge_length); if (b->min_length > bridge_len) return CMD_ERROR; if (bridge_len <= max) return CommandCost(); @@ -1079,8 +1079,8 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis GetSlopePixelZOnEdge(ti->tileh, ReverseDiagDir(south_dir), &z_front_north, &z_back_north); /* Shared height of pillars */ - int z_front = max(z_front_north, z_front_south); - int z_back = max(z_back_north, z_back_south); + int z_front = std::max(z_front_north, z_front_south); + int z_back = std::max(z_back_north, z_back_south); /* x and y size of bounding-box of pillars */ int w = bounding_box_size[axis]; @@ -1912,7 +1912,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti if (v->type == VEH_ROAD) spd *= 2; Vehicle *first = v->First(); - first->cur_speed = min(first->cur_speed, spd); + first->cur_speed = std::min(first->cur_speed, spd); } if (vdir == dir) { diff --git a/src/vehicle.cpp b/src/vehicle.cpp index e358421186..e8901e059b 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -973,7 +973,7 @@ void CallVehicleTicks() Vehicle *front = v->First(); if (v->vcache.cached_cargo_age_period != 0) { - v->cargo_age_counter = min(v->cargo_age_counter, v->vcache.cached_cargo_age_period); + v->cargo_age_counter = std::min(v->cargo_age_counter, v->vcache.cached_cargo_age_period); if (--v->cargo_age_counter == 0) { v->cargo.AgeCargo(); v->cargo_age_counter = v->vcache.cached_cargo_age_period; @@ -1213,7 +1213,7 @@ Vehicle *CheckClickOnVehicle(const Viewport *vp, int x, int y) x >= v->coord.left && x <= v->coord.right && y >= v->coord.top && y <= v->coord.bottom) { - dist = max( + dist = std::max( abs(((v->coord.left + v->coord.right) >> 1) - x), abs(((v->coord.top + v->coord.bottom) >> 1) - y) ); @@ -1256,7 +1256,7 @@ void CheckVehicleBreakdown(Vehicle *v) /* decrease reliability */ if (!_settings_game.order.no_servicing_if_no_breakdowns || _settings_game.difficulty.vehicle_breakdowns != 0) { - v->reliability = rel = max((rel_old = v->reliability) - v->reliability_spd_dec, 0); + v->reliability = rel = std::max((rel_old = v->reliability) - v->reliability_spd_dec, 0); if ((rel_old >> 8) != (rel >> 8)) SetWindowDirty(WC_VEHICLE_DETAILS, v->index); } @@ -1271,7 +1271,7 @@ void CheckVehicleBreakdown(Vehicle *v) /* increase chance of failure */ int chance = v->breakdown_chance + 1; if (Chance16I(1, 25, r)) chance += 25; - v->breakdown_chance = min(255, chance); + v->breakdown_chance = std::min(255, chance); /* calculate reliability value to use in comparison */ rel = v->reliability; @@ -1281,7 +1281,7 @@ void CheckVehicleBreakdown(Vehicle *v) if (_settings_game.difficulty.vehicle_breakdowns == 1) rel += 0x6666; /* check if to break down */ - if (_breakdown_chance[(uint)min(rel, 0xffff) >> 10] <= v->breakdown_chance) { + if (_breakdown_chance[(uint)std::min(rel, 0xffff) >> 10] <= v->breakdown_chance) { v->breakdown_ctr = GB(r, 16, 6) + 0x3F; v->breakdown_delay = GB(r, 24, 7) + 0x80; v->breakdown_chance = 0; @@ -1623,10 +1623,10 @@ void Vehicle::UpdateViewport(bool dirty) this->MarkAllViewportsDirty(); } else { ::MarkAllViewportsDirty( - min(old_coord.left, this->coord.left), - min(old_coord.top, this->coord.top), - max(old_coord.right, this->coord.right), - max(old_coord.bottom, this->coord.bottom)); + std::min(old_coord.left, this->coord.left), + std::min(old_coord.top, this->coord.top), + std::max(old_coord.right, this->coord.right), + std::max(old_coord.bottom, this->coord.bottom)); } } } @@ -1724,7 +1724,7 @@ FreeUnitIDGenerator::FreeUnitIDGenerator(VehicleType type, CompanyID owner) : ca /* Find maximum */ for (const Vehicle *v : Vehicle::Iterate()) { if (v->type == type && v->owner == owner) { - this->maxid = max(this->maxid, v->unitnumber); + this->maxid = std::max(this->maxid, v->unitnumber); } } @@ -2279,7 +2279,7 @@ void Vehicle::HandleLoading(bool mode) { switch (this->current_order.GetType()) { case OT_LOADING: { - uint wait_time = max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0); + uint wait_time = std::max(this->current_order.GetTimetabledWait() - this->lateness_counter, 0); /* Not the first call for this tick, or still loading */ if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || this->current_order_time < wait_time) return; diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 7e1d3a8633..32706837f7 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -433,14 +433,14 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles, /* Store the result */ for (RefitResult &result : refit_result) { Vehicle *u = result.v; - u->refit_cap = (u->cargo_type == new_cid) ? min(result.capacity, u->refit_cap) : 0; + u->refit_cap = (u->cargo_type == new_cid) ? std::min(result.capacity, u->refit_cap) : 0; if (u->cargo.TotalCount() > u->refit_cap) u->cargo.Truncate(u->cargo.TotalCount() - u->refit_cap); u->cargo_type = new_cid; u->cargo_cap = result.capacity; u->cargo_subtype = result.subtype; if (u->type == VEH_AIRCRAFT) { Vehicle *w = u->Next(); - w->refit_cap = min(w->refit_cap, result.mail_capacity); + w->refit_cap = std::min(w->refit_cap, result.mail_capacity); w->cargo_cap = result.mail_capacity; if (w->cargo.TotalCount() > w->refit_cap) w->cargo.Truncate(w->cargo.TotalCount() - w->refit_cap); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 50a011c8ed..877767aa5e 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -39,8 +39,6 @@ #include "safeguards.h" -#include - BaseVehicleListWindow::GroupBy _grouping[VLT_END][VEH_COMPANY_END]; Sorting _sorting[BaseVehicleListWindow::GB_END]; @@ -168,7 +166,7 @@ uint GetUnitNumberDigits(VehicleList &vehicles) { uint unitnumber = 0; for (const Vehicle *v : vehicles) { - unitnumber = max(unitnumber, v->unitnumber); + unitnumber = std::max(unitnumber, v->unitnumber); } return CountDigitsForAllocatingSpace(unitnumber); @@ -189,7 +187,7 @@ void BaseVehicleListWindow::BuildVehicleList() for (auto it = this->vehicles.begin(); it != this->vehicles.end(); ++it) { this->vehgroups.emplace_back(it, it + 1, (*it)->GetDisplayProfitThisYear(), (*it)->GetDisplayProfitLastYear(), (*it)->age); - max_unitnumber = max(max_unitnumber, (*it)->unitnumber); + max_unitnumber = std::max(max_unitnumber, (*it)->unitnumber); } this->unitnumber_digits = CountDigitsForAllocatingSpace(max_unitnumber); } else { @@ -213,12 +211,12 @@ void BaseVehicleListWindow::BuildVehicleList() const Vehicle * const v = (*it); display_profit_this_year += v->GetDisplayProfitThisYear(); display_profit_last_year += v->GetDisplayProfitLastYear(); - age = max(age, v->age); + age = std::max(age, v->age); } this->vehgroups.emplace_back(begin, end, display_profit_this_year, display_profit_last_year, age); - max_num_vehicles = max(max_num_vehicles, static_cast(end - begin)); + max_num_vehicles = std::max(max_num_vehicles, static_cast(end - begin)); begin = end; } @@ -428,7 +426,7 @@ static void DrawVehicleRefitWindow(const SubtypeList list[NUM_CARGO], const int uint current = 0; bool rtl = _current_text_dir == TD_RTL; - uint iconwidth = max(GetSpriteSize(SPR_CIRCLE_FOLDED).width, GetSpriteSize(SPR_CIRCLE_UNFOLDED).width); + uint iconwidth = std::max(GetSpriteSize(SPR_CIRCLE_FOLDED).width, GetSpriteSize(SPR_CIRCLE_UNFOLDED).width); uint iconheight = GetSpriteSize(SPR_CIRCLE_FOLDED).height; int linecolour = _colour_gradient[COLOUR_ORANGE][4]; @@ -733,7 +731,7 @@ struct RefitWindow : public Window { /* Calculate sprite position. */ NWidgetCore *vehicle_panel_display = this->GetWidget(WID_VR_VEHICLE_PANEL_DISPLAY); - int sprite_width = max(0, ((int)vehicle_panel_display->current_x - this->vehicle_width) / 2); + int sprite_width = std::max(0, ((int)vehicle_panel_display->current_x - this->vehicle_width) / 2); this->sprite_left = vehicle_panel_display->pos_x; this->sprite_right = vehicle_panel_display->pos_x + vehicle_panel_display->current_x - 1; if (_current_text_dir == TD_RTL) { @@ -853,7 +851,7 @@ struct RefitWindow : public Window { } int right = Clamp(left + width, 0, r.right); - left = max(0, left); + left = std::max(0, left); if (_current_text_dir == TD_RTL) { right = this->GetWidget(WID_VR_VEHICLE_PANEL_DISPLAY)->current_x - left; @@ -926,7 +924,7 @@ struct RefitWindow : public Window { StringID string = this->GetCapacityString(&list[i][j]); if (string != INVALID_STRING_ID) { Dimension dim = GetStringBoundingBox(string); - max_width = max(dim.width, max_width); + max_width = std::max(dim.width, max_width); } } } @@ -960,8 +958,8 @@ struct RefitWindow : public Window { { drag_x = GetClickPosition(drag_x); - int left_x = min(this->click_x, drag_x); - int right_x = max(this->click_x, drag_x); + int left_x = std::min(this->click_x, drag_x); + int right_x = std::max(this->click_x, drag_x); this->num_vehicles = 0; Vehicle *v = Vehicle::Get(this->window_number); @@ -1499,7 +1497,7 @@ uint GetVehicleListHeight(VehicleType type, uint divisor) /* Name + vehicle + profit */ uint base = ScaleGUITrad(GetVehicleHeight(type)) + 2 * FONT_HEIGHT_SMALL; /* Drawing of the 4 small orders + profit*/ - if (type >= VEH_SHIP) base = max(base, 5U * FONT_HEIGHT_SMALL); + if (type >= VEH_SHIP) base = std::max(base, 5U * FONT_HEIGHT_SMALL); if (divisor == 1) return base; @@ -1521,13 +1519,13 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int int width = right - left; bool rtl = _current_text_dir == TD_RTL; - int text_offset = max(GetSpriteSize(SPR_PROFIT_LOT).width, GetDigitWidth() * this->unitnumber_digits) + WD_FRAMERECT_RIGHT; + int text_offset = std::max(GetSpriteSize(SPR_PROFIT_LOT).width, GetDigitWidth() * this->unitnumber_digits) + WD_FRAMERECT_RIGHT; int text_left = left + (rtl ? 0 : text_offset); int text_right = right - (rtl ? text_offset : 0); bool show_orderlist = this->vli.vtype >= VEH_SHIP; - int orderlist_left = left + (rtl ? 0 : max(ScaleGUITrad(100) + text_offset, width / 2)); - int orderlist_right = right - (rtl ? max(ScaleGUITrad(100) + text_offset, width / 2) : 0); + int orderlist_left = left + (rtl ? 0 : std::max(ScaleGUITrad(100) + text_offset, width / 2)); + int orderlist_right = right - (rtl ? std::max(ScaleGUITrad(100) + text_offset, width / 2) : 0); int image_left = (rtl && show_orderlist) ? orderlist_right : text_left; int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right; @@ -1535,7 +1533,7 @@ void BaseVehicleListWindow::DrawVehicleListItems(VehicleID selected_vehicle, int int vehicle_button_x = rtl ? right - GetSpriteSize(SPR_PROFIT_LOT).width : left; int y = r.top; - uint max = min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), static_cast(this->vehgroups.size())); + uint max = static_cast(std::min(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), this->vehgroups.size())); for (uint i = this->vscroll->GetPosition(); i < max; ++i) { const GUIVehicleGroup &vehgroup = this->vehgroups[i]; @@ -2200,7 +2198,7 @@ struct VehicleDetailsWindow : Window { } case WID_VD_MATRIX: - resize->height = max(ScaleGUITrad(14), WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); + resize->height = std::max(ScaleGUITrad(14), WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM); size->height = 4 * resize->height; break; @@ -2217,7 +2215,10 @@ struct VehicleDetailsWindow : Window { case WID_VD_SERVICING_INTERVAL: SetDParamMaxValue(0, MAX_SERVINT_DAYS); // Roughly the maximum interval SetDParamMaxValue(1, MAX_YEAR * DAYS_IN_YEAR); // Roughly the maximum year - size->width = max(GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT).width, GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS).width) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; + size->width = std::max( + GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT).width, + GetStringBoundingBox(STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS).width + ) + WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; size->height = WD_FRAMERECT_TOP + FONT_HEIGHT_NORMAL + WD_FRAMERECT_BOTTOM; break; } @@ -2749,7 +2750,7 @@ public: const Vehicle *v = Vehicle::Get(this->window_number); switch (widget) { case WID_VV_START_STOP: - size->height = max(size->height, max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).height, GetSpriteSize(SPR_FLAG_VEH_RUNNING).height) + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); + size->height = std::max(size->height, std::max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).height, GetSpriteSize(SPR_FLAG_VEH_RUNNING).height) + WD_IMGBTN_TOP + WD_IMGBTN_BOTTOM); break; case WID_VV_FORCE_PROCEED: @@ -2882,7 +2883,7 @@ public: /* Draw the flag plus orders. */ bool rtl = (_current_text_dir == TD_RTL); - uint text_offset = max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).width, GetSpriteSize(SPR_FLAG_VEH_RUNNING).width) + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; + uint text_offset = std::max(GetSpriteSize(SPR_FLAG_VEH_STOPPED).width, GetSpriteSize(SPR_FLAG_VEH_RUNNING).width) + WD_IMGBTN_LEFT + WD_IMGBTN_RIGHT; int text_left = r.left + (rtl ? (uint)WD_FRAMERECT_LEFT : text_offset); int text_right = r.right - (rtl ? text_offset : (uint)WD_FRAMERECT_RIGHT); int image_left = (rtl ? text_right + 1 : r.left) + WD_IMGBTN_LEFT; diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 9b0bef1ac7..9cab0805ea 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -26,7 +26,6 @@ #include "../thread.h" #include "allegro_v.h" #include -#include #include "../safeguards.h" diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index ea2a88bb92..dee0ff93d1 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #ifdef __EMSCRIPTEN__ # include # include @@ -635,8 +634,8 @@ int VideoDriver_SDL::PollEvent() // Force a redraw of the entire screen. _num_dirty_rects = MAX_DIRTY_RECTS + 1; } else if (ev.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { - int w = max(ev.window.data1, 64); - int h = max(ev.window.data2, 64); + int w = std::max(ev.window.data1, 64); + int h = std::max(ev.window.data2, 64); CreateMainSurface(w, h, w != ev.window.data1 || h != ev.window.data2); } else if (ev.window.event == SDL_WINDOWEVENT_ENTER) { // mouse entered the window, enable cursor diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 4f5167335a..3fae8e69bf 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include "../safeguards.h" @@ -583,8 +582,8 @@ int VideoDriver_SDL::PollEvent() break; case SDL_VIDEORESIZE: { - int w = max(ev.resize.w, 64); - int h = max(ev.resize.h, 64); + int w = std::max(ev.resize.w, 64); + int h = std::max(ev.resize.h, 64); CreateMainSurface(w, h); break; } diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index fa780dd3d5..29b85985fb 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include "../safeguards.h" @@ -903,8 +902,8 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP w = r->right - r->left - (r2.right - r2.left); h = r->bottom - r->top - (r2.bottom - r2.top); - w = max(w, 64); - h = max(h, 64); + w = std::max(w, 64); + h = std::max(h, 64); SetRect(&r2, 0, 0, w, h); AdjustWindowRect(&r2, GetWindowLong(hwnd, GWL_STYLE), FALSE); @@ -1037,8 +1036,8 @@ static bool AllocateDibSection(int w, int h, bool force) HDC dc; uint bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); - w = max(w, 64); - h = max(h, 64); + w = std::max(w, 64); + h = std::max(h, 64); if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals"); diff --git a/src/viewport.cpp b/src/viewport.cpp index 7c5fd93b3e..8fd6f373fb 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -695,10 +695,10 @@ void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, if (_draw_bounding_boxes && (image != SPR_EMPTY_BOUNDING_BOX)) { /* Compute maximal extents of sprite and its bounding box */ - left = min(left , RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x); - right = max(right , RemapCoords(x + bb_offset_x, y + h , z + bb_offset_z).x + 1); - top = min(top , RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y); - bottom = max(bottom, RemapCoords(x + w , y + h , z + bb_offset_z).y + 1); + left = std::min(left , RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x); + right = std::max(right , RemapCoords(x + bb_offset_x, y + h , z + bb_offset_z).x + 1); + top = std::min(top , RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y); + bottom = std::max(bottom, RemapCoords(x + w , y + h , z + bb_offset_z).y + 1); } /* Do not add the sprite to the viewport, if it is outside */ @@ -720,13 +720,13 @@ void AddSortableSpriteToDraw(SpriteID image, PaletteID pal, int x, int y, int w, ps.pal = pal; ps.sub = sub; ps.xmin = x + bb_offset_x; - ps.xmax = x + max(bb_offset_x, w) - 1; + ps.xmax = x + std::max(bb_offset_x, w) - 1; ps.ymin = y + bb_offset_y; - ps.ymax = y + max(bb_offset_y, h) - 1; + ps.ymax = y + std::max(bb_offset_y, h) - 1; ps.zmin = z + bb_offset_z; - ps.zmax = z + max(bb_offset_z, dz) - 1; + ps.zmax = z + std::max(bb_offset_z, dz) - 1; ps.first_child = -1; @@ -1556,7 +1556,7 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) * Also min coordinates can be > max so using max(xmin, xmax) + max(ymin, ymax) * to ensure that we iterate the current sprite as we need to remove it from the list. */ - auto ssum = max(s->xmax, s->xmin) + max(s->ymax, s->ymin); + auto ssum = std::max(s->xmax, s->xmin) + std::max(s->ymax, s->ymin); auto prev = sprite_list.before_begin(); auto x = sprite_list.begin(); while (x != sprite_list.end() && ((*x).first <= ssum)) { @@ -1917,11 +1917,11 @@ static void MarkViewportDirty(const Viewport *vp, int left, int top, int right, bottom -= vp->virtual_top; if (bottom <= 0) return; - left = max(0, left - vp->virtual_left); + left = std::max(0, left - vp->virtual_left); if (left >= vp->virtual_width) return; - top = max(0, top - vp->virtual_top); + top = std::max(0, top - vp->virtual_top); if (top >= vp->virtual_height) return; @@ -2222,7 +2222,7 @@ ViewportSignKdtreeItem ViewportSignKdtreeItem::MakeStation(StationID id) item.top = st->sign.top; /* Assume the sign can be a candidate for drawing, so measure its width */ - _viewport_sign_maxwidth = max(_viewport_sign_maxwidth, st->sign.width_normal); + _viewport_sign_maxwidth = std::max(_viewport_sign_maxwidth, st->sign.width_normal); return item; } @@ -2239,7 +2239,7 @@ ViewportSignKdtreeItem ViewportSignKdtreeItem::MakeWaypoint(StationID id) item.top = st->sign.top; /* Assume the sign can be a candidate for drawing, so measure its width */ - _viewport_sign_maxwidth = max(_viewport_sign_maxwidth, st->sign.width_normal); + _viewport_sign_maxwidth = std::max(_viewport_sign_maxwidth, st->sign.width_normal); return item; } @@ -2256,7 +2256,7 @@ ViewportSignKdtreeItem ViewportSignKdtreeItem::MakeTown(TownID id) item.top = town->cache.sign.top; /* Assume the sign can be a candidate for drawing, so measure its width */ - _viewport_sign_maxwidth = max(_viewport_sign_maxwidth, town->cache.sign.width_normal); + _viewport_sign_maxwidth = std::max(_viewport_sign_maxwidth, town->cache.sign.width_normal); return item; } @@ -2273,7 +2273,7 @@ ViewportSignKdtreeItem ViewportSignKdtreeItem::MakeSign(SignID id) item.top = sign->sign.top; /* Assume the sign can be a candidate for drawing, so measure its width */ - _viewport_sign_maxwidth = max(_viewport_sign_maxwidth, sign->sign.width_normal); + _viewport_sign_maxwidth = std::max(_viewport_sign_maxwidth, sign->sign.width_normal); return item; } @@ -2857,7 +2857,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t assert(style_t < lengthof(heightdiff_line_by_dir) - 13); h0 = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t]))); uint ht = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t + 1]))); - h0 = max(h0, ht); + h0 = std::max(h0, ht); /* Use lookup table for end-tile based on HighLightStyle direction * flip around side (lower/upper, left/right) based on distance */ @@ -2865,7 +2865,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t assert(style_t < lengthof(heightdiff_line_by_dir) - 13); h1 = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t]))); ht = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t + 1]))); - h1 = max(h1, ht); + h1 = std::max(h1, ht); break; } } diff --git a/src/viewport_sprite_sorter_sse4.cpp b/src/viewport_sprite_sorter_sse4.cpp index aac8333180..ae51218181 100644 --- a/src/viewport_sprite_sorter_sse4.cpp +++ b/src/viewport_sprite_sorter_sse4.cpp @@ -84,7 +84,7 @@ void ViewportSortParentSpritesSSE41(ParentSpriteToSortVector *psdv) * Also min coordinates can be > max so using max(xmin, xmax) + max(ymin, ymax) * to ensure that we iterate the current sprite as we need to remove it from the list. */ - auto ssum = max(s->xmax, s->xmin) + max(s->ymax, s->ymin); + auto ssum = std::max(s->xmax, s->xmin) + std::max(s->ymax, s->ymin); auto prev = sprite_list.before_begin(); auto x = sprite_list.begin(); while (x != sprite_list.end() && ((*x).first <= ssum)) { diff --git a/src/widget.cpp b/src/widget.cpp index c0844abd0b..2be2f2b85d 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -235,7 +235,7 @@ static inline void DrawLabel(const Rect &r, WidgetType type, bool clicked, Strin if (str == STR_NULL) return; if ((type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++; Dimension d = GetStringBoundingBox(str); - int offset = max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered + int offset = std::max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered DrawString(r.left + clicked, r.right + clicked, r.top + offset + clicked, str, TC_FROMSTRING, SA_HOR_CENTER); } @@ -248,7 +248,7 @@ static inline void DrawLabel(const Rect &r, WidgetType type, bool clicked, Strin static inline void DrawText(const Rect &r, TextColour colour, StringID str) { Dimension d = GetStringBoundingBox(str); - int offset = max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered + int offset = std::max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered if (str != STR_NULL) DrawString(r.left, r.right, r.top + offset, str, colour); } @@ -548,7 +548,7 @@ void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str) if (str != STR_NULL) { Dimension d = GetStringBoundingBox(str); - int offset = max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered + int offset = std::max(0, ((int)(r.bottom - r.top + 1) - (int)d.height) / 2); // Offset for rendering the text vertically centered DrawString(r.left + WD_CAPTIONTEXT_LEFT, r.right - WD_CAPTIONTEXT_RIGHT, r.top + offset, str, TC_FROMSTRING, SA_HOR_CENTER); } } @@ -565,11 +565,11 @@ void DrawCaption(const Rect &r, Colours colour, Owner owner, StringID str) */ static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicked_button, bool clicked_dropdown, StringID str) { - int text_offset = max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered + int text_offset = std::max(0, ((int)(r.bottom - r.top + 1) - FONT_HEIGHT_NORMAL) / 2); // Offset for rendering the text vertically centered int dd_width = NWidgetLeaf::dropdown_dimension.width; int dd_height = NWidgetLeaf::dropdown_dimension.height; - int image_offset = max(0, ((int)(r.bottom - r.top + 1) - dd_height) / 2); + int image_offset = std::max(0, ((int)(r.bottom - r.top + 1) - dd_height) / 2); if (_current_text_dir == TD_LTR) { DrawFrameRect(r.left, r.top, r.right - dd_width, r.bottom, colour, clicked_button ? FR_LOWERED : FR_NONE); @@ -814,8 +814,8 @@ NWidgetResizeBase::NWidgetResizeBase(WidgetType tp, uint fill_x, uint fill_y) : */ void NWidgetResizeBase::SetMinimalSize(uint min_x, uint min_y) { - this->min_x = max(this->min_x, min_x); - this->min_y = max(this->min_y, min_y); + this->min_x = std::max(this->min_x, min_x); + this->min_y = std::max(this->min_y, min_y); } /** @@ -1011,8 +1011,8 @@ void NWidgetStacked::SetupSmallestSize(Window *w, bool init_array) for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) { child_wid->SetupSmallestSize(w, init_array); - this->smallest_x = max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); - this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); + this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); + this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); this->fill_x = LeastCommonMultiple(this->fill_x, child_wid->fill_x); this->fill_y = LeastCommonMultiple(this->fill_y, child_wid->fill_y); this->resize_x = LeastCommonMultiple(this->resize_x, child_wid->resize_x); @@ -1142,9 +1142,9 @@ void NWidgetHorizontal::SetupSmallestSize(Window *w, bool init_array) uint max_vert_fill = 0; // Biggest vertical fill step. for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) { child_wid->SetupSmallestSize(w, init_array); - longest = max(longest, child_wid->smallest_x); - max_vert_fill = max(max_vert_fill, child_wid->GetVerticalStepSize(ST_SMALLEST)); - this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); + longest = std::max(longest, child_wid->smallest_x); + max_vert_fill = std::max(max_vert_fill, child_wid->GetVerticalStepSize(ST_SMALLEST)); + this->smallest_y = std::max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); } /* 1b. Make the container higher if needed to accommodate all children nicely. */ uint max_smallest = this->smallest_y + 3 * max_vert_fill; // Upper limit to computing smallest height. @@ -1232,7 +1232,7 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui uint hor_step = child_wid->GetHorizontalStepSize(sizing); if (hor_step > 0) { num_changing_childs++; - biggest_stepsize = max(biggest_stepsize, hor_step); + biggest_stepsize = std::max(biggest_stepsize, hor_step); } else { child_wid->current_x = child_wid->smallest_x; } @@ -1255,7 +1255,7 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui additional_length -= increment; continue; } - next_biggest_stepsize = max(next_biggest_stepsize, hor_step); + next_biggest_stepsize = std::max(next_biggest_stepsize, hor_step); } biggest_stepsize = next_biggest_stepsize; } @@ -1307,9 +1307,9 @@ void NWidgetVertical::SetupSmallestSize(Window *w, bool init_array) uint max_hor_fill = 0; // Biggest horizontal fill step. for (NWidgetBase *child_wid = this->head; child_wid != nullptr; child_wid = child_wid->next) { child_wid->SetupSmallestSize(w, init_array); - highest = max(highest, child_wid->smallest_y); - max_hor_fill = max(max_hor_fill, child_wid->GetHorizontalStepSize(ST_SMALLEST)); - this->smallest_x = max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); + highest = std::max(highest, child_wid->smallest_y); + max_hor_fill = std::max(max_hor_fill, child_wid->GetHorizontalStepSize(ST_SMALLEST)); + this->smallest_x = std::max(this->smallest_x, child_wid->smallest_x + child_wid->padding_left + child_wid->padding_right); } /* 1b. Make the container wider if needed to accommodate all children nicely. */ uint max_smallest = this->smallest_x + 3 * max_hor_fill; // Upper limit to computing smallest height. @@ -1388,7 +1388,7 @@ void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint uint vert_step = child_wid->GetVerticalStepSize(sizing); if (vert_step > 0) { num_changing_childs++; - biggest_stepsize = max(biggest_stepsize, vert_step); + biggest_stepsize = std::max(biggest_stepsize, vert_step); } else { child_wid->current_y = child_wid->smallest_y; } @@ -1411,7 +1411,7 @@ void NWidgetVertical::AssignSizePosition(SizingType sizing, uint x, uint y, uint additional_length -= increment; continue; } - next_biggest_stepsize = max(next_biggest_stepsize, vert_step); + next_biggest_stepsize = std::max(next_biggest_stepsize, vert_step); } biggest_stepsize = next_biggest_stepsize; } @@ -1772,14 +1772,14 @@ void NWidgetBackground::SetupSmallestSize(Window *w, bool init_array) if (w != nullptr && this->type == WWT_FRAME) { this->child->padding_left = WD_FRAMETEXT_LEFT; this->child->padding_right = WD_FRAMETEXT_RIGHT; - this->child->padding_top = max((int)WD_FRAMETEXT_TOP, this->widget_data != STR_NULL ? FONT_HEIGHT_NORMAL + WD_FRAMETEXT_TOP / 2 : 0); + this->child->padding_top = std::max((int)WD_FRAMETEXT_TOP, this->widget_data != STR_NULL ? FONT_HEIGHT_NORMAL + WD_FRAMETEXT_TOP / 2 : 0); this->child->padding_bottom = WD_FRAMETEXT_BOTTOM; this->smallest_x += this->child->padding_left + this->child->padding_right; this->smallest_y += this->child->padding_top + this->child->padding_bottom; if (this->index >= 0) w->SetStringParameters(this->index); - this->smallest_x = max(this->smallest_x, GetStringBoundingBox(this->widget_data).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); + this->smallest_x = std::max(this->smallest_x, GetStringBoundingBox(this->widget_data).width + WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT); } } else { Dimension d = {this->min_x, this->min_y}; @@ -2283,8 +2283,8 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array) } case WWT_EDITBOX: { Dimension sprite_size = GetSpriteSize(_current_text_dir == TD_RTL ? SPR_IMG_DELETE_RIGHT : SPR_IMG_DELETE_LEFT); - size.width = max(size.width, 30 + sprite_size.width); - size.height = max(sprite_size.height, GetStringBoundingBox("_").height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); + size.width = std::max(size.width, 30 + sprite_size.width); + size.height = std::max(sprite_size.height, GetStringBoundingBox("_").height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM); } FALLTHROUGH; case WWT_PUSHBTN: { @@ -2370,7 +2370,7 @@ void NWidgetLeaf::SetupSmallestSize(Window *w, bool init_array) if (this->index >= 0) w->SetStringParameters(this->index); Dimension d2 = GetStringBoundingBox(this->widget_data); d2.width += extra.width; - d2.height = max(d2.height, NWidgetLeaf::dropdown_dimension.height) + extra.height; + d2.height = std::max(d2.height, NWidgetLeaf::dropdown_dimension.height) + extra.height; size = maxdim(size, d2); break; } @@ -2588,7 +2588,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WWT_FRAME: if (*dest != nullptr) return num_used; *dest = new NWidgetBackground(parts->type, parts->u.widget.colour, parts->u.widget.index); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); *fill_dest = true; break; @@ -2605,7 +2605,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, *fill_dest = true; nwm->SetIndex(parts->u.widget.index); nwm->SetColour(parts->u.widget.colour); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); break; } @@ -2614,7 +2614,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, /* Ensure proper functioning even when the called code simply writes its largest index. */ int biggest = -1; *dest = parts->u.func_ptr(&biggest); - *biggest_index = max(*biggest_index, biggest); + *biggest_index = std::max(*biggest_index, biggest); *fill_dest = false; break; } @@ -2688,14 +2688,14 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case NWID_VIEWPORT: if (*dest != nullptr) return num_used; *dest = new NWidgetViewport(parts->u.widget.index); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); break; case NWID_HSCROLLBAR: case NWID_VSCROLLBAR: if (*dest != nullptr) return num_used; *dest = new NWidgetScrollbar(parts->type, parts->u.widget.colour, parts->u.widget.index); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); break; case NWID_SELECTION: { @@ -2704,7 +2704,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, *dest = nws; *fill_dest = true; nws->SetIndex(parts->u.widget.index); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); break; } @@ -2712,7 +2712,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, if (*dest != nullptr) return num_used; assert((parts->type & WWT_MASK) < WWT_LAST || (parts->type & WWT_MASK) == NWID_BUTTON_DROPDOWN); *dest = new NWidgetLeaf(parts->type, parts->u.widget.colour, parts->u.widget.index, 0x0, STR_NULL); - *biggest_index = max(*biggest_index, (int)parts->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); break; } num_used++; @@ -2845,7 +2845,7 @@ NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int int biggest2 = -1; MakeNWidgets(parts, count, &biggest2, body); - *biggest_index = max(*biggest_index, biggest2); + *biggest_index = std::max(*biggest_index, biggest2); return root; } diff --git a/src/widget_type.h b/src/widget_type.h index 3a36d9aad9..1b16770391 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -687,7 +687,7 @@ public: assert(capacity <= MAX_UVALUE(uint16)); this->cap = capacity; - if (this->cap + this->pos > this->count) this->pos = max(0, this->count - this->cap); + if (this->cap + this->pos > this->count) this->pos = std::max(0, this->count - this->cap); } void SetCapacityFromWidget(Window *w, int widget, int padding = 0); @@ -717,7 +717,7 @@ public: case SS_BIG: difference *= this->cap; break; default: break; } - this->SetPosition(Clamp(this->pos + difference, 0, max(this->count - this->cap, 0))); + this->SetPosition(Clamp(this->pos + difference, 0, std::max(this->count - this->cap, 0))); } /** diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index c450dc7b8c..97c755e4bc 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -83,7 +83,7 @@ DropDownListIconItem::DropDownListIconItem(SpriteID sprite, PaletteID pal, Strin uint DropDownListIconItem::Height(uint width) const { - return max(this->dim.height, (uint)FONT_HEIGHT_NORMAL); + return std::max(this->dim.height, (uint)FONT_HEIGHT_NORMAL); } uint DropDownListIconItem::Width() const @@ -381,7 +381,7 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button for (const auto &item : list) { height += item->Height(width); - if (auto_width) max_item_width = max(max_item_width, item->Width() + 5); + if (auto_width) max_item_width = std::max(max_item_width, item->Width() + 5); } /* Scrollbar needed? */ @@ -391,12 +391,12 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button bool above = false; /* Available height below (or above, if the dropdown is placed above the widget). */ - uint available_height = (uint)max(GetMainViewBottom() - top - 4, 0); + uint available_height = std::max(GetMainViewBottom() - top - 4, 0); /* If the dropdown doesn't fully fit below the widget... */ if (height > available_height) { - uint available_height_above = (uint)max(w->top + wi_rect.top - GetMainViewTop() - 4, 0); + uint available_height_above = std::max(w->top + wi_rect.top - GetMainViewTop() - 4, 0); /* Put the dropdown above if there is more available space. */ if (available_height_above > available_height) { @@ -426,7 +426,7 @@ void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button } } - if (auto_width) width = max(width, max_item_width); + if (auto_width) width = std::max(width, max_item_width); Point dw_pos = { w->left + (_current_text_dir == TD_RTL ? wi_rect.right + 1 - (int)width : wi_rect.left), top}; Dimension dw_size = {width, height}; diff --git a/src/window.cpp b/src/window.cpp index feabbfdd26..f67cda90f8 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -726,8 +726,8 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count) w->window_desc->pref_width = w->width; w->window_desc->pref_height = w->height; } else { - int16 def_width = max(min(w->window_desc->GetDefaultWidth(), _screen.width), w->nested_root->smallest_x); - int16 def_height = max(min(w->window_desc->GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y); + int16 def_width = std::max(std::min(w->window_desc->GetDefaultWidth(), _screen.width), w->nested_root->smallest_x); + int16 def_height = std::max(std::min(w->window_desc->GetDefaultHeight(), _screen.height - 50), w->nested_root->smallest_y); int dx = (w->resize.step_width == 0) ? 0 : def_width - w->width; int dy = (w->resize.step_height == 0) ? 0 : def_height - w->height; @@ -971,7 +971,7 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom) left < w->left + w->width && top < w->top + w->height) { /* Window w intersects with the rectangle => needs repaint */ - DrawOverlappedWindow(w, max(left, w->left), max(top, w->top), min(right, w->left + w->width), min(bottom, w->top + w->height)); + DrawOverlappedWindow(w, std::max(left, w->left), std::max(top, w->top), std::min(right, w->left + w->width), std::min(bottom, w->top + w->height)); } } _cur_dpi = old_dpi; @@ -1010,8 +1010,8 @@ void Window::ReInit(int rx, int ry) this->resize.step_height = this->nested_root->resize_y; /* Resize as close to the original size + requested resize as possible. */ - window_width = max(window_width + rx, this->width); - window_height = max(window_height + ry, this->height); + window_width = std::max(window_width + rx, this->width); + window_height = std::max(window_height + ry, this->height); int dx = (this->resize.step_width == 0) ? 0 : window_width - this->width; int dy = (this->resize.step_height == 0) ? 0 : window_height - this->height; /* dx and dy has to go by step.. calculate it. @@ -1525,8 +1525,8 @@ void Window::InitializePositionSize(int x, int y, int sm_width, int sm_height) */ void Window::FindWindowPlacementAndResize(int def_width, int def_height) { - def_width = max(def_width, this->width); // Don't allow default size to be smaller than smallest size - def_height = max(def_height, this->height); + def_width = std::max(def_width, this->width); // Don't allow default size to be smaller than smallest size + def_height = std::max(def_height, this->height); /* Try to make windows smaller when our window is too small. * w->(width|height) is normally the same as min_(width|height), * but this way the GUIs can be made a little more dynamic; @@ -1540,8 +1540,8 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height) wt = FindWindowById(WC_MAIN_TOOLBAR, 0); if (wt != nullptr) free_height -= wt->height; - int enlarge_x = max(min(def_width - this->width, _screen.width - this->width), 0); - int enlarge_y = max(min(def_height - this->height, free_height - this->height), 0); + int enlarge_x = std::max(std::min(def_width - this->width, _screen.width - this->width), 0); + int enlarge_y = std::max(std::min(def_height - this->height, free_height - this->height), 0); /* X and Y has to go by step.. calculate it. * The cast to int is necessary else x/y are implicitly casted to @@ -1562,8 +1562,8 @@ void Window::FindWindowPlacementAndResize(int def_width, int def_height) if (nx + this->width > _screen.width) nx -= (nx + this->width - _screen.width); const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - ny = max(ny, (wt == nullptr || this == wt || this->top == 0) ? 0 : wt->height); - nx = max(nx, 0); + ny = std::max(ny, (wt == nullptr || this == wt || this->top == 0) ? 0 : wt->height); + nx = std::max(nx, 0); if (this->viewport != nullptr) { this->viewport->left += nx - this->left; @@ -1711,7 +1711,7 @@ static Point GetAutoPlacePosition(int width, int height) */ int left = rtl ? _screen.width - width : 0, top = toolbar_y; int offset_x = rtl ? -(int)NWidgetLeaf::closebox_dimension.width : (int)NWidgetLeaf::closebox_dimension.width; - int offset_y = max(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WD_CAPTIONTEXT_TOP + WD_CAPTIONTEXT_BOTTOM); + int offset_y = std::max(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WD_CAPTIONTEXT_TOP + WD_CAPTIONTEXT_BOTTOM); restart: FOR_ALL_WINDOWS_FROM_BACK(w) { @@ -1763,8 +1763,8 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int Point pt; const Window *w; - int16 default_width = max(desc->GetDefaultWidth(), sm_width); - int16 default_height = max(desc->GetDefaultHeight(), sm_height); + int16 default_width = std::max(desc->GetDefaultWidth(), sm_width); + int16 default_height = std::max(desc->GetDefaultHeight(), sm_height); if (desc->parent_cls != WC_NONE && (w = FindWindowById(desc->parent_cls, window_number)) != nullptr) { bool rtl = _current_text_dir == TD_RTL; @@ -1777,16 +1777,16 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16 sm_width, int * - Y position: closebox of parent + closebox of child + statusbar * - X position: closebox on left/right, resizebox on right/left (depending on ltr/rtl) */ - int indent_y = max(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WD_CAPTIONTEXT_TOP + WD_CAPTIONTEXT_BOTTOM); + int indent_y = std::max(NWidgetLeaf::closebox_dimension.height, FONT_HEIGHT_NORMAL + WD_CAPTIONTEXT_TOP + WD_CAPTIONTEXT_BOTTOM); if (w->top + 3 * indent_y < _screen.height) { pt.y = w->top + indent_y; int indent_close = NWidgetLeaf::closebox_dimension.width; int indent_resize = NWidgetLeaf::resizebox_dimension.width; if (_current_text_dir == TD_RTL) { - pt.x = max(w->left + w->width - default_width - indent_close, 0); + pt.x = std::max(w->left + w->width - default_width - indent_close, 0); if (pt.x + default_width >= indent_close && pt.x + indent_resize <= _screen.width) return pt; } else { - pt.x = min(w->left + indent_close, _screen.width - default_width); + pt.x = std::min(w->left + indent_close, _screen.width - default_width); if (pt.x + default_width >= indent_resize && pt.x + indent_close <= _screen.width) return pt; } } @@ -2151,14 +2151,14 @@ void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen) * the resolution clamp it in such a manner that it stays within the bounds. */ int new_right = w->left + w->width + delta_x; int new_bottom = w->top + w->height + delta_y; - if (new_right >= (int)_cur_resolution.width) delta_x -= Ceil(new_right - _cur_resolution.width, max(1U, w->nested_root->resize_x)); - if (new_bottom >= (int)_cur_resolution.height) delta_y -= Ceil(new_bottom - _cur_resolution.height, max(1U, w->nested_root->resize_y)); + if (new_right >= (int)_cur_resolution.width) delta_x -= Ceil(new_right - _cur_resolution.width, std::max(1U, w->nested_root->resize_x)); + if (new_bottom >= (int)_cur_resolution.height) delta_y -= Ceil(new_bottom - _cur_resolution.height, std::max(1U, w->nested_root->resize_y)); } w->SetDirty(); - uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x); - uint new_yinc = max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y); + uint new_xinc = std::max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x); + uint new_yinc = std::max(0, (w->nested_root->resize_y == 0) ? 0 : (int)(w->nested_root->current_y - w->nested_root->smallest_y) + delta_y); assert(w->nested_root->resize_x == 0 || new_xinc % w->nested_root->resize_x == 0); assert(w->nested_root->resize_y == 0 || new_yinc % w->nested_root->resize_y == 0); @@ -2434,8 +2434,8 @@ static void HandleScrollbarScrolling(Window *w) } /* Find the item we want to move to and make sure it's inside bounds. */ - int pos = min(RoundDivSU(max(0, i + _scrollbar_start_pos) * sb->GetCount(), _scrollbar_size), max(0, sb->GetCount() - sb->GetCapacity())); - if (rtl) pos = max(0, sb->GetCount() - sb->GetCapacity() - pos); + int pos = std::min(RoundDivSU(std::max(0, i + _scrollbar_start_pos) * sb->GetCount(), _scrollbar_size), std::max(0, sb->GetCount() - sb->GetCapacity())); + if (rtl) pos = std::max(0, sb->GetCount() - sb->GetCapacity() - pos); if (pos != sb->GetPosition()) { sb->SetPosition(pos); w->SetDirty(); @@ -3581,7 +3581,7 @@ void RelocateAllWindows(int neww, int newh) continue; case WC_MAIN_TOOLBAR: - ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false); + ResizeWindow(w, std::min(neww, _toolbar_width) - w->width, 0, false); top = w->top; left = PositionMainToolbar(w); // changes toolbar orientation @@ -3593,14 +3593,14 @@ void RelocateAllWindows(int neww, int newh) break; case WC_STATUS_BAR: - ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false); + ResizeWindow(w, std::min(neww, _toolbar_width) - w->width, 0, false); top = newh - w->height; left = PositionStatusbar(w); break; case WC_SEND_NETWORK_MSG: - ResizeWindow(w, min(neww, _toolbar_width) - w->width, 0, false); + ResizeWindow(w, std::min(neww, _toolbar_width) - w->width, 0, false); top = newh - w->height - FindWindowById(WC_STATUS_BAR, 0)->height; left = PositionNetworkChatWindow(w); From d9ec8053d7e545fd5b1b06760a592c1c0c07d103 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 7 Jan 2021 08:40:27 +0100 Subject: [PATCH 05/50] Fix #8050: ending-year of 5000000 allows you to get to year 5000001 and beyond MAX_YEAR is set to 5000000, but having an ending-year set to the same meant you could bypass this, and play till the uint32 wrapped. The game can either show highscore or wrap year, not both. When you would do both, every year you get the highscore dialog. By changing the maximum value of ending-year to 4999999 we prevent this issue. --- src/table/settings.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/table/settings.ini b/src/table/settings.ini index 97c892b0bf..1142bcc5ea 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1423,7 +1423,7 @@ from = SLV_ENDING_YEAR guiflags = SGF_0ISDISABLED def = DEF_END_YEAR min = MIN_YEAR -max = MAX_YEAR +max = MAX_YEAR - 1 interval = 1 str = STR_CONFIG_SETTING_ENDING_YEAR strhelp = STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT From a1987df96acda0f58f88f2e154e26c529f59670b Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 7 Jan 2021 08:55:35 +0100 Subject: [PATCH 06/50] Fix #8050: never show the highscore when disabled, not even if you start in year zero Using zero as "never" value can have its drawbacks ;) --- src/date.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/date.cpp b/src/date.cpp index 97758a3ebf..397d02c54a 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -200,11 +200,13 @@ static void OnNewYear() if (_cur_year == _settings_client.gui.semaphore_build_before) ResetSignalVariant(); - /* check if we reached end of the game (end of ending year) */ - if (_cur_year == _settings_game.game_creation.ending_year + 1) { + /* check if we reached end of the game (end of ending year); 0 = never */ + if (_cur_year == _settings_game.game_creation.ending_year + 1 && _settings_game.game_creation.ending_year != 0) { ShowEndGameChart(); + } + /* check if we reached the maximum year, decrement dates by a year */ - } else if (_cur_year == MAX_YEAR + 1) { + if (_cur_year == MAX_YEAR + 1) { int days_this_year; _cur_year--; From ef6b17baf74119e5c1515482cd6feb837afbe90b Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 7 Jan 2021 09:06:27 +0100 Subject: [PATCH 07/50] Fix 2fd871e2af5: load correct ending-year for old (pre 0.7) savegames Despite what it looked like, you could never really change the ending-year (it was always reset to 2050 on start-up). See commit 683b65ee1 for details. As a side-effect, the variable that was suppose to store the ending-year was just zero, never containing a real ending-year. --- src/date.cpp | 2 -- src/saveload/afterload.cpp | 7 +------ src/table/settings.ini | 12 ++---------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/date.cpp b/src/date.cpp index 397d02c54a..18e1ad180c 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -28,8 +28,6 @@ Date _date; ///< Current date in days (day counter) DateFract _date_fract; ///< Fractional part of the day. uint16 _tick_counter; ///< Ever incrementing (and sometimes wrapping) tick counter for setting off various events -int32 _old_ending_year_slv_105; ///< Old ending year for savegames before SLV_105 - /** * Set the date. * @param date New date diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index c3aef307b2..42e36022ab 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -755,12 +755,7 @@ bool AfterLoadGame() _settings_game.linkgraph.distribution_default = DT_MANUAL; } - if (IsSavegameVersionBefore(SLV_105)) { - extern int32 _old_ending_year_slv_105; // in date.cpp - _settings_game.game_creation.ending_year = _old_ending_year_slv_105 - 1; - } else if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) { - /* Ending year was a GUI setting before SLV_105, was removed in revision 683b65ee1 (svn r14755). */ - /* This also converts scenarios, both when loading them into the editor, and when starting a new game. */ + if (IsSavegameVersionBefore(SLV_ENDING_YEAR)) { _settings_game.game_creation.ending_year = DEF_END_YEAR; } diff --git a/src/table/settings.ini b/src/table/settings.ini index 1142bcc5ea..573d8e7109 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -47,8 +47,6 @@ static bool UpdateServerPassword(int32 p1); static bool UpdateRconPassword(int32 p1); static bool UpdateClientConfigValues(int32 p1); -extern int32 _old_ending_year_slv_105; - /* End - Callback Functions for the various settings */ /* Some settings do not need to be synchronised when playing in multiplayer. @@ -1405,15 +1403,9 @@ str = STR_CONFIG_SETTING_STARTING_YEAR strval = STR_JUST_INT cat = SC_BASIC -[SDTG_VAR] -name = ""old_ending_year_slv_105"" -var = _old_ending_year_slv_105 -flags = SLF_NOT_IN_CONFIG -type = SLE_INT32 +[SDT_NULL] +length = 4 to = SLV_105 -def = DEF_END_YEAR -min = MIN_YEAR -max = MAX_YEAR [SDT_VAR] base = GameSettings From ebd9f26c152a400d55d52bad77ec97ea2f5788fe Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 6 Jan 2021 19:39:20 +0100 Subject: [PATCH 08/50] Fix: replacing a bridge didn't charge for clearing last tile It only considered the end-tile (or start-tile) for the bridge, instead of both. This is obvious in the rest of the code which constantly does "+ 2"; this being the only place that does a "+ 1". --- src/tunnelbridge_cmd.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index e19b64c507..1ac747bc2d 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -296,6 +296,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u } else { if (bridge_len > _settings_game.construction.max_bridge_length) return_cmd_error(STR_ERROR_BRIDGE_TOO_LONG); } + bridge_len += 2; // begin and end tiles/ramps int z_start; int z_end; @@ -372,7 +373,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u return_cmd_error(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER); } - cost.AddCost((bridge_len + 1) * _price[PR_CLEAR_BRIDGE]); // The cost of clearing the current bridge. + cost.AddCost(bridge_len * _price[PR_CLEAR_BRIDGE]); // The cost of clearing the current bridge. owner = GetTileOwner(tile_start); /* If bridge belonged to bankrupt company, it has a new owner now */ @@ -497,7 +498,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u switch (transport_type) { case TRANSPORT_RAIL: /* Add to company infrastructure count if required. */ - if (is_new_owner && c != nullptr) c->infrastructure.rail[railtype] += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; + if (is_new_owner && c != nullptr) c->infrastructure.rail[railtype] += bridge_len * TUNNELBRIDGE_TRACKBIT_FACTOR; MakeRailBridgeRamp(tile_start, owner, bridge_type, dir, railtype); MakeRailBridgeRamp(tile_end, owner, bridge_type, ReverseDiagDir(dir), railtype); SetTunnelBridgeReservation(tile_start, pbs_reservation); @@ -514,11 +515,11 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u /* Add all new road types to the company infrastructure counter. */ if (!hasroad && road_rt != INVALID_ROADTYPE) { /* A full diagonal road tile has two road bits. */ - c->infrastructure.road[road_rt] += (bridge_len + 2) * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR; + c->infrastructure.road[road_rt] += bridge_len * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR; } if (!hastram && tram_rt != INVALID_ROADTYPE) { /* A full diagonal road tile has two road bits. */ - c->infrastructure.road[tram_rt] += (bridge_len + 2) * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR; + c->infrastructure.road[tram_rt] += bridge_len * 2 * TUNNELBRIDGE_TRACKBIT_FACTOR; } } Owner owner_road = hasroad ? GetRoadOwner(tile_start, RTT_ROAD) : company; @@ -529,7 +530,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u } case TRANSPORT_WATER: - if (is_new_owner && c != nullptr) c->infrastructure.water += (bridge_len + 2) * TUNNELBRIDGE_TRACKBIT_FACTOR; + if (is_new_owner && c != nullptr) c->infrastructure.water += bridge_len * TUNNELBRIDGE_TRACKBIT_FACTOR; MakeAqueductBridgeRamp(tile_start, owner, dir); MakeAqueductBridgeRamp(tile_end, owner, ReverseDiagDir(dir)); CheckForDockingTile(tile_start); @@ -557,8 +558,6 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u * For (non-spectated) AI, Towns this has to be of course calculated. */ Company *c = Company::GetIfValid(company); if (!(flags & DC_QUERY_COST) || (c != nullptr && c->is_ai && company != _local_company)) { - bridge_len += 2; // begin and end tiles/ramps - switch (transport_type) { case TRANSPORT_ROAD: if (road_rt != INVALID_ROADTYPE) { From aac8c28d7369a4394303449ce5307067379067bd Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 6 Jan 2021 21:12:32 +0100 Subject: [PATCH 09/50] Fix #7656: destroying a tunnel/bridge now first removes the tracks for cost calculation This means that for rail tunnel/bridges, the rail is first sold, and the tunnel/bridge is destroyed after. This means destroying tunnels/ bridges now often makes you money, instead of costing. Similar, with road/tram tracks. Destroying a road+tram tunnel/bridge now costs the same amount of money as first removing the tram tracks and than destroying the road tunnel/bridge. Especially as tram tracks generate money when removing, this is a noticeable difference. --- regression/regression/result.txt | 6 ++--- src/tunnelbridge_cmd.cpp | 41 +++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/regression/regression/result.txt b/regression/regression/result.txt index 2153cdaade..84d8feaffe 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -7314,7 +7314,7 @@ ERROR: IsEnd() is invalid as Begin() is never called IsBuoyTile(): false IsLockTile(): false IsCanalTile(): false - GetBankBalance(): 1999979664 + GetBankBalance(): 1999979304 BuildWaterDepot(): true BuildDock(): true BuildBuoy(): true @@ -7327,7 +7327,7 @@ ERROR: IsEnd() is invalid as Begin() is never called IsBuoyTile(): true IsLockTile(): true IsCanalTile(): true - GetBankBalance(): 1999965040 + GetBankBalance(): 1999964680 --AIWaypointList(BUOY)-- Count(): 1 @@ -7346,7 +7346,7 @@ ERROR: IsEnd() is invalid as Begin() is never called IsBuoyTile(): false IsLockTile(): false IsCanalTile(): false - GetBankBalance(): 1999959645 + GetBankBalance(): 1999959285 BuildWaterDepot(): true BuildDock(): true diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 1ac747bc2d..e71440fc2e 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -213,6 +213,38 @@ CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoC return_cmd_error(STR_ERROR_BRIDGE_TOO_LONG); } +/** + * Calculate the base cost of clearing a tunnel/bridge per tile. + * @param tile Start tile of the tunnel/bridge. + * @return How much clearing this tunnel/bridge costs per tile. + */ +static Money TunnelBridgeClearCost(TileIndex tile, Price base_price) +{ + Money base_cost = _price[base_price]; + + /* Add the cost of the transport that is on the tunnel/bridge. */ + switch (GetTunnelBridgeTransportType(tile)) { + case TRANSPORT_ROAD: { + RoadType road_rt = GetRoadTypeRoad(tile); + RoadType tram_rt = GetRoadTypeTram(tile); + + if (road_rt != INVALID_ROADTYPE) { + base_cost += 2 * RoadClearCost(road_rt); + } + if (tram_rt != INVALID_ROADTYPE) { + base_cost += 2 * RoadClearCost(tram_rt); + } + } break; + + case TRANSPORT_RAIL: base_cost += RailClearCost(GetRailType(tile)); break; + /* Aquaducts have their own clear price. */ + case TRANSPORT_WATER: base_cost = _price[PR_CLEAR_AQUEDUCT]; break; + default: break; + } + + return base_cost; +} + /** * Build a Bridge * @param end_tile end tile @@ -373,7 +405,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u return_cmd_error(STR_ERROR_AREA_IS_OWNED_BY_ANOTHER); } - cost.AddCost(bridge_len * _price[PR_CLEAR_BRIDGE]); // The cost of clearing the current bridge. + /* The cost of clearing the current bridge. */ + cost.AddCost(bridge_len * TunnelBridgeClearCost(tile_start, PR_CLEAR_BRIDGE)); owner = GetTileOwner(tile_start); /* If bridge belonged to bankrupt company, it has a new owner now */ @@ -849,6 +882,7 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags) ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, flags); } + Money base_cost = TunnelBridgeClearCost(tile, PR_CLEAR_TUNNEL); uint len = GetTunnelBridgeLength(tile, endtile) + 2; // Don't forget the end tiles. if (flags & DC_EXEC) { @@ -889,7 +923,8 @@ static CommandCost DoClearTunnel(TileIndex tile, DoCommandFlag flags) DoClearSquare(endtile); } } - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_CLEAR_TUNNEL] * len); + + return CommandCost(EXPENSES_CONSTRUCTION, len * base_cost); } @@ -928,7 +963,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM, flags); } - Money base_cost = (GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) ? _price[PR_CLEAR_BRIDGE] : _price[PR_CLEAR_AQUEDUCT]; + Money base_cost = TunnelBridgeClearCost(tile, PR_CLEAR_BRIDGE); uint len = GetTunnelBridgeLength(tile, endtile) + 2; // Don't forget the end tiles. if (flags & DC_EXEC) { From 7463c46a54bed2d21ee8e8e2e8cfe9d67f5f45dc Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 12:02:38 +0100 Subject: [PATCH 10/50] Fix: for arctic and tropic, make sure we have at least a few hills (#8513) Without hills, not all industries can be generated, which means that with a default configuration you get errors. This is far from optimal, of course. This now forces that there is at least some hills, even when you are using very-flat. This is a stopgap solution, but a proper solution requires a full rewrite of the terrain generator, which is not a 2 minute (or even 2 week) job. To make sure flat is still flat-ish, reduce the default snow-line-height to 10, making it look a lot better on smaller maps. This is a compromise between being able to have flat maps and still having all industries on arctic. --- src/tgp.cpp | 22 +++++++++++++++++++++- src/tile_type.h | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/tgp.cpp b/src/tgp.cpp index f6d902255d..190499cbc1 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -234,7 +234,27 @@ static height_t TGPGetMaxHeight() { 12, 19, 25, 31, 67, 75, 87 }, ///< Alpinist }; - int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS]; + int map_size_bucket = std::min(MapLogX(), MapLogY()) - MIN_MAP_SIZE_BITS; + int max_height_from_table = max_height[_settings_game.difficulty.terrain_type][map_size_bucket]; + + /* Arctic needs snow to have all industries, so make sure we allow TGP to generate this high. */ + if (_settings_game.game_creation.landscape == LT_ARCTIC) { + max_height_from_table += _settings_newgame.game_creation.snow_line_height; + /* Make flat a bit more flat by removing "very flat" from it, to somewhat compensate for the increase we just did. */ + if (_settings_game.difficulty.terrain_type > 0) { + max_height_from_table -= max_height[_settings_game.difficulty.terrain_type - 1][map_size_bucket]; + } + } + /* Tropic needs tropical forest to have all industries, so make sure we allow TGP to generate this high. + * Tropic forest always starts at 1/4th of the max height. */ + if (_settings_game.game_creation.landscape == LT_TROPIC) { + max_height_from_table += CeilDiv(_settings_game.construction.max_heightlevel, 4); + /* Make flat a bit more flat by removing "very flat" from it, to somewhat compensate for the increase we just did. */ + if (_settings_game.difficulty.terrain_type > 0) { + max_height_from_table -= max_height[_settings_game.difficulty.terrain_type - 1][map_size_bucket]; + } + } + return I2H(std::min(max_height_from_table, _settings_game.construction.max_heightlevel)); } diff --git a/src/tile_type.h b/src/tile_type.h index 132b566f0f..c1e7081f04 100644 --- a/src/tile_type.h +++ b/src/tile_type.h @@ -26,7 +26,7 @@ static const uint DEF_MAX_HEIGHTLEVEL = 30; ///< Default maxi static const uint MAX_MAX_HEIGHTLEVEL = MAX_TILE_HEIGHT; ///< Upper bound of maximum allowed heightlevel (in the construction settings) static const uint MIN_SNOWLINE_HEIGHT = 2; ///< Minimum snowline height -static const uint DEF_SNOWLINE_HEIGHT = 15; ///< Default snowline height +static const uint DEF_SNOWLINE_HEIGHT = 10; ///< Default snowline height static const uint MAX_SNOWLINE_HEIGHT = (MAX_TILE_HEIGHT - 2); ///< Maximum allowed snowline height From 4059ccf863909a777932f6d8f2e937a2bf97b7bb Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 15:20:27 +0100 Subject: [PATCH 11/50] Fix: [Actions] circumvent Windows tar warning about read-only files (#8524) Because certain files are read-only, the "restore-cache" step fails, as Windows tar refuses to overwrite those files (even if they are identical). Instead of hoping upstream fixes "restore-cache", just remove the read-only flag on these files instead. --- .github/workflows/ci-build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 08f3a7a198..8b9a160d96 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -220,6 +220,18 @@ jobs: - name: Checkout uses: actions/checkout@v2 + # "restore-cache" which is done by "run-vcpkg" uses Windows tar. + # A git clone on windows marks a few files as read-only; when Windows tar + # tries to extract the cache over this folder, it fails, despite the files + # being identical. This failure shows up as an warning in the logs. We + # avoid this by simply removing the read-only mark from the git folder. + # In other words: this is a hack! + # See: https://github.com/lukka/run-vcpkg/issues/61 + - name: Remove read-only flag from vcpkg git folder + shell: powershell + run: | + attrib -r "c:\vcpkg\.git\*.*" /s + - name: Prepare vcpkg (with cache) uses: lukka/run-vcpkg@v6 with: From fda1fbf61cbce0b857a14122fe8d6341c6411a98 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 15:25:44 +0100 Subject: [PATCH 12/50] Revert c1fddb9, 639cfa4: "Codechange: Check if access __attribute__ is supported before trying to use it." (#8526) This reverts commit c1fddb9a6ae5c3af6865461a7295788a341011a2 and 639cfa43d23aa142cabbf2f08ec20a2133b0503e. access_mode "none" is only supported by GCC11, but introduced after it branched. So there are GCC11.0s out there that do not support it. We will have to wait for GCC11.1 to hit before we can re-add this. --- src/stdafx.h | 10 ---------- src/string_func.h | 16 ++++++++-------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/stdafx.h b/src/stdafx.h index 0244e567d3..e5cb9205ff 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -137,16 +137,6 @@ # endif #endif /* __GNUC__ || __clang__ */ -#if defined __has_attribute -# if __has_attribute (access) -# define NOACCESS(args) __attribute__ ((access (none, args))) -# else -# define NOACCESS(args) -# endif -#else -# define NOACCESS(args) -#endif - #if defined(__WATCOMC__) # define NORETURN # define CDECL diff --git a/src/string_func.h b/src/string_func.h index 7a53710c23..13e14f2d39 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -30,25 +30,25 @@ #include "core/bitmath_func.hpp" #include "string_type.h" -char *strecat(char *dst, const char *src, const char *last) NOACCESS(3); -char *strecpy(char *dst, const char *src, const char *last) NOACCESS(3); -char *stredup(const char *src, const char *last = nullptr) NOACCESS(2); +char *strecat(char *dst, const char *src, const char *last); +char *strecpy(char *dst, const char *src, const char *last); +char *stredup(const char *src, const char *last = nullptr); -int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4) NOACCESS(2); -int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) WARN_FORMAT(3, 0) NOACCESS(2); +int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4); +int CDECL vseprintf(char *str, const char *last, const char *format, va_list ap) WARN_FORMAT(3, 0); char *CDECL str_fmt(const char *str, ...) WARN_FORMAT(1, 2); -void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK) NOACCESS(2); +void str_validate(char *str, const char *last, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); std::string str_validate(const std::string &str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); void ValidateString(const char *str); -void str_fix_scc_encoded(char *str, const char *last) NOACCESS(2); +void str_fix_scc_encoded(char *str, const char *last); void str_strip_colours(char *str); bool strtolower(char *str); bool strtolower(std::string &str, std::string::size_type offs = 0); -bool StrValid(const char *str, const char *last) NOACCESS(2); +bool StrValid(const char *str, const char *last); /** * Check if a string buffer is empty. From 9aa39d0af9f6a4423e37e82a46a6558e51beeece Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 16:04:44 +0100 Subject: [PATCH 13/50] Fix #7972: show invalid orders to stations that don't accept your vehicle (#8516) Before it was shown as a normal order, but the vehicle was skipping it. This was rather unclear to the user. Now it is red and contains text with some hints what is going on. The text is prefixed rather than post-fixed, as we have many post-fixes already. --- src/lang/english.txt | 1 + src/order_gui.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index c92d03cb62..52b10d8d11 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4021,6 +4021,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Refit to {STRI STR_ORDER_STOP_ORDER :(Stop) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING1} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Can't use station){POP_COLOUR} {STRING} {STATION} {STRING1} STR_ORDER_IMPLICIT :(Implicit) diff --git a/src/order_gui.cpp b/src/order_gui.cpp index d26d00278a..d3b4aa9527 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -28,6 +28,7 @@ #include "hotkeys.h" #include "aircraft.h" #include "engine_func.h" +#include "vehicle_func.h" #include "widgets/order_widget.h" @@ -258,8 +259,9 @@ void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int case OT_GOTO_STATION: { OrderLoadFlags load = order->GetLoadType(); OrderUnloadFlags unload = order->GetUnloadType(); + bool valid_station = CanVehicleUseStation(v, Station::Get(order->GetDestination())); - SetDParam(0, STR_ORDER_GO_TO_STATION); + SetDParam(0, valid_station ? STR_ORDER_GO_TO_STATION : STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION); SetDParam(1, STR_ORDER_GO_TO + (v->IsGroundVehicle() ? order->GetNonStopType() : 0)); SetDParam(2, order->GetDestination()); From a6aec252b1987d11e09f2778e481ae3d6fb916fa Mon Sep 17 00:00:00 2001 From: Chris Stevens Date: Fri, 8 Jan 2021 15:05:49 +0000 Subject: [PATCH 14/50] Fix #8153: Report incompatible cargo/order when autoreplace fails (#8169) --- src/autoreplace_cmd.cpp | 43 ++++++++++++++++++++++++++++++++++++++++- src/lang/english.txt | 2 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 313de99cf0..5785968cf0 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -20,6 +20,8 @@ #include "vehiclelist.h" #include "road.h" #include "ai/ai.hpp" +#include "news_func.h" +#include "strings_func.h" #include "table/strings.h" @@ -191,6 +193,29 @@ static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, EngineID engine_ty return true; } +/** + * Gets the index of the first refit order that is incompatible with the requested engine type + * @param v The vehicle to be replaced + * @param engine_type The type we want to replace with + * @return index of the incompatible order or -1 if none were found + */ +static int GetIncompatibleRefitOrderIdForAutoreplace(const Vehicle *v, EngineID engine_type) +{ + CargoTypes union_refit_mask = GetUnionOfArticulatedRefitMasks(engine_type, false); + + const Order *o; + const Vehicle *u = (v->type == VEH_TRAIN) ? v->First() : v; + + const OrderList *orders = u->orders.list; + for (VehicleOrderID i = 0; i < orders->GetNumOrders(); i++) { + o = orders->GetOrderAt(i); + if (!o->IsRefit()) continue; + if (!HasBit(union_refit_mask, o->GetRefitCargo())) return i; + } + + return -1; +} + /** * Function to find what type of cargo to refit to when autoreplacing * @param *v Original vehicle that is being replaced. @@ -293,7 +318,23 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic /* Does it need to be refitted */ CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain); - if (refit_cargo == CT_INVALID) return CommandCost(); // incompatible cargoes + if (refit_cargo == CT_INVALID) { + SetDParam(0, old_veh->index); + + int order_id = GetIncompatibleRefitOrderIdForAutoreplace(old_veh, e); + if (order_id != -1) { + /* Orders contained a refit order that is incompatible with the new vehicle. */ + SetDParam(1, STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT); + SetDParam(2, order_id + 1); // 1-based indexing for display + } else { + /* Current cargo is incompatible with the new vehicle. */ + SetDParam(1, STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO); + SetDParam(2, CargoSpec::Get(old_veh->cargo_type)->name); + } + + AddVehicleAdviceNewsItem(STR_NEWS_VEHICLE_AUTORENEW_FAILED, old_veh->index); + return CommandCost(); + } /* Build the new vehicle */ cost = DoCommand(old_veh->tile, e | (CT_INVALID << 24), 0, DC_EXEC | DC_AUTOREPLACE, GetCmdBuildVeh(old_veh)); diff --git a/src/lang/english.txt b/src/lang/english.txt index 52b10d8d11..52b75f413f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4474,6 +4474,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Wrong depot typ STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} is too long after replacement STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}No autoreplace/renew rules applied STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(money limit) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}New vehicle can't carry {STRING} +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}New vehicle can't do refit in order {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Impossible track combination From 85a49a0d3605b83b911c57c6e5cc9d8b79365131 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 7 Jan 2021 22:28:08 +0100 Subject: [PATCH 15/50] Change: always allow to click on the toolbar icons for road/rail/dock/airport This change allows a user to see what is available and what will become available before it is available, instead of only disabling the button with no further explanation. It also always allows building roads and canals, even if no vehicles are available for road / water. For rail/road/tram, a dropdown with available types is shown. If none are available, it reads "None". If the type is not yet available, it is greyed out. For dock/airport, this always open the toolbar, but building airports, docks, and depots buttons are disabled till vehicles are available for those. Road is the only exception, with the primary road always being available. Here too, stations and depots are disabled till vehicles become available. It does mean you can now always build roads to for example help towns grow. --- src/airport_gui.cpp | 10 ++++++++-- src/dock_gui.cpp | 3 --- src/rail_gui.cpp | 13 ------------- src/road_gui.cpp | 16 +++++++++++----- src/toolbar_gui.cpp | 11 +++-------- 5 files changed, 22 insertions(+), 31 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 8760e1f2a8..62eca78f9f 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -71,6 +71,7 @@ struct BuildAirToolbarWindow : Window { BuildAirToolbarWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc) { this->InitNested(window_number); + this->OnInvalidateData(); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); this->last_user_action = WIDGET_LIST_END; } @@ -90,7 +91,13 @@ struct BuildAirToolbarWindow : Window { { if (!gui_scope) return; - if (!CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) delete this; + bool can_build = CanBuildVehicleInfrastructure(VEH_AIRCRAFT); + this->SetWidgetsDisabledState(!can_build, + WID_AT_AIRPORT, + WIDGET_LIST_END); + if (!can_build) { + DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); + } } void OnClick(Point pt, int widget, int click_count) override @@ -160,7 +167,6 @@ struct BuildAirToolbarWindow : Window { */ static EventState AirportToolbarGlobalHotkeys(int hotkey) { - if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) return ES_NOT_HANDLED; Window *w = ShowBuildAirToolbar(); if (w == nullptr) return ES_NOT_HANDLED; return w->OnHotkey(hotkey); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 30a60e74f7..7e2d618572 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -144,17 +144,14 @@ struct BuildDocksToolbarWindow : Window { break; case WID_DT_DEPOT: // Build depot button - if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; if (HandlePlacePushButton(this, WID_DT_DEPOT, SPR_CURSOR_SHIP_DEPOT, HT_RECT)) ShowBuildDocksDepotPicker(this); break; case WID_DT_STATION: // Build station button - if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; if (HandlePlacePushButton(this, WID_DT_STATION, SPR_CURSOR_DOCK, HT_SPECIAL)) ShowBuildDockStationPicker(this); break; case WID_DT_BUOY: // Build buoy button - if (!CanBuildVehicleInfrastructure(VEH_SHIP)) return; HandlePlacePushButton(this, WID_DT_BUOY, SPR_CURSOR_BUOY, HT_RECT); break; diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 177f72accb..37c365881f 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -436,18 +436,6 @@ struct BuildRailToolbarWindow : Window { if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0, false); } - /** - * Some data on this window has become invalid. - * @param data Information about the changed data. - * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. - */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override - { - if (!gui_scope) return; - - if (!CanBuildVehicleInfrastructure(VEH_TRAIN)) delete this; - } - /** * Configures the rail toolbar for railtype given * @param railtype the railtype to display @@ -781,7 +769,6 @@ struct BuildRailToolbarWindow : Window { */ static EventState RailToolbarGlobalHotkeys(int hotkey) { - if (_game_mode != GM_NORMAL || !CanBuildVehicleInfrastructure(VEH_TRAIN)) return ES_NOT_HANDLED; extern RailType _last_built_railtype; Window *w = ShowBuildRailToolbar(_last_built_railtype); if (w == nullptr) return ES_NOT_HANDLED; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 1e1f3e807f..dff4d2bc10 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -304,7 +304,17 @@ struct BuildRoadToolbarWindow : Window { { if (!gui_scope) return; - if (_game_mode != GM_EDITOR && !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) delete this; + bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype)); + this->SetWidgetsDisabledState(!can_build, + WID_ROT_DEPOT, + WID_ROT_BUS_STATION, + WID_ROT_TRUCK_STATION, + WIDGET_LIST_END); + if (!can_build) { + DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); + DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); + DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + } } void Initialize(RoadType roadtype) @@ -434,7 +444,6 @@ struct BuildRoadToolbarWindow : Window { break; case WID_ROT_DEPOT: - if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return; if (HandlePlacePushButton(this, WID_ROT_DEPOT, this->rti->cursor.depot, HT_RECT)) { ShowRoadDepotPicker(this); this->last_started_action = widget; @@ -442,7 +451,6 @@ struct BuildRoadToolbarWindow : Window { break; case WID_ROT_BUS_STATION: - if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return; if (HandlePlacePushButton(this, WID_ROT_BUS_STATION, SPR_CURSOR_BUS_STATION, HT_RECT)) { ShowRVStationPicker(this, ROADSTOP_BUS); this->last_started_action = widget; @@ -450,7 +458,6 @@ struct BuildRoadToolbarWindow : Window { break; case WID_ROT_TRUCK_STATION: - if (_game_mode == GM_EDITOR || !CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype))) return; if (HandlePlacePushButton(this, WID_ROT_TRUCK_STATION, SPR_CURSOR_TRUCK_STATION, HT_RECT)) { ShowRVStationPicker(this, ROADSTOP_TRUCK); this->last_started_action = widget; @@ -711,7 +718,6 @@ static EventState RoadTramToolbarGlobalHotkeys(int hotkey, RoadType last_build, Window* w = nullptr; switch (_game_mode) { case GM_NORMAL: - if (!CanBuildVehicleInfrastructure(VEH_ROAD, rtt)) return ES_NOT_HANDLED; w = ShowBuildRoadToolbar(last_build); break; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 224c8ccdb1..6a851d2b5d 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2033,11 +2033,6 @@ struct MainToolbarWindow : Window { this->SetWidgetDisabledState(WID_TN_GOAL, Goal::GetNumItems() == 0); this->SetWidgetDisabledState(WID_TN_STORY, StoryPage::GetNumItems() == 0); - this->SetWidgetDisabledState(WID_TN_RAILS, !CanBuildVehicleInfrastructure(VEH_TRAIN)); - this->SetWidgetDisabledState(WID_TN_ROADS, !CanBuildVehicleInfrastructure(VEH_ROAD, RTT_ROAD)); - this->SetWidgetDisabledState(WID_TN_TRAMS, !CanBuildVehicleInfrastructure(VEH_ROAD, RTT_TRAM)); - this->SetWidgetDisabledState(WID_TN_AIR, !CanBuildVehicleInfrastructure(VEH_AIRCRAFT)); - this->DrawWidgets(); } @@ -2078,11 +2073,11 @@ struct MainToolbarWindow : Window { case MTHK_AIRCRAFT_LIST: ShowVehicleListWindow(_local_company, VEH_AIRCRAFT); break; case MTHK_ZOOM_IN: ToolbarZoomInClick(this); break; case MTHK_ZOOM_OUT: ToolbarZoomOutClick(this); break; - case MTHK_BUILD_RAIL: if (CanBuildVehicleInfrastructure(VEH_TRAIN)) ShowBuildRailToolbar(_last_built_railtype); break; + case MTHK_BUILD_RAIL: ShowBuildRailToolbar(_last_built_railtype); break; case MTHK_BUILD_ROAD: ShowBuildRoadToolbar(_last_built_roadtype); break; - case MTHK_BUILD_TRAM: if (CanBuildVehicleInfrastructure(VEH_ROAD, RTT_TRAM)) ShowBuildRoadToolbar(_last_built_tramtype); break; + case MTHK_BUILD_TRAM: ShowBuildRoadToolbar(_last_built_tramtype); break; case MTHK_BUILD_DOCKS: ShowBuildDocksToolbar(); break; - case MTHK_BUILD_AIRPORT: if (CanBuildVehicleInfrastructure(VEH_AIRCRAFT)) ShowBuildAirToolbar(); break; + case MTHK_BUILD_AIRPORT: ShowBuildAirToolbar(); break; case MTHK_BUILD_TREES: ShowBuildTreesToolbar(); break; case MTHK_MUSIC: ShowMusicWindow(); break; case MTHK_AI_DEBUG: ShowAIDebugWindow(); break; From af22a4f2cda86a7667578281a51ea1ec08a49af6 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Thu, 7 Jan 2021 23:06:23 +0100 Subject: [PATCH 16/50] Add: show in the tooltip of disabled toolbar buttons why they are disabled --- src/airport_gui.cpp | 5 +++++ src/dock_gui.cpp | 9 +++++++++ src/lang/english.txt | 3 +++ src/road_gui.cpp | 12 +++++++++++- src/widget.cpp | 9 +++++++++ src/widget_type.h | 1 + 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 62eca78f9f..e12b8dccbd 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -97,6 +97,11 @@ struct BuildAirToolbarWindow : Window { WIDGET_LIST_END); if (!can_build) { DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR); + + /* Show in the tooltip why this button is disabled. */ + this->GetWidget(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + } else { + this->GetWidget(WID_AT_AIRPORT)->SetToolTip(STR_TOOLBAR_AIRCRAFT_BUILD_AIRPORT_TOOLTIP); } } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 7e2d618572..39237f5ca1 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -125,6 +125,15 @@ struct BuildDocksToolbarWindow : Window { if (!can_build) { DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER); DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); + + /* Show in the tooltip why this button is disabled. */ + this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + } else { + this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP); + this->GetWidget(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP); + this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP); } } diff --git a/src/lang/english.txt b/src/lang/english.txt index 52b75f413f..a0cf2b9a0f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2353,6 +2353,9 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Build a STR_JOIN_WAYPOINT_CAPTION :{WHITE}Join waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Build a separate waypoint +# Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Disabled as currently no vehicles are available for this infrastructure + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Railway Construction STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Electrified Railway Construction diff --git a/src/road_gui.cpp b/src/road_gui.cpp index dff4d2bc10..b9f59333d4 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -303,8 +303,9 @@ struct BuildRoadToolbarWindow : Window { void OnInvalidateData(int data = 0, bool gui_scope = true) override { if (!gui_scope) return; + RoadTramType rtt = GetRoadTramType(this->roadtype); - bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD, GetRoadTramType(this->roadtype)); + bool can_build = CanBuildVehicleInfrastructure(VEH_ROAD, rtt); this->SetWidgetsDisabledState(!can_build, WID_ROT_DEPOT, WID_ROT_BUS_STATION, @@ -314,6 +315,15 @@ struct BuildRoadToolbarWindow : Window { DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + + /* Show in the tooltip why this button is disabled. */ + this->GetWidget(WID_ROT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + } else { + this->GetWidget(WID_ROT_DEPOT)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT); + this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION); + this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION); } } diff --git a/src/widget.cpp b/src/widget.cpp index 2be2f2b85d..d1ba44679b 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -895,6 +895,15 @@ void NWidgetCore::SetDataTip(uint32 widget_data, StringID tool_tip) this->tool_tip = tool_tip; } +/** + * Set the tool tip of the nested widget. + * @param tool_tip Tool tip string to use. + */ +void NWidgetCore::SetToolTip(StringID tool_tip) +{ + this->tool_tip = tool_tip; +} + void NWidgetCore::FillNestedArray(NWidgetBase **array, uint length) { if (this->index >= 0 && (uint)(this->index) < length) array[this->index] = this; diff --git a/src/widget_type.h b/src/widget_type.h index 1b16770391..d8841f9bd2 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -285,6 +285,7 @@ public: void SetIndex(int index); void SetDataTip(uint32 widget_data, StringID tool_tip); + void SetToolTip(StringID tool_tip); inline void SetLowered(bool lowered); inline bool IsLowered() const; From b9f3e45af7bef330acdd87cfc9c8086433d6c439 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Sun, 5 Apr 2020 19:30:22 +0100 Subject: [PATCH 17/50] Cleanup: Remove unused (and mostly duplicated) function --- src/road.cpp | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/src/road.cpp b/src/road.cpp index 486dc0044c..788c611654 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -295,39 +295,3 @@ RoadTypes ExistingRoadTypes(CompanyID c) return known_roadtypes; } - -/** - * Check whether we can build infrastructure for the given RoadType. This to disable building stations etc. when - * you are not allowed/able to have the RoadType yet. - * @param roadtype the roadtype to check this for - * @param company the company id to check this for - * @param any_date to check only existing vehicles or if it is possible to build them in the future - * @return true if there is any reason why you may build the infrastructure for the given roadtype - */ -bool CanBuildRoadTypeInfrastructure(RoadType roadtype, CompanyID company) -{ - if (_game_mode != GM_EDITOR && !Company::IsValidID(company)) return false; - if (!_settings_client.gui.disable_unsuitable_building) return true; - if (!HasAnyRoadTypesAvail(company, GetRoadTramType(roadtype))) return false; - - RoadTypes roadtypes = ExistingRoadTypes(company); - - /* Check if the filtered roadtypes does have the roadtype we are checking for - * and if we can build new ones */ - if (_settings_game.vehicle.max_roadveh > 0 && HasBit(roadtypes, roadtype)) { - /* Can we actually build the vehicle type? */ - for (const Engine *e : Engine::IterateType(VEH_ROAD)) { - if (!HasBit(e->company_avail, company)) continue; - if (HasPowerOnRoad(e->u.road.roadtype, roadtype) || HasPowerOnRoad(roadtype, e->u.road.roadtype)) return true; - } - return false; - } - - /* We should be able to build infrastructure when we have the actual vehicle type */ - for (const Vehicle *v : Vehicle::Iterate()) { - if (v->type == VEH_ROAD && (company == OWNER_DEITY || v->owner == company) && - HasBit(roadtypes, RoadVehicle::From(v)->roadtype) && HasPowerOnRoad(RoadVehicle::From(v)->roadtype, roadtype)) return true; - } - - return false; -} From 188bf0fbc92b26cbbd5bcd67c5352ab7f6ad769b Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Sun, 5 Apr 2020 19:36:25 +0100 Subject: [PATCH 18/50] Change: Remove disable_unsuitable_building setting This setting is no longer useful, as you can now always build roads, canals, etc. --- src/settings_gui.cpp | 1 - src/settings_type.h | 1 - src/table/settings.ini | 9 --------- src/vehicle.cpp | 1 - 4 files changed, 12 deletions(-) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index f0d9b7f3ba..e04c50ac34 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1555,7 +1555,6 @@ static SettingsContainer &GetSettingsTree() construction->Add(new SettingEntry("gui.persistent_buildingtools")); construction->Add(new SettingEntry("gui.quick_goto")); construction->Add(new SettingEntry("gui.default_rail_type")); - construction->Add(new SettingEntry("gui.disable_unsuitable_building")); } interface->Add(new SettingEntry("gui.autosave")); diff --git a/src/settings_type.h b/src/settings_type.h index 219888a73b..3c325a0cc0 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -108,7 +108,6 @@ struct GUISettings { uint8 window_soft_limit; ///< soft limit of maximum number of non-stickied non-vital windows (0 = no limit) ZoomLevel zoom_min; ///< minimum zoom out level ZoomLevel zoom_max; ///< maximum zoom out level - bool disable_unsuitable_building; ///< disable infrastructure building when no suitable vehicles are available byte autosave; ///< how often should we do autosaves? bool threaded_saves; ///< should we do threaded saves? bool keep_all_autosave; ///< name the autosave in a different way diff --git a/src/table/settings.ini b/src/table/settings.ini index 573d8e7109..eebb23f7e9 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -3048,15 +3048,6 @@ def = true str = STR_CONFIG_SETTING_WARN_LOST_VEHICLE strhelp = STR_CONFIG_SETTING_WARN_LOST_VEHICLE_HELPTEXT -[SDTC_BOOL] -var = gui.disable_unsuitable_building -flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC -def = true -str = STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING -strhelp = STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING_HELPTEXT -proc = RedrawScreen -cat = SC_EXPERT - [SDTC_BOOL] var = gui.new_nonstop flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC diff --git a/src/vehicle.cpp b/src/vehicle.cpp index e8901e059b..17e843255b 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1792,7 +1792,6 @@ bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype) assert(IsCompanyBuildableVehicleType(type)); if (!Company::IsValidID(_local_company)) return false; - if (!_settings_client.gui.disable_unsuitable_building) return true; UnitID max; switch (type) { From bbc96fd37c56a7bf69d4c0a8c7b8e5cc89a0a16d Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Thu, 7 Jan 2021 16:04:01 +0000 Subject: [PATCH 19/50] Fix: Don't add -mno-sse4 on arm64 --- cmake/CompileFlags.cmake | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index f0b8af0613..772041a42c 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -129,14 +129,16 @@ macro(compile_flags) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - include(CheckCXXCompilerFlag) - check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND) - - if(NO_SSE4_FOUND) - add_compile_options( - # Don't use SSE4 for general sources to increase compatibility. - -mno-sse4 - ) + if (NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64") + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND) + + if(NO_SSE4_FOUND) + add_compile_options( + # Don't use SSE4 for general sources to increase compatibility. + -mno-sse4 + ) + endif() endif() endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") From fec5ce093f1f20b71f3b9a2d9008bd95065b0399 Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Thu, 7 Jan 2021 13:51:50 +0000 Subject: [PATCH 20/50] Feature: Build ARM64 (Apple Silicon) version for macOS --- .github/workflows/release.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 275a994d99..efd58bfbd6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -366,8 +366,10 @@ jobs: include: - arch: x64 full_arch: x86_64 + - arch: arm64 + full_arch: arm64 - runs-on: macos-11.0 + runs-on: macos-10.15 env: MACOSX_DEPLOYMENT_TARGET: 10.9 @@ -381,11 +383,20 @@ jobs: run: | tar -xf source.tar.gz --strip-components=1 + # The following step can be removed and the default vcpkg installation + # (/usr/local/share/vcpkg) restored when the build VM is updated with a revision of + # vcpkg dating from roughly 01/01/2021 or later. + - name: Update vcpkg + run: | + cd /tmp + git clone https://github.com/Microsoft/vcpkg + - name: Prepare vcpkg (with cache) uses: lukka/run-vcpkg@v6 with: - vcpkgDirectory: '/usr/local/share/vcpkg' - doNotUpdateVcpkg: true + vcpkgDirectory: '/tmp/vcpkg' + doNotUpdateVcpkg: false + vcpkgGitCommitId: 2a42024b53ebb512fb5dd63c523338bf26c8489c vcpkgArguments: 'freetype liblzma lzo' vcpkgTriplet: '${{ matrix.arch }}-osx' @@ -418,7 +429,7 @@ jobs: cmake ${GITHUB_WORKSPACE} \ -DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \ -DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \ - -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DCMAKE_TOOLCHAIN_FILE=/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ # EOF From 9c0da686da260962c68a6a0ec58fe10cbf4dc421 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Fri, 8 Jan 2021 12:32:44 -0500 Subject: [PATCH 21/50] Add: Towns can build tunnels (#8473) --- src/town_cmd.cpp | 104 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 87 insertions(+), 17 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 6bd78ff0d0..3ea1ce436a 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1109,44 +1109,44 @@ static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd) } /** - * Checks if a town road can be continued on the other side of a bridge. + * Checks if a town road can be continued into the next tile. + * Road vehicle stations, bridges, and tunnels are fine, as long as they are facing the right direction. * - * @param end_tile The end tile of the bridge - * @param bridge_dir The direction of the bridge + * @param tile The tile where the road would be built + * @param road_dir The direction of the road * @return true if the road can be continued, else false */ -static bool CanRoadContinueAfterBridge(const Town* t, const TileIndex end_tile, const DiagDirection bridge_dir) +static bool CanRoadContinueIntoNextTile(const Town* t, const TileIndex tile, const DiagDirection road_dir) { - const int delta = TileOffsByDiagDir(bridge_dir); // +1 tile in the direction of the bridge - TileIndex next_tile = end_tile + delta; // The tile beyond the bridge - RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(bridge_dir)); + 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 + RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir)); RoadType rt = GetTownRoadType(t); /* Before we try anything, make sure the tile is on the map and not the void. */ if (!IsValidTile(next_tile)) return false; - /* If the next tile is a bridge or tunnel, allow if it's a road bridge/tunnel continuing in the same direction. */ + /* If the next tile is a bridge or tunnel, allow if it's continuing in the same direction. */ if (IsTileType(next_tile, MP_TUNNELBRIDGE)) { - return GetTunnelBridgeTransportType(next_tile) == TRANSPORT_ROAD && GetTunnelBridgeDirection(next_tile) == bridge_dir; + return GetTunnelBridgeTransportType(next_tile) == TRANSPORT_ROAD && GetTunnelBridgeDirection(next_tile) == road_dir; } /* If the next tile is a station, allow if it's a road station facing the proper direction. Otherwise return false. */ if (IsTileType(next_tile, MP_STATION)) { /* If the next tile is a road station, allow if it's facing the same direction, otherwise disallow. */ - return IsRoadStop(next_tile) && GetRoadStopDir(next_tile) == ReverseDiagDir(bridge_dir); + return IsRoadStop(next_tile) && GetRoadStopDir(next_tile) == ReverseDiagDir(road_dir); } - /* If the next tile is a road depot, allow if it's facing the new bridge. */ + /* If the next tile is a road depot, allow if it's facing the right way. */ if (IsTileType(next_tile, MP_ROAD)) { - return IsRoadDepot(next_tile) && GetRoadDepotDirection(next_tile) == ReverseDiagDir(bridge_dir); + return IsRoadDepot(next_tile) && GetRoadDepotDirection(next_tile) == ReverseDiagDir(road_dir); } /* If the next tile is a railroad track, check if towns are allowed to build level crossings. - * If level crossing are not allowed, reject the bridge. Else allow DoCommand to determine if the rail track is buildable. */ + * If level crossing are not allowed, reject the construction. Else allow DoCommand to determine if the rail track is buildable. */ if (IsTileType(next_tile, MP_RAILWAY) && !_settings_game.economy.allow_town_level_crossings) return false; - /* If a road tile can be built, the bridge is allowed. - * If not, the bridge is rejected. */ + /* If a road tile can be built, the construction is allowed. */ return DoCommand(next_tile, rcmd | (rt << 4), t->index, DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD).Succeeded(); } @@ -1208,7 +1208,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi if (bridge_length == 1) return false; /* Make sure the road can be continued past the bridge. At this point, bridge_tile holds the end tile of the bridge. */ - if (!CanRoadContinueAfterBridge(t, bridge_tile, bridge_dir)) return false; + if (!CanRoadContinueIntoNextTile(t, bridge_tile, bridge_dir)) return false; for (uint8 times = 0; times <= 22; times++) { byte bridge_type = RandomRange(MAX_BRIDGES - 1); @@ -1225,6 +1225,75 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi return false; } +/** + * Grows the town with a tunnel. + * First we check if a tunnel is reasonable. + * If so we check if we are able to build it. + * + * @param t The current town + * @param tile The current tile + * @param tunnel_dir The valid direction in which to grow a tunnel + * @return true if a tunnel has been built, else false + */ +static bool GrowTownWithTunnel(const Town* t, const TileIndex tile, const DiagDirection tunnel_dir) +{ + assert(tunnel_dir < DIAGDIR_END); + + Slope slope = GetTileSlope(tile); + + /* Only consider building a tunnel if the starting tile is sloped properly. */ + if (slope != InclinedSlope(tunnel_dir)) return false; + + /* Assure that the tunnel is connectable to the start side */ + if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(tunnel_dir))) & DiagDirToRoadBits(tunnel_dir))) return false; + + const int delta = TileOffsByDiagDir(tunnel_dir); + int max_tunnel_length = 0; + + /* There are two conditions for building tunnels: Under a mountain and under an obstruction. */ + if (CanRoadContinueIntoNextTile(t, tile, tunnel_dir)) { + /* Only tunnel under a mountain if the slope is continuous for at least 4 tiles. We want tunneling to be a last resort for large hills. */ + TileIndex slope_tile = tile; + for (uint8 tiles = 0; tiles < 4; tiles++) { + slope = GetTileSlope(slope_tile); + if (slope != InclinedSlope(tunnel_dir) && !IsSteepSlope(slope) && !IsSlopeWithOneCornerRaised(slope)) return false; + slope_tile += delta; + } + + /* More population means longer tunnels, but make sure we can at least cover the smallest mountain which neccesitates tunneling. */ + max_tunnel_length = (t->cache.population / 1000) + 7; + } else { + /* When tunneling under an obstruction, the length limit is 5, enough to tunnel under a four-track railway. */ + max_tunnel_length = 5; + } + + uint8 tunnel_length = 0; + TileIndex tunnel_tile = tile; // Iteratator to store the other end tile of the tunnel. + + /* Find the end tile of the tunnel for length and continuation checks. */ + do { + if (tunnel_length++ >= max_tunnel_length) return false; + tunnel_tile += delta; + /* The tunnel ends when start and end tiles are the same height. */ + } while (IsValidTile(tunnel_tile) && GetTileZ(tile) != GetTileZ(tunnel_tile)); + + /* Don't allow a tunnel where the start and end tiles are adjacent. */ + if (tunnel_length == 1) return false; + + /* Make sure the road can be continued past the tunnel. At this point, tunnel_tile holds the end tile of the tunnel. */ + 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. */ + RoadType rt = GetTownRoadType(t); + if (DoCommand(tile, rt | (TRANSPORT_ROAD << 8), 0, CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_TUNNEL)), CMD_BUILD_TUNNEL).Succeeded()) { + DoCommand(tile, rt | (TRANSPORT_ROAD << 8), 0, DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags(CMD_BUILD_TUNNEL)), CMD_BUILD_TUNNEL); + _grow_town_result = GROWTH_SUCCEED; + return true; + } + + return false; +} + /** * Checks whether at least one surrounding roads allows to build a house here * @@ -1460,10 +1529,11 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t rcmd = CleanUpRoadBits(tile, rcmd); if (rcmd == ROAD_NONE) return; - /* Only use the target direction for bridges to ensure they're connected. + /* Only use the target direction for bridges and tunnels to ensure they're connected. * The target_dir is as computed previously according to town layout, so * it will match it perfectly. */ if (GrowTownWithBridge(t1, tile, target_dir)) return; + if (GrowTownWithTunnel(t1, tile, target_dir)) return; GrowTownWithRoad(t1, tile, rcmd); } From b08c66a796c8f9d1430201717fc6b5f0cc31f7c7 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Fri, 8 Jan 2021 12:56:39 -0500 Subject: [PATCH 22/50] Fix 7bdfb38: Drive-thru road stations can be connected at either end (#8528) --- src/town_cmd.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 3ea1ce436a..3a2cd70871 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1112,6 +1112,7 @@ static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd) * Checks if a town road can be continued into the next tile. * Road vehicle stations, bridges, and tunnels are fine, as long as they are facing the right direction. * + * @param t The current town * @param tile The tile where the road would be built * @param road_dir The direction of the road * @return true if the road can be continued, else false @@ -1133,8 +1134,8 @@ static bool CanRoadContinueIntoNextTile(const Town* t, const TileIndex tile, con /* If the next tile is a station, allow if it's a road station facing the proper direction. Otherwise return false. */ if (IsTileType(next_tile, MP_STATION)) { - /* If the next tile is a road station, allow if it's facing the same direction, otherwise disallow. */ - return IsRoadStop(next_tile) && GetRoadStopDir(next_tile) == ReverseDiagDir(road_dir); + /* If the next tile is a road station, allow if it can be entered by the new tunnel/bridge, otherwise disallow. */ + return IsRoadStop(next_tile) && (GetRoadStopDir(next_tile) == ReverseDiagDir(road_dir) || (IsDriveThroughStopTile(next_tile) && GetRoadStopDir(next_tile) == road_dir)); } /* If the next tile is a road depot, allow if it's facing the right way. */ From 0f1d338dda71df118b9dc380dca942915e184317 Mon Sep 17 00:00:00 2001 From: translators Date: Fri, 8 Jan 2021 18:26:47 +0000 Subject: [PATCH 23/50] Update: Translations from eints korean: 2 changes by telk5093 finnish: 2 changes by hpiirai dutch: 49 changes by Afoklala spanish: 16 changes by Luis45ccs french: 7 changes by dimensi0n polish: 2 changes by yazalo --- src/lang/afrikaans.txt | 2 + src/lang/arabic_egypt.txt | 2 + src/lang/basque.txt | 2 + src/lang/belarusian.txt | 2 + src/lang/brazilian_portuguese.txt | 2 + src/lang/bulgarian.txt | 2 + src/lang/catalan.txt | 2 + src/lang/croatian.txt | 2 + src/lang/czech.txt | 2 + src/lang/danish.txt | 2 + src/lang/dutch.txt | 59 ++++++++++++++++++++++++++---- src/lang/english_AU.txt | 2 + src/lang/english_US.txt | 2 + src/lang/esperanto.txt | 2 + src/lang/estonian.txt | 2 + src/lang/faroese.txt | 2 + src/lang/finnish.txt | 4 ++ src/lang/french.txt | 9 +++++ src/lang/gaelic.txt | 2 + src/lang/galician.txt | 2 + src/lang/german.txt | 2 + src/lang/greek.txt | 2 + src/lang/hebrew.txt | 2 + src/lang/hungarian.txt | 2 + src/lang/icelandic.txt | 2 + src/lang/indonesian.txt | 2 + src/lang/irish.txt | 2 + src/lang/italian.txt | 2 + src/lang/japanese.txt | 2 + src/lang/korean.txt | 4 ++ src/lang/latin.txt | 2 + src/lang/latvian.txt | 2 + src/lang/lithuanian.txt | 2 + src/lang/luxembourgish.txt | 2 + src/lang/malay.txt | 2 + src/lang/norwegian_bokmal.txt | 2 + src/lang/norwegian_nynorsk.txt | 2 + src/lang/polish.txt | 4 ++ src/lang/portuguese.txt | 2 + src/lang/romanian.txt | 2 + src/lang/russian.txt | 2 + src/lang/serbian.txt | 2 + src/lang/simplified_chinese.txt | 2 + src/lang/slovak.txt | 2 + src/lang/slovenian.txt | 2 + src/lang/spanish.txt | 26 +++++++++---- src/lang/spanish_MX.txt | 2 + src/lang/swedish.txt | 2 + src/lang/tamil.txt | 2 + src/lang/thai.txt | 2 + src/lang/traditional_chinese.txt | 2 + src/lang/turkish.txt | 2 + src/lang/ukrainian.txt | 2 + src/lang/unfinished/chuvash.txt | 2 + src/lang/unfinished/frisian.txt | 2 + src/lang/unfinished/ido.txt | 2 + src/lang/unfinished/macedonian.txt | 2 + src/lang/unfinished/maltese.txt | 2 + src/lang/unfinished/marathi.txt | 2 + src/lang/unfinished/persian.txt | 2 + src/lang/unfinished/urdu.txt | 2 + src/lang/vietnamese.txt | 2 + src/lang/welsh.txt | 2 + 63 files changed, 204 insertions(+), 16 deletions(-) diff --git a/src/lang/afrikaans.txt b/src/lang/afrikaans.txt index 43c4accfec..89e4a16f7f 100644 --- a/src/lang/afrikaans.txt +++ b/src/lang/afrikaans.txt @@ -2315,6 +2315,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bou 'n STR_JOIN_WAYPOINT_CAPTION :{WHITE}Verbind roetebaken STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bou 'n aparte roetebaken +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Spoorwegkonstruksie STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektriese spoorwegkonstruksie diff --git a/src/lang/arabic_egypt.txt b/src/lang/arabic_egypt.txt index 4ea95acbb0..47cf9ef538 100644 --- a/src/lang/arabic_egypt.txt +++ b/src/lang/arabic_egypt.txt @@ -1915,6 +1915,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW} بنا STR_JOIN_WAYPOINT_CAPTION :{WHITE}اربط نقطة العبور STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW} ابني نقطة عبور مستقلة +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :بناء السكك الحديدية STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :بناء سكة القطار الكهربائية diff --git a/src/lang/basque.txt b/src/lang/basque.txt index 0152d1ea47..5ae8983494 100644 --- a/src/lang/basque.txt +++ b/src/lang/basque.txt @@ -2177,6 +2177,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Geltoki STR_JOIN_WAYPOINT_CAPTION :{WHITE}Bidepuntua lotu STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Ibilbide puntu bereizitua eraiki +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Trenbidea eraiki STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Trenbide elektrikoa eraiki diff --git a/src/lang/belarusian.txt b/src/lang/belarusian.txt index a7bc7a2dda..a1a717cb66 100644 --- a/src/lang/belarusian.txt +++ b/src/lang/belarusian.txt @@ -2640,6 +2640,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Паб STR_JOIN_WAYPOINT_CAPTION :{WHITE}Аб'яднаць пункты шляху STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Пабудаваць асобны пункт шляху +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Чыгунка STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Электрыфікаваная чыгунка diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 5799dcaf74..2d56c02019 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -2325,6 +2325,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Unir ponto de controle STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construir um ponto de controle separado +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construir ferrovias STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construir ferrovias (elétricas) diff --git a/src/lang/bulgarian.txt b/src/lang/bulgarian.txt index 2108ee7d4d..5d506677f1 100644 --- a/src/lang/bulgarian.txt +++ b/src/lang/bulgarian.txt @@ -2230,6 +2230,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Нап STR_JOIN_WAYPOINT_CAPTION :{WHITE}Съедини пътеводител STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Построи отделен пътеводител +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Конструкции за Двурелсов път STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Строене на електрифицирана ЖП мрежа diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index d1b839de8d..76dcddf6b3 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -2351,6 +2351,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Uneix punt de pas STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construeix un punt de pas separat +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construcció de ferrocarril STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construcció de ferrocarril elèctric diff --git a/src/lang/croatian.txt b/src/lang/croatian.txt index 513f38f747..fabf0e4b97 100644 --- a/src/lang/croatian.txt +++ b/src/lang/croatian.txt @@ -2420,6 +2420,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Izgradi STR_JOIN_WAYPOINT_CAPTION :{WHITE}Spoji čvorište STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Izgradi zasebno čvorište +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Izgradnja željeznice STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Izgradnja elektrificirane željeznice diff --git a/src/lang/czech.txt b/src/lang/czech.txt index f47ab5584e..5cec2b7750 100644 --- a/src/lang/czech.txt +++ b/src/lang/czech.txt @@ -2411,6 +2411,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Postavi STR_JOIN_WAYPOINT_CAPTION :{WHITE}Spojování směrování STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Postavit samostatné směrování +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Výstavba železnice STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Výstavba elektrifikované železnice diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 411062ecbb..2f6da57ad3 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -2324,6 +2324,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Byg en STR_JOIN_WAYPOINT_CAPTION :{WHITE}Forbind waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Byg et separat waypoint +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Jernbanekonstruktion STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektrisk jernbanekonstruktion diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index a64fc7ef6e..7e0977baea 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -194,6 +194,7 @@ STR_COLOUR_DEFAULT :Standaard STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mph STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}km/u STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}m/s +STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}tegels/dag STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}pk STR_UNITS_POWER_METRIC :{COMMA}{NBSP}pk @@ -314,8 +315,15 @@ STR_SORT_BY_CARGO_CAPACITY :Vrachtcapacitei STR_SORT_BY_RANGE :Bereik STR_SORT_BY_POPULATION :Aantal inwoners STR_SORT_BY_RATING :Waardering +STR_SORT_BY_NUM_VEHICLES :Aantal voertuigen +STR_SORT_BY_TOTAL_PROFIT_LAST_YEAR :Totale winst vorig jaar +STR_SORT_BY_TOTAL_PROFIT_THIS_YEAR :Totale winst dit jaar +STR_SORT_BY_AVERAGE_PROFIT_LAST_YEAR :Gemiddelde winst vorig jaar +STR_SORT_BY_AVERAGE_PROFIT_THIS_YEAR :Gemiddelde winst dit jaar # Group by options for vehicle list +STR_GROUP_BY_NONE :Geen +STR_GROUP_BY_SHARED_ORDERS :Gedeelde orders # Tooltips for the main toolbar STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Hiermee pauzeer je het spel @@ -772,6 +780,7 @@ STR_SMALLMAP_TOOLTIP_ENABLE_ALL_CARGOS :{BLACK}Alle vra STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS :{BLACK}Laatste (nieuws-)bericht weergeven STR_STATUSBAR_COMPANY_NAME :{SILVER}- - {COMPANY} - - STR_STATUSBAR_PAUSED :{YELLOW}* * GEPAUZEERD * * +STR_STATUSBAR_PAUSED_LINK_GRAPH :{ORANGE}* * GEPAUZEERD (wacht op bijwerken koppelinggrafiek) * * STR_STATUSBAR_AUTOSAVE :{RED}AUTOMATISCH OPSLAAN STR_STATUSBAR_SAVING_GAME :{RED}* * SPEL WORDT OPGESLAGEN * * @@ -1442,6 +1451,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Bouwgereedschap STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Houd de bouwhulpmiddelen voor bruggen, tunnels, enz. open na gebruik STR_CONFIG_SETTING_EXPENSES_LAYOUT :Uitgaven in bedrijfsfinanciënvenster groeperen: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Definieer de lay-out voor het bedrijfsuitgavenvenster +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Automatisch seinen verwijderen tijdens spooraanleg: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Seinen automatisch verwijderen tijdens spooraanleg als deze in de weg staan. Dit kan botsingen veroorzaken. STR_CONFIG_SETTING_SOUND_TICKER :Nieuwsticker: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Speel geluidseffecten af bij korte nieuwsberichten @@ -1555,6 +1566,11 @@ STR_CONFIG_SETTING_ENDING_YEAR :Eindjaar voor s STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT :Jaar dat het spel eindigt ten behoeve van de score. Aan het einde van dit jaar wordt de score van het bedrijf vastgelegd en verschijnt het venster met topscores. De spelers kunnen echter doorgaan met spelen.{}Als dit voor het startjaar ligt, verschijnt het venster met topscores niet. STR_CONFIG_SETTING_ENDING_YEAR_VALUE :{NUM} STR_CONFIG_SETTING_ENDING_YEAR_ZERO :Nooit +STR_CONFIG_SETTING_ECONOMY_TYPE :Type economie: {STRING} +STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :Bij gelijkmatige economie zijn er vaker wijzigingen in productie, die in kleinere stappen verlopen. Bij vaste economie zijn er geen wijzigingen in productie en sluiten bedrijven niet. Deze instelling werkt misschien niet als de soorten industrie worden geleverd in een NewGRF. +STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL :Origineel +STR_CONFIG_SETTING_ECONOMY_TYPE_SMOOTH :Gelijkmatig +STR_CONFIG_SETTING_ECONOMY_TYPE_FROZEN :Vast STR_CONFIG_SETTING_ALLOW_SHARES :Kopen van aandelen in andere bedrijven toestaan: {STRING} STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Wanneer ingeschakeld is het toegestaan om bedrijfsaandelen te kopen en te verkopen. Aandelen zullen alleen beschikbaar zijn voor bedrijven die een bepaalde leeftijd hebben bereikt STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Minimale leeftijd van bedrijf om aandelen te kunnen verhandelen: {STRING} @@ -1606,6 +1622,10 @@ STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Lineair STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :Plaatsing van bomen in het spel: {STRING} STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT :Beheert het willekeurig verschijnen van bomen tijdens het spel. Dit kan gevolgen hebben voor industrietakken die afhankelijk zijn van groei van bomen, bijvoorbeeld houtzagerijen. +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD :Groeien maar niet verspreiden {RED}(houtzagerijen werken niet meer) +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_RAINFOREST :Groeien, maar alleen verspreiden in regenwoud +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_ALL :Overal groeien en verspreiden +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_GROWTH_NO_SPREAD :Niet groeien, niet verspreiden {RED}(houtzagerijen werken niet meer) STR_CONFIG_SETTING_TOOLBAR_POS :Positie van algemene knoppenbalk: {STRING} STR_CONFIG_SETTING_TOOLBAR_POS_HELPTEXT :Horizontale positie van de algemene taakbalk aan de bovenkant van het scherm. @@ -1672,6 +1692,7 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Wanneer een sne STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperiaal (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Metrisch (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Speleenheden (tegels/dag) STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Voertuigkrachteenheden: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Als het verbruik van een voertuig wordt weergegeven in het gebruikersscherm, gebruik dan de geselecteerde eenheden @@ -1804,6 +1825,7 @@ STR_INTRO_TRANSLATION :{BLACK}Deze ver # Quit window STR_QUIT_CAPTION :{WHITE}Afsluiten +STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD :{YELLOW}Weet je zeker dat je OpenTTD wilt verlaten? STR_QUIT_YES :{BLACK}Ja STR_QUIT_NO :{BLACK}Nee @@ -1967,6 +1989,10 @@ STR_NETWORK_SERVER_LIST_JOIN_GAME :{BLACK}Meespele STR_NETWORK_SERVER_LIST_REFRESH :{BLACK}Ververs server STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP :{BLACK}Ververs de informatie over deze server +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET :{BLACK}Op internet zoeken +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET_TOOLTIP :{BLACK}Op het internet zoeken naar openbare servers +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN :{BLACK}Op LAN zoeken +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN_TOOLTIP :{BLACK}Op lokaal netwerk zoeken naar servers STR_NETWORK_SERVER_LIST_ADD_SERVER :{BLACK}Voeg server toe STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP :{BLACK}Voegt een server toe aan de lijst die altijd gecontroleerd zal worden op draaiende spellen STR_NETWORK_SERVER_LIST_START_SERVER :{BLACK}Start server @@ -2192,11 +2218,13 @@ STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_1 :Spel nog steeds STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_2 :Spel nog steeds gepauzeerd ({STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_3 :Spel nog steeds gepauzeerd ({STRING}, {STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_4 :Spel nog steeds gepauzeerd ({STRING}, {STRING}, {STRING}, {STRING}) +STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_5 :Spel nog steeds gepauzeerd ({STRING}, {STRING}, {STRING}, {STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_UNPAUSED :Spel vervolgd ({STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_REASON_NOT_ENOUGH_PLAYERS :aantal spelers STR_NETWORK_SERVER_MESSAGE_GAME_REASON_CONNECTING_CLIENTS :spelers maken verbinding STR_NETWORK_SERVER_MESSAGE_GAME_REASON_MANUAL :Handmatig STR_NETWORK_SERVER_MESSAGE_GAME_REASON_GAME_SCRIPT :spelscript +STR_NETWORK_SERVER_MESSAGE_GAME_REASON_LINK_GRAPH :wacht op bijwerken koppelinggrafiek ############ End of leave-in-this-order STR_NETWORK_MESSAGE_CLIENT_LEAVING :vertrekt STR_NETWORK_MESSAGE_CLIENT_JOINED :*** {STRING} heeft zich bij het spel gevoegd @@ -2206,6 +2234,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} ki STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} heeft een nieuw bedrijf opgericht (nr. {2:NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} heeft het spel verlaten ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} heeft zijn/haar naam gewijzigd naar {STRING} +STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} gaf {2:CURRENCY_LONG} aan {1:STRING} STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}De server heeft de sessie gesloten STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}De server wordt opnieuw gestart...{}Wacht alstublieft... STR_NETWORK_MESSAGE_KICKED :*** {STRING} is eruit geschopt. Reden: ({STRING}) @@ -2324,6 +2353,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Een los STR_JOIN_WAYPOINT_CAPTION :{WHITE}Routepunt samenvoegen STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Los routepunt bouwen +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Spoorwegen bouwen STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Geëlektrificeerde spoorwegen bouwen @@ -2518,6 +2549,12 @@ STR_TREES_RANDOM_TYPE :{BLACK}Willekeu STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Willekeurig bomen planten. Shift+klik wisselt tussen bouwen/verwachte kosten. STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Willekeurige bomen STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Hiermee plant je bomen willekeurig over het landschap +STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normaal +STR_TREES_MODE_NORMAL_TOOLTIP :{BLACK}Losse bomen planten door over het landschap te slepen +STR_TREES_MODE_FOREST_SM_BUTTON :{BLACK}Groepje bomen +STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Kleine bossen planten door over het landschap te slepen +STR_TREES_MODE_FOREST_LG_BUTTON :{BLACK}Bos +STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Grote bossen planten door over het landschap te slepen # Land generation window (SE) STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Landontwikkeling @@ -3147,10 +3184,10 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Bedrijfs STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Klik op doel centreert venster op industrie/stad/tegel. Ctrl+Klik opent een nieuw venster op de locatie van de industrie/stad/tegel. # Goal question window -STR_GOAL_QUESTION_CAPTION_QUESTION :Vraag -STR_GOAL_QUESTION_CAPTION_INFORMATION :Informatie -STR_GOAL_QUESTION_CAPTION_WARNING :Waarschuwing -STR_GOAL_QUESTION_CAPTION_ERROR :Fout +STR_GOAL_QUESTION_CAPTION_QUESTION :{BLACK}Vraag +STR_GOAL_QUESTION_CAPTION_INFORMATION :{BLACK}Informatie +STR_GOAL_QUESTION_CAPTION_WARNING :{BLACK}Waarschuwing +STR_GOAL_QUESTION_CAPTION_ERROR :{YELLOW}Fout ############ Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Annuleren @@ -3340,6 +3377,8 @@ STR_COMPANY_VIEW_RELOCATE_HQ :{BLACK}Hoofdkan STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS :{BLACK}Hoofdkantoor verplaatsen voor 1% van de bedrijfswaarde. Shift+klik geeft de verwachte kosten zonder hoofdkantoor te verplaatsen. STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}Details STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}Gedetailleerde aantallen infrastructuur bekijken +STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}Geld geven +STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}Geld geven aan dit bedrijf STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}Nieuw gezicht STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}Nieuw gezicht voor directeur kiezen @@ -3357,6 +3396,7 @@ STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP :{BLACK}Verkoop STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION :Bedrijfsnaam STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :Naam van directeur +STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :Voer het bedrag in om weg te geven STR_BUY_COMPANY_MESSAGE :{WHITE}We zoeken een transportbedrijf dat ons bedrijf over kan nemen.{}{}Wil je {COMPANY} kopen voor {CURRENCY_LONG}? @@ -4227,6 +4267,7 @@ STR_GAME_SAVELOAD_ERROR_TOO_NEW_SAVEGAME :Opgeslagen spel STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE :Bestand is niet leesbaar STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE :Bestand is niet schrijfbaar STR_GAME_SAVELOAD_ERROR_DATA_INTEGRITY_CHECK_FAILED :Data-integriteitscontrole mislukt +STR_GAME_SAVELOAD_ERROR_PATCHPACK :Opgeslagen spel is gemaakt met een aangepaste versie STR_GAME_SAVELOAD_NOT_AVAILABLE : STR_WARNING_LOADGAME_REMOVED_TRAMS :{WHITE}Spel was opgeslagen in een versie zonder tramondersteuning. Alle trams zijn verwijderd @@ -4307,6 +4348,7 @@ STR_ERROR_LOAN_ALREADY_REPAYED :{WHITE}... geen STR_ERROR_CURRENCY_REQUIRED :{WHITE}... {CURRENCY_LONG} benodigd STR_ERROR_CAN_T_REPAY_LOAN :{WHITE}Kan de lening niet afbetalen.. STR_ERROR_INSUFFICIENT_FUNDS :{WHITE}Kan geen geld weggeven dat van de bank geleend is... +STR_ERROR_CAN_T_GIVE_MONEY :{WHITE}Kan geen geld weggeven aan dit bedrijf... STR_ERROR_CAN_T_BUY_COMPANY :{WHITE}Kan het bedrijf niet kopen... STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS :{WHITE}Kan bedrijfshoofdkantoor niet bouwen... STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}Kan geen 25% aandeel in dit bedrijf kopen... @@ -4714,10 +4756,10 @@ STR_INDUSTRY_NAME_SUGAR_MINE :Suikermijn ##id 0x6000 STR_SV_EMPTY : STR_SV_UNNAMED :Geen naam -STR_SV_TRAIN_NAME :Trein {COMMA} -STR_SV_ROAD_VEHICLE_NAME :Wegvoertuig {COMMA} -STR_SV_SHIP_NAME :Schip {COMMA} -STR_SV_AIRCRAFT_NAME :Vliegtuig {COMMA} +STR_SV_TRAIN_NAME :Trein #{COMMA} +STR_SV_ROAD_VEHICLE_NAME :Wegvoertuig #{COMMA} +STR_SV_SHIP_NAME :Schip #{COMMA} +STR_SV_AIRCRAFT_NAME :Vliegtuig #{COMMA} STR_SV_STNAME :{STRING} STR_SV_STNAME_NORTH :{STRING} Noord @@ -5019,6 +5061,7 @@ STR_FORMAT_BUOY_NAME :Boei {TOWN} STR_FORMAT_BUOY_NAME_SERIAL :Boei {TOWN} {COMMA} STR_FORMAT_COMPANY_NUM :(Bedrijf {COMMA}) STR_FORMAT_GROUP_NAME :Groep {COMMA} +STR_FORMAT_GROUP_VEHICLE_NAME :{GROUP} #{COMMA} STR_FORMAT_INDUSTRY_NAME :{1:STRING} {0:TOWN} STR_FORMAT_WAYPOINT_NAME :Routepunt {TOWN} STR_FORMAT_WAYPOINT_NAME_SERIAL :Routepunt {TOWN} {COMMA} diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index 4eadc29207..49a7f2faf3 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -2240,6 +2240,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Build a STR_JOIN_WAYPOINT_CAPTION :{WHITE}Join waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Build a separate waypoint +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Railway Construction STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Electrified Railway Construction diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index 37a5a41736..50a128d7e1 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -2320,6 +2320,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Build a STR_JOIN_WAYPOINT_CAPTION :{WHITE}Join waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Build a separate waypoint +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Railroad Construction STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Electrified Railroad Construction diff --git a/src/lang/esperanto.txt b/src/lang/esperanto.txt index ac98e7f459..9cbbac6eb7 100644 --- a/src/lang/esperanto.txt +++ b/src/lang/esperanto.txt @@ -1893,6 +1893,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Konstru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Ligi vojpunkton STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Krei apartan vojpunkton +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Konstruado de Fervojo STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Konstruado de Elektrofervojo diff --git a/src/lang/estonian.txt b/src/lang/estonian.txt index 37913382ec..c52fa46482 100644 --- a/src/lang/estonian.txt +++ b/src/lang/estonian.txt @@ -2337,6 +2337,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Ehita e STR_JOIN_WAYPOINT_CAPTION :{WHITE}Liida teemärgis STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Ehita eraldi teemärgis +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Rööbasteede ehitamine STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektriraudtee ehitamine diff --git a/src/lang/faroese.txt b/src/lang/faroese.txt index 4f7ef37286..88dad29d3a 100644 --- a/src/lang/faroese.txt +++ b/src/lang/faroese.txt @@ -2078,6 +2078,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bygg se STR_JOIN_WAYPOINT_CAPTION :{WHITE}Bind waypoint saman STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bygg eitt serstakt waypoint +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Jarnbreyta bygging STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Ravmagns jarnbreyta bygging diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 28d260b5a5..802f0544c1 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -1451,6 +1451,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Pidä rakennust STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Pidä siltojen, tunneleiden, jne. rakennustyökalut käytössä käytön jälkeen STR_CONFIG_SETTING_EXPENSES_LAYOUT :Ryhmitä kulut yhtiön rahoitusikkunassa: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Määritä asettelu yhtiön rahoitusikkunalle +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Poista automaattisesti opastimia rautateitä rakennettaessa: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Poista automaattisesti opastimia, jos ne ovat rautatien rakentamisen tiellä. Huomaa, että tämä saattaa johtaa junien yhteentörmäyksiin. STR_CONFIG_SETTING_SOUND_TICKER :Uutiset: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Toista ääni tiivistetyille uutisviesteille @@ -2351,6 +2353,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Rakenna STR_JOIN_WAYPOINT_CAPTION :{WHITE}Liitä reittipiste STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Rakenna erillinen reittipiste +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Rautatien rakentaminen STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Sähköradan rakentaminen diff --git a/src/lang/french.txt b/src/lang/french.txt index 3ebccb2a0a..c3f2cb51b8 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -1452,6 +1452,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Conserver les o STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Garde les outils de construction de ponts, tunnels, etc. ouverts après usage STR_CONFIG_SETTING_EXPENSES_LAYOUT :Regrouper les dépenses dans la fenêtre des finances{NBSP}: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Définit la mise en forme de la fenêtre des dépenses de la compagnie +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Retire automatiquement les signaux durant la construction de la voie ferrée: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Retire automatiquement les signaux durant la construction de la voie ferrée si les signaux sont sur le chemin. A noter que ça peut potentiellement mener à des accidents de trains. STR_CONFIG_SETTING_SOUND_TICKER :Bulletin{NBSP}: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Jouer un son pour les bulletins @@ -2233,6 +2235,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} a STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} a lancé une nouvelle compagnie (n°{NBSP}{2:NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} a quitté la partie ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} a changé son nom en {STRING} +STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} a donné {2:CURRENCY_LONG} à {1:STRING} STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}Le serveur a fermé la session STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}Le serveur redémarre...{}Veuillez patienter... STR_NETWORK_MESSAGE_KICKED :*** {STRING} a été exclu. Raison{NBSP}: ({STRING}) @@ -2351,6 +2354,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Joindre un point de contrôle STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construire un point de contrôle séparé +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construction de voie ferrée STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construction de voie ferrée électrifiée @@ -3373,6 +3378,8 @@ STR_COMPANY_VIEW_RELOCATE_HQ :{BLACK}Déména STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS :{BLACK}Reconstruire ailleurs le siège de la compagnie pour le prix de 1{NBSP}% de sa valeur.{}Shift-clic pour afficher seulement le coût estimé. STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}Détails STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}Afficher le détail des calculs d'infrastructure +STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :Donner de l’argent +STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}Donner de l’argent à cette compagnie STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}Nouveau visage STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}Choix d'un nouveau visage pour le P.D.G. @@ -3390,6 +3397,7 @@ STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP :{BLACK}Vendre 2 STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION :Nom de la société STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :Nom du P.D.G. +STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :Entrer le montant que vous souhaiter donner STR_BUY_COMPANY_MESSAGE :{WHITE}Nous sommes à la recherche d'un repreneur pour notre compagnie{}{}Voulez-vous acheter {COMPANY} pour {CURRENCY_LONG}{NBSP}? @@ -4341,6 +4349,7 @@ STR_ERROR_LOAN_ALREADY_REPAYED :{WHITE}... empr STR_ERROR_CURRENCY_REQUIRED :{WHITE}... {CURRENCY_LONG} nécessaires STR_ERROR_CAN_T_REPAY_LOAN :{WHITE}Impossible de rembourser... STR_ERROR_INSUFFICIENT_FUNDS :{WHITE}Impossible de distribuer de l'argent emprunté à la banque... +STR_ERROR_CAN_T_GIVE_MONEY :{WHITE}Vous ne pouvez pas donner de l’argent à cette compagnie STR_ERROR_CAN_T_BUY_COMPANY :{WHITE}Impossible d'acheter la compagnie... STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS :{WHITE}Impossible de construire le siège... STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}Impossible d'acheter 25{NBSP}% des parts... diff --git a/src/lang/gaelic.txt b/src/lang/gaelic.txt index 43d9729597..7d1f88e6a9 100644 --- a/src/lang/gaelic.txt +++ b/src/lang/gaelic.txt @@ -2477,6 +2477,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Tog st STR_JOIN_WAYPOINT_CAPTION :{WHITE}Co-aonaich a' phuing-thurais STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Tog puing-thurais fa leth +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Tog rathad-iarainn STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Togail rathaid-iarainn dealain diff --git a/src/lang/galician.txt b/src/lang/galician.txt index 386eb4ab8c..0383950d00 100644 --- a/src/lang/galician.txt +++ b/src/lang/galician.txt @@ -2315,6 +2315,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Unir punto de ruta STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Constrúe un un punto de ruta separado +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construción de Ferrocarrís STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construción de Vías Electrificadas diff --git a/src/lang/german.txt b/src/lang/german.txt index 78218be1e4..097c1359c2 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -2348,6 +2348,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Erricht STR_JOIN_WAYPOINT_CAPTION :{WHITE}Verbinde mit Wegpunkt STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Errichte einen getrennten Wegpunkt +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Eisenbahnbau STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Bau elektrifizierter Strecken diff --git a/src/lang/greek.txt b/src/lang/greek.txt index 6fd9000a21..ecf80b3310 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -2408,6 +2408,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Χτί STR_JOIN_WAYPOINT_CAPTION :{WHITE}Συνένωση σημείου καθοδήγησης STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Κτίσιμο ενός ξεχωριστού σημείου καθοδήγησης +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Κατασκευή Σιδηρόδρομου STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Κατασκευή Ηλεκτροδοτημένου Σιδηρόδρομου diff --git a/src/lang/hebrew.txt b/src/lang/hebrew.txt index 7915708bc8..b6bcbc8d27 100644 --- a/src/lang/hebrew.txt +++ b/src/lang/hebrew.txt @@ -2291,6 +2291,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}בנה STR_JOIN_WAYPOINT_CAPTION :{WHITE}חבר נקודות ציון STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}בנה נקודת ציון נפרדת +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :בניית מסילות STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :בניית מסילות חשמליות diff --git a/src/lang/hungarian.txt b/src/lang/hungarian.txt index 2454d63bef..20e2ae9e29 100644 --- a/src/lang/hungarian.txt +++ b/src/lang/hungarian.txt @@ -2388,6 +2388,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Külön STR_JOIN_WAYPOINT_CAPTION :{WHITE}Ellenőrző pont egyesítése STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Különálló ellenőrző pont építése +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Vasút építése STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Villamosított vasút építése diff --git a/src/lang/icelandic.txt b/src/lang/icelandic.txt index a9be3cce62..6ad03bac63 100644 --- a/src/lang/icelandic.txt +++ b/src/lang/icelandic.txt @@ -2117,6 +2117,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Reisa a STR_JOIN_WAYPOINT_CAPTION :{WHITE}Tengja millistöð STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Reisa aðra millistöð +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Járnbrautarspors framkvæmdir STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Raflestaframkvæmdir diff --git a/src/lang/indonesian.txt b/src/lang/indonesian.txt index ee1c81d1da..4958ba989d 100644 --- a/src/lang/indonesian.txt +++ b/src/lang/indonesian.txt @@ -2324,6 +2324,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Pisahka STR_JOIN_WAYPOINT_CAPTION :{WHITE}Gabungkan waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Pisahkan waypoint +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Pembangunan Rel Kereta STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Pembangunan Rel Kereta Listrik diff --git a/src/lang/irish.txt b/src/lang/irish.txt index 6f5d91e820..16264999d5 100644 --- a/src/lang/irish.txt +++ b/src/lang/irish.txt @@ -2265,6 +2265,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Tóg st STR_JOIN_WAYPOINT_CAPTION :{WHITE}Ceangail pointe bealaigh STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Tóg pointe bealaigh ar leithligh +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Tógáil Iarnróid STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Tógáil Iarnróid Leicrithe diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 4940019e8c..acb761b733 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -2350,6 +2350,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Costrui STR_JOIN_WAYPOINT_CAPTION :{WHITE}Unisci waypoint STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Costruisci waypoint separato +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Costruzione ferrovie STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Costruzione ferrovie elettrificate diff --git a/src/lang/japanese.txt b/src/lang/japanese.txt index 50ef3dec80..ff021acd65 100644 --- a/src/lang/japanese.txt +++ b/src/lang/japanese.txt @@ -2265,6 +2265,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}統合 STR_JOIN_WAYPOINT_CAPTION :{WHITE}通過点を統合 STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}統合せずに建設 +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :鉄道建設 STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :電気鉄道建設 diff --git a/src/lang/korean.txt b/src/lang/korean.txt index e8ac288947..3c92fb9407 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -1452,6 +1452,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :건설 도구 STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :다리, 터널 등의 건설 도구를 사용 후에도 계속 열어둔 채로 놔둡니다. STR_CONFIG_SETTING_EXPENSES_LAYOUT :재정 창에서 비용을 종류별로 묶어서 표시: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :재정 창에 나타나는 회사 비용을 어떻게 표시할지 설정합니다. +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :선로 건설 중 신호기 자동 제거: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :신호기가 이미 있는 선로에 선로를 추가로 설치하면 신호기를 자동으로 제거합니다. 잘못 사용하면 잠재적으로 열차가 충돌할 수 있다는 점을 명심하세요. STR_CONFIG_SETTING_SOUND_TICKER :뉴스 자막: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :요약된 뉴스 메시지가 나타나면 효과음을 재생합니다. @@ -2352,6 +2354,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}분리 STR_JOIN_WAYPOINT_CAPTION :{WHITE}연결할 경유지 STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}분리된 경유지를 새로 만들기 +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :선로 건설 STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :전기선로 건설 diff --git a/src/lang/latin.txt b/src/lang/latin.txt index e15aa32863..f0d1636871 100644 --- a/src/lang/latin.txt +++ b/src/lang/latin.txt @@ -2496,6 +2496,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Struere STR_JOIN_WAYPOINT_CAPTION :{WHITE}Iungere interlocum STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Struere discretum interlocum +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Constructio Ferriviarum STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Constructio Electricarum Ferriviarum diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 1c2ca1e87d..5aba43ac06 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -2354,6 +2354,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Būvēt STR_JOIN_WAYPOINT_CAPTION :{WHITE}Pievienot pieturas punktu STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Uzbūvēt jaunu maršruta punktu +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Dzelzceļa būvniecība STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektrificētā dzelzceļa būvniecība diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt index 4fb6ac9f47..8cf458b1da 100644 --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -2494,6 +2494,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Statyti STR_JOIN_WAYPOINT_CAPTION :{WHITE}Sujungti kontrolės punktus STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Statyti atskirą kontrolės punktą +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Geležinkelio tiesimas STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektrifikuoto geležinkelio tiesimas diff --git a/src/lang/luxembourgish.txt b/src/lang/luxembourgish.txt index 23b78a77d9..434bcf92f3 100644 --- a/src/lang/luxembourgish.txt +++ b/src/lang/luxembourgish.txt @@ -2323,6 +2323,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Eng sep STR_JOIN_WAYPOINT_CAPTION :{WHITE}Weepunkt verbannen STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Separate Weepunkt bauen +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Schinnebau STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektresche Schinnebau diff --git a/src/lang/malay.txt b/src/lang/malay.txt index 0494addb0f..20c9718201 100644 --- a/src/lang/malay.txt +++ b/src/lang/malay.txt @@ -2015,6 +2015,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bina st STR_JOIN_WAYPOINT_CAPTION :{WHITE}Sambungkan tandatuju STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bina tandatuju yang berasingan +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Pembinaan Landasan Keretapi STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Pembinaan Landasan Keretapi Berelektrik diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt index ea52a9a721..2e8bc5809d 100644 --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -2325,6 +2325,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bygg se STR_JOIN_WAYPOINT_CAPTION :{WHITE}Slå sammen kontrollpunkter STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bygg separat kontrollpunkt +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Bygg jernbane STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Bygg elektrisk jernbane diff --git a/src/lang/norwegian_nynorsk.txt b/src/lang/norwegian_nynorsk.txt index 2ae8d0499d..bc416a3402 100644 --- a/src/lang/norwegian_nynorsk.txt +++ b/src/lang/norwegian_nynorsk.txt @@ -2189,6 +2189,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bygg ei STR_JOIN_WAYPOINT_CAPTION :{WHITE}Spleis kontrollpunkt STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bygg eit seperat kontrollpunkt +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Bygg jernbane STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Bygg elektrisk jernbane diff --git a/src/lang/polish.txt b/src/lang/polish.txt index b1b1eaad2e..de72797e3d 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -1831,6 +1831,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Pozostaw aktywn STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Zachowaj narzędzia budowy mostów, tuneli, itp. po użyciu STR_CONFIG_SETTING_EXPENSES_LAYOUT :Pogrupuj wydatki w oknie finsnasów firmy: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Określa układ okienka wydatków firmy +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Automatycznie usuwaj sygnały podczas budowy torów: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Automatycznie usuwaj sygnały, które przeszkadzają w budowie toru. Pamiętaj, że może to doprowadzić do zderzenia pociągów, w przypadku usunięcia ważnych sygnałów. STR_CONFIG_SETTING_SOUND_TICKER :Pasek informacji: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Odtwarzaj dźwięk dla podsumowania wiadomości @@ -2731,6 +2733,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Zbuduj STR_JOIN_WAYPOINT_CAPTION :{WHITE}Połącz posterunki STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Zbuduj oddzielny posterunek +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Konstrukcja linii kolejowej STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Konstrukcja linii zelektryfikowanej diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index a6da1ac2ae..79c9bbd058 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -2310,6 +2310,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Juntar ponto de controlo STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construir um ponto de controlo separado +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construção de caminhos-de-ferro STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construção de caminhos-de-ferro eletrificados diff --git a/src/lang/romanian.txt b/src/lang/romanian.txt index 7351f34497..eb276c3ce0 100644 --- a/src/lang/romanian.txt +++ b/src/lang/romanian.txt @@ -2258,6 +2258,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Uneşte punctul de tranzit STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construieşte un punct de tranzit separat +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construcţie cale ferată STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construcţie cale ferată electrificată diff --git a/src/lang/russian.txt b/src/lang/russian.txt index c8d9f1cbd3..2b2c416c67 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -2518,6 +2518,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Пос STR_JOIN_WAYPOINT_CAPTION :{WHITE}Объединить точки STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Поставить отдельную точку пути +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Неэлектрифицированная ж/д STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Электрифицированная ж/д diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt index 91ab5a559e..8c528b56a5 100644 --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -2473,6 +2473,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Izgradi STR_JOIN_WAYPOINT_CAPTION :{WHITE}Spoji putanje STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Napravi zasebnu putanju +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Izgradnja železnice STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Izgradnja elektrifikovane železnice diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index ae28ed2b79..50c1351bca 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -2324,6 +2324,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}建造 STR_JOIN_WAYPOINT_CAPTION :{WHITE}合并路点 STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}建造分体路点 +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :铁路建设 STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :电气化铁路建设 diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt index 48bc3ab7aa..a33f69761a 100644 --- a/src/lang/slovak.txt +++ b/src/lang/slovak.txt @@ -2418,6 +2418,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Postavi STR_JOIN_WAYPOINT_CAPTION :{WHITE}Spojiť smerový bod STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Postaviť smerový bod oddelene +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Výstavba železnice STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Výstavba elektrifikovanej železnice diff --git a/src/lang/slovenian.txt b/src/lang/slovenian.txt index f1396d8717..10187d7578 100644 --- a/src/lang/slovenian.txt +++ b/src/lang/slovenian.txt @@ -2421,6 +2421,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Izgradn STR_JOIN_WAYPOINT_CAPTION :{WHITE}Združi točke poti STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Zgradi ločeno točko poti +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Gradnja železnice STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Gradnja elektrificirane železnica diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 61bd0375b5..9daebaf7d4 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -195,6 +195,7 @@ STR_COLOUR_DEFAULT :Por Defecto STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}mph STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}km/h STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}m/s +STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL} {NBSP}casillas/día STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}cv STR_UNITS_POWER_METRIC :{COMMA}{NBSP}cv @@ -1451,6 +1452,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Mantener activa STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Mantiene las herramientas de construcción de puentes, túneles, etcétera, abiertas después de su uso STR_CONFIG_SETTING_EXPENSES_LAYOUT :Agrupar costes en la ventana de finanzas: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Define el diseño de la ventana de finanzas +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Elimina automáticamente las señales durante la construcción del ferrocarril: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Elimine automáticamente las señales durante la construcción del carril si las señales están en el camino. Tenga en cuenta que esto puede provocar accidentes de tren. STR_CONFIG_SETTING_SOUND_TICKER :Noticias resumidas: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Reproducir sonido para mensajes de noticias resumidos @@ -1566,6 +1569,7 @@ STR_CONFIG_SETTING_ENDING_YEAR_VALUE :{NUM} STR_CONFIG_SETTING_ENDING_YEAR_ZERO :Nunca STR_CONFIG_SETTING_ECONOMY_TYPE :Tipo de economía: {STRING} STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :La economía fluida hace que los cambios de producción sean más frecuentes y en pasos más pequeños. La economía congelada detiene los cambios de producción y los cierres de industrias. Esta configuración puede no tener efecto si los tipos de industria los proporciona un NewGRF. +STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL :Original STR_CONFIG_SETTING_ECONOMY_TYPE_SMOOTH :Suave STR_CONFIG_SETTING_ECONOMY_TYPE_FROZEN :Congelado STR_CONFIG_SETTING_ALLOW_SHARES :Permitir comprar acciones de otras empresas: {STRING} @@ -1620,6 +1624,7 @@ STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Lineal STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :Crecimiento de árboles durante el juego: {STRING} STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT :Controla la aparición aleatoria de árboles durante la partida. Esto puede afectar a industrias que dependen del crecimiento de árboles, como los aserraderos STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD :Crecer, pero no extienda {RED}(rompe al aserradero) +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_RAINFOREST :Crece pero solo se extiende en las selvas tropicales STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_ALL :Crece y difunde por todas partes STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_GROWTH_NO_SPREAD :No crezcas, no te extiendas {RED}(rompe el aserradero) @@ -1688,7 +1693,7 @@ STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :Cada vez que se STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :Imperial (mph) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :Métrico (km/h) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :SI (m/s) -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Unidades de juego (fichas/día) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :Unidades de juego (casillas/día) STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :Unidades de potencia de vehículos: {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :Cada vez que se muestra la potencia de un vehículo en la interfaz de usuario, se emplean las unidades seleccionadas @@ -1821,6 +1826,7 @@ STR_INTRO_TRANSLATION :{BLACK}A esta t # Quit window STR_QUIT_CAPTION :{WHITE}Salir +STR_QUIT_ARE_YOU_SURE_YOU_WANT_TO_EXIT_OPENTTD :{YELLOW}¿Está seguro de salir de OpenTTD? STR_QUIT_YES :{BLACK}Sí STR_QUIT_NO :{BLACK}No @@ -2229,6 +2235,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} se STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} ha creado una nueva empresa (#{2:NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} ha abandonado el juego ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} ha cambiado su nombre a {STRING} +STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} dio {2:CURRENCY_LONG} a {1:STRING} STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}El servidor ha cerrado la sesión STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}Se está reiniciando el servidor...{}Espere por favor... STR_NETWORK_MESSAGE_KICKED :*** {STRING} ha sido expulsado. Razón: ({STRING}) @@ -2347,6 +2354,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Unir punto de ruta STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construir un punto de ruta separado +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construcción de Ferrocarril STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construcción Ferrocarril Eléctrico @@ -3176,10 +3185,10 @@ STR_GOALS_COMPANY_TITLE :{BLACK}Metas de STR_GOALS_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}Clic en una meta para centrar la vista principal en la casilla, industria o municipio. Ctrl+Clic abre una nueva vista en esa localización # Goal question window -STR_GOAL_QUESTION_CAPTION_QUESTION :Pregunta -STR_GOAL_QUESTION_CAPTION_INFORMATION :Información -STR_GOAL_QUESTION_CAPTION_WARNING :Advertencia -STR_GOAL_QUESTION_CAPTION_ERROR :Error +STR_GOAL_QUESTION_CAPTION_QUESTION :{BLACK}Pregunta +STR_GOAL_QUESTION_CAPTION_INFORMATION :{BLACK}Información +STR_GOAL_QUESTION_CAPTION_WARNING :{BLACK}Advertencia +STR_GOAL_QUESTION_CAPTION_ERROR :{YELLOW}Error ############ Start of Goal Question button list STR_GOAL_QUESTION_BUTTON_CANCEL :Cancelar @@ -3370,6 +3379,7 @@ STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS :{BLACK}Reubica STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}Detalles STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}Ver informe detallado de infraestructura STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}Dar dinero +STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}Dar dinero a esta empresa STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}Nueva Cara STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}Selecciona nueva cara para el presidente @@ -4747,9 +4757,9 @@ STR_INDUSTRY_NAME_SUGAR_MINE :{G=f}Mina de Az ##id 0x6000 STR_SV_EMPTY : STR_SV_UNNAMED :Sin nombre -STR_SV_TRAIN_NAME :Tren {COMMA} -STR_SV_ROAD_VEHICLE_NAME :Vehículo de carretera {COMMA} -STR_SV_SHIP_NAME :Barco {COMMA} +STR_SV_TRAIN_NAME :Tren #{COMMA} +STR_SV_ROAD_VEHICLE_NAME :Vehículo de carretera #{COMMA} +STR_SV_SHIP_NAME :Barco #{COMMA} STR_SV_AIRCRAFT_NAME :Aeronave {COMMA} STR_SV_STNAME :{STRING} diff --git a/src/lang/spanish_MX.txt b/src/lang/spanish_MX.txt index c76c2f2bbb..3db30473b5 100644 --- a/src/lang/spanish_MX.txt +++ b/src/lang/spanish_MX.txt @@ -2352,6 +2352,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Constru STR_JOIN_WAYPOINT_CAPTION :{WHITE}Unir puntos de ruta STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construir aparte +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construcción de ferrocarril STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Construcción ferrocarril eléctrico diff --git a/src/lang/swedish.txt b/src/lang/swedish.txt index b384abd8bb..cf4a1cb98a 100644 --- a/src/lang/swedish.txt +++ b/src/lang/swedish.txt @@ -2324,6 +2324,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Bygg en STR_JOIN_WAYPOINT_CAPTION :{WHITE}Slå ihop riktmärken STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Bygg ett separat riktmärke +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Bygg järnväg STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Bygg elektrifierad järnväg diff --git a/src/lang/tamil.txt b/src/lang/tamil.txt index dffb4c20ae..bb3e7b2df0 100644 --- a/src/lang/tamil.txt +++ b/src/lang/tamil.txt @@ -2086,6 +2086,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}தன STR_JOIN_WAYPOINT_CAPTION :{WHITE}பாதைப்புள்ளியினை இணை STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}தனியொரு பாதைப்புள்ளிடினை கட்டு +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :இரயில்வே கட்டுமானம் STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :மின்சார இரயில்வே கட்டுமானம் diff --git a/src/lang/thai.txt b/src/lang/thai.txt index 32d342e5e4..0686122e81 100644 --- a/src/lang/thai.txt +++ b/src/lang/thai.txt @@ -2214,6 +2214,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}สร STR_JOIN_WAYPOINT_CAPTION :{WHITE}รวมจุดตรวจ STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}สร้างจุดตรวจแยกต่างหาก +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :การก่อสร้างทางรถไฟ STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :การก่อสร้างทางรถไฟพลังไฟฟ้า diff --git a/src/lang/traditional_chinese.txt b/src/lang/traditional_chinese.txt index 8bf827a12a..f658e8e602 100644 --- a/src/lang/traditional_chinese.txt +++ b/src/lang/traditional_chinese.txt @@ -2268,6 +2268,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}建造 STR_JOIN_WAYPOINT_CAPTION :{WHITE}聯合路徑 STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}建立個別路徑 +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :鋪設鐵路 STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :鋪設電氣化鐵路 diff --git a/src/lang/turkish.txt b/src/lang/turkish.txt index 007316a9da..104b2d94b8 100644 --- a/src/lang/turkish.txt +++ b/src/lang/turkish.txt @@ -2325,6 +2325,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Ayrı b STR_JOIN_WAYPOINT_CAPTION :{WHITE}Yerimini birleştir STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Ayrı bir yerimi yap +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Demiryolu Yapımı STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektrikli Ray Yapımı diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt index db5fc2a282..06cd652d12 100644 --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -2455,6 +2455,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Поб STR_JOIN_WAYPOINT_CAPTION :{WHITE}З'єднати точку маршруту STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Створити окрему точку маршруту +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Будівництво залізниці STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Будівництво електрифікованої залізниці diff --git a/src/lang/unfinished/chuvash.txt b/src/lang/unfinished/chuvash.txt index 71e04a7fa3..e7c04c6acf 100644 --- a/src/lang/unfinished/chuvash.txt +++ b/src/lang/unfinished/chuvash.txt @@ -826,6 +826,8 @@ STR_CONTENT_DETAIL_VERSION :{SILVER}Вер # Join station window +# Generic toolbar + # Rail construction toolbar diff --git a/src/lang/unfinished/frisian.txt b/src/lang/unfinished/frisian.txt index 303881a9e3..1773c94fa9 100644 --- a/src/lang/unfinished/frisian.txt +++ b/src/lang/unfinished/frisian.txt @@ -2099,6 +2099,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}In apar STR_JOIN_WAYPOINT_CAPTION :{WHITE}Kontrôlepost gearfoegje STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}In apart kontrôlepost bouwe +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Spoarwei Konstruksje STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Elektrifisearre Spoarwei Bouwe diff --git a/src/lang/unfinished/ido.txt b/src/lang/unfinished/ido.txt index 15d02f916b..9079e02fa1 100644 --- a/src/lang/unfinished/ido.txt +++ b/src/lang/unfinished/ido.txt @@ -677,6 +677,8 @@ STR_STATION_BUILD_ACCEPTS_CARGO :{BLACK}Aceptas: # Join station window +# Generic toolbar + # Rail construction toolbar diff --git a/src/lang/unfinished/macedonian.txt b/src/lang/unfinished/macedonian.txt index 41f2383c47..85a61f3b5d 100644 --- a/src/lang/unfinished/macedonian.txt +++ b/src/lang/unfinished/macedonian.txt @@ -1044,6 +1044,8 @@ STR_STATION_BUILD_SUPPLIES_CARGO :{BLACK}Зали # Join station window +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_TOOLTIP_BUILD_AUTORAIL :{BLACK}Изгради пруга користејки 'Авто-пруга' мод diff --git a/src/lang/unfinished/maltese.txt b/src/lang/unfinished/maltese.txt index e450ac6948..00865a5255 100644 --- a/src/lang/unfinished/maltese.txt +++ b/src/lang/unfinished/maltese.txt @@ -605,6 +605,8 @@ STR_NETWORK_SERVER_MESSAGE :*** {1:STRING} # Join station window +# Generic toolbar + # Rail construction toolbar diff --git a/src/lang/unfinished/marathi.txt b/src/lang/unfinished/marathi.txt index 59b6e34179..17ae83698d 100644 --- a/src/lang/unfinished/marathi.txt +++ b/src/lang/unfinished/marathi.txt @@ -1001,6 +1001,8 @@ STR_NETWORK_SERVER_MESSAGE :*** {1:STRING} # Join station window +# Generic toolbar + # Rail construction toolbar diff --git a/src/lang/unfinished/persian.txt b/src/lang/unfinished/persian.txt index a86ed9bc2e..11fa081ddd 100644 --- a/src/lang/unfinished/persian.txt +++ b/src/lang/unfinished/persian.txt @@ -1979,6 +1979,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}ساخ STR_JOIN_WAYPOINT_CAPTION :{WHITE}پیوستن نقطه مسیر STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}ساخت یک نقطه مسیر جداگانه +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :ساخت راه آهن STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :ساخت و ساز ریل برقی diff --git a/src/lang/unfinished/urdu.txt b/src/lang/unfinished/urdu.txt index fd2adab21f..c19b3c727a 100644 --- a/src/lang/unfinished/urdu.txt +++ b/src/lang/unfinished/urdu.txt @@ -1861,6 +1861,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}الگ STR_JOIN_WAYPOINT_CAPTION :{WHITE}گزرگاہ ملائیں STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}الگ سے گزرگاہ تعمیر کریں +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :ریلوے کی تعمیر STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :برقی ریلوے کی تعمیر diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 5eb17c191e..ad9c506c10 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -2326,6 +2326,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Tạo m STR_JOIN_WAYPOINT_CAPTION :{WHITE}Nối điểm mốc STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Tạo một điểm mốc riêng rẽ +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Xây Dựng Đường Ray STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Xây Dựng Đường Ray Điện diff --git a/src/lang/welsh.txt b/src/lang/welsh.txt index 4b0ce7a64d..caa13bb311 100644 --- a/src/lang/welsh.txt +++ b/src/lang/welsh.txt @@ -2273,6 +2273,8 @@ STR_JOIN_STATION_CREATE_SPLITTED_STATION :{YELLOW}Adeilad STR_JOIN_WAYPOINT_CAPTION :{WHITE}Uno pwynt llwybro STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Adeiladu pwynt llwybro annibynnol +# Generic toolbar + # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Adeiladu Rheilffyrdd STR_RAIL_TOOLBAR_ELRAIL_CONSTRUCTION_CAPTION :Adeiladu Rheilffyrdd Drydan From 7ba0fa4bf01ff7e9f08a10a83c27243733f0a18c Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 19:48:39 +0100 Subject: [PATCH 24/50] Fix af22a4f2: scenario editor doesn't have build station/depot/etc (#8529) --- src/dock_gui.cpp | 20 ++++++++++++-------- src/road_gui.cpp | 20 ++++++++++++-------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 39237f5ca1..9fe8c7875a 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -125,15 +125,19 @@ struct BuildDocksToolbarWindow : Window { if (!can_build) { DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER); DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); + } - /* Show in the tooltip why this button is disabled. */ - this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - this->GetWidget(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - } else { - this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP); - this->GetWidget(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP); - this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP); + if (_game_mode != GM_EDITOR) { + if (!can_build) { + /* Show in the tooltip why this button is disabled. */ + this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_DT_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + } else { + this->GetWidget(WID_DT_DEPOT)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DEPOT_TOOLTIP); + this->GetWidget(WID_DT_STATION)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUILD_DOCK_TOOLTIP); + this->GetWidget(WID_DT_BUOY)->SetToolTip(STR_WATERWAYS_TOOLBAR_BUOY_TOOLTIP); + } } } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index b9f59333d4..a9781be002 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -315,15 +315,19 @@ struct BuildRoadToolbarWindow : Window { DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD); + } - /* Show in the tooltip why this button is disabled. */ - this->GetWidget(WID_ROT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); - } else { - this->GetWidget(WID_ROT_DEPOT)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT); - this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION); - this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION); + if (_game_mode != GM_EDITOR) { + if (!can_build) { + /* Show in the tooltip why this button is disabled. */ + this->GetWidget(WID_ROT_DEPOT)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE); + } else { + this->GetWidget(WID_ROT_DEPOT)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_ROAD_VEHICLE_DEPOT : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRAM_VEHICLE_DEPOT); + this->GetWidget(WID_ROT_BUS_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_BUS_STATION : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_PASSENGER_TRAM_STATION); + this->GetWidget(WID_ROT_TRUCK_STATION)->SetToolTip(rtt == RTT_ROAD ? STR_ROAD_TOOLBAR_TOOLTIP_BUILD_TRUCK_LOADING_BAY : STR_ROAD_TOOLBAR_TOOLTIP_BUILD_CARGO_TRAM_STATION); + } } } From 31d19680043cecaaca31dba3fee341699db1b7a3 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 8 Jan 2021 20:20:54 +0100 Subject: [PATCH 25/50] Fix: Start the inactivity-timeout for the content server only after the connection has been established. (#8530) When connecting took long due to the first N resolve-addresses timing out, OpenTTD would immediately close the connection, without sending anything. --- src/network/network_content.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 1c19a2b526..9ed6551c6c 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -743,6 +743,7 @@ public: void OnConnect(SOCKET s) override { assert(_network_content_client.sock == INVALID_SOCKET); + _network_content_client.lastActivity = _realtime_tick; _network_content_client.isConnecting = false; _network_content_client.sock = s; _network_content_client.Reopen(); @@ -755,8 +756,6 @@ public: */ void ClientNetworkContentSocketHandler::Connect() { - this->lastActivity = _realtime_tick; - if (this->sock != INVALID_SOCKET || this->isConnecting) return; this->isConnecting = true; new NetworkContentConnecter(NetworkAddress(NETWORK_CONTENT_SERVER_HOST, NETWORK_CONTENT_SERVER_PORT, AF_UNSPEC)); From 5f591c86fe0d49f18da12515facc884269497b08 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 22:34:21 +0100 Subject: [PATCH 26/50] Fix 85a49a0d: invalidate airport toolbar when new planes become available (#8532) Otherwise if the airport button is disabled, it will remain disabled until you close/open the toolbar again. --- src/engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/engine.cpp b/src/engine.cpp index 2681b8fa62..e73fdb058a 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -735,6 +735,7 @@ static void EnableEngineForCompany(EngineID eid, CompanyID company) InvalidateWindowData(WC_MAIN_TOOLBAR, 0); if (e->type == VEH_ROAD) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_ROAD); if (e->type == VEH_SHIP) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_WATER); + if (e->type == VEH_AIRCRAFT) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR); } } @@ -1018,6 +1019,7 @@ static void NewVehicleAvailable(Engine *e) /* Update the toolbar. */ if (e->type == VEH_ROAD) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_ROAD); if (e->type == VEH_SHIP) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_WATER); + if (e->type == VEH_AIRCRAFT) InvalidateWindowData(WC_BUILD_TOOLBAR, TRANSPORT_AIR); /* Close pending preview windows */ DeleteWindowById(WC_ENGINE_PREVIEW, index); From b6ac5a3ab9d2dcb9496ad16973bca14ec495fa31 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 23:28:46 +0100 Subject: [PATCH 27/50] Fix 85a49a0d3: hotkeys were enabled outside of GM_NORMAL (#8534) --- src/airport_gui.cpp | 1 + src/rail_gui.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index e12b8dccbd..0697c24439 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -172,6 +172,7 @@ struct BuildAirToolbarWindow : Window { */ static EventState AirportToolbarGlobalHotkeys(int hotkey) { + if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED; Window *w = ShowBuildAirToolbar(); if (w == nullptr) return ES_NOT_HANDLED; return w->OnHotkey(hotkey); diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 37c365881f..77792f2761 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -769,6 +769,7 @@ struct BuildRailToolbarWindow : Window { */ static EventState RailToolbarGlobalHotkeys(int hotkey) { + if (_game_mode != GM_NORMAL) return ES_NOT_HANDLED; extern RailType _last_built_railtype; Window *w = ShowBuildRailToolbar(_last_built_railtype); if (w == nullptr) return ES_NOT_HANDLED; From b0456669c9391423dafca39230e990ed59e112d1 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Sat, 9 Jan 2021 04:06:31 -0500 Subject: [PATCH 28/50] Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535) --- src/town_cmd.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 3a2cd70871..d92a076b2c 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1349,6 +1349,9 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t assert(tile < MapSize()); + /* Don't allow junctions on roadtypes which can't be built by towns. */ + if (IsTileType(tile, MP_ROAD) && !HasBit(GetRoadTypeInfo(GetRoadTypeRoad(tile))->flags, ROTF_TOWN_BUILD)) return; + if (cur_rb == ROAD_NONE) { /* Tile has no road. First reset the status counter * to say that this is the last iteration. */ From 8e6574dcdb6362edd0124d400d9c4a00071b22a1 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Jan 2021 12:14:23 +0100 Subject: [PATCH 29/50] Revert 78f92130: "Fix #8506: Towns shouldn't add junctions to NewGRF roads they cannot build (#8535)" (#8541) As per https://github.com/OpenTTD/OpenTTD/pull/8535#issuecomment-757122918, jumped the gun here. --- src/town_cmd.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index d92a076b2c..3a2cd70871 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1349,9 +1349,6 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t assert(tile < MapSize()); - /* Don't allow junctions on roadtypes which can't be built by towns. */ - if (IsTileType(tile, MP_ROAD) && !HasBit(GetRoadTypeInfo(GetRoadTypeRoad(tile))->flags, ROTF_TOWN_BUILD)) return; - if (cur_rb == ROAD_NONE) { /* Tile has no road. First reset the status counter * to say that this is the last iteration. */ From 8da5cff21065501303db98e2e575ac1202157985 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sat, 9 Jan 2021 11:18:31 +0000 Subject: [PATCH 30/50] Fix #8462: Don't check whether to grow a town road on water (#8471) --- src/town_cmd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 3a2cd70871..e87c4437f5 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -932,8 +932,8 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir) * If that fails clear the land, and if that fails exit. * This is to make sure that we can build a road here later. */ RoadType rt = GetTownRoadType(t); - if (DoCommand(tile, ((dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X) | (rt << 4), 0, DC_AUTO, CMD_BUILD_ROAD).Failed() && - DoCommand(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR).Failed()) { + if (DoCommand(tile, ((dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X) | (rt << 4), 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD).Failed() && + DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR).Failed()) { return false; } } From 3dbdb1c7e3d5b7561d87d2cf891809324064bc1c Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Jan 2021 15:14:59 +0100 Subject: [PATCH 31/50] Change: remove warning in cheat window and reduce it to a note (#8538) Although meant as a funny joke towards the player, our social standards have changed since 2004, and such "jokes" are no longer acceptable by the community as a whole. The only value of the message is that people are informed the information is stored in the savegame. This is mostly useful for us, developers, as some of those cheats can have side-effects which people report. While at it, styled the GUI a bit better, as the way the text was presented was odd. --- src/cheat_gui.cpp | 12 ++++++------ src/lang/english.txt | 2 +- src/widgets/cheat_widget.h | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index d83cd3996f..3a40fb21dd 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -203,12 +203,14 @@ static const NWidgetPart _nested_cheat_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(WWT_PANEL, COLOUR_GREY, WID_C_PANEL), SetDataTip(0x0, STR_CHEATS_TOOLTIP), EndContainer(), + NWidget(WWT_PANEL, COLOUR_GREY), + NWidget(WWT_LABEL, COLOUR_GREY, WID_C_NOTE), SetFill(1, 1), SetDataTip(STR_CHEATS_NOTE, STR_NULL), SetPadding(WD_PAR_VSEP_NORMAL, 4, WD_PAR_VSEP_NORMAL, 4), + EndContainer(), }; /** GUI for the cheats. */ struct CheatWindow : Window { int clicked; - int header_height; int clicked_widget; uint line_height; int box_width; @@ -223,8 +225,7 @@ struct CheatWindow : Window { { if (widget != WID_C_PANEL) return; - int y = r.top + WD_FRAMERECT_TOP + this->header_height; - DrawStringMultiLine(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_LEFT, r.top + WD_FRAMERECT_TOP, y, STR_CHEATS_WARNING, TC_FROMSTRING, SA_CENTER); + int y = r.top + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL; bool rtl = _current_text_dir == TD_RTL; uint box_left = rtl ? r.right - this->box_width - 5 : r.left + 5; @@ -324,14 +325,13 @@ struct CheatWindow : Window { this->line_height = std::max(this->line_height, FONT_HEIGHT_NORMAL) + WD_PAR_VSEP_NORMAL; size->width = width + 20 + this->box_width + SETTING_BUTTON_WIDTH /* stuff on the left */ + 10 /* extra spacing on right */; - this->header_height = GetStringHeight(STR_CHEATS_WARNING, size->width - WD_FRAMERECT_LEFT - WD_FRAMERECT_RIGHT) + WD_PAR_VSEP_WIDE; - size->height = this->header_height + WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui); + size->height = WD_FRAMERECT_TOP + WD_PAR_VSEP_NORMAL + WD_FRAMERECT_BOTTOM + this->line_height * lengthof(_cheats_ui); } void OnClick(Point pt, int widget, int click_count) override { const NWidgetBase *wid = this->GetWidget(WID_C_PANEL); - uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / this->line_height; + uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - WD_PAR_VSEP_NORMAL) / this->line_height; int x = pt.x - wid->pos_x; bool rtl = _current_text_dir == TD_RTL; if (rtl) x = wid->current_x - x; diff --git a/src/lang/english.txt b/src/lang/english.txt index a0cf2b9a0f..6f2168f20d 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1837,7 +1837,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Are you # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Checkboxes indicate if you have used this cheat before -STR_CHEATS_WARNING :{BLACK}Warning! You are about to betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity +STR_CHEATS_NOTE :{BLACK}Note: any usage of these settings will be recorded by the savegame STR_CHEAT_MONEY :{LTBLUE}Increase money by {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Playing as company: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magic bulldozer (remove industries, unmovable objects): {ORANGE}{STRING1} diff --git a/src/widgets/cheat_widget.h b/src/widgets/cheat_widget.h index c43799d5d3..b8ee75f52b 100644 --- a/src/widgets/cheat_widget.h +++ b/src/widgets/cheat_widget.h @@ -12,6 +12,7 @@ /** Widgets of the #CheatWindow class. */ enum CheatWidgets { + WID_C_NOTE, ///< Note on top of panel for use of cheat. WID_C_PANEL, ///< Panel where all cheats are shown in. }; From 218f40eea2227dddb2e3475f4f89d08ffd5c9c6f Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Jan 2021 15:15:14 +0100 Subject: [PATCH 32/50] Add: [Script] ScriptCargo::GetName, to get the human readable name of a cargo (#8544) Of course this translates into AICargo.GetName() for AIs and GSCargo.GetName() for GameScripts. --- regression/regression/main.nut | 3 ++- regression/regression/result.txt | 16 ++++++++++++++++ src/script/api/ai_changelog.hpp | 1 + src/script/api/game_changelog.hpp | 1 + src/script/api/script_cargo.cpp | 10 ++++++++++ src/script/api/script_cargo.hpp | 8 ++++++++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/regression/regression/main.nut b/regression/regression/main.nut index 5eb65b08f1..e0859e7a37 100644 --- a/regression/regression/main.nut +++ b/regression/regression/main.nut @@ -332,7 +332,8 @@ function Regression::Cargo() for (local i = -1; i < 15; i++) { print(" Cargo " + i); print(" IsValidCargo(): " + AICargo.IsValidCargo(i)); - print(" GetCargoLabel(): '" + AICargo.GetCargoLabel(i)+ "'"); + print(" GetName(): '" + AICargo.GetName(i) + "'"); + print(" GetCargoLabel(): '" + AICargo.GetCargoLabel(i) + "'"); print(" IsFreight(): " + AICargo.IsFreight(i)); print(" HasCargoClass(): " + AICargo.HasCargoClass(i, AICargo.CC_PASSENGERS)); print(" GetTownEffect(): " + AICargo.GetTownEffect(i)); diff --git a/regression/regression/result.txt b/regression/regression/result.txt index 84d8feaffe..140289ab15 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -1109,6 +1109,7 @@ ERROR: IsEnd() is invalid as Begin() is never called --AICargo-- Cargo -1 IsValidCargo(): false + GetName(): '(null : 0x00000000)' GetCargoLabel(): '(null : 0x00000000)' IsFreight(): false HasCargoClass(): false @@ -1120,6 +1121,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 0 IsValidCargo(): true + GetName(): 'Passengers' GetCargoLabel(): 'PASS' IsFreight(): false HasCargoClass(): true @@ -1131,6 +1133,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 0 Cargo 1 IsValidCargo(): true + GetName(): 'Coal' GetCargoLabel(): 'COAL' IsFreight(): true HasCargoClass(): false @@ -1142,6 +1145,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 2 IsValidCargo(): true + GetName(): 'Mail' GetCargoLabel(): 'MAIL' IsFreight(): false HasCargoClass(): false @@ -1153,6 +1157,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 3 IsValidCargo(): true + GetName(): 'Oil' GetCargoLabel(): 'OIL_' IsFreight(): true HasCargoClass(): false @@ -1164,6 +1169,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 4 IsValidCargo(): true + GetName(): 'Livestock' GetCargoLabel(): 'LVST' IsFreight(): true HasCargoClass(): false @@ -1175,6 +1181,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 5 IsValidCargo(): true + GetName(): 'Goods' GetCargoLabel(): 'GOOD' IsFreight(): true HasCargoClass(): false @@ -1186,6 +1193,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 6 IsValidCargo(): true + GetName(): 'Grain' GetCargoLabel(): 'GRAI' IsFreight(): true HasCargoClass(): false @@ -1197,6 +1205,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 7 IsValidCargo(): true + GetName(): 'Wood' GetCargoLabel(): 'WOOD' IsFreight(): true HasCargoClass(): false @@ -1208,6 +1217,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 8 IsValidCargo(): true + GetName(): 'Iron Ore' GetCargoLabel(): 'IORE' IsFreight(): true HasCargoClass(): false @@ -1219,6 +1229,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 9 IsValidCargo(): true + GetName(): 'Steel' GetCargoLabel(): 'STEL' IsFreight(): true HasCargoClass(): false @@ -1230,6 +1241,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 10 IsValidCargo(): true + GetName(): 'Valuables' GetCargoLabel(): 'VALU' IsFreight(): true HasCargoClass(): false @@ -1241,6 +1253,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 11 IsValidCargo(): false + GetName(): '(null : 0x00000000)' GetCargoLabel(): '(null : 0x00000000)' IsFreight(): false HasCargoClass(): false @@ -1252,6 +1265,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 12 IsValidCargo(): false + GetName(): '(null : 0x00000000)' GetCargoLabel(): '(null : 0x00000000)' IsFreight(): false HasCargoClass(): false @@ -1263,6 +1277,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 13 IsValidCargo(): false + GetName(): '(null : 0x00000000)' GetCargoLabel(): '(null : 0x00000000)' IsFreight(): false HasCargoClass(): false @@ -1274,6 +1289,7 @@ ERROR: IsEnd() is invalid as Begin() is never called GetRoadVehicleTypeForCargo(): 1 Cargo 14 IsValidCargo(): false + GetName(): '(null : 0x00000000)' GetCargoLabel(): '(null : 0x00000000)' IsFreight(): false HasCargoClass(): false diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index a579bb27bc..5d5d5c26fd 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -18,6 +18,7 @@ * This version is not yet released. The following changes are not set in stone yet. * * API additions: + * \li AICargo::GetName * \li AIPriorityQueue * * \b 1.10.0 diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index 1f43cdea1c..cbb862f1ca 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -18,6 +18,7 @@ * This version is not yet released. The following changes are not set in stone yet. * * API additions: + * \li GSCargo::GetName * \li GSEventStoryPageButtonClick * \li GSEventStoryPageTileSelect * \li GSEventStoryPageVehicleSelect diff --git a/src/script/api/script_cargo.cpp b/src/script/api/script_cargo.cpp index 67cbc1930c..6b0a4aa7a5 100644 --- a/src/script/api/script_cargo.cpp +++ b/src/script/api/script_cargo.cpp @@ -11,7 +11,9 @@ #include "script_cargo.hpp" #include "../../economy_func.h" #include "../../core/bitmath_func.hpp" +#include "../../strings_func.h" #include "../../settings_type.h" +#include "table/strings.h" #include "../../safeguards.h" @@ -25,6 +27,14 @@ return (towneffect_type >= (TownEffect)TE_BEGIN && towneffect_type < (TownEffect)TE_END); } +/* static */ char *ScriptCargo::GetName(CargoID cargo_type) +{ + if (!IsValidCargo(cargo_type)) return nullptr; + + ::SetDParam(0, 1 << cargo_type); + return GetString(STR_JUST_CARGO_LIST); +} + /* static */ char *ScriptCargo::GetCargoLabel(CargoID cargo_type) { if (!IsValidCargo(cargo_type)) return nullptr; diff --git a/src/script/api/script_cargo.hpp b/src/script/api/script_cargo.hpp index 9ecd4cbfb2..1bfd8c5531 100644 --- a/src/script/api/script_cargo.hpp +++ b/src/script/api/script_cargo.hpp @@ -84,6 +84,14 @@ public: */ static bool IsValidTownEffect(TownEffect towneffect_type); + /** + * Get the name of the cargo type. + * @param cargo_type The cargo type to get the name of. + * @pre IsValidCargo(cargo_type). + * @return The name of the cargo type. + */ + static char *GetName(CargoID cargo_type); + /** * Gets the string representation of the cargo label. * @param cargo_type The cargo to get the string representation of. From 928276a66e739d8b82aa87064cc736f1c5cfaa47 Mon Sep 17 00:00:00 2001 From: translators Date: Sat, 9 Jan 2021 18:30:51 +0000 Subject: [PATCH 33/50] Update: Translations from eints korean: 4 changes by telk5093 finnish: 4 changes by hpiirai catalan: 11 changes by J0anJosep --- src/lang/afrikaans.txt | 1 - src/lang/arabic_egypt.txt | 1 - src/lang/basque.txt | 1 - src/lang/belarusian.txt | 1 - src/lang/brazilian_portuguese.txt | 1 - src/lang/bulgarian.txt | 1 - src/lang/catalan.txt | 12 +++++++++++- src/lang/croatian.txt | 1 - src/lang/czech.txt | 1 - src/lang/danish.txt | 1 - src/lang/dutch.txt | 1 - src/lang/english_AU.txt | 1 - src/lang/english_US.txt | 1 - src/lang/esperanto.txt | 1 - src/lang/estonian.txt | 1 - src/lang/faroese.txt | 1 - src/lang/finnish.txt | 5 ++++- src/lang/french.txt | 1 - src/lang/gaelic.txt | 1 - src/lang/galician.txt | 1 - src/lang/german.txt | 1 - src/lang/greek.txt | 1 - src/lang/hebrew.txt | 1 - src/lang/hungarian.txt | 1 - src/lang/icelandic.txt | 1 - src/lang/indonesian.txt | 1 - src/lang/irish.txt | 1 - src/lang/italian.txt | 1 - src/lang/japanese.txt | 1 - src/lang/korean.txt | 5 ++++- src/lang/latin.txt | 1 - src/lang/latvian.txt | 1 - src/lang/lithuanian.txt | 1 - src/lang/luxembourgish.txt | 1 - src/lang/malay.txt | 1 - src/lang/norwegian_bokmal.txt | 1 - src/lang/norwegian_nynorsk.txt | 1 - src/lang/polish.txt | 1 - src/lang/portuguese.txt | 1 - src/lang/romanian.txt | 1 - src/lang/russian.txt | 1 - src/lang/serbian.txt | 1 - src/lang/simplified_chinese.txt | 1 - src/lang/slovak.txt | 1 - src/lang/slovenian.txt | 1 - src/lang/spanish.txt | 1 - src/lang/spanish_MX.txt | 1 - src/lang/swedish.txt | 1 - src/lang/thai.txt | 1 - src/lang/traditional_chinese.txt | 1 - src/lang/turkish.txt | 1 - src/lang/ukrainian.txt | 1 - src/lang/unfinished/persian.txt | 1 - src/lang/unfinished/urdu.txt | 1 - src/lang/vietnamese.txt | 1 - src/lang/welsh.txt | 1 - 56 files changed, 19 insertions(+), 56 deletions(-) diff --git a/src/lang/afrikaans.txt b/src/lang/afrikaans.txt index 89e4a16f7f..26f7db3cc0 100644 --- a/src/lang/afrikaans.txt +++ b/src/lang/afrikaans.txt @@ -1806,7 +1806,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Is jy s # Cheat window STR_CHEATS :{WHITE}Kullery STR_CHEATS_TOOLTIP :{BLACK}Keuseblokkies wys aan as jy die kulkode voorheen gebruik het -STR_CHEATS_WARNING :{BLACK}Waarskuwing! U staan op die punt om jou mededinger te veraai. Hou in gedagte dat so 'n skande vir ewigheid sal onthou word. STR_CHEAT_MONEY :{LTBLUE}Vermeerder geld met {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Speel as maatskappy: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Tower stootskraper (verwyder nywerhede, onbeweegbare voorwerpe): {ORANGE}{STRING} diff --git a/src/lang/arabic_egypt.txt b/src/lang/arabic_egypt.txt index 47cf9ef538..16e4f408d0 100644 --- a/src/lang/arabic_egypt.txt +++ b/src/lang/arabic_egypt.txt @@ -1442,7 +1442,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}هل ت # Cheat window STR_CHEATS :{WHITE}اسرار STR_CHEATS_TOOLTIP :{BLACK}علامة صح اذا استخدمت هذا السرمن قبل -STR_CHEATS_WARNING :{BLACK}تحذير! انت على وشك ان تغش منافسيك. إعلم انهم سيتذكرون عليك هذا العار للإبد STR_CHEAT_MONEY :{LTBLUE}زيادة السيولة بـ {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}العب كشركة{ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}الجرافة السحرية - لازالة المصانع و الاجسام غير القابلة للازالة.{ORANGE}{STRING} diff --git a/src/lang/basque.txt b/src/lang/basque.txt index 5ae8983494..ec1c6892d2 100644 --- a/src/lang/basque.txt +++ b/src/lang/basque.txt @@ -1682,7 +1682,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}¿Segur # Cheat window STR_CHEATS :{WHITE}Trukoak STR_CHEATS_TOOLTIP :{BLACK}Kontrol laukiek erakutsiko dute trukoak erabili badituzu -STR_CHEATS_WARNING :{BLACK}Abisua! Zure kideak traizionatzear zaude. Gogoratu traizioa ez dela inoiz ahaztuko STR_CHEAT_MONEY :{LTBLUE}Dirua {CURRENCY_LONG}-etan areagotu STR_CHEAT_CHANGE_COMPANY :{LTBLUE} {ORANGE}{COMMA} konpainiarekin jolastu STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer magikoa (edozer ezabatzen du): {ORANGE}{STRING} diff --git a/src/lang/belarusian.txt b/src/lang/belarusian.txt index a1a717cb66..e08d93aa9b 100644 --- a/src/lang/belarusian.txt +++ b/src/lang/belarusian.txt @@ -2116,7 +2116,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Вы ў # Cheat window STR_CHEATS :{WHITE}Махлярства (чыты) STR_CHEATS_TOOLTIP :{BLACK}Птушкі паказваюць, ці выкарыстоўвалі Вы гэты чыт раней -STR_CHEATS_WARNING :{BLACK}Увага, Вы зьбіраецеся здрадзіць сваім спаборнікам! Гэтага вам ніколі не даруюць! STR_CHEAT_MONEY :{LTBLUE}Дадаць {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Гульня за кампанію: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Чароўны дынамiт (знос УСЯГО): {ORANGE}{STRING} diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 2d56c02019..c628cf2829 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -1816,7 +1816,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Você t # Cheat window STR_CHEATS :{WHITE}Trapaças STR_CHEATS_TOOLTIP :{BLACK}As caixas de verificação indicam se você usou esta trapaça antes -STR_CHEATS_WARNING :{BLACK}Atenção! Você está prestes a trair os seus companheiros oponentes. Tenha em mente que tal desgraça será lembrada pela eternidade STR_CHEAT_MONEY :{LTBLUE}Aumentar dinheiro em {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jogando pela Co.: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Escavadeira mágica (destrói indústrias, objetos estáticos): {ORANGE}{STRING} diff --git a/src/lang/bulgarian.txt b/src/lang/bulgarian.txt index 5d506677f1..f8c7065075 100644 --- a/src/lang/bulgarian.txt +++ b/src/lang/bulgarian.txt @@ -1728,7 +1728,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Иск # Cheat window STR_CHEATS :{WHITE}Кодове STR_CHEATS_TOOLTIP :{BLACK}Кутийките показват дали този код е бил използван -STR_CHEATS_WARNING :{BLACK}Внимание! По този начин ще измамите своите съперници. Имайте в предвид, че това безчестие ще бъде запомнено вовеки веков. STR_CHEAT_MONEY :{LTBLUE}Увеличаване на парите с {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Играе като компания: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Магически булдозер (премахва промишленост, неподвижни обекти): {ORANGE}{STRING} diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index 76dcddf6b3..1f64363a1a 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -1452,6 +1452,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Mantingues les STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Mantingues les eines de construcció pels ponts, túnels, etc. obertes després d'utilitzar-les STR_CONFIG_SETTING_EXPENSES_LAYOUT :Agrupa les despeses a la finestra de finances de la companyia: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Defineix la disposició de la companyia a la finestra de despeses +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Treu automàticament els senyals durant la construcció ferroviària: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Treu automàticament els senyals ferroviaris que hi hagi pel mig durant la construcció de rail. Aneu amb compte ja que pot provocar col·lisions de trens. STR_CONFIG_SETTING_SOUND_TICKER :Barra de notícies: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Reprodueix un so quan apareixen les notícies resumides a la barra inferior @@ -1836,7 +1838,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Esteu s # Cheat window STR_CHEATS :{WHITE}Trampes STR_CHEATS_TOOLTIP :{BLACK}Les caselles de selecció indiquen si heu fet servir aquesta trampa. -STR_CHEATS_WARNING :{BLACK}Atenció! Esteu a punt d'enredar als altres jugadors. Penseu que una cosa així serà recordada per tota l'eternitat. STR_CHEAT_MONEY :{LTBLUE}Augmenta els diners de la companyia actual en {CURRENCY_LONG}. STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Juga amb la companyia: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Eruga màgica (treu indústries i altres objectes inamovibles): {ORANGE}{STRING} @@ -2233,6 +2234,7 @@ STR_NETWORK_MESSAGE_CLIENT_COMPANY_SPECTATE :*** {STRING} s' STR_NETWORK_MESSAGE_CLIENT_COMPANY_NEW :*** {STRING} ha començat una nova companyia (#{2:NUM}) STR_NETWORK_MESSAGE_CLIENT_LEFT :*** {STRING} ha deixat la partida ({2:STRING}) STR_NETWORK_MESSAGE_NAME_CHANGE :*** {STRING} ha canviat el seu nom a {STRING} +STR_NETWORK_MESSAGE_GIVE_MONEY :*** {STRING} ha donat {2:CURRENCY_LONG} a {1:STRING}. STR_NETWORK_MESSAGE_SERVER_SHUTDOWN :{WHITE}El servidor ha tancat la sessió STR_NETWORK_MESSAGE_SERVER_REBOOT :{WHITE}El servidor està reiniciant...{}Espera un moment... STR_NETWORK_MESSAGE_KICKED :*** S'ha expulsat {STRING}. Motiu: {STRING} @@ -2352,6 +2354,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Uneix pu STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construeix un punt de pas separat # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}S'ha desactivat ja que actualment no disposeu de vehicles per usar aquesta infraestructura. # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construcció de ferrocarril @@ -3375,6 +3378,8 @@ STR_COMPANY_VIEW_RELOCATE_HQ :{BLACK}Trasllad STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS :{BLACK}Trasllada la seu a un altre lloc amb el cost d'un 1% del valor de la companyia. Amb Maj+Clic, mostra el cost estimat sense traslladar la seu. STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}Detalls STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}Veure els detalls de la infraestructura de la companyia. +STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}Dóna diners +STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}Doneu diners a aquesta companyia. STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}Modifica la cara STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}Modifica la cara del president de la companyia. @@ -3392,6 +3397,7 @@ STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP :{BLACK}Ven un 2 STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION :Nom de la companyia STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :Nom del president +STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :Escriviu la quantitat de diners que voleu donar STR_BUY_COMPANY_MESSAGE :{WHITE}Estem venent la nostra companyia de transports.{}{}Vols comprar {COMPANY} per {CURRENCY_LONG}? @@ -4018,6 +4024,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Remodela a {ST STR_ORDER_STOP_ORDER :(Para) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(No pot usar l'estació){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(Implícit) @@ -4343,6 +4350,7 @@ STR_ERROR_LOAN_ALREADY_REPAYED :{WHITE}... No q STR_ERROR_CURRENCY_REQUIRED :{WHITE}... {CURRENCY_LONG} necessaris STR_ERROR_CAN_T_REPAY_LOAN :{WHITE}No es pot amortitzar préstec... STR_ERROR_INSUFFICIENT_FUNDS :{WHITE}No es poden regalar els diners deixats pel banc... +STR_ERROR_CAN_T_GIVE_MONEY :{WHITE}No podeu donar diners a aquesta companyia... STR_ERROR_CAN_T_BUY_COMPANY :{WHITE}No pots comprar la companyia... STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS :{WHITE}No es pot construir la seu de la companyia... STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}No pots comprar el 25% de participació en aquesta companyia... @@ -4469,6 +4477,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Tipus de cotxer STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} és massa llarg després de la substitució STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}No s'han aplicat normes d'autosubstitució/renovació STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(límit de diners) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}El vehicle nou no pot portar {STRING}. +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}El vehicle nou no pot complir el remodelat de l'ordre {NUM}. # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Combinació de vies impossible diff --git a/src/lang/croatian.txt b/src/lang/croatian.txt index fabf0e4b97..d11109fc0b 100644 --- a/src/lang/croatian.txt +++ b/src/lang/croatian.txt @@ -1911,7 +1911,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Doista # Cheat window STR_CHEATS :{WHITE}Varanje STR_CHEATS_TOOLTIP :{BLACK}Kvačice ukazuju na to jesi li koristio ovo varanje prije -STR_CHEATS_WARNING :{BLACK}Upozorenje! Upravo se spremaš izdati svoj kolege natjecatelje. Imaj na umu da se takva sramota pamti zauvijek STR_CHEAT_MONEY :{LTBLUE}Povećaj novce za iznos {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Igraj kao tvrtka: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magični buldožer (uklanja industrije, nepokretne objekte): {ORANGE}{STRING} diff --git a/src/lang/czech.txt b/src/lang/czech.txt index 5cec2b7750..97d31253b4 100644 --- a/src/lang/czech.txt +++ b/src/lang/czech.txt @@ -1902,7 +1902,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Určite # Cheat window STR_CHEATS :{WHITE}Cheaty STR_CHEATS_TOOLTIP :{BLACK}Zaškrtávací políčka ukazují, jestli jsi tento cheat už použil -STR_CHEATS_WARNING :{BLACK}Varování! Chystáš se podvést ostatní hráče. Pamatuj si, že tento podlý čin nebude nikdy zapomenut! STR_CHEAT_MONEY :{LTBLUE}Navýšit peníze o {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Hrát jako společnost: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magický buldozer (odstraní průmysl a další objekty): {ORANGE}{STRING} diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 2f6da57ad3..f3158e0932 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -1815,7 +1815,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du s # Cheat window STR_CHEATS :{WHITE}Snydefunktioner STR_CHEATS_TOOLTIP :{BLACK}Checkbokse viser, om du har brugt denne snydefunktion før -STR_CHEATS_WARNING :{BLACK}Advarsel! Du er ved at forråde dine modstandere. Tænk lige på at dette vil blive husket i al evighed. STR_CHEAT_MONEY :{LTBLUE}Forøg kassebeholdning med {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spiller som firmaet: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magisk bulldozer (nedriv ting, som normalt ikke kan fjernes): {ORANGE}{STRING} diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 7e0977baea..461b66c03e 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -1837,7 +1837,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Weet je # Cheat window STR_CHEATS :{WHITE}Valsspelen STR_CHEATS_TOOLTIP :{BLACK}Keuzevakjes geven aan of je deze manier van valsspelen eerder hebt gebruikt -STR_CHEATS_WARNING :{BLACK}Waarschuwing! Je staat op het punt je medespelers te verraden. Onthoud dat zo'n schande eeuwig wordt onthouden STR_CHEAT_MONEY :{LTBLUE}Kapitaal vergroten met {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spelen als bedrijf: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magische bulldozer (industrieën en andere onverplaatsbare objecten verwijderen): {ORANGE}{STRING} diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index 49a7f2faf3..2fe4e02be8 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -1738,7 +1738,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Are you # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Checkboxes indicate if you have used this cheat before -STR_CHEATS_WARNING :{BLACK}Warning! You are about to betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity STR_CHEAT_MONEY :{LTBLUE}Increase money by {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Playing as company: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magic bulldozer (remove industries, unmovable objects): {ORANGE}{STRING} diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index 50a128d7e1..7f910c8e07 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -1813,7 +1813,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Are you # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Checkboxes indicate if you have used this cheat before -STR_CHEATS_WARNING :{BLACK}Warning! You are about to betray your fellow competitors. Keep in mind that such a disgrace will be remembered for eternity STR_CHEAT_MONEY :{LTBLUE}Increase money by {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Playing as company: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magic bulldozer (remove industries, unmovable objects): {ORANGE}{STRING} diff --git a/src/lang/esperanto.txt b/src/lang/esperanto.txt index 9cbbac6eb7..73d20fde5f 100644 --- a/src/lang/esperanto.txt +++ b/src/lang/esperanto.txt @@ -1422,7 +1422,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ĉu vi # Cheat window STR_CHEATS :{WHITE}Filudaĵoj STR_CHEATS_TOOLTIP :{BLACK}La kvadratetoj indikas ĉu vi jam uzis la filudaĵon antaŭe. -STR_CHEATS_WARNING :{BLACK}Atentu! Vi preskaŭ perfidos viajn kunulajn konkurantojn. Memoru ke io tia rememoriĝos eterne STR_CHEAT_MONEY :{LTBLUE}Altigu monkvanton per {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Ludanta kiel kompanio: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magia forigilo (forviŝu industriojn, nemovebla objektoj): {ORANGE}{STRING} diff --git a/src/lang/estonian.txt b/src/lang/estonian.txt index c52fa46482..704e745e1c 100644 --- a/src/lang/estonian.txt +++ b/src/lang/estonian.txt @@ -1829,7 +1829,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Kas sa # Cheat window STR_CHEATS :{WHITE}Petmine STR_CHEATS_TOOLTIP :{BLACK}Märgistatud kastid näitavad et, kas sa oled varem seda pettust kasutanud -STR_CHEATS_WARNING :{BLACK}Hoiatus! Sa kavatsed oma konkurente reeta. Pea meeles, et sellisest häbist ei saa sa enam kunagi lahti STR_CHEAT_MONEY :{LTBLUE}Suurenda raha hulka {CURRENCY_LONG} võrra STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Mängimine ettevõttena: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Võlubuldooser (eemaldab tööstused, paiksed objektid): {ORANGE}{STRING} diff --git a/src/lang/faroese.txt b/src/lang/faroese.txt index 88dad29d3a..4b6dcfb6d4 100644 --- a/src/lang/faroese.txt +++ b/src/lang/faroese.txt @@ -1588,7 +1588,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er tú # Cheat window STR_CHEATS :{WHITE}Snýt STR_CHEATS_TOOLTIP :{BLACK}Flugubeins kassanir vísa um tú hevur nýtt hetta snýti áður -STR_CHEATS_WARNING :{BLACK}Ávaring! Tú er í holt við at svíkja tínar kappingarneytar. Hav í huga at ein slík vanæra verður aldrin gloymd á ævini STR_CHEAT_MONEY :{LTBLUE}Hækka pening við {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spælir sum fyritøka: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Gandaður bulldosari (bein burtur ídnaðir, lutir ið ikki kunnu flytast): {ORANGE}{STRING} diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 802f0544c1..24a5cc860a 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -1837,7 +1837,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Lopetet # Cheat window STR_CHEATS :{WHITE}Huijaukset STR_CHEATS_TOOLTIP :{BLACK}Valintaruudut osoittavat, oletko käyttänyt huijausta aiemmin -STR_CHEATS_WARNING :{BLACK}Varoitus! Olet juuri pettämässä kanssakilpailijoitasi. Pidä mielessä, että tällainen häväistys pidetään mielessä ikuisuuden ajan STR_CHEAT_MONEY :{LTBLUE}Anna lisää rahaa: {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Hallinnassa oleva yhtiö: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Taikapuskutraktori (poista teollisuutta, liikuttamattomia kohteita): {ORANGE}{STRING} @@ -2354,6 +2353,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Liitä r STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Rakenna erillinen reittipiste # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Ei käytössä, koska tälle infrastruktuurille ei ole kulkuneuvoja tällä hetkellä # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Rautatien rakentaminen @@ -4023,6 +4023,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Sovita rahtity STR_ORDER_STOP_ORDER :(Pysähdy) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Asema ei käytettävissä){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(Ehdoton) @@ -4475,6 +4476,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Väärä varikk STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} on liian pitkä korvaamisen jälkeen STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Ei käytössä olevia itsekorvaus- tai itseuudistussääntöjä STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(rahoitusraja) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}Uusi kulkuneuvo ei voi kuljettaa {STRING} +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Uutta kulkuneuvoa ei voida uudelleensovittaa käskyssä {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Mahdoton ratayhdistelmä. diff --git a/src/lang/french.txt b/src/lang/french.txt index c3f2cb51b8..f9d680ea5e 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -1838,7 +1838,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Êtes-v # Cheat window STR_CHEATS :{WHITE}Triches STR_CHEATS_TOOLTIP :{BLACK}Les cases à cocher montrent si vous avez déjà utilisé cette triche auparavant -STR_CHEATS_WARNING :{BLACK}Attention{NBSP}! Vous êtes sur le point de trahir vos adversaires. Vous et votre famille serez déshonoré pour l'éternité. STR_CHEAT_MONEY :{LTBLUE}Augmenter l'argent de {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jouer en tant que compagnie{NBSP}: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer magique (enlèvement des industries et des objets fixes){NBSP}: {ORANGE}{STRING} diff --git a/src/lang/gaelic.txt b/src/lang/gaelic.txt index 7d1f88e6a9..016ec60869 100644 --- a/src/lang/gaelic.txt +++ b/src/lang/gaelic.txt @@ -1972,7 +1972,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}A bheil # Cheat window STR_CHEATS :{WHITE}Cealgaireachd STR_CHEATS_TOOLTIP :{BLACK}Is ciall dha bhogsaichean-cromaige gun deach a' chealgaireachd seo a chleachdadh roimhe -STR_CHEATS_WARNING :{BLACK}Rabhadh! Tha thu gu bhith a' mealladh nan co-fharpaiseach agad. Thoir an aire gun cumar cuimhne air an tàmailt seo gu bràth tuilleadh STR_CHEAT_MONEY :{LTBLUE}Meudaich an t-airgead le {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}A' cluich mar a' chompanaidh: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer draoidheach (thoir air falbh gnìomhachasan, oibseactan do-ghluasad): {ORANGE}{STRING} diff --git a/src/lang/galician.txt b/src/lang/galician.txt index 0383950d00..2d4f193a67 100644 --- a/src/lang/galician.txt +++ b/src/lang/galician.txt @@ -1808,7 +1808,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Estás # Cheat window STR_CHEATS :{WHITE}Trampulladas STR_CHEATS_TOOLTIP :{BLACK}As caixas de confirmación indican se usaches esta trampa antes -STR_CHEATS_WARNING :{BLACK}Coidado! Estás a piques de traizoar aos teus competidores. Ten en conta que un escándalo coma este vai ser lembrado eternamente STR_CHEAT_MONEY :{LTBLUE}Incrementar os cartos en {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Xogando coma compañía: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Escavadora máxica (elimina industrias, obxectos non eliminables): {ORANGE}{STRING} diff --git a/src/lang/german.txt b/src/lang/german.txt index 097c1359c2..789ef7deeb 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -1834,7 +1834,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Soll da # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Die Kontrollkästchen zeigen an, ob dieser Cheat schonmal verwendet worden ist -STR_CHEATS_WARNING :{BLACK}Achtung! Hiermit betrügt man seine Mitbewerber. Man sollte bedenken, dass sie das niemals verzeihen werden STR_CHEAT_MONEY :{LTBLUE}Kontostand um {CURRENCY_LONG} erhöhen STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spiele die Firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Mächtigeres Abrisswerkzeug (entfernt Industrien und unbewegliche Objekte): {ORANGE}{STRING} diff --git a/src/lang/greek.txt b/src/lang/greek.txt index ecf80b3310..7f949089ad 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -1901,7 +1901,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Είσ # Cheat window STR_CHEATS :{WHITE}Απατεωνιές STR_CHEATS_TOOLTIP :{BLACK}Τα κουτάκια δείχνουν αν έχετε ξαναχρησιμοποιήσει αυτή την απατεωνιά -STR_CHEATS_WARNING :{BLACK}Προσοχή! Είστε έτοιμοι να προδώσετε τους φίλους ανταγωνιστές σας. Θυμηθείτε ότι αυτή η ντροπή θα μείνει για πάντα. STR_CHEAT_MONEY :{LTBLUE}Αύξηση χρημάτων κατά {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Παίζετε με την εταιρία: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Μαγική μπουλντόζα (αφαιρεί βιομηχανίες, αμετακίνητα αντικείμενα): {ORANGE}{STRING} diff --git a/src/lang/hebrew.txt b/src/lang/hebrew.txt index b6bcbc8d27..e233592807 100644 --- a/src/lang/hebrew.txt +++ b/src/lang/hebrew.txt @@ -1787,7 +1787,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}האם # Cheat window STR_CHEATS :{WHITE}(cheats) טריקים STR_CHEATS_TOOLTIP :{BLACK}תיבות הסימון מציינות האם השתמשת בטריק הנתון בעבר -STR_CHEATS_WARNING :{BLACK}אזהרה! את/ה עומ/ת לבגוד בחבריך למשחק. קח/י בחשבון שחרפה כזו תיזכר לנצח. STR_CHEAT_MONEY :{LTBLUE}{CURRENCY_LONG}- הגדל את כמות הכסף במאזנך ל STR_CHEAT_CHANGE_COMPANY :{ORANGE}{COMMA}{LTBLUE} :שחק כבעלי החברה STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}טרקטור אימתני (הסרת מפעלים, רכיבים שאי אפשר להזיז): {ORANGE}{STRING} diff --git a/src/lang/hungarian.txt b/src/lang/hungarian.txt index 20e2ae9e29..6f2fb4c835 100644 --- a/src/lang/hungarian.txt +++ b/src/lang/hungarian.txt @@ -1879,7 +1879,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Biztosa # Cheat window STR_CHEATS :{WHITE}Csalások STR_CHEATS_TOOLTIP :{BLACK}A kijelölőnégyzetek jelzik a csalások eddigi használatát -STR_CHEATS_WARNING :{BLACK}Figyelem! Te épp a versenytársaidat készülöd elárulni. Sose felejtsd el, hogy egy ilyen szégyenletes tett sose merül feledésbe STR_CHEAT_MONEY :{LTBLUE}Tőkeemelés {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Irányított vállalat: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Csodabuldózer (lerombol gazdasági épületeket, mozgathatatlan objektumokat): {ORANGE}{STRING} diff --git a/src/lang/icelandic.txt b/src/lang/icelandic.txt index 6ad03bac63..fa03f937ff 100644 --- a/src/lang/icelandic.txt +++ b/src/lang/icelandic.txt @@ -1626,7 +1626,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ertu vi # Cheat window STR_CHEATS :{WHITE}Svindl STR_CHEATS_TOOLTIP :{BLACK}Valreitur segir til um ef þú hefur notað þetta svindl áður -STR_CHEATS_WARNING :{BLACK}Aðvörun! Þú ert í þann mund að svíkja keppinauta þína. Hafðu í huga að þess lags svívirðing mun ætíð höfð í minnum STR_CHEAT_MONEY :{LTBLUE}Auka pening um {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spila sem fyrirtæki: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Töfrajarðýta (eyðir iðnaði, óeyðanlegum hlutum): {ORANGE}{STRING} diff --git a/src/lang/indonesian.txt b/src/lang/indonesian.txt index 4958ba989d..5eabbcff18 100644 --- a/src/lang/indonesian.txt +++ b/src/lang/indonesian.txt @@ -1815,7 +1815,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Apa and # Cheat window STR_CHEATS :{WHITE}Kode Curang STR_CHEATS_TOOLTIP :{BLACK}Daftar cek ini mengindikasikan bahwa anda telah menggunakan kode curang ini sebelumnya -STR_CHEATS_WARNING :{BLACK}Peringatan! Anda akan mencurangi pemain lainnya. Kecurangan ini akan tetap tercatat selama game berjalan STR_CHEAT_MONEY :{LTBLUE}Tambah uang sebanyak {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Bermain sebagai pemain: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Buldozer ajaib (hancurkan industri, objek tidak bergerak): {ORANGE}{STRING} diff --git a/src/lang/irish.txt b/src/lang/irish.txt index 16264999d5..25fbad2efe 100644 --- a/src/lang/irish.txt +++ b/src/lang/irish.txt @@ -1761,7 +1761,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}An bhfu # Cheat window STR_CHEATS :{WHITE}Caimiléireacht STR_CHEATS_TOOLTIP :{BLACK}Tugann ticbhoscaí le fios más rud é gur úsáid tú an chaimiléireacht seo roimhe seo -STR_CHEATS_WARNING :{BLACK}Rabhadh! Tá tú ar tí feall a imirt ar do chomhimreoirí. Coinnigh i gcuimhne nach ndéanfar dearmad go brách ar a leithead de náire. STR_CHEAT_MONEY :{LTBLUE}Méadaigh airgead de {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Ag imirt mar chuideachta: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Ollscartaire draíochta (bain tionscail, nithe dobhogtha): {ORANGE}{STRING} diff --git a/src/lang/italian.txt b/src/lang/italian.txt index acb761b733..4348e3335f 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -1839,7 +1839,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Si è s # Cheat window STR_CHEATS :{WHITE}Trucchi STR_CHEATS_TOOLTIP :{BLACK}Le caselle indicano se un trucco è già stato usato una volta -STR_CHEATS_WARNING :{BLACK}Attenzione! Stai per tradire i tuoi avversari. Ricordati che un così grande disonore sarà ricordato per l'eternità STR_CHEAT_MONEY :{LTBLUE}Aumenta denaro di {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Compagnia controllata: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer magico (rimuove industrie e oggetti fissi): {ORANGE}{STRING} diff --git a/src/lang/japanese.txt b/src/lang/japanese.txt index ff021acd65..8144d10619 100644 --- a/src/lang/japanese.txt +++ b/src/lang/japanese.txt @@ -1761,7 +1761,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}この # Cheat window STR_CHEATS :{WHITE}チート STR_CHEATS_TOOLTIP :{BLACK}以前にこのチートを使用したことがあることを示します -STR_CHEATS_WARNING :{BLACK}注意: チートを使用すると、競争者に裏切りと見做され、永久に呪われる可能性があります STR_CHEAT_MONEY :{LTBLUE}預金残高を{CURRENCY_LONG}増やす STR_CHEAT_CHANGE_COMPANY :{LTBLUE}会社: {ORANGE}{COMMA}を乗っ取ってプレイする STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}魔法のブルドーザー(産業拠点等、何でも撤去できる): {ORANGE}{STRING} diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 3c92fb9407..720a3c1bec 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -1838,7 +1838,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}정말 # Cheat window STR_CHEATS :{WHITE}치트 STR_CHEATS_TOOLTIP :{BLACK}체크박스의 체크 표시는 이전에 이 치트를 사용했는지 여부를 나타냅니다. -STR_CHEATS_WARNING :{BLACK}경고! 치트는 경쟁자를 속이는 행위입니다. 치트를 사용한 기록은 절대 지워지지 않음을 명심하십시오. STR_CHEAT_MONEY :{LTBLUE}재정을 {CURRENCY_LONG} 만큼 증가 STR_CHEAT_CHANGE_COMPANY :{LTBLUE}다음 회사로 플레이: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}마법 불도저 (산업시설이나 옮길 수 없는 건물 제거): {ORANGE}{STRING} @@ -2355,6 +2354,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}연결 STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}분리된 경유지를 새로 만들기 # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}현재 이 기반 시설에서 사용할 수 있는 차량이 없어 비활성화되었습니다 # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :선로 건설 @@ -4024,6 +4024,7 @@ STR_ORDER_REFIT_STOP_ORDER :({STRING}에서 STR_ORDER_STOP_ORDER :(멈춤) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(이 역을 이용할 수 없음){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(자동) @@ -4476,6 +4477,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :잘못된 차 STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} : 교체된지 너무 오래되었습니다 STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}자동 교체/갱신 규칙이 적용되지 않았습니다 STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(자금 부족) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}새로 교체된 차량이 {0:STRING}{G 0 "을" "를"} 실을 수 없습니다 +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}새로 교체된 차량이 경로 {NUM} 대로 개조될 수 없습니다 # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}불가능한 트랙 조합입니다 diff --git a/src/lang/latin.txt b/src/lang/latin.txt index f0d1636871..c15bc1d944 100644 --- a/src/lang/latin.txt +++ b/src/lang/latin.txt @@ -1979,7 +1979,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Esne ce # Cheat window STR_CHEATS :{WHITE}Tricae STR_CHEATS_TOOLTIP :{BLACK}Quadrum signi plenum indicat trica iam a te usa est -STR_CHEATS_WARNING :{BLACK}Cave! Competitores tuas falsurus es! Memento tantam infamiam memoria omnium in aeternum teneri! STR_CHEAT_MONEY :{LTBLUE}Augere pecuniam {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Ludens es in loco societatis: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magica machina aggerandi (removet industrias, obiecta immobilia): {ORANGE}{STRING} diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 5aba43ac06..f1264ca036 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -1839,7 +1839,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Vai tie # Cheat window STR_CHEATS :{WHITE}Blēdības STR_CHEATS_TOOLTIP :{BLACK}Atzīmētās rūtiņas norāda uz to, vai esat jau izmantojis šo blēdību -STR_CHEATS_WARNING :{BLACK}Brīdinājums! Jūs grasāties būt neuzticams saviem spēles biedriem, sāncenšiem. Iegaumējiet, ka šādu negodu viņi atcerēsies mūžīgi STR_CHEAT_MONEY :{LTBLUE}Palielināt naudas līdzekļus par {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spēlēt kā uzņēmumam: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Burvju buldozers (nojauc ražotnes, nepārvietojamus objektus): {ORANGE}{STRING} diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt index 8cf458b1da..5f5df17ab3 100644 --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -1990,7 +1990,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ar tikr # Cheat window STR_CHEATS :{WHITE}Sukčiavimai STR_CHEATS_TOOLTIP :{BLACK}Laukeliai rodo ar jus naudojote šį triuką prieš tai -STR_CHEATS_WARNING :{BLACK}Dėmesio! Tu bandai išduoti vargšus savo varžovus. Tai bus tavo gėda visiems laikams ir niekada neužmiršta. STR_CHEAT_MONEY :{LTBLUE}Padauginti pinigų {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Žaidiama už kompaniją: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magiškas buldozeris (pašalina gamyklas ir nepajudinamus objektus): {ORANGE}{STRING} diff --git a/src/lang/luxembourgish.txt b/src/lang/luxembourgish.txt index 434bcf92f3..597daf7adb 100644 --- a/src/lang/luxembourgish.txt +++ b/src/lang/luxembourgish.txt @@ -1814,7 +1814,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Sécher # Cheat window STR_CHEATS :{WHITE}Cheater STR_CHEATS_TOOLTIP :{BLACK}Checkboxen weisen un dass du den Cheat schon eng Kéier benotzt hues -STR_CHEATS_WARNING :{BLACK}Warnung! Du bass um Wee de Géigner ze verroden. Sou eng Ongnod gëtt bis an all Éiwegkeet behalen STR_CHEAT_MONEY :{LTBLUE}Suen ëm {CURRENCY_LONG} erhéijen STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Als Firma {ORANGE}{COMMA} spillen STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magësche Bulldozer (Industrien ofrappen, onzerstéierbar Objeten): {ORANGE}{STRING} diff --git a/src/lang/malay.txt b/src/lang/malay.txt index 20c9718201..eba44af687 100644 --- a/src/lang/malay.txt +++ b/src/lang/malay.txt @@ -1523,7 +1523,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Pastika # Cheat window STR_CHEATS :{WHITE}Penipuan (Cheats) STR_CHEATS_TOOLTIP :{BLACK}Kotak bertanda menunjukkan anda pernah menggunakan penipuan (cheats) ini -STR_CHEATS_WARNING :{BLACK}Amaran! Anda akan mengkhianati rakan-rakan pesaing anda. Perbuatan yang mengaibkan ini tidak akan dilupakan selama-lamanya. STR_CHEAT_MONEY :{LTBLUE}Tambahkan wang sebanyak {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Bermain sebagai syarikat: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Jentolak ajaib (buang industri dan objek lain yang biasanya tidak boleh dibuang): {ORANGE}{STRING} diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt index 2e8bc5809d..ef821268ec 100644 --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -1816,7 +1816,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du s # Cheat window STR_CHEATS :{WHITE}Juksekoder STR_CHEATS_TOOLTIP :{BLACK}Avkrysningsbokser indikerer om du har brukt denne juksekoden tidligere -STR_CHEATS_WARNING :{BLACK}Advarsel! Du er i ferd med å bedra dine motstandere. Vær klar over at en slik skammelig oppførsel vil bli husket i all evighet STR_CHEAT_MONEY :{LTBLUE}Øk pengebeholdningen med {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spiller som firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magisk bulldoser (fjern industrier, uflyttbare objekter): {ORANGE}{STRING} diff --git a/src/lang/norwegian_nynorsk.txt b/src/lang/norwegian_nynorsk.txt index bc416a3402..4b35078727 100644 --- a/src/lang/norwegian_nynorsk.txt +++ b/src/lang/norwegian_nynorsk.txt @@ -1685,7 +1685,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du s # Cheat window STR_CHEATS :{WHITE}Juks STR_CHEATS_TOOLTIP :{BLACK}Avkrysningsbokser fortel at du har nytta denne juksekoden tidlegare -STR_CHEATS_WARNING :{BLACK}Åtvaring! Du er i ferd med å forråda motspelarane. Vær klar over at denne skammelige handlinga vil bli hugsa i all framtid. STR_CHEAT_MONEY :{LTBLUE}Auk pengebehaldninga med {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Speler som firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magisk bulldoser (fjern industriar, uflyttbare ting): {ORANGE}{STRING} diff --git a/src/lang/polish.txt b/src/lang/polish.txt index de72797e3d..5cd3e7e194 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -2217,7 +2217,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Czy jes # Cheat window STR_CHEATS :{WHITE}Oszustwa STR_CHEATS_TOOLTIP :{BLACK}Pole wyboru wskazuje, czy użyłeś już wcześniej tego oszustwa -STR_CHEATS_WARNING :{BLACK}Ostrzeżenie! Właśnie chcesz zdradzić swoich współzawodników. Miej na uwadze, że taka hańba będzie pamiętana na wieczność STR_CHEAT_MONEY :{LTBLUE}Zwiększ ilość pieniędzy o {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Grasz jako firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magiczny buldożer (usuwanie przedsiębiorstw, nieprzesuwalnych obiektów): {ORANGE}{STRING} diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index 79c9bbd058..3adf8fe222 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -1803,7 +1803,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Tem a c # Cheat window STR_CHEATS :{WHITE}Truques STR_CHEATS_TOOLTIP :{BLACK}As caixas de verificação indicam se já usou este truque antes -STR_CHEATS_WARNING :{BLACK} Atenção! Está prestes a trair seus concorrentes. Tenha em mente que a desonra será lembrada para a eternidade STR_CHEAT_MONEY :{LTBLUE}Aumentar dinheiro em {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jogando como empresa: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer mágico (destrói indústrias, objectos amovíveis etc.): {ORANGE}{STRING} diff --git a/src/lang/romanian.txt b/src/lang/romanian.txt index eb276c3ce0..2ee2c7081e 100644 --- a/src/lang/romanian.txt +++ b/src/lang/romanian.txt @@ -1753,7 +1753,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Eşti s # Cheat window STR_CHEATS :{WHITE}Cheat-uri STR_CHEATS_TOOLTIP :{BLACK}Bifa vă indică dacă aţi folosit anterior acest cheat -STR_CHEATS_WARNING :{BLACK}Atenţie! Eşti pe cale să-ţi trădezi colegii de joc! Nu uita că această ruşine va rămâne înregistrată pentru totdeauna STR_CHEAT_MONEY :{LTBLUE}Măreşte fondurile cu {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Joacă drept compania: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Buldozer magic (demolează industrii şi lucruri amovibile): {ORANGE}{STRING} diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 2b2c416c67..54275c7285 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -1987,7 +1987,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Вы у # Cheat window STR_CHEATS :{WHITE}Читы STR_CHEATS_TOOLTIP :{BLACK}Галочки показывают, использовали ли Вы этот чит раньше -STR_CHEATS_WARNING :{BLACK}Внимание, вы собираетесь предать своих соперников! Этого вам никогда не простят! STR_CHEAT_MONEY :{LTBLUE}Добавить {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Игра за компанию: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Волшебный динамит (снос ВСЕГО): {ORANGE}{STRING} diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt index 8c528b56a5..499d3986f9 100644 --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -1968,7 +1968,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Da li s # Cheat window STR_CHEATS :{WHITE}Varanja STR_CHEATS_TOOLTIP :{BLACK}Štiklirano polje označava da ste i ranije koristili ovu opciju -STR_CHEATS_WARNING :{BLACK}Upozorenje! Upravo ćete prevariti vaše saradnike. Imajte na umu da će takav loš postupak biti trajno upamćen STR_CHEAT_MONEY :{LTBLUE}Dodati još {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Upravljanje preduzećem: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magični buldožer (uklanja fabrike, nepokretnosti): {ORANGE}{STRING} diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index 50c1351bca..97c0977d49 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -1815,7 +1815,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}你确 # Cheat window STR_CHEATS :{WHITE}作弊 STR_CHEATS_TOOLTIP :{BLACK}标志您是否用过此作弊选项的单选框 -STR_CHEATS_WARNING :{BLACK}注意!作弊是不光彩的!所有作弊都将被记录下来! STR_CHEAT_MONEY :{LTBLUE}增加 {CURRENCY_LONG} 现金 STR_CHEAT_CHANGE_COMPANY :{LTBLUE}作为{ORANGE}{COMMA}进行游戏 STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}神奇推土机 (清除工业设施和其他不可移除物): {ORANGE}{STRING} diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt index a33f69761a..237ffb37b0 100644 --- a/src/lang/slovak.txt +++ b/src/lang/slovak.txt @@ -1903,7 +1903,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ste si # Cheat window STR_CHEATS :{WHITE}Cheaty STR_CHEATS_TOOLTIP :{BLACK}Zaškrtávacie pole indikuje opakované použite cheatu -STR_CHEATS_WARNING :{BLACK}Varovanie! Chceš oklamať svojich protihráčov. Pamätajte že táto hanba bude zapísaná naveky STR_CHEAT_MONEY :{LTBLUE}Zvýšiť hotovosť o {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Hrať za spoločnosť: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magický buldozér (odstráni priemysel a nehnuteľnosti): {ORANGE}{STRING} diff --git a/src/lang/slovenian.txt b/src/lang/slovenian.txt index 10187d7578..9df575f685 100644 --- a/src/lang/slovenian.txt +++ b/src/lang/slovenian.txt @@ -1916,7 +1916,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Zagotov # Cheat window STR_CHEATS :{WHITE}Goljufije STR_CHEATS_TOOLTIP :{BLACK}Kljukice kažejo, če so bile goljufije že kdaj uporabljene -STR_CHEATS_WARNING :{BLACK}Pozor! Nameravaš izdati svoje tekmece. Tako sramotno dejanje bo zabeleženo za vselej STR_CHEAT_MONEY :{LTBLUE}Povečaj denar za {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Igra kot podjetje: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Čarobni buldožer (odstrani industrije, neodstranljive objekte): {ORANGE}{STRING} diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 9daebaf7d4..9464ec1533 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -1838,7 +1838,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}¿Está # Cheat window STR_CHEATS :{WHITE}Trucos STR_CHEATS_TOOLTIP :{BLACK}Las casillas indican si ha usado este truco antes -STR_CHEATS_WARNING :{BLACK}¡Atención! Usted está a punto de traicionar a sus competidores. Tenga presente que tal deshonra será recordada por la eternidad STR_CHEAT_MONEY :{LTBLUE}Incrementar dinero en {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jugando como la empresa: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldózer mágico (elimina industrias, objetos inamovibles): {ORANGE}{STRING} diff --git a/src/lang/spanish_MX.txt b/src/lang/spanish_MX.txt index 3db30473b5..648f1a7ac0 100644 --- a/src/lang/spanish_MX.txt +++ b/src/lang/spanish_MX.txt @@ -1836,7 +1836,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}¿Está # Cheat window STR_CHEATS :{WHITE}Trucos STR_CHEATS_TOOLTIP :{BLACK}Las casillas marcadas indican que ya se usó este truco -STR_CHEATS_WARNING :{BLACK}¡Atención! Estás a punto de traicionar a tus competidores. Recuerda que siempre se recordará tal deshonra STR_CHEAT_MONEY :{LTBLUE}Añadir {CURRENCY_LONG} en efectivo STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jugar como la empresa: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Excavadora mágica (elimina industrias y objetos inamovibles): {ORANGE}{STRING} diff --git a/src/lang/swedish.txt b/src/lang/swedish.txt index cf4a1cb98a..6aa165a8d0 100644 --- a/src/lang/swedish.txt +++ b/src/lang/swedish.txt @@ -1815,7 +1815,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Är du # Cheat window STR_CHEATS :{WHITE}Fusk STR_CHEATS_TOOLTIP :{BLACK}Checkboxar indikerar om du använt det här fusket förut -STR_CHEATS_WARNING :{BLACK}Varning! Du är på väg att förråda dina motståndare. Kom ihåg att detta inte kommer glömmas STR_CHEAT_MONEY :{LTBLUE}Öka pengar med {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spelar som företag:: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magisk bulldozer (ta bort industrier, oflyttbara objekt etc.): {ORANGE}{STRING} diff --git a/src/lang/thai.txt b/src/lang/thai.txt index 0686122e81..e483e12aa9 100644 --- a/src/lang/thai.txt +++ b/src/lang/thai.txt @@ -1712,7 +1712,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}คุ # Cheat window STR_CHEATS :{WHITE}สูตรโกงเกม STR_CHEATS_TOOLTIP :{BLACK}กล่องตัวเลือกจะแสดงว่าคุณโกงมาก่อนหรือไม่ -STR_CHEATS_WARNING :{BLACK}คำเตือน! คุณกำลังหักหลังคู่แข่งของคุณ พึงระลึกว่าการกระทำเช่นนี้จะถูกจดจำไปอีกนาน STR_CHEAT_MONEY :{LTBLUE}เพิ่มเงิน {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}เล่นเป็นบริษัท: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}เครื่องมือทำลายพิเศษ (ทำลายส่วนอุตสาหกรรม, ของที่เคลื่อนย้ายไม่ได้): {ORANGE}{STRING} diff --git a/src/lang/traditional_chinese.txt b/src/lang/traditional_chinese.txt index f658e8e602..2cde78a06a 100644 --- a/src/lang/traditional_chinese.txt +++ b/src/lang/traditional_chinese.txt @@ -1763,7 +1763,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}你確 # Cheat window STR_CHEATS :{WHITE}作弊 STR_CHEATS_TOOLTIP :{BLACK}方塊被勾選代表您用過這個密技 -STR_CHEATS_WARNING :{BLACK}警告!您正準備背叛您的競爭對手。請記住這種恥辱將永傳不朽 STR_CHEAT_MONEY :{LTBLUE}增加金錢:{CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}切換玩家操控的公司:{ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}神奇推土機 (可摧毀工業、無法移除的物件):{ORANGE}{STRING} diff --git a/src/lang/turkish.txt b/src/lang/turkish.txt index 104b2d94b8..a054f0823b 100644 --- a/src/lang/turkish.txt +++ b/src/lang/turkish.txt @@ -1816,7 +1816,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Bu sena # Cheat window STR_CHEATS :{WHITE}Hileler STR_CHEATS_TOOLTIP :{BLACK}Onay kutuları bu hilenin daha önce kullanılıp kullanmadığını bildirir. -STR_CHEATS_WARNING :{BLACK}Uyarı! Rakiplerine ihanet etmek üzeresin. Böyle bir davranışı sonsuza dek unutmayacaklarını akılda tut STR_CHEAT_MONEY :{LTBLUE}Parayı {CURRENCY_LONG} kadar arttır STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Oynanan şirket: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Sihirli buldozer (fabrikaları, silinemeyen nesneleri siler): {ORANGE}{STRING} diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt index 06cd652d12..219edef8a2 100644 --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -1943,7 +1943,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ви д # Cheat window STR_CHEATS :{WHITE}Гратиму нечесно STR_CHEATS_TOOLTIP :{BLACK}Галка показує, що Ви стали грати нечесно -STR_CHEATS_WARNING :{BLACK}Попередження! Ви збираєтесь обманути своїх конкурентів. Пам'ятайте, що подібне безчестя буде запам'ятовано назавжди STR_CHEAT_MONEY :{LTBLUE}Збільшити кошти на {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Грає як компанія: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Супербульдозер (руйнує все): {ORANGE}{STRING} diff --git a/src/lang/unfinished/persian.txt b/src/lang/unfinished/persian.txt index 11fa081ddd..5dda198e4d 100644 --- a/src/lang/unfinished/persian.txt +++ b/src/lang/unfinished/persian.txt @@ -1484,7 +1484,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}آیا # Cheat window STR_CHEATS :{WHITE}تقلبها STR_CHEATS_TOOLTIP :{BLACK}جعبه انتخاب ها نشان می دهند که قبلا از چه تقلبی استفاده کردید -STR_CHEATS_WARNING :{BLACK}هشدار!شما می خواهید که به رقبای همکارتان خیانت کنید. بدانید که چنین رسوایی تا ابد به یاد خواهد ماند STR_CHEAT_MONEY :{LTBLUE}اضافه کردن پول به مقدار {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}بازی به عنوان شرکت: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}بولدوزر جادویی(ازبین بردن صنایع و اشیاء غیرقابل حرکت): {ORANGE}{STRING} diff --git a/src/lang/unfinished/urdu.txt b/src/lang/unfinished/urdu.txt index c19b3c727a..668b38c217 100644 --- a/src/lang/unfinished/urdu.txt +++ b/src/lang/unfinished/urdu.txt @@ -1376,7 +1376,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}کیا # Cheat window STR_CHEATS :{WHITE}دھوکے STR_CHEATS_TOOLTIP :{BLACK}چیک باکسز سے ظاہر ہوتا ہے کہ آپ نے یہ دھوکا پہلے بھی کیا یے -STR_CHEATS_WARNING :{BLACK}انتباہ! آپ ساتھی کھلاڑیوں کو دھوکہ دینے جا رہے ہیں STR_CHEAT_MONEY :{LTBLUE}رقم کو {CURRENCY_LONG} سے بڑھائیں STR_CHEAT_CHANGE_COMPANY :{LTBLUE}اس کمپنی کی طور پر کھیلیں: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}جادوئی دھماکہ خیز (نہ ٹوٹنے والی چیزیں بھی توڑ دے): {ORANGE}{STRING} diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index ad9c506c10..93158dec8d 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -1817,7 +1817,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Bạn c # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Ô đánh dấu cho biết nếu bạn đã từng dùng mã ăn gian đó -STR_CHEATS_WARNING :{BLACK}Cảnh báo! Bạn muốn lừa dối những đối thủ thành thực của bạn ư? Những hành động đó của bạn sẽ là vết nhơ suốt đời! STR_CHEAT_MONEY :{LTBLUE}Tăng số tiền lên {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Điều khiển công ty: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Xe ủi thần kỳ (xóa bỏ nhà máy, vật không thể di chuyển): {ORANGE}{STRING} diff --git a/src/lang/welsh.txt b/src/lang/welsh.txt index caa13bb311..9af53f9432 100644 --- a/src/lang/welsh.txt +++ b/src/lang/welsh.txt @@ -1768,7 +1768,6 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Ydych c # Cheat window STR_CHEATS :{WHITE}Twyllo STR_CHEATS_TOOLTIP :{BLACK}Mae'r blychau marcio'n dangos os ydych chi wedi twyllo neu beidio, gan nodi sut -STR_CHEATS_WARNING :{BLACK}Rhybudd! Rydych ar fin bradychu eich cydgystadleuwyr. Cofiwch y bydd y fath gywilydd yn cael ei gofio o'r awr hon hyd byth STR_CHEAT_MONEY :{LTBLUE}Cynyddu arian {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Chwarae fel cwmni: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Tarw Dur Hud (chwalu diwydiannau, gwrthrychau nad oes modd eu chwalu): {ORANGE}{STRING} From 5f1154e0765251dd0a88dc28dbe487080fdcd6e0 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Jan 2021 23:43:06 +0100 Subject: [PATCH 34/50] Fix #8272: vehicle destination text colour when mousing over (#8543) Co-authored-by: Jonathan G Rennison --- src/vehicle_gui.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 877767aa5e..1e558373bb 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2800,6 +2800,7 @@ public: const Vehicle *v = Vehicle::Get(this->window_number); StringID str; + TextColour text_colour = TC_FROMSTRING; if (v->vehstatus & VS_CRASHED) { str = STR_VEHICLE_STATUS_CRASHED; } else if (v->type != VEH_AIRCRAFT && v->breakdown_ctr == 1) { // check for aircraft necessary? @@ -2824,6 +2825,13 @@ public: } else if (v->type == VEH_AIRCRAFT && HasBit(Aircraft::From(v)->flags, VAF_DEST_TOO_FAR) && !v->current_order.IsType(OT_LOADING)) { str = STR_VEHICLE_STATUS_AIRCRAFT_TOO_FAR; } else { // vehicle is in a "normal" state, show current order + if (mouse_over_start_stop) { + if (v->vehstatus & VS_STOPPED) { + text_colour = TC_RED | TC_FORCED; + } else if (v->type == VEH_TRAIN && HasBit(Train::From(v)->flags, VRF_TRAIN_STUCK) && !v->current_order.IsType(OT_LOADING)) { + text_colour = TC_ORANGE | TC_FORCED; + } + } switch (v->current_order.GetType()) { case OT_GOTO_STATION: { SetDParam(0, v->current_order.GetDestination()); @@ -2890,7 +2898,7 @@ public: int image = ((v->vehstatus & VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING; int lowered = this->IsWidgetLowered(WID_VV_START_STOP) ? 1 : 0; DrawSprite(image, PAL_NONE, image_left + lowered, r.top + WD_IMGBTN_TOP + lowered); - DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, TC_FROMSTRING, SA_HOR_CENTER); + DrawString(text_left + lowered, text_right + lowered, r.top + WD_FRAMERECT_TOP + lowered, str, text_colour, SA_HOR_CENTER); } void OnClick(Point pt, int widget, int click_count) override From 97d554feb175179c7af70f7d61cf56886b3090bd Mon Sep 17 00:00:00 2001 From: glx22 Date: Sat, 9 Jan 2021 18:28:51 +0100 Subject: [PATCH 35/50] Codechange: On regression failure, output the result in a file --- cmake/scripts/Regression.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/scripts/Regression.cmake b/cmake/scripts/Regression.cmake index b38caed5c6..620ed2c2ca 100644 --- a/cmake/scripts/Regression.cmake +++ b/cmake/scripts/Regression.cmake @@ -74,23 +74,30 @@ list(LENGTH REGRESSION_EXPECTED REGRESSION_EXPECTED_LENGTH) # Compare the output foreach(RESULT IN LISTS REGRESSION_RESULT) - list(GET REGRESSION_EXPECTED ${ARGC} EXPECTED) + unset(EXPECTED) + if(ARGC LESS REGRESSION_EXPECTED_LENGTH) + list(GET REGRESSION_EXPECTED ${ARGC} EXPECTED) + endif() + + math(EXPR ARGC "${ARGC} + 1") if(NOT RESULT STREQUAL EXPECTED) message("${ARGC}: - ${EXPECTED}") message("${ARGC}: + ${RESULT}'") set(ERROR YES) endif() - - math(EXPR ARGC "${ARGC} + 1") endforeach() if(NOT REGRESSION_EXPECTED_LENGTH EQUAL ARGC) - math(EXPR MISSING "${REGRESSION_EXPECTED_LENGTH} - ${ARGC}") - message("(${MISSING} more lines were expected than found)") + message("(${REGRESSION_EXPECTED_LENGTH} lines were expected but ${ARGC} were found)") set(ERROR YES) endif() if(ERROR) - message(FATAL_ERROR "Regression failed") + # Ouput the regression result to a file + set(REGRESSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/regression_${REGRESSION_TEST}_output.txt") + string(REPLACE ";" "\n" REGRESSION_RESULT "${REGRESSION_RESULT}") + file(WRITE ${REGRESSION_FILE} "${REGRESSION_RESULT}") + + message(FATAL_ERROR "Regression failed - Output in ${REGRESSION_FILE}") endif() From c0d7949d7c798285cc289bb9c76b4b155256456c Mon Sep 17 00:00:00 2001 From: glx Date: Sat, 7 Mar 2020 19:34:50 +0100 Subject: [PATCH 36/50] Fix: Don't use a timer for hundredth tick determination --- src/window.cpp | 27 +++++++++++++-------------- src/window_gui.h | 4 +++- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/window.cpp b/src/window.cpp index f67cda90f8..aea7bf3418 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1944,10 +1944,15 @@ void ResetWindowSystem() static void DecreaseWindowCounters() { + static byte hundredth_tick_timeout = 100; + if (_scroller_click_timeout != 0) _scroller_click_timeout--; + if (hundredth_tick_timeout != 0) hundredth_tick_timeout--; Window *w; FOR_ALL_WINDOWS_FROM_FRONT(w) { + if (!_network_dedicated && hundredth_tick_timeout == 0) w->OnHundredthTick(); + if (_scroller_click_timeout == 0) { /* Unclick scrollbar buttons if they are pressed. */ for (uint i = 0; i < w->nested_array_size; i++) { @@ -1979,6 +1984,8 @@ static void DecreaseWindowCounters() w->RaiseButtons(true); } } + + if (hundredth_tick_timeout == 0) hundredth_tick_timeout = 100; } static void HandlePlacePresize() @@ -3150,6 +3157,12 @@ void UpdateWindows() Window *w; + /* Process invalidations before anything else. */ + FOR_ALL_WINDOWS_FROM_FRONT(w) { + w->ProcessScheduledInvalidations(); + w->ProcessHighlightedInvalidations(); + } + static GUITimer window_timer = GUITimer(1); if (window_timer.Elapsed(delta_ms)) { if (_network_dedicated) window_timer.SetInterval(MILLISECONDS_PER_TICK); @@ -3171,24 +3184,10 @@ void UpdateWindows() if (!_pause_mode || _game_mode == GM_EDITOR || _settings_game.construction.command_pause_level > CMDPL_NO_CONSTRUCTION) MoveAllTextEffects(delta_ms); - FOR_ALL_WINDOWS_FROM_FRONT(w) { - w->ProcessScheduledInvalidations(); - w->ProcessHighlightedInvalidations(); - } - /* Skip the actual drawing on dedicated servers without screen. * But still empty the invalidation queues above. */ if (_network_dedicated) return; - static GUITimer hundredth_timer = GUITimer(1); - if (hundredth_timer.Elapsed(delta_ms)) { - hundredth_timer.SetInterval(3000); // Historical reason: 100 * MILLISECONDS_PER_TICK - - FOR_ALL_WINDOWS_FROM_FRONT(w) { - w->OnHundredthTick(); - } - } - if (window_timer.HasElapsed()) { window_timer.SetInterval(MILLISECONDS_PER_TICK); diff --git a/src/window_gui.h b/src/window_gui.h index b03f5bbcad..c792a6b28c 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -691,7 +691,9 @@ public: virtual void OnGameTick() {} /** - * Called once every 100 (game) ticks. + * Called once every 100 (game) ticks, or once every 3s, whichever comes last. + * In normal game speed the frequency is 1 call every 100 ticks (can be more than 3s). + * In fast-forward the frequency is 1 call every ~3s (can be more than 100 ticks). */ virtual void OnHundredthTick() {} From 1fb4ed8eef558d13ef6f72253652ce65611e0c4b Mon Sep 17 00:00:00 2001 From: glx22 Date: Thu, 7 Jan 2021 00:53:10 +0100 Subject: [PATCH 37/50] Fix: Use realtime for error message and console backlog timeouts --- src/console_gui.cpp | 7 ++++++- src/error.h | 3 ++- src/error_gui.cpp | 19 +++++++++---------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/console_gui.cpp b/src/console_gui.cpp index c8ad5fbdbf..7310738667 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -12,6 +12,7 @@ #include "window_gui.h" #include "console_gui.h" #include "console_internal.h" +#include "guitimer_func.h" #include "window_func.h" #include "string_func.h" #include "strings_func.h" @@ -171,6 +172,7 @@ struct IConsoleWindow : Window static int scroll; int line_height; ///< Height of one line of text in the console. int line_offset; + GUITimer truncate_timer; IConsoleWindow() : Window(&_console_window_desc) { @@ -179,6 +181,7 @@ struct IConsoleWindow : Window this->line_offset = GetStringBoundingBox("] ").width + 5; this->InitNested(0); + this->truncate_timer.SetInterval(3000); ResizeWindow(this, _screen.width, _screen.height / 3); } @@ -227,8 +230,10 @@ struct IConsoleWindow : Window } } - void OnHundredthTick() override + void OnRealtimeTick(uint delta_ms) override { + if (this->truncate_timer.CountElapsed(delta_ms) == 0) return; + if (IConsoleLine::Truncate() && (IConsoleWindow::scroll > IConsoleLine::size)) { IConsoleWindow::scroll = std::max(0, IConsoleLine::size - (this->height / this->line_height) + 1); diff --git a/src/error.h b/src/error.h index 8aa8ac2258..6dd4b02342 100644 --- a/src/error.h +++ b/src/error.h @@ -13,6 +13,7 @@ #include "strings_type.h" #include "company_type.h" #include "core/geometry_type.hpp" +#include "guitimer_func.h" struct GRFFile; @@ -27,7 +28,7 @@ enum WarningLevel { /** The data of the error message. */ class ErrorMessageData { protected: - uint duration; ///< Length of display of the message. 0 means forever, + GUITimer display_timer; ///< Timer before closing the message. uint64 decode_params[20]; ///< Parameters of the message strings. const char *strings[20]; ///< Copies of raw strings that were used. const GRFFile *textref_stack_grffile; ///< NewGRF that filled the #TextRefStack for the error message. diff --git a/src/error_gui.cpp b/src/error_gui.cpp index f9d88a1993..c8594e34a2 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -71,7 +71,7 @@ static WindowDesc _errmsg_face_desc( * @param data The data to copy. */ ErrorMessageData::ErrorMessageData(const ErrorMessageData &data) : - duration(data.duration), textref_stack_grffile(data.textref_stack_grffile), textref_stack_size(data.textref_stack_size), + display_timer(data.display_timer), textref_stack_grffile(data.textref_stack_grffile), textref_stack_size(data.textref_stack_size), summary_msg(data.summary_msg), detailed_msg(data.detailed_msg), position(data.position), face(data.face) { memcpy(this->textref_stack, data.textref_stack, sizeof(this->textref_stack)); @@ -103,7 +103,6 @@ ErrorMessageData::~ErrorMessageData() * @param textref_stack Values to put on the #TextRefStack. */ ErrorMessageData::ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration, int x, int y, const GRFFile *textref_stack_grffile, uint textref_stack_size, const uint32 *textref_stack) : - duration(duration), textref_stack_grffile(textref_stack_grffile), textref_stack_size(textref_stack_size), summary_msg(summary_msg), @@ -119,6 +118,8 @@ ErrorMessageData::ErrorMessageData(StringID summary_msg, StringID detailed_msg, if (textref_stack_size > 0) MemCpyT(this->textref_stack, textref_stack, textref_stack_size); assert(summary_msg != INVALID_STRING_ID); + + this->display_timer.SetInterval(duration * 3000); } /** @@ -297,16 +298,14 @@ public: void OnMouseLoop() override { /* Disallow closing the window too easily, if timeout is disabled */ - if (_right_button_down && this->duration != 0) delete this; + if (_right_button_down && !this->display_timer.HasElapsed()) delete this; } - void OnHundredthTick() override + void OnRealtimeTick(uint delta_ms) override { - /* Timeout enabled? */ - if (this->duration != 0) { - this->duration--; - if (this->duration == 0) delete this; - } + if (this->display_timer.CountElapsed(delta_ms) == 0) return; + + delete this; } ~ErrmsgWindow() @@ -321,7 +320,7 @@ public: */ bool IsCritical() { - return this->duration == 0; + return this->display_timer.HasElapsed(); } }; From 75b7bb5097c286e00e902ac6f70533602c2f5495 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sun, 10 Jan 2021 11:43:34 +0000 Subject: [PATCH 38/50] Fix: Remove semicolons from regression output --- regression/regression/main.nut | 42 ++--- regression/regression/result.txt | 292 +++++++++++++++---------------- 2 files changed, 167 insertions(+), 167 deletions(-) diff --git a/regression/regression/main.nut b/regression/regression/main.nut index e0859e7a37..ffb0856dd6 100644 --- a/regression/regression/main.nut +++ b/regression/regression/main.nut @@ -429,29 +429,29 @@ function Regression::Company() print(" GetCompanyHQ(): " + AICompany.GetCompanyHQ(AICompany.COMPANY_SELF)); print(" BuildCompanyHQ(): " + AICompany.BuildCompanyHQ(AIMap.GetTileIndex(239, 76))); print(" GetLastErrorString(): " + AIError.GetLastErrorString()); - print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); - print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true)); - print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); - print(" SetAutoRenewStatus(true); " + AICompany.SetAutoRenewStatus(true)); - print(" SetAutoRenewStatus(false); " + AICompany.SetAutoRenewStatus(false)); - print(" GetAutoRenewStatus(); " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); - print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF)); - print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12)); - print(" GetAutoRenewMonths(); " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF)); - print(" SetAutoRenewMonths(-12); " + AICompany.SetAutoRenewMonths(-12)); - print(" SetAutoRenewMonths(6); " + AICompany.SetAutoRenewMonths(6)); - print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF)); - print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000)); - print(" GetAutoRenewMoney(); " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF)); - print(" SetAutoRenewMoney(200000); " + AICompany.SetAutoRenewMoney(200000)); - print(" SetAutoRenewMoney(100000); " + AICompany.SetAutoRenewMoney(100000)); + print(" GetAutoRenewStatus(): " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); + print(" SetAutoRenewStatus(true): " + AICompany.SetAutoRenewStatus(true)); + print(" GetAutoRenewStatus(): " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); + print(" SetAutoRenewStatus(true): " + AICompany.SetAutoRenewStatus(true)); + print(" SetAutoRenewStatus(false): " + AICompany.SetAutoRenewStatus(false)); + print(" GetAutoRenewStatus(): " + AICompany.GetAutoRenewStatus(AICompany.COMPANY_SELF)); + print(" GetAutoRenewMonths(): " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF)); + print(" SetAutoRenewMonths(-12): " + AICompany.SetAutoRenewMonths(-12)); + print(" GetAutoRenewMonths(): " + AICompany.GetAutoRenewMonths(AICompany.COMPANY_SELF)); + print(" SetAutoRenewMonths(-12): " + AICompany.SetAutoRenewMonths(-12)); + print(" SetAutoRenewMonths(6): " + AICompany.SetAutoRenewMonths(6)); + print(" GetAutoRenewMoney(): " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF)); + print(" SetAutoRenewMoney(200000): " + AICompany.SetAutoRenewMoney(200000)); + print(" GetAutoRenewMoney(): " + AICompany.GetAutoRenewMoney(AICompany.COMPANY_SELF)); + print(" SetAutoRenewMoney(200000): " + AICompany.SetAutoRenewMoney(200000)); + print(" SetAutoRenewMoney(100000): " + AICompany.SetAutoRenewMoney(100000)); for (local i = -1; i <= AICompany.EARLIEST_QUARTER; i++) { print(" Quarter: " + i); - print(" GetQuarterlyIncome(); " + AICompany.GetQuarterlyIncome(AICompany.COMPANY_SELF, i)); - print(" GetQuarterlyExpenses(); " + AICompany.GetQuarterlyExpenses(AICompany.COMPANY_SELF, i)); - print(" GetQuarterlyCargoDelivered(); " + AICompany.GetQuarterlyCargoDelivered(AICompany.COMPANY_SELF, i)); - print(" GetQuarterlyPerformanceRating(); " + AICompany.GetQuarterlyPerformanceRating(AICompany.COMPANY_SELF, i)); - print(" GetQuarterlyCompanyValue(); " + AICompany.GetQuarterlyCompanyValue(AICompany.COMPANY_SELF, i)); + print(" GetQuarterlyIncome(): " + AICompany.GetQuarterlyIncome(AICompany.COMPANY_SELF, i)); + print(" GetQuarterlyExpenses(): " + AICompany.GetQuarterlyExpenses(AICompany.COMPANY_SELF, i)); + print(" GetQuarterlyCargoDelivered(): " + AICompany.GetQuarterlyCargoDelivered(AICompany.COMPANY_SELF, i)); + print(" GetQuarterlyPerformanceRating(): " + AICompany.GetQuarterlyPerformanceRating(AICompany.COMPANY_SELF, i)); + print(" GetQuarterlyCompanyValue(): " + AICompany.GetQuarterlyCompanyValue(AICompany.COMPANY_SELF, i)); } } diff --git a/regression/regression/result.txt b/regression/regression/result.txt index 140289ab15..f2d42cc86f 100644 --- a/regression/regression/result.txt +++ b/regression/regression/result.txt @@ -615,178 +615,178 @@ ERROR: IsEnd() is invalid as Begin() is never called GetCompanyHQ(): 33153 BuildCompanyHQ(): false GetLastErrorString(): ERR_AREA_NOT_CLEAR - GetAutoRenewStatus(); true - SetAutoRenewStatus(true); true - GetAutoRenewStatus(); true - SetAutoRenewStatus(true); true - SetAutoRenewStatus(false); true - GetAutoRenewStatus(); false - GetAutoRenewMonths(); 6 - SetAutoRenewMonths(-12); true - GetAutoRenewMonths(); -12 - SetAutoRenewMonths(-12); true - SetAutoRenewMonths(6); true - GetAutoRenewMoney(); 100000 - SetAutoRenewMoney(200000); true - GetAutoRenewMoney(); 200000 - SetAutoRenewMoney(200000); true - SetAutoRenewMoney(100000); true + GetAutoRenewStatus(): true + SetAutoRenewStatus(true): true + GetAutoRenewStatus(): true + SetAutoRenewStatus(true): true + SetAutoRenewStatus(false): true + GetAutoRenewStatus(): false + GetAutoRenewMonths(): 6 + SetAutoRenewMonths(-12): true + GetAutoRenewMonths(): -12 + SetAutoRenewMonths(-12): true + SetAutoRenewMonths(6): true + GetAutoRenewMoney(): 100000 + SetAutoRenewMoney(200000): true + GetAutoRenewMoney(): 200000 + SetAutoRenewMoney(200000): true + SetAutoRenewMoney(100000): true Quarter: -1 - GetQuarterlyIncome(); -1 - GetQuarterlyExpenses(); -1 - GetQuarterlyCargoDelivered(); -1 - GetQuarterlyPerformanceRating(); -1 - GetQuarterlyCompanyValue(); -1 + GetQuarterlyIncome(): -1 + GetQuarterlyExpenses(): -1 + GetQuarterlyCargoDelivered(): -1 + GetQuarterlyPerformanceRating(): -1 + GetQuarterlyCompanyValue(): -1 Quarter: 0 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); -210 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); -1 - GetQuarterlyCompanyValue(); 1 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): -210 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): -1 + GetQuarterlyCompanyValue(): 1 Quarter: 1 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 2 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 3 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 4 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 5 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 6 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 7 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 8 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 9 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 10 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 11 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 12 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 13 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 14 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 15 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 16 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 17 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 18 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 19 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 20 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 21 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 22 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 23 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 Quarter: 24 - GetQuarterlyIncome(); 0 - GetQuarterlyExpenses(); 0 - GetQuarterlyCargoDelivered(); 0 - GetQuarterlyPerformanceRating(); 0 - GetQuarterlyCompanyValue(); 0 + GetQuarterlyIncome(): 0 + GetQuarterlyExpenses(): 0 + GetQuarterlyCargoDelivered(): 0 + GetQuarterlyPerformanceRating(): 0 + GetQuarterlyCompanyValue(): 0 --AIAirport-- IsHangarTile(): false From 63288f80f3970905bc9b18e0961eec3da5be7ee2 Mon Sep 17 00:00:00 2001 From: translators Date: Sun, 10 Jan 2021 18:31:52 +0000 Subject: [PATCH 39/50] Update: Translations from eints korean: 1 change by telk5093 finnish: 1 change by hpiirai polish: 5 changes by yazalo --- src/lang/finnish.txt | 1 + src/lang/korean.txt | 1 + src/lang/polish.txt | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 24a5cc860a..233c2be9d0 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -1837,6 +1837,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Lopetet # Cheat window STR_CHEATS :{WHITE}Huijaukset STR_CHEATS_TOOLTIP :{BLACK}Valintaruudut osoittavat, oletko käyttänyt huijausta aiemmin +STR_CHEATS_NOTE :{BLACK}Huom.: näiden asetusten käyttö tallentuu pelitallenteeseen STR_CHEAT_MONEY :{LTBLUE}Anna lisää rahaa: {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Hallinnassa oleva yhtiö: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Taikapuskutraktori (poista teollisuutta, liikuttamattomia kohteita): {ORANGE}{STRING} diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 720a3c1bec..d01ed11d12 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -1838,6 +1838,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}정말 # Cheat window STR_CHEATS :{WHITE}치트 STR_CHEATS_TOOLTIP :{BLACK}체크박스의 체크 표시는 이전에 이 치트를 사용했는지 여부를 나타냅니다. +STR_CHEATS_NOTE :{BLACK}참고: 치트 사용 여부는 저장 파일에 기록될 것입니다 STR_CHEAT_MONEY :{LTBLUE}재정을 {CURRENCY_LONG} 만큼 증가 STR_CHEAT_CHANGE_COMPANY :{LTBLUE}다음 회사로 플레이: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}마법 불도저 (산업시설이나 옮길 수 없는 건물 제거): {ORANGE}{STRING} diff --git a/src/lang/polish.txt b/src/lang/polish.txt index 5cd3e7e194..1a3c4af434 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -2217,6 +2217,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Czy jes # Cheat window STR_CHEATS :{WHITE}Oszustwa STR_CHEATS_TOOLTIP :{BLACK}Pole wyboru wskazuje, czy użyłeś już wcześniej tego oszustwa +STR_CHEATS_NOTE :{BLACK}Uwaga: każde użycie tych ustawień zostanie zanotowane w pliku zapisu gry STR_CHEAT_MONEY :{LTBLUE}Zwiększ ilość pieniędzy o {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Grasz jako firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Magiczny buldożer (usuwanie przedsiębiorstw, nieprzesuwalnych obiektów): {ORANGE}{STRING} @@ -2733,6 +2734,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Połącz STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Zbuduj oddzielny posterunek # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Nieaktywne, ponieważ nie są dostępne pojazdy korzystające z takiej infrastruktury # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Konstrukcja linii kolejowej @@ -4408,6 +4410,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Przebuduj na { STR_ORDER_STOP_ORDER :(Stop) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Nie może korzystać ze stacji){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(sugerowany) @@ -4860,6 +4863,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Zły typ zajezd STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} jest za długi po wymianie STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Brak reguł autozastępowania/odnawiania STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(limit funduszy) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}{STRING} to ładunek nieobsługiwany przez ten pojazd. +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Nowy pojazd nie może być tak przebudowywany (polecenie {NUM}) # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Niemożliwa kombinacja torów From 0078554d6a9df92ce25e07706c4e51143151b2c8 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 Jan 2021 15:10:03 +0100 Subject: [PATCH 40/50] Fix: GetCargoTranslation could return out-of-bounds index for old-style NewGRF using cargo-slots. --- src/newgrf_cargo.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/newgrf_cargo.cpp b/src/newgrf_cargo.cpp index 22c7120d82..c2859b71ef 100644 --- a/src/newgrf_cargo.cpp +++ b/src/newgrf_cargo.cpp @@ -91,7 +91,10 @@ uint16 GetCargoCallback(CallbackID callback, uint32 param1, uint32 param2, const CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile, bool usebit) { /* Pre-version 7 uses the 'climate dependent' ID in callbacks and properties, i.e. cargo is the cargo ID */ - if (grffile->grf_version < 7 && !usebit) return cargo; + if (grffile->grf_version < 7 && !usebit) { + if (cargo >= CargoSpec::GetArraySize() || !CargoSpec::Get(cargo)->IsValid()) return CT_INVALID; + return cargo; + } /* Other cases use (possibly translated) cargobits */ From 5b089605606ecbf6d7e9996b49f6cb0605deaa68 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 Jan 2021 15:12:06 +0100 Subject: [PATCH 41/50] Fix: [NewGRF] industry variables 69 to 71 did not check, whether the queried cargo is valid. --- src/newgrf_industries.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 6579c5b09d..5e59634e84 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -311,6 +311,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout case 0x70: case 0x71: { CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile); + if (cargo == CT_INVALID) return 0; int index = this->industry->GetCargoProducedIndex(cargo); if (index < 0) return 0; // invalid cargo switch (variable) { @@ -329,6 +330,7 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout case 0x6E: case 0x6F: { CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile); + if (cargo == CT_INVALID) return 0; int index = this->industry->GetCargoAcceptedIndex(cargo); if (index < 0) return 0; // invalid cargo if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index]; From 868d84bbfc8d2c1471ef713854dd05ebc872615a Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 Jan 2021 14:37:40 +0100 Subject: [PATCH 42/50] Add: [NewGRF] vehicle variable 63 to test the tracktype of the current tile against a given tracktype. --- src/newgrf_engine.cpp | 30 ++++++++++++++++++++++++++++++ src/newgrf_railtype.cpp | 22 ++++++++++++++++++++++ src/newgrf_railtype.h | 1 + src/newgrf_roadtype.cpp | 31 +++++++++++++++++++++++++++++++ src/newgrf_roadtype.h | 1 + src/table/newgrf_debug_data.h | 3 ++- 6 files changed, 87 insertions(+), 1 deletion(-) diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 8066ea4324..e3dc059ff5 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -702,6 +702,36 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, return ret; } + case 0x63: + /* Tile compatibility wrt. arbitrary track-type + * Format: + * bit 0: Type 'parameter' is known. + * bit 1: Engines with type 'parameter' are compatible with this tile. + * bit 2: Engines with type 'parameter' are powered on this tile. + * bit 3: This tile has type 'parameter' or it is considered equivalent (alternate labels). + */ + switch (v->type) { + case VEH_TRAIN: { + RailType param_type = GetRailTypeTranslation(parameter, object->ro.grffile); + if (param_type == INVALID_RAILTYPE) return 0x00; + RailType tile_type = GetTileRailType(v->tile); + if (tile_type == param_type) return 0x0F; + return (HasPowerOnRail(param_type, tile_type) ? 0x04 : 0x00) | + (IsCompatibleRail(param_type, tile_type) ? 0x02 : 0x00) | + 0x01; + } + case VEH_ROAD: { + RoadTramType rtt = GetRoadTramType(RoadVehicle::From(v)->roadtype); + RoadType param_type = GetRoadTypeTranslation(rtt, parameter, object->ro.grffile); + if (param_type == INVALID_ROADTYPE) return 0x00; + RoadType tile_type = GetRoadType(v->tile, rtt); + if (tile_type == param_type) return 0x0F; + return (HasPowerOnRoad(param_type, tile_type) ? 0x06 : 0x00) | + 0x01; + } + default: return 0x00; + } + case 0xFE: case 0xFF: { uint16 modflags = 0; diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 2a98948e7b..326ee80baf 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -138,6 +138,28 @@ SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalTy return group->GetResult(); } +/** + * Translate an index to the GRF-local railtype-translation table into a RailType. + * @param railtype Index into GRF-local translation table. + * @param grffile Originating GRF file. + * @return RailType or INVALID_RAILTYPE if the railtype is unknown. + */ +RailType GetRailTypeTranslation(uint8 railtype, const GRFFile *grffile) +{ + if (grffile == nullptr || grffile->railtype_list.size() == 0) { + /* No railtype table present. Return railtype as-is (if valid), so it works for original railtypes. */ + if (railtype >= RAILTYPE_END || GetRailTypeInfo(static_cast(railtype))->label == 0) return INVALID_RAILTYPE; + + return static_cast(railtype); + } else { + /* Railtype table present, but invalid index, return invalid type. */ + if (railtype >= grffile->railtype_list.size()) return INVALID_RAILTYPE; + + /* Look up railtype including alternate labels. */ + return GetRailTypeByLabel(grffile->railtype_list[railtype]); + } +} + /** * Perform a reverse railtype lookup to get the GRF internal ID. * @param railtype The global (OpenTTD) railtype. diff --git a/src/newgrf_railtype.h b/src/newgrf_railtype.h index 1e0ff01d82..c382117385 100644 --- a/src/newgrf_railtype.h +++ b/src/newgrf_railtype.h @@ -58,6 +58,7 @@ struct RailTypeResolverObject : public ResolverObject { SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = nullptr); SpriteID GetCustomSignalSprite(const RailtypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, SignalState state, bool gui = false); +RailType GetRailTypeTranslation(uint8 railtype, const GRFFile *grffile); uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile); #endif /* NEWGRF_RAILTYPE_H */ diff --git a/src/newgrf_roadtype.cpp b/src/newgrf_roadtype.cpp index 3f6150cd36..025d03bb6a 100644 --- a/src/newgrf_roadtype.cpp +++ b/src/newgrf_roadtype.cpp @@ -132,6 +132,37 @@ SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSp return group->GetResult(); } +/** + * Translate an index to the GRF-local road/tramtype-translation table into a RoadType. + * @param rtt Whether to index the road- or tramtype-table. + * @param tracktype Index into GRF-local translation table. + * @param grffile Originating GRF file. + * @return RoadType or INVALID_ROADTYPE if the roadtype is unknown. + */ +RoadType GetRoadTypeTranslation(RoadTramType rtt, uint8 tracktype, const GRFFile *grffile) +{ + /* Because OpenTTD mixes RoadTypes and TramTypes into the same type, + * the mapping of the original road- and tramtypes does not match the default GRF-local mapping. + * So, this function cannot provide any similar behavior to GetCargoTranslation() and GetRailTypeTranslation() + * when the GRF defines no translation table. + * But since there is only one default road/tram-type, this makes little sense anyway. + * So for GRF without translation table, we always return INVALID_ROADTYPE. + */ + + if (grffile == nullptr) return INVALID_ROADTYPE; + + const auto &list = rtt == RTT_TRAM ? grffile->tramtype_list : grffile->roadtype_list; + if (tracktype >= list.size()) return INVALID_ROADTYPE; + + /* Look up roadtype including alternate labels. */ + RoadType result = GetRoadTypeByLabel(list[tracktype]); + + /* Check whether the result is actually the wanted road/tram-type */ + if (result != INVALID_ROADTYPE && GetRoadTramType(result) != rtt) return INVALID_ROADTYPE; + + return result; +} + /** * Perform a reverse roadtype lookup to get the GRF internal ID. * @param roadtype The global (OpenTTD) roadtype. diff --git a/src/newgrf_roadtype.h b/src/newgrf_roadtype.h index 07451f6566..0e08697932 100644 --- a/src/newgrf_roadtype.h +++ b/src/newgrf_roadtype.h @@ -48,6 +48,7 @@ struct RoadTypeResolverObject : public ResolverObject { SpriteID GetCustomRoadSprite(const RoadTypeInfo *rti, TileIndex tile, RoadTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL, uint *num_results = nullptr); +RoadType GetRoadTypeTranslation(RoadTramType rtt, uint8 tracktype, const GRFFile *grffile); uint8 GetReverseRoadTypeTranslation(RoadType roadtype, const GRFFile *grffile); #endif /* NEWGRF_ROADTYPE_H */ diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 4e5abaff5b..d69c2d5cc3 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -63,7 +63,8 @@ static const NIVariable _niv_vehicles[] = { NIV(0x4D, "position in articulated vehicle"), NIV(0x60, "count vehicle id occurrences"), // 0x61 not useful, since it requires register 0x10F - NIV(0x62, "Curvature/position difference to other vehicle"), + NIV(0x62, "curvature/position difference to other vehicle"), + NIV(0x63, "tile compatibility wrt. track-type"), NIV_END() }; From f1bc4d8407613795c1b0c1fbe3b1adf39479913d Mon Sep 17 00:00:00 2001 From: "Johannes E. Krause" Date: Tue, 15 Jan 2019 19:52:00 +0100 Subject: [PATCH 43/50] Add: [NewGRF] Vehicle variable 4A now also returns, whether the current tile has catenary. --- src/newgrf_engine.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index e3dc059ff5..d67a5c118c 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -609,12 +609,18 @@ static uint32 VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *object, switch (v->type) { case VEH_TRAIN: { RailType rt = GetTileRailType(v->tile); - return (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) | GetReverseRailTypeTranslation(rt, object->ro.grffile); + const RailtypeInfo *rti = GetRailTypeInfo(rt); + return ((rti->flags & RTFB_CATENARY) ? 0x200 : 0) | + (HasPowerOnRail(Train::From(v)->railtype, rt) ? 0x100 : 0) | + GetReverseRailTypeTranslation(rt, object->ro.grffile); } case VEH_ROAD: { RoadType rt = GetRoadType(v->tile, GetRoadTramType(RoadVehicle::From(v)->roadtype)); - return 0x100 | GetReverseRoadTypeTranslation(rt, object->ro.grffile); + const RoadTypeInfo *rti = GetRoadTypeInfo(rt); + return ((rti->flags & ROTFB_CATENARY) ? 0x200 : 0) | + 0x100 | + GetReverseRoadTypeTranslation(rt, object->ro.grffile); } default: From f6abc81cf17aa03f1718f523ce049e0e41e70303 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 10 Jan 2021 18:52:59 +0100 Subject: [PATCH 44/50] Fix: add missing variables to NewGRF inspect window. --- .github/PULL_REQUEST_TEMPLATE.md | 1 + src/table/newgrf_debug_data.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 1949f6f1f9..b0151ed52a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -44,4 +44,5 @@ Some things are not automated, and forgotten often. This list is a reminder for * ai_changelog.hpp, gs_changelog.hpp need updating. * The compatibility wrappers (compat_*.nut) need updating. * This PR affects the NewGRF API? (label 'needs review: NewGRF') + * newgrf_debug_data.h may need updating. * [PR must be added to API tracker](https://wiki.openttd.org/en/Development/NewGRF/Specification%20Status) diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index d69c2d5cc3..e31d093385 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -343,6 +343,15 @@ static const NIVariable _niv_industries[] = { NIV(0x66, "get square of Euclidean distance of closes town"), NIV(0x67, "count of industry and distance of closest instance"), NIV(0x68, "count of industry and distance of closest instance with layout filter"), + NIV(0x69, "produced cargo waiting"), + NIV(0x6A, "cargo produced this month"), + NIV(0x6B, "cargo transported this month"), + NIV(0x6C, "cargo produced last month"), + NIV(0x6D, "cargo transported last month"), + NIV(0x6E, "date since cargo was delivered"), + NIV(0x6F, "waiting input cargo"), + NIV(0x70, "production rate"), + NIV(0x71, "percentage of cargo transported last month"), NIV_END() }; From 6298d9221a8c0a2eb4020e6d5887ad8a3cb1c97f Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Sun, 10 Jan 2021 18:51:48 +0000 Subject: [PATCH 45/50] Fix 218f40e: Warning about 32-bit shift implicitly converted to 64 bits --- src/script/api/script_cargo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/api/script_cargo.cpp b/src/script/api/script_cargo.cpp index 6b0a4aa7a5..5e092b52a0 100644 --- a/src/script/api/script_cargo.cpp +++ b/src/script/api/script_cargo.cpp @@ -31,7 +31,7 @@ { if (!IsValidCargo(cargo_type)) return nullptr; - ::SetDParam(0, 1 << cargo_type); + ::SetDParam(0, 1ULL << cargo_type); return GetString(STR_JUST_CARGO_LIST); } @@ -80,4 +80,4 @@ { if (!ScriptCargo::IsValidCargo(cargo_type)) return INVALID_DISTRIBUTION_TYPE; return (ScriptCargo::DistributionType)_settings_game.linkgraph.GetDistributionType(cargo_type); -} \ No newline at end of file +} From eb23a6921bdb6f00ecd0f92b9feb3569d501ee85 Mon Sep 17 00:00:00 2001 From: translators Date: Mon, 11 Jan 2021 18:33:36 +0000 Subject: [PATCH 46/50] Update: Translations from eints arabic (egypt): 30 changes by AviationGamerX indonesian: 30 changes by dimaspaf14 german: 12 changes by MagnumSociety french: 5 changes by glx22 --- src/lang/arabic_egypt.txt | 30 ++++++++++++++++++++++++++++++ src/lang/french.txt | 5 +++++ src/lang/german.txt | 12 ++++++++++++ src/lang/indonesian.txt | 31 ++++++++++++++++++++++++++++++- 4 files changed, 77 insertions(+), 1 deletion(-) diff --git a/src/lang/arabic_egypt.txt b/src/lang/arabic_egypt.txt index 16e4f408d0..d224c42494 100644 --- a/src/lang/arabic_egypt.txt +++ b/src/lang/arabic_egypt.txt @@ -192,6 +192,7 @@ STR_COLOUR_WHITE :ابيض STR_UNITS_VELOCITY_IMPERIAL :{COMMA}{NBSP}ميل/س STR_UNITS_VELOCITY_METRIC :{COMMA}{NBSP}كم/س STR_UNITS_VELOCITY_SI :{COMMA}{NBSP}م/ث +STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}مربعات/ اليوم STR_UNITS_POWER_IMPERIAL :{COMMA}{NBSP}حصان STR_UNITS_POWER_METRIC :{COMMA}{NBSP}حصان @@ -226,6 +227,7 @@ STR_TOOLTIP_FILTER_CRITERIA :{BLACK}حدد STR_BUTTON_SORT_BY :{BLACK} رتب بـ STR_BUTTON_LOCATION :{BLACK}الموقع STR_BUTTON_RENAME :{BLACK}اعادة تسمية +STR_BUTTON_CATCHMENT :{BLACK}مدى التغطية STR_TOOLTIP_CLOSE_WINDOW :{BLACK}اغلاق الاطار STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS :{BLACK}عنوان الاطار- اسحب لتحريك الاطار @@ -880,6 +882,8 @@ STR_GAME_OPTIONS_CURRENCY_TRY :ليرة ترك STR_GAME_OPTIONS_CURRENCY_SKK :كرونا سلوفاكية (SKK) STR_GAME_OPTIONS_CURRENCY_BRL :ريال برازيلي (BRL) STR_GAME_OPTIONS_CURRENCY_EEK :كرونا استونية (EEK) +STR_GAME_OPTIONS_CURRENCY_KRW :وون كوريا الجنوبية (KRW) +STR_GAME_OPTIONS_CURRENCY_ZAR :راند جنوب أفريقيا (ZAR) STR_GAME_OPTIONS_CURRENCY_CUSTOM :مخصص ... ############ end of currency region @@ -1088,6 +1092,7 @@ STR_CONFIG_SETTING_AUTOSLOPE :السماح ب STR_CONFIG_SETTING_CATCHMENT :السماح بحدود اكثر واقعية للمحطات بحسب الحجم: {STRING} STR_CONFIG_SETTING_EXTRADYNAMITE :السماح بحذف اكثر من الطرق المملوكة للمدينة و الجسور و غيرها: {STRING} STR_CONFIG_SETTING_SMOKE_AMOUNT :كمية دخان/شرار القطارات:{STRING} +STR_CONFIG_SETTING_SMOKE_AMOUNT_HELPTEXT :حدد مقدار الدخان أو عدد الشرارت من المركبات STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL :موديل تسارع القطارات: {STRING} STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL :نمط تسارع عربات الطريق: {STRING} STR_CONFIG_SETTING_FORBID_90_DEG :منع القطارات والسفن من الدوران بزاوية تسعين درجة : {STRING} @@ -1098,6 +1103,7 @@ STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_NONE :بدون STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_NORMAL :ككل المصانع الأخرى STR_CONFIG_SETTING_RAW_INDUSTRY_CONSTRUCTION_METHOD_PROSPECTING :تنقيب STR_CONFIG_SETTING_MULTIPINDTOWN :السماح بوجود أكثر من مصنع من نفس النوع في المدينة الواحدة: {STRING} +STR_CONFIG_SETTING_SIGNALSIDE_DRIVING_SIDE :على جانب القيادة STR_CONFIG_SETTING_SHOWFINANCES :أعرض نافذة المالية في آخر السنة: {STRING} STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :الامر الجديد - بدون توقف - قياسيا: {STRING} STR_CONFIG_SETTING_STOP_LOCATION :اوامر القطار الجديدة تتوقف قياسيا في {STRING} رصيف المحطة @@ -1117,6 +1123,7 @@ STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :منخفض STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :طبيعي STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :السماح للعربات بالعبور خلال المواقف المملوكة داخل المدن: {STRING} STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :السماح بمرور العربات خلال المحطات المملوكة للمنافسين: {STRING} +STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD_HELPTEXT :السماح ببناء مواقف السيارات على الطرق المملوكة لشركات أخرى STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}تغير هذا الخيار غير متاح عندما يكون هناك عربات STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE :صيانة البنية التحتية: {STRING} @@ -1244,6 +1251,7 @@ STR_CONFIG_SETTING_DISABLE_UNSUITABLE_BUILDING :عطل ادوا STR_CONFIG_SETTING_MAX_TRAINS :الحد الأعلى لعدد القطارات لكل شركة: {STRING} STR_CONFIG_SETTING_MAX_ROAD_VEHICLES :الحد الأعلى لعدد العربات لكل شركة: {STRING} STR_CONFIG_SETTING_MAX_AIRCRAFT :الحد الأعلى لعدد الطائرات لكل شركة: {STRING} +STR_CONFIG_SETTING_MAX_AIRCRAFT_HELPTEXT :الحد الأقصى لعدد الطائرات التي يمكن أن تمتلكها الشركة STR_CONFIG_SETTING_MAX_SHIPS :الحد الأعلى لعدد السفن لكل شركة: {STRING} STR_CONFIG_SETTING_AI_BUILDS_TRAINS :حظر القطارات على الحاسوب: {STRING} @@ -1251,6 +1259,7 @@ STR_CONFIG_SETTING_AI_BUILDS_ROAD_VEHICLES :حظر العر STR_CONFIG_SETTING_AI_BUILDS_AIRCRAFT :حظر الطائرات على الحاسوب: {STRING} STR_CONFIG_SETTING_AI_BUILDS_SHIPS :حظر السفن على الحاسوب: {STRING} +STR_CONFIG_SETTING_AI_PROFILE_EASY :سهل STR_CONFIG_SETTING_AI_IN_MULTIPLAYER :السماح بالذكاء الصناعي في اللعب الجماعي : {STRING} STR_CONFIG_SETTING_SCRIPT_MAX_OPCODES :#opcodes قبل تعليق الاسكربت: {STRING} @@ -1289,6 +1298,7 @@ STR_CONFIG_SETTING_NEWS_MESSAGES_FULL :ممتلئ STR_CONFIG_SETTING_COLOURED_NEWS_YEAR :الاخبار الملونة تظهر في: {STRING} STR_CONFIG_SETTING_STARTING_YEAR :سنة البدايه: {STRING} +STR_CONFIG_SETTING_ENDING_YEAR_ZERO :لا تنتهي STR_CONFIG_SETTING_ALLOW_SHARES :السماح بشراء حصص من الشركات الاخرى: {STRING} STR_CONFIG_SETTING_SEMAPHORE_BUILD_BEFORE_DATE :اتاحة استخدام الأشارات بالأعلام قبل :{STRING} STR_CONFIG_SETTING_ENABLE_SIGNAL_GUI :السماح باستخدام اشارات واجهة المستخدم الرسومية: {STRING} @@ -1336,11 +1346,15 @@ STR_CONFIG_SETTING_TOWN_GROWTH_FAST :سريع STR_CONFIG_SETTING_TOWN_GROWTH_VERY_FAST :سريع جدا STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :مضاعف المدن المبدئي: {STRING} +STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :ضبط هذا إلى أقل من 100٪ يؤدي إلى جعل التوزيع المتماثل يتصرف مثل التوزيع غير المتماثل. سيتم إعادة شحنات أقل غصبا إذا تم إرسال مبلغ معين إلى المحطة. إذا قمت بتعيينه على 0٪ ، فإن التوزيع المتماثل يتصرف تمامًا مثل التوزيع غير المتماثل +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :(متري (كم / ساعة +STR_CONFIG_SETTING_LOCALISATION_UNITS_WEIGHT_METRIC :(متري (طن +STR_CONFIG_SETTING_LOCALISATION_UNITS_FORCE ::وحدات جهد الجر {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_HEIGHT_METRIC :م) متري) @@ -1829,6 +1843,7 @@ STR_CONTENT_SELECT_UPDATES_CAPTION :{BLACK} اخت STR_CONTENT_SELECT_UPDATES_CAPTION_TOOLTIP :{BLACK} ضع علامة على التحديثات للمحتويات الموجودة و التي سيتم تحميلها STR_CONTENT_UNSELECT_ALL_CAPTION :{BLACK} مسح الكل STR_CONTENT_UNSELECT_ALL_CAPTION_TOOLTIP :{BLACK} ضع علامة على المحتوى التي لن يتم تحميلها +STR_CONTENT_SEARCH_EXTERNAL :{BLACK}بحث المواقع الخارجية STR_CONTENT_FILTER_TITLE :{BLACK}مُرَشِح: STR_CONTENT_DOWNLOAD_CAPTION :{BLACK} تحميل STR_CONTENT_DOWNLOAD_CAPTION_TOOLTIP :{BLACK} ابدأ تحميل المحتويات المختارة @@ -2201,6 +2216,7 @@ STR_LAND_AREA_INFORMATION_NEWGRF_NAME :{BLACK}NewGRF: STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED :{BLACK}الشحنة المقبولة: {LTBLUE} STR_LAND_AREA_INFORMATION_CARGO_EIGHTS :({COMMA} /8 {STRING}) STR_LANG_AREA_INFORMATION_ROAD_TYPE :{BLACK}:نوع الطريق {LTBLUE}{STRING} +STR_LANG_AREA_INFORMATION_TRAM_TYPE :{BLACK}:نوع الترام {LTBLUE}{STRING} STR_LANG_AREA_INFORMATION_RAIL_SPEED_LIMIT :{BLACK}حدود سرعة سكة الحديد: {LTBLUE}{VELOCITY} STR_LANG_AREA_INFORMATION_ROAD_SPEED_LIMIT :{BLACK}حدود سرعه الطريق: {LTBLUE}{VELOCITY} @@ -2302,9 +2318,12 @@ STR_ABOUT_VERSION :{BLACK}النس STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}النسخة المفتوحة {COPYRIGHT}2002-{STRING} فريق النسخة المفتوحة # Framerate display window +STR_FRAMERATE_FPS_GOOD :{LTBLUE}{DECIMAL} صورة في الثانية ############ Leave those lines in this order!! +STR_FRAMERATE_AI :{BLACK} AI {NUM} {STRING} ############ End of leave-in-this-order ############ Leave those lines in this order!! +STR_FRAMETIME_CAPTION_GAMESCRIPT :كتابة اللعبة ############ End of leave-in-this-order @@ -2330,6 +2349,7 @@ STR_SAVELOAD_DETAIL_CAPTION :{BLACK}تفاص STR_SAVELOAD_DETAIL_NOT_AVAILABLE :{BLACK}لا توجد معلومات متاحة STR_SAVELOAD_DETAIL_COMPANY_INDEX :{SILVER}{COMMA}: {WHITE}{STRING} STR_SAVELOAD_DETAIL_GRFSTATUS :{SILVER}اضافات جديدة: {WHITE}{STRING} +STR_SAVELOAD_OVERWRITE_TITLE :{WHITE}الكتابة على الملف STR_SAVELOAD_OSKTITLE :{BLACK}ادخل اسم الحفظ للعبة @@ -2640,6 +2660,7 @@ STR_GOAL_QUESTION_CAPTION_WARNING :تحذير STR_GOAL_QUESTION_CAPTION_ERROR :خطا ############ Start of Goal Question button list +STR_GOAL_QUESTION_BUTTON_RETRY :إعادة المحاولة ############ End of Goal Question button list # Subsidies window @@ -2652,6 +2673,7 @@ STR_SUBSIDIES_SUBSIDISED_FROM_TO :{ORANGE}{STRING STR_SUBSIDIES_TOOLTIP_CLICK_ON_SERVICE_TO_CENTER :{BLACK}اضغط على الخدمة لتوسيط الخريطة على المصنع/المدينة. اضغط + كنترول لفتح شاشة عرض جديدة للمدينة. # Story book window +STR_STORY_BOOK_CAPTION :{WHITE}{COMPANY}كتاب القصة # Station list window STR_STATION_LIST_TOOLTIP :{BLACK}اسم المحطة - اضغط على اسم المحطة لتوسيطها في الشاشة. اضغط + كنترول لفتح شاشة عرض جديدة بمنطقة المحطة. @@ -2677,6 +2699,7 @@ STR_STATION_VIEW_ACCEPTS_CARGO :{BLACK}يقبل STR_STATION_VIEW_RATINGS_BUTTON :{BLACK}معدل النقل STR_STATION_VIEW_RATINGS_TOOLTIP :{BLACK}اظهار معدل النقل للمحطة +STR_STATION_VIEW_WAITING_AMOUNT :الكمية: في الانتظار ############ range for rating starts @@ -2786,7 +2809,9 @@ STR_BUY_COMPANY_MESSAGE :{WHITE}نحن STR_INDUSTRY_DIRECTORY_CAPTION :{WHITE}صناعات STR_INDUSTRY_DIRECTORY_NONE :{ORANGE}-بدون- STR_INDUSTRY_DIRECTORY_ITEM_NOPROD :{ORANGE}{INDUSTRY} +STR_INDUSTRY_DIRECTORY_ITEM_PROD1 :{ORANGE}{INDUSTRY} {STRING} STR_INDUSTRY_DIRECTORY_LIST_CAPTION :{BLACK}اسماء المصانع - اضغط على اسم المصنع لتوسيط الشاشة عليه. اضغط + كنترول لفتح شاشة عرض جديدة لمنطقة المصنع. +STR_INDUSTRY_DIRECTORY_FILTER_NONE :بدون # Industry view STR_INDUSTRY_VIEW_CAPTION :{WHITE}{INDUSTRY} @@ -2893,6 +2918,7 @@ STR_PURCHASE_INFO_AIRCRAFT_CAPACITY :{BLACK} الس STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT :{BLACK} العربات ذات الطاقة: {GOLD}+{POWER}{BLACK} الوزن: {GOLD}+{WEIGHT_SHORT} STR_PURCHASE_INFO_REFITTABLE_TO :{BLACK}يمكن تعديلها الى: {GOLD}{STRING} STR_PURCHASE_INFO_ALL_TYPES :كل انواع الحمولة +STR_PURCHASE_INFO_NONE :بدون STR_PURCHASE_INFO_ALL_BUT :الكل الا {CARGO_LIST} STR_PURCHASE_INFO_MAX_TE :{BLACK}تأثير الجذب القصى: {GOLD}{FORCE} @@ -2925,6 +2951,7 @@ STR_BUY_VEHICLE_SHIP_RENAME_TOOLTIP :{BLACK}اعاد STR_BUY_VEHICLE_AIRCRAFT_RENAME_TOOLTIP :{BLACK}اعادة تسمية نوع الطائرة +STR_BUY_VEHICLE_AIRCRAFT_SHOW_TOGGLE_BUTTON :{BLACK}عرض STR_BUY_VEHICLE_AIRCRAFT_HIDE_SHOW_TOGGLE_TOOLTIP :{BLACK} تبيدل بين إخفاء / عرض نوع الطائرة @@ -3191,6 +3218,7 @@ STR_VEHICLE_DETAILS_TRAIN_ARTICULATED_RV_CAPACITY :{BLACK}السع STR_REFIT_CAPTION :{WHITE}{VEHICLE} (تغيير) STR_REFIT_TITLE :{GOLD}اختر نوع الحمولة ... STR_REFIT_NEW_CAPACITY_COST_OF_REFIT :{BLACK}السعة الجديدة: {GOLD}{CARGO_LONG}{}{BLACK}تكلفة التغيير: {RED}{CURRENCY_LONG} +STR_REFIT_NEW_CAPACITY_INCOME_FROM_REFIT :{BLACK}:المساحة الجديدة {GOLD}{CARGO_LONG}{}{BLACK}:الدخل من التجديد {GREEN}{CURRENCY_LONG} STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT :{BLACK}السعة الجديدة: {GOLD}{CARGO_LONG}, {GOLD}{CARGO_LONG}{}{BLACK}تكلفة اعادة التهيئة: {RED}{CURRENCY_LONG} STR_REFIT_SELECT_VEHICLES_TOOLTIP :{BLACK}اختر العربة لاعادة تهيئتها. اسحب بالفارة لاختيار عدة عربات. اضغط على مساحة خالية لاختيار كل العربات. اضغط + كنترول لاختيار العربة الحالية وما بعدها. @@ -3478,6 +3506,7 @@ STR_AI_LIST_ACCEPT_TOOLTIP :{BLACK} اخت STR_AI_LIST_CANCEL :{BLACK} الغاء STR_AI_LIST_CANCEL_TOOLTIP :{BLACK} لا تغير الذكاء الصناعي +STR_SCREENSHOT_ZOOMIN_SCREENSHOT :{BLACK}التقط لقطة شاشة كاملة # AI Parameters STR_AI_SETTINGS_CLOSE :{BLACK} اغلاق @@ -3752,6 +3781,7 @@ STR_ERROR_CAN_T_REMOVE_ROAD_FROM :{WHITE}تعذر STR_ERROR_CAN_T_REMOVE_TRAMWAY_FROM :{WHITE}تعذر إزاله سكه الترام من هنا... STR_ERROR_THERE_IS_NO_ROAD :{WHITE}... لا يوجد طريق STR_ERROR_THERE_IS_NO_TRAMWAY :{WHITE}... لا يوجد سكه ترام هنا +STR_ERROR_NO_SUITABLE_TRAMWAY :{WHITE}لا يوجد ترام مناسب # Waterway construction errors STR_ERROR_CAN_T_BUILD_CANALS :{WHITE}تعذر بناء القناه هنا... diff --git a/src/lang/french.txt b/src/lang/french.txt index f9d680ea5e..d57a4b4d78 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -1838,6 +1838,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Êtes-v # Cheat window STR_CHEATS :{WHITE}Triches STR_CHEATS_TOOLTIP :{BLACK}Les cases à cocher montrent si vous avez déjà utilisé cette triche auparavant +STR_CHEATS_NOTE :{BLACK}Note{}: tout usage de ces paramètres sera enregistré dans la sauvegarde STR_CHEAT_MONEY :{LTBLUE}Augmenter l'argent de {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Jouer en tant que compagnie{NBSP}: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Bulldozer magique (enlèvement des industries et des objets fixes){NBSP}: {ORANGE}{STRING} @@ -2354,6 +2355,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Joindre STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Construire un point de contrôle séparé # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Désactivé car aucun véhicule n'est actuellement disponible pour cette infrastructure # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Construction de voie ferrée @@ -4023,6 +4025,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Réaménager p STR_ORDER_STOP_ORDER :(Arrêt) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Station inutilisable){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(Implicite) @@ -4475,6 +4478,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Dépôt incompa STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} est trop long après remplacement STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Aucune règle de remplacement/renouvellement automatique appliquée STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(limite d'argent) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}Le nouveau véhicule ne peut pas transporter {STRING} +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Le nouveau véhicule ne peut être réaménagé à l'ordre {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Combinaison de rails impossible diff --git a/src/lang/german.txt b/src/lang/german.txt index 789ef7deeb..5e81d55270 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -324,6 +324,7 @@ STR_SORT_BY_AVERAGE_PROFIT_THIS_YEAR :Durchschnittlic # Group by options for vehicle list STR_GROUP_BY_NONE :Keine +STR_GROUP_BY_SHARED_ORDERS :Gemeinsame Aufträge # Tooltips for the main toolbar STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}Spiel anhalten @@ -1450,6 +1451,8 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Belasse Bauwerk STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Die Bauwerkzeuge für Brücken, Tunnel, etc. nach Benutzung weiter aktiviert lassen STR_CONFIG_SETTING_EXPENSES_LAYOUT :Zwischensummen für Kategorien bei Firmenausgaben:{STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Lege das Layout für das Fenster mit den Firmenausgaben fest +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Automatische Entfernung von Signalen während der Errichtung von Bahntrassen: {STRING} +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS_HELPTEXT :Automatische Entfernung von Signalen während der Errichtung der Bahntrasse, wenn diese sich im Weg befinden.Hinweis: Dies kann zu Unfällen führen! STR_CONFIG_SETTING_SOUND_TICKER :Nachrichtenticker: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Soundeffekte für Kurzfassungen von Nachrichten abspielen (Ticker) @@ -1834,6 +1837,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Soll da # Cheat window STR_CHEATS :{WHITE}Cheats STR_CHEATS_TOOLTIP :{BLACK}Die Kontrollkästchen zeigen an, ob dieser Cheat schonmal verwendet worden ist +STR_CHEATS_NOTE :{BLACK}Hinweis: Jede Nutzung dieser Einstellungen wird im Spielstand gespeichert! STR_CHEAT_MONEY :{LTBLUE}Kontostand um {CURRENCY_LONG} erhöhen STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Spiele die Firma: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Mächtigeres Abrisswerkzeug (entfernt Industrien und unbewegliche Objekte): {ORANGE}{STRING} @@ -2220,6 +2224,7 @@ STR_NETWORK_SERVER_MESSAGE_GAME_REASON_NOT_ENOUGH_PLAYERS :Spieleranzahl STR_NETWORK_SERVER_MESSAGE_GAME_REASON_CONNECTING_CLIENTS :Teilnehmer meldet sich an STR_NETWORK_SERVER_MESSAGE_GAME_REASON_MANUAL :manuell STR_NETWORK_SERVER_MESSAGE_GAME_REASON_GAME_SCRIPT :Skript +STR_NETWORK_SERVER_MESSAGE_GAME_REASON_LINK_GRAPH :Warten auf Neuberechnung des Verteilungsgraphen. ############ End of leave-in-this-order STR_NETWORK_MESSAGE_CLIENT_LEAVING :geht STR_NETWORK_MESSAGE_CLIENT_JOINED :*** {STRING} ist dem Spiel beigetreten @@ -2348,6 +2353,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Verbinde STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Errichte einen getrennten Wegpunkt # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :Deaktiviert, da aktuell keine Fahrzeuge für diese Infrastruktur verfügbar sind. # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Eisenbahnbau @@ -3369,6 +3375,8 @@ STR_COMPANY_VIEW_RELOCATE_HQ :{BLACK}Verlegen STR_COMPANY_VIEW_RELOCATE_COMPANY_HEADQUARTERS :{BLACK}Errichte Firmensitz für 1% des Firmenwertes an anderer Stelle neu. Shift+Klick zeigt einen Kostenvoranschlag STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}Details STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}Detaillierte Informationen zur Infrastruktur dieser Firma anzeigen +STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}Verschenke Geld +STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}Geld an diese Firma verschenken STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}Neues Gesicht STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}Neues Gesicht für Manager aussuchen @@ -3386,6 +3394,7 @@ STR_COMPANY_VIEW_SELL_SHARE_TOOLTIP :{BLACK}25% der STR_COMPANY_VIEW_COMPANY_NAME_QUERY_CAPTION :Firmenname STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :Name des Managers +STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :Geben Sie den Betrag des Geldes ein, welchen sie verschenken möchten. STR_BUY_COMPANY_MESSAGE :{WHITE}Wir suchen eine Transportfirma, die unsere Firma übernimmt.{}{}Besteht Interesse daran, {COMPANY} für {CURRENCY_LONG} zu übernehmen? @@ -4336,6 +4345,7 @@ STR_ERROR_LOAN_ALREADY_REPAYED :{WHITE}... Kred STR_ERROR_CURRENCY_REQUIRED :{WHITE}... erfordert {CURRENCY_LONG} STR_ERROR_CAN_T_REPAY_LOAN :{WHITE}Kredit kann nicht getilgt werden... STR_ERROR_INSUFFICIENT_FUNDS :{WHITE}Von der Bank geliehenes Geld kann nicht abgegeben werden... +STR_ERROR_CAN_T_GIVE_MONEY :{WHITE}Geld kann nicht an diese Firma verschenkt werden... STR_ERROR_CAN_T_BUY_COMPANY :{WHITE}Firmenkauf nicht möglich... STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS :{WHITE}Firmensitz kann nicht gebaut werden ... STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}Kauf von 25% der Aktien dieser Firma nicht möglich... @@ -4462,6 +4472,8 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Falscher Depott STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} ist nach Ersetzung zu lang STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Es treffen keine Ersetzungs-/Erneuerungsregeln zu STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(Geld fehlt) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_CARGO :{WHITE}Neues Fahrzeug kann diesen Frachttyp nicht transportieren. {STRING} +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Neues Fahrzeug kann nicht wie geplant umgerüstet werden {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Unmögliche Gleisverbindung diff --git a/src/lang/indonesian.txt b/src/lang/indonesian.txt index 5eabbcff18..2e34f13026 100644 --- a/src/lang/indonesian.txt +++ b/src/lang/indonesian.txt @@ -314,6 +314,9 @@ STR_SORT_BY_CARGO_CAPACITY :Kapasitas muata STR_SORT_BY_RANGE :Jangkauan STR_SORT_BY_POPULATION :Populasi STR_SORT_BY_RATING :Peringkat +STR_SORT_BY_NUM_VEHICLES :Jumlah kendaraan +STR_SORT_BY_TOTAL_PROFIT_THIS_YEAR :Total laba tahun ini +STR_SORT_BY_AVERAGE_PROFIT_LAST_YEAR :Laba rata-rata tahun lalu # Group by options for vehicle list @@ -772,6 +775,7 @@ STR_SMALLMAP_TOOLTIP_ENABLE_ALL_CARGOS :{BLACK}Tampilka STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS :{BLACK}Tampilkan pesan atau laporan berita terakhir STR_STATUSBAR_COMPANY_NAME :{SILVER}- - {COMPANY} - - STR_STATUSBAR_PAUSED :{YELLOW}* * BERHENTI * * +STR_STATUSBAR_PAUSED_LINK_GRAPH :{ORANGE}* * PAUSED (menunggu pembaruan grafik tautan) * * STR_STATUSBAR_AUTOSAVE :{RED}SIMPAN OTOMATIS STR_STATUSBAR_SAVING_GAME :{RED}* * MENYIMPAN PERMAINAN * * @@ -1316,7 +1320,7 @@ STR_CONFIG_SETTING_SHOW_NEWGRF_NAME :Tampilkan nama STR_CONFIG_SETTING_SHOW_NEWGRF_NAME_HELPTEXT :Tambahkan garis ke jendela beli kendaraan, yang menunjukkan NewGRF kendaraan yang dipilih berasal. STR_CONFIG_SETTING_LANDSCAPE :Bentang Darat: {STRING} -STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Bentang darat akan menegaskan skenario bermain dasar dengan muatan berbeda dan kebutuhan pertumbuhan kota. Data NewGRF dan Game Script lain membolehkan lebih banyak pengaturan. +STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Lanskap mendefinisikan skenario gameplay dasar dengan kargo yang berbeda dan persyaratan pertumbuhan kota. NewGRF dan Game Scripts memungkinkan kontrol yang lebih halus STR_CONFIG_SETTING_LAND_GENERATOR :Pembangkit dataran: {STRING} STR_CONFIG_SETTING_LAND_GENERATOR_HELPTEXT :Pembuat yang orisinil tergantung pada kelompok grafik yang dasar, dan membuat bentang darat yang tertentu. TerraGenesis adalah pembuat yang berbasis Perlin Noise, dengan pengaturan kuasa yang lebih spesifik STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :Asli @@ -1442,6 +1446,7 @@ STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS :Toolbar tetap a STR_CONFIG_SETTING_PERSISTENT_BUILDINGTOOLS_HELPTEXT :Menjagakan alat pembangunan untuk jembatan, terowongan, etc. buka setelah dipakai STR_CONFIG_SETTING_EXPENSES_LAYOUT :Kelompokkan pengeluaran perusahaan dalam neraca: {STRING} STR_CONFIG_SETTING_EXPENSES_LAYOUT_HELPTEXT :Mendefinisikan tata ruang untuk tetingkap biaya perusahaan +STR_CONFIG_SETTING_AUTO_REMOVE_SIGNALS :Secara otomatis menghapus sinyal selama konstruksi rel: {STRING} STR_CONFIG_SETTING_SOUND_TICKER :Ticker berita: {STRING} STR_CONFIG_SETTING_SOUND_TICKER_HELPTEXT :Mainkan suara untuk pesanan berita yang diringkas @@ -1555,6 +1560,10 @@ STR_CONFIG_SETTING_ENDING_YEAR :Penilaian akhir STR_CONFIG_SETTING_ENDING_YEAR_HELPTEXT :Tahun pertandingan berakhir untuk tujuan mencetak gol. Pada akhir tahun ini, skor perusahaan dicatat dan layar skor tertinggi ditampilkan, tetapi para pemain dapat terus bermain setelah itu.{} Jika ini sebelum tahun mulai, layar skor tinggi tidak pernah ditampilkan. STR_CONFIG_SETTING_ENDING_YEAR_VALUE :{NUM} STR_CONFIG_SETTING_ENDING_YEAR_ZERO :Tidak pernah +STR_CONFIG_SETTING_ECONOMY_TYPE :Tipe ekonomi: {STRING} +STR_CONFIG_SETTING_ECONOMY_TYPE_HELPTEXT :Ekonomi yang lancar membuat perubahan produksi lebih sering, dan dalam langkah yang lebih kecil. Ekonomi beku menghentikan perubahan produksi dan penutupan industri. Pengaturan ini mungkin tidak berpengaruh jika jenis industri disediakan oleh NewGRF. +STR_CONFIG_SETTING_ECONOMY_TYPE_ORIGINAL :Asli +STR_CONFIG_SETTING_ECONOMY_TYPE_SMOOTH :Halus STR_CONFIG_SETTING_ALLOW_SHARES :Ijinkan pembelian saham perusahaan lain: {STRING} STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :Jika diaktifkan, pemain dibolehkan membeli saham suatu perusahaan. Saham hanya bisa dibeli saat perusahaan memasuki umur tertentu STR_CONFIG_SETTING_MIN_YEARS_FOR_SHARES :Usia minimum perusahaan untuk memperdagangkan saham: {STRING} @@ -1606,6 +1615,9 @@ STR_CONFIG_SETTING_TOWN_CARGOGENMODE_BITCOUNT :Linier STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT :Penempatan pohon dalam permainan: {STRING} STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_HELPTEXT :Mengendalikan kemunculan pohon dalam permainan. Ini akan berefek pada industri yang memerlukan pohon, contohnya pengolahan kayu gelondongan +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_SPREAD :Tumbuh tapi jangan menyebar {RED}(memecahkan pabrik kayu) +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_SPREAD_RAINFOREST :Tumbuh tetapi hanya tersebar di hutan hujan +STR_CONFIG_SETTING_EXTRA_TREE_PLACEMENT_NO_GROWTH_NO_SPREAD :Jangan tumbuh, jangan menyebar {RED}(menghancurkan pabrik kayu) STR_CONFIG_SETTING_TOOLBAR_POS :Posisi toolbar utama: {STRING} STR_CONFIG_SETTING_TOOLBAR_POS_HELPTEXT :Posisi horizontal toolbar utama di bagian atas layar @@ -1815,6 +1827,7 @@ STR_ABANDON_SCENARIO_QUERY :{YELLOW}Apa and # Cheat window STR_CHEATS :{WHITE}Kode Curang STR_CHEATS_TOOLTIP :{BLACK}Daftar cek ini mengindikasikan bahwa anda telah menggunakan kode curang ini sebelumnya +STR_CHEATS_NOTE :{BLACK}Catatan: setiap penggunaan pengaturan ini akan direkam oleh savegame STR_CHEAT_MONEY :{LTBLUE}Tambah uang sebanyak {CURRENCY_LONG} STR_CHEAT_CHANGE_COMPANY :{LTBLUE}Bermain sebagai pemain: {ORANGE}{COMMA} STR_CHEAT_EXTRA_DYNAMITE :{LTBLUE}Buldozer ajaib (hancurkan industri, objek tidak bergerak): {ORANGE}{STRING} @@ -1966,6 +1979,9 @@ STR_NETWORK_SERVER_LIST_JOIN_GAME :{BLACK}Bergabun STR_NETWORK_SERVER_LIST_REFRESH :{BLACK}Cek server STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP :{BLACK}Periksa lagi status server +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET_TOOLTIP :{BLACK}Cari di internet untuk server publik +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN :{BLACK}CARI LAN +STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN_TOOLTIP :{BLACK}Cari jaringan area lokal untuk server STR_NETWORK_SERVER_LIST_ADD_SERVER :{BLACK}Tambah server STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP :{BLACK}Daftarkan server baru yang akan dipantau aktivitasnya STR_NETWORK_SERVER_LIST_START_SERVER :{BLACK}Mulai server @@ -2191,11 +2207,13 @@ STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_1 :Permainan masih STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_2 :Permainan masih dihentikan ({STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_3 :Permainan masih dihentikan ({STRING}, {STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_4 :Permainan masih dihentikan ({STRING}, {STRING}, {STRING}, {STRING}) +STR_NETWORK_SERVER_MESSAGE_GAME_STILL_PAUSED_5 :Permainan masih dijeda({STRING}, {STRING}, {STRING}, {STRING}, {STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_UNPAUSED :Permainan dilanjutkan ({STRING}) STR_NETWORK_SERVER_MESSAGE_GAME_REASON_NOT_ENOUGH_PLAYERS :jumlah pemain STR_NETWORK_SERVER_MESSAGE_GAME_REASON_CONNECTING_CLIENTS :menghubungkan ke klien STR_NETWORK_SERVER_MESSAGE_GAME_REASON_MANUAL :manual STR_NETWORK_SERVER_MESSAGE_GAME_REASON_GAME_SCRIPT :skrip permainan +STR_NETWORK_SERVER_MESSAGE_GAME_REASON_LINK_GRAPH :menunggu pembaruan grafik link ############ End of leave-in-this-order STR_NETWORK_MESSAGE_CLIENT_LEAVING :pergi STR_NETWORK_MESSAGE_CLIENT_JOINED :*** {STRING} telah bergabung @@ -2324,6 +2342,7 @@ STR_JOIN_WAYPOINT_CAPTION :{WHITE}Gabungka STR_JOIN_WAYPOINT_CREATE_SPLITTED_WAYPOINT :{YELLOW}Pisahkan waypoint # Generic toolbar +STR_TOOLBAR_DISABLED_NO_VEHICLE_AVAILABLE :{BLACK}Dinonaktifkan karena saat ini tidak ada kendaraan yang tersedia untuk infrastruktur ini # Rail construction toolbar STR_RAIL_TOOLBAR_RAILROAD_CONSTRUCTION_CAPTION :Pembangunan Rel Kereta @@ -2519,6 +2538,12 @@ STR_TREES_RANDOM_TYPE :{BLACK}Tanam po STR_TREES_RANDOM_TYPE_TOOLTIP :{BLACK}Tempatkan tipe tumbuhan secara acak. Shift untuk menampilkan perkiraan biaya STR_TREES_RANDOM_TREES_BUTTON :{BLACK}Pohon Acak STR_TREES_RANDOM_TREES_TOOLTIP :{BLACK}Menanam pohon secara acak pada lansekap +STR_TREES_MODE_NORMAL_BUTTON :{BLACK}Normal +STR_TREES_MODE_NORMAL_TOOLTIP :{BLACK}Tanam pohon tunggal dengan menyeret ke atas lanskap. +STR_TREES_MODE_FOREST_SM_BUTTON :{BLACK}Kelompok Pohon +STR_TREES_MODE_FOREST_SM_TOOLTIP :{BLACK}Tanam hutan kecil dengan menyeret ke atas lanskap. +STR_TREES_MODE_FOREST_LG_BUTTON :{BLACK}Hutan +STR_TREES_MODE_FOREST_LG_TOOLTIP :{BLACK}Tanam hutan besar dengan menyeret ke atas lanskap. # Land generation window (SE) STR_TERRAFORM_TOOLBAR_LAND_GENERATION_CAPTION :{WHITE}Pertumbuhan Wilayah @@ -3984,6 +4009,7 @@ STR_ORDER_REFIT_STOP_ORDER :(Pasang {STRING STR_ORDER_STOP_ORDER :(Berhenti) STR_ORDER_GO_TO_STATION :{STRING} {STATION} {STRING} +STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION :{PUSH_COLOUR}{RED}(Tidak dapat menggunakan stasiun){POP_COLOUR} {STRING} {STATION} {STRING} STR_ORDER_IMPLICIT :(Terkandung) @@ -4228,6 +4254,7 @@ STR_GAME_SAVELOAD_ERROR_TOO_NEW_SAVEGAME :Berkas simpanan STR_GAME_SAVELOAD_ERROR_FILE_NOT_READABLE :Berkas tidak terbaca STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE :Berkas tidak dapat ditulisi STR_GAME_SAVELOAD_ERROR_DATA_INTEGRITY_CHECK_FAILED :Pemeriksaan integritas data gagal +STR_GAME_SAVELOAD_ERROR_PATCHPACK :Simpanan permainan dibuat dengan versi yang dimodifikasi STR_GAME_SAVELOAD_NOT_AVAILABLE : STR_WARNING_LOADGAME_REMOVED_TRAMS :{WHITE}Game telah disimpan pada versi tanpa dukungan trem. Semua Trem telah dihilangkan @@ -4308,6 +4335,7 @@ STR_ERROR_LOAN_ALREADY_REPAYED :{WHITE}... tida STR_ERROR_CURRENCY_REQUIRED :{WHITE}... dibutuhkan {CURRENCY_LONG} STR_ERROR_CAN_T_REPAY_LOAN :{WHITE}Tidak dapat membayar hutang... STR_ERROR_INSUFFICIENT_FUNDS :{WHITE}Tidak dapat memberikan uang yang berasal dari pinjaman bank... +STR_ERROR_CAN_T_GIVE_MONEY :{WHITE}Tidak bisa memberikan uang kepada perusahaan ini... STR_ERROR_CAN_T_BUY_COMPANY :{WHITE}Tidak dapat membeli perusahaan... STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS :{WHITE}Tidak dapat membangun kantor pusat perusahaan... STR_ERROR_CAN_T_BUY_25_SHARE_IN_THIS :{WHITE}Tidak dapat membeli 25% saham perusahaan ini... @@ -4434,6 +4462,7 @@ STR_ERROR_DEPOT_WRONG_DEPOT_TYPE :Jenis bengkel s STR_ERROR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}{VEHICLE} jadi terlalu panjang setelah diganti STR_ERROR_AUTOREPLACE_NOTHING_TO_DO :{WHITE}Tidak ada aturan peremajaan otomatis yang berlaku STR_ERROR_AUTOREPLACE_MONEY_LIMIT :(batas min. uang) +STR_ERROR_AUTOREPLACE_INCOMPATIBLE_REFIT :{WHITE}Kendaraan baru tidak dapat melakukan perbaikan dalam urutan {NUM} # Rail construction errors STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION :{WHITE}Kombinasi rel yang mustahil From fe86bf8bf66775201924d01b14e3de821ab81902 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 11 Jan 2021 20:10:53 +0100 Subject: [PATCH 47/50] Fix #7619: nudge fast planes sooner towards their target (#8531) For non-NewGRF planes, "count" is never above 1. So planes can smoothly be guided to their destination. For NewGRF planes, they can go as quick as "count" values of 20. This easily overshoots the target. So, calculate if the plane will overshoot, and start nudging him to the destination earlier. You won't notice this either way, as it all happens within a single tick. --- src/aircraft_cmd.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 475bd7b12a..0495da0b26 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -856,8 +856,6 @@ static void MaybeCrashAirplane(Aircraft *v); */ static bool AircraftController(Aircraft *v) { - int count; - /* nullptr if station is invalid */ const Station *st = Station::GetIfValid(v->targetairport); /* INVALID_TILE if there is no station */ @@ -917,7 +915,7 @@ static bool AircraftController(Aircraft *v) } } else { u->cur_speed = 32; - count = UpdateAircraftSpeed(v); + int count = UpdateAircraftSpeed(v); if (count > 0) { v->tile = 0; @@ -972,7 +970,7 @@ static bool AircraftController(Aircraft *v) } u->cur_speed += 4; } else { - count = UpdateAircraftSpeed(v); + int count = UpdateAircraftSpeed(v); if (count > 0) { if (v->z_pos > z) { SetAircraftPosition(v, v->x_pos, v->y_pos, std::max(v->z_pos - count, z)); @@ -1023,16 +1021,23 @@ static bool AircraftController(Aircraft *v) if (amd.flag & AMED_LAND) { speed_limit = SPEED_LIMIT_APPROACH; hard_limit = false; } if (amd.flag & AMED_BRAKE) { speed_limit = SPEED_LIMIT_TAXI; hard_limit = false; } - count = UpdateAircraftSpeed(v, speed_limit, hard_limit); + int count = UpdateAircraftSpeed(v, speed_limit, hard_limit); if (count == 0) return false; + /* If the plane will be a few subpixels away from the destination after + * this movement loop, start nudging him towards the exact position for + * the whole loop. Otherwise, heavily depending on the speed of the plane, + * it is possible we totally overshoot the target, causing the plane to + * make a loop, and trying again, and again, and again .. */ + bool nudge_towards_target = static_cast(count) + 3 > dist; + if (v->turn_counter != 0) v->turn_counter--; do { GetNewVehiclePosResult gp; - if (dist < 4 || (amd.flag & AMED_LAND)) { + if (nudge_towards_target || (amd.flag & AMED_LAND)) { /* move vehicle one pixel towards target */ gp.x = (v->x_pos != (x + amd.x)) ? v->x_pos + ((x + amd.x > v->x_pos) ? 1 : -1) : From ff89f5f4c6deff65fab5f08f32e6d2bb07c7a632 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 16:21:54 +0100 Subject: [PATCH 48/50] Fix 8f3d1ec: "restart" did not always restart your current game In the sequence: - Load a game - Start a newgame (via console) - Restart a game (via console) Gave you the loaded game back, not the new game. --- src/openttd.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/openttd.cpp b/src/openttd.cpp index 41900933a4..805e591b98 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -928,6 +928,10 @@ static void MakeNewGameDone() static void MakeNewGame(bool from_heightmap, bool reset_settings) { _game_mode = GM_NORMAL; + if (!from_heightmap) { + /* "reload" command needs to know what mode we were in. */ + _file_to_saveload.SetMode(SLO_INVALID, FT_INVALID, DFT_INVALID); + } ResetGRFConfig(true); @@ -943,6 +947,8 @@ static void MakeNewEditorWorldDone() static void MakeNewEditorWorld() { _game_mode = GM_EDITOR; + /* "reload" command needs to know what mode we were in. */ + _file_to_saveload.SetMode(SLO_INVALID, FT_INVALID, DFT_INVALID); ResetGRFConfig(true); @@ -1052,9 +1058,9 @@ void SwitchToMode(SwitchMode new_mode) SwitchToMode(_switch_mode); break; } - /* No break here, to enter the next case: - * Restart --> 'Random game' with current settings */ - FALLTHROUGH; + + MakeNewGame(false, new_mode == SM_NEWGAME); + break; case SM_NEWGAME: // New Game --> 'Random game' if (_network_server) { From 760b0cdc114864e2987a1e9c2b8369cea603a04e Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Fri, 8 Jan 2021 16:23:07 +0100 Subject: [PATCH 49/50] Change: change console command "restart" and add "reload" The current "restart" command is now called "reload", as that is what it does. The old "restart" command is now called "restart", as that is what it did. As this has not been in any official release yet, this shouldn't harm any kitten. --- src/console_cmds.cpp | 18 ++++++++++++++++++ src/openttd.cpp | 5 +++-- src/openttd.h | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 356cfc7ab4..e1cabd88f7 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1073,6 +1073,23 @@ DEF_CONSOLE_CMD(ConRestart) return true; } +DEF_CONSOLE_CMD(ConReload) +{ + if (argc == 0) { + IConsoleHelp("Reload game. Usage: 'reload'"); + IConsoleHelp("Reloads a game."); + IConsoleHelp(" * if you started from a savegame / scenario / heightmap, that exact same savegame / scenario / heightmap will be loaded."); + IConsoleHelp(" * if you started from a new game, this acts the same as 'restart'."); + return true; + } + + /* Don't copy the _newgame pointers to the real pointers, so call SwitchToMode directly */ + _settings_game.game_creation.map_x = MapLogX(); + _settings_game.game_creation.map_y = FindFirstBit(MapSizeY()); + _switch_mode = SM_RELOADGAME; + return true; +} + /** * Print a text buffer line by line to the console. Lines are separated by '\n'. * @param buf The buffer to print. @@ -2113,6 +2130,7 @@ void IConsoleStdLibRegister() IConsoleCmdRegister("list_aliases", ConListAliases); IConsoleCmdRegister("newgame", ConNewGame); IConsoleCmdRegister("restart", ConRestart); + IConsoleCmdRegister("reload", ConReload); IConsoleCmdRegister("getseed", ConGetSeed); IConsoleCmdRegister("getdate", ConGetDate); IConsoleCmdRegister("getsysdate", ConGetSysDate); diff --git a/src/openttd.cpp b/src/openttd.cpp index 805e591b98..9d28a3fe59 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1046,9 +1046,9 @@ void SwitchToMode(SwitchMode new_mode) MakeNewEditorWorld(); break; - case SM_RESTARTGAME: // Restart --> Current settings preserved + case SM_RELOADGAME: // Reload with what-ever started the game if (_file_to_saveload.abstract_ftype == FT_SAVEGAME || _file_to_saveload.abstract_ftype == FT_SCENARIO) { - /* Restart current savegame/scenario */ + /* Reload current savegame/scenario */ _switch_mode = _game_mode == GM_EDITOR ? SM_LOAD_SCENARIO : SM_LOAD_GAME; SwitchToMode(_switch_mode); break; @@ -1062,6 +1062,7 @@ void SwitchToMode(SwitchMode new_mode) MakeNewGame(false, new_mode == SM_NEWGAME); break; + case SM_RESTARTGAME: // Restart --> 'Random game' with current settings case SM_NEWGAME: // New Game --> 'Random game' if (_network_server) { seprintf(_network_game_info.map_name, lastof(_network_game_info.map_name), "Random Map"); diff --git a/src/openttd.h b/src/openttd.h index 6568881c47..62651fe7f0 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -25,6 +25,7 @@ enum SwitchMode { SM_NONE, SM_NEWGAME, ///< New Game --> 'Random game'. SM_RESTARTGAME, ///< Restart --> 'Random game' with current settings. + SM_RELOADGAME, ///< Reload the savegame / scenario / heightmap you started the game with. SM_EDITOR, ///< Switch to scenario editor. SM_LOAD_GAME, ///< Load game, Play Scenario. SM_MENU, ///< Switch to game intro menu. From cd36e1716022dc86b128901604ebb0960d6dc35a Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 11 Jan 2021 20:58:00 +0100 Subject: [PATCH 50/50] Fix: don't allow free-wagon-chains to exceed max-train-length (#8533) This makes no sense, that a free-wagon-chain could be larger than the maximum length of a train, as you cannot put an engine in front of that anyway. And it prevents run-away AIs making very silly long free-wagon-chains. --- src/train_cmd.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index ddd8cafc7b..3b8230e5fa 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -646,8 +646,9 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const w->engine_type == e->index && ///< Same type w->First() != v && ///< Don't connect to ourself !(w->vehstatus & VS_CRASHED)) { ///< Not crashed/flooded - DoCommand(0, v->index | 1 << 20, w->Last()->index, DC_EXEC, CMD_MOVE_RAIL_VEHICLE); - break; + if (DoCommand(0, v->index | 1 << 20, w->Last()->index, DC_EXEC, CMD_MOVE_RAIL_VEHICLE).Succeeded()) { + break; + } } } } @@ -959,12 +960,25 @@ static CommandCost CheckNewTrain(Train *original_dst, Train *dst, Train *origina static CommandCost CheckTrainAttachment(Train *t) { /* No multi-part train, no need to check. */ - if (t == nullptr || t->Next() == nullptr || !t->IsEngine()) return CommandCost(); + if (t == nullptr || t->Next() == nullptr) return CommandCost(); /* The maximum length for a train. For each part we decrease this by one * and if the result is negative the train is simply too long. */ int allowed_len = _settings_game.vehicle.max_train_length * TILE_SIZE - t->gcache.cached_veh_length; + /* For free-wagon chains, check if they are within the max_train_length limit. */ + if (!t->IsEngine()) { + t = t->Next(); + while (t != nullptr) { + allowed_len -= t->gcache.cached_veh_length; + + t = t->Next(); + } + + if (allowed_len < 0) return_cmd_error(STR_ERROR_TRAIN_TOO_LONG); + return CommandCost(); + } + Train *head = t; Train *prev = t;