diff --git a/config.lib b/config.lib index 5a70d4351c..1a32297566 100644 --- a/config.lib +++ b/config.lib @@ -419,11 +419,11 @@ check_params() { detect_awk + detect_os + check_build check_host - detect_os - # We might enable universal builds always on OSX targets.. but currently we don't # if [ "$enable_universal" = "1" ] && [ "$os" != "OSX" ]; then if [ "$enable_universal" = "1" ]; then @@ -1347,13 +1347,26 @@ check_compiler() { } check_build() { - check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine" + if [ "$os" = "FREEBSD" ]; then + # FreeBSD's C compiler does not support dump machine. + # However, removing C support is not possible because PSP must be linked with the C compiler. + check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine" + else + check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine" + fi } check_host() { # By default the host is the build if [ -z "$host" ]; then host="$build"; fi - check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine" + + if [ "$os" = "FREEBSD" ]; then + # FreeBSD's C compiler does not support dump machine. + # However, removing C support is not possible because PSP must be linked with the C compiler. + check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine" + else + check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine" + fi } check_cxx_build() { diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 421d227f53..8061e62e34 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -1809,8 +1809,6 @@ STR_205C_PIGGY_BANK :Mealheiro STR_INDUSTRY :{INDUSTRY} STR_TOWN :{TOWN} STR_INDUSTRY_FORMAT :{1:STRING} de {0:TOWN} -STR_INDUSTRY_FORMAT.f :{G=f}{1:STRING} de {0:TOWN} -STR_INDUSTRY_FORMAT.m :{G=m}{1:STRING} de {0:TOWN} STR_STATION :{STATION} ##id 0x2800 diff --git a/src/lang/english.txt b/src/lang/english.txt index e694e23bb0..c9755f37d9 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3129,6 +3129,8 @@ STR_NEWGRF_NOT_FOUND_WARNING :{WHITE}Missing STR_NEWGRF_UNPAUSE_WARNING_TITLE :{YELLOW}Missing GRF file(s) STR_NEWGRF_UNPAUSE_WARNING :{WHITE}Unpausing can crash OpenTTD. Do not file bug reports for subsequent crashes.{}Do you really want to unpause? +STR_LOADGAME_REMOVED_TRAMS :{WHITE}Game was saved in version without tram support. All trams have been removed. + STR_CURRENCY_WINDOW :{WHITE}Custom currency STR_CURRENCY_EXCHANGE_RATE :{LTBLUE}Exchange rate: {ORANGE}{CURRENCY} = £ {COMMA} STR_CURRENCY_SEPARATOR :{LTBLUE}Separator: diff --git a/src/openttd.cpp b/src/openttd.cpp index a27e7bc365..2587e53708 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2440,6 +2440,21 @@ bool AfterLoadGame() } } + if (CheckSavegameVersion(62)) { + /* Remove all trams from savegames without tram support. + * There would be trams without tram track under causing crashes sooner or later. */ + Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (v->type == VEH_ROAD && v->First() == v && + HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM)) { + if (_switch_mode_errorstr == INVALID_STRING_ID || _switch_mode_errorstr == STR_NEWGRF_COMPATIBLE_LOAD_WARNING) { + _switch_mode_errorstr = STR_LOADGAME_REMOVED_TRAMS; + } + delete v; + } + } + } + return InitializeWindowsAndCaches(); } diff --git a/src/vehicle.cpp b/src/vehicle.cpp index a7185f076a..6347b8e3e5 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -583,7 +583,7 @@ void Vehicle::PreDestructor() } Window *w = FindWindowById(WC_MAIN_WINDOW, 0); - if (WP(w, vp_d).follow_vehicle == this->index) { + if (w != NULL && WP(w, vp_d).follow_vehicle == this->index) { ScrollMainWindowTo(this->x_pos, this->y_pos, true); // lock the main view on the vehicle's last position WP(w, vp_d).follow_vehicle = INVALID_VEHICLE; }