diff --git a/config.lib b/config.lib index dec0dc3a77..a2f19113dd 100644 --- a/config.lib +++ b/config.lib @@ -1718,9 +1718,9 @@ make_cflags_and_ldflags() { # Some icu-configs have the 'feature' of not adding a space where others do add the space if [ "$static_icu" != "0" ]; then - LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly --ldflags-layout | tr '\n\r' ' ' | sed s/licu/lsicu/g`" + LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' ' | sed s/licu/lsicu/g`" else - LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly --ldflags-layout | tr '\n\r' ' '`" + LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' '`" fi fi diff --git a/src/engine.cpp b/src/engine.cpp index b09332c0fc..700475c1b4 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1112,12 +1112,16 @@ void CheckEngines() if (!e->IsEnabled()) continue; /* We have an available engine... yay! */ - if (e->flags & ENGINE_AVAILABLE && e->company_avail != 0) return; + 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); } - SetDParam(0, min_date); - ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE, STR_ERROR_NO_VEHICLES_AVAILABLE_EXPLANATION, WL_WARNING); + if (min_date < INT32_MAX) { + SetDParam(0, min_date); + ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_YET, STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION, WL_WARNING); + } else { + ShowErrorMessage(STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL, STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION, WL_WARNING); + } } diff --git a/src/lang/english.txt b/src/lang/english.txt index 41f0b33321..ddfdd6bfae 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -4190,8 +4190,10 @@ STR_ERROR_CAN_T_CHANGE_SERVICING :{WHITE}Can't ch STR_ERROR_VEHICLE_IS_DESTROYED :{WHITE}... vehicle is destroyed -STR_ERROR_NO_VEHICLES_AVAILABLE :{WHITE}No vehicles are available yet -STR_ERROR_NO_VEHICLES_AVAILABLE_EXPLANATION :{WHITE}Start a new game after {DATE_SHORT} or use a NewGRF that provides early vehicles +STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL :{WHITE}No vehicles will be available at all +STR_ERROR_NO_VEHICLES_AVAILABLE_AT_ALL_EXPLANATION :{WHITE}Change your NewGRF configuration +STR_ERROR_NO_VEHICLES_AVAILABLE_YET :{WHITE}No vehicles are available yet +STR_ERROR_NO_VEHICLES_AVAILABLE_YET_EXPLANATION :{WHITE}Start a new game after {DATE_SHORT} or use a NewGRF that provides early vehicles # Specific vehicle errors STR_ERROR_CAN_T_MAKE_TRAIN_PASS_SIGNAL :{WHITE}Can't make train pass signal at danger... diff --git a/src/script/api/ai/ai_rail.hpp.sq b/src/script/api/ai/ai_rail.hpp.sq index 8ec22e3384..ba9d7e6564 100644 --- a/src/script/api/ai/ai_rail.hpp.sq +++ b/src/script/api/ai/ai_rail.hpp.sq @@ -53,6 +53,9 @@ void SQAIRail_Register(Squirrel *engine) ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD); ScriptError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_ARE_NO_SIGNALS, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_STATION, ScriptRail::ERR_UNSUITABLE_TRACK); ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING); ScriptError::RegisterErrorMapString(ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD"); diff --git a/src/script/api/game/game_rail.hpp.sq b/src/script/api/game/game_rail.hpp.sq index 68c8b3322d..c057360300 100644 --- a/src/script/api/game/game_rail.hpp.sq +++ b/src/script/api/game/game_rail.hpp.sq @@ -53,6 +53,9 @@ void SQGSRail_Register(Squirrel *engine) ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_ON_ONEWAY_ROAD, ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD); ScriptError::RegisterErrorMap(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_ARE_NO_SIGNALS, ScriptRail::ERR_UNSUITABLE_TRACK); + ScriptError::RegisterErrorMap(STR_ERROR_THERE_IS_NO_STATION, ScriptRail::ERR_UNSUITABLE_TRACK); ScriptError::RegisterErrorMap(STR_ERROR_CROSSING_DISALLOWED, ScriptRail::ERR_RAILTYPE_DISALLOWS_CROSSING); ScriptError::RegisterErrorMapString(ScriptRail::ERR_CROSSING_ON_ONEWAY_ROAD, "ERR_CROSSING_ON_ONEWAY_ROAD"); diff --git a/src/script/api/script_rail.hpp b/src/script/api/script_rail.hpp index 787b5b5988..7e2a59e7f7 100644 --- a/src/script/api/script_rail.hpp +++ b/src/script/api/script_rail.hpp @@ -32,8 +32,8 @@ public: /** One-way roads cannot have crossings */ ERR_CROSSING_ON_ONEWAY_ROAD, // [STR_ERROR_CROSSING_ON_ONEWAY_ROAD] - /** Track not suitable for signals */ - ERR_UNSUITABLE_TRACK, // [STR_ERROR_NO_SUITABLE_RAILROAD_TRACK] + /** No suitable track could be found */ + ERR_UNSUITABLE_TRACK, // [STR_ERROR_NO_SUITABLE_RAILROAD_TRACK, STR_ERROR_THERE_IS_NO_RAILROAD_TRACK, STR_ERROR_THERE_ARE_NO_SIGNALS, STR_ERROR_THERE_IS_NO_STATION] /** This railtype cannot have crossings */ ERR_RAILTYPE_DISALLOWS_CROSSING, // [STR_ERROR_CROSSING_DISALLOWED] @@ -268,6 +268,9 @@ public: * Build a NewGRF rail station. This calls callback 18 to let a NewGRF * provide the station class / id to build, so we don't end up with * only the default stations on the map. + * When no NewGRF provides a rail station, or an unbuildable rail station is + * returned by a NewGRF, this function will fall back to building a default + * non-NewGRF station as if ScriptRail::BuildRailStation was called. * @param tile Place to build the station. * @param direction The direction to build the station. * @param num_platforms The number of platforms to build. @@ -319,6 +322,7 @@ public: * @pre IsValidTile(tile). * @pre IsValidTile(tile2). * @game @pre Valid ScriptCompanyMode active in scope. + * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether at least one tile has been/can be cleared or not. */ static bool RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail); @@ -331,6 +335,7 @@ public: * @pre IsValidTile(tile). * @pre IsValidTile(tile2). * @game @pre Valid ScriptCompanyMode active in scope. + * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether at least one tile has been/can be cleared or not. */ static bool RemoveRailStationTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail); @@ -369,6 +374,7 @@ public: * @pre ScriptMap::IsValidTile(tile). * @pre (GetRailTracks(tile) & rail_track) != 0. * @game @pre Valid ScriptCompanyMode active in scope. + * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether the rail has been/can be removed or not. * @note You can only remove a single track with this function so do not * use the values from RailTrack as bitmask. @@ -424,6 +430,7 @@ public: * (ScriptMap::GetTileX(from) == ScriptMap::GetTileX(tile) && ScriptMap::GetTileX(tile) == ScriptMap::GetTileX(to)) || * (ScriptMap::GetTileY(from) == ScriptMap::GetTileY(tile) && ScriptMap::GetTileY(tile) == ScriptMap::GetTileY(to)). * @game @pre Valid ScriptCompanyMode active in scope. + * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether the rail has been/can be removed or not. */ static bool RemoveRail(TileIndex from, TileIndex tile, TileIndex to); @@ -457,6 +464,7 @@ public: * @pre ScriptMap::DistanceManhattan(tile, front) == 1. * @pre GetSignalType(tile, front) != SIGNALTYPE_NONE. * @game @pre Valid ScriptCompanyMode active in scope. + * @exception ScriptRail::ERR_UNSUITABLE_TRACK * @return Whether the signal has been/can be removed or not. */ static bool RemoveSignal(TileIndex tile, TileIndex front); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 624cc74464..08ecc65d54 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -681,7 +681,10 @@ private: /** Sort by population */ static int CDECL TownPopulationSorter(const Town * const *a, const Town * const *b) { - return (*a)->cache.population - (*b)->cache.population; + uint32 a_population = (*a)->cache.population; + uint32 b_population = (*b)->cache.population; + if (a_population == b_population) return TownDirectoryWindow::TownNameSorter(a, b); + return (a_population < b_population) ? -1 : 1; } public: