(svn r12905) [0.6] -Backport from trunk r12904, r12876:

- Fix: Remove trams from savegames saved in OTTD without tram support, it is better than to simply crash [FS#1953] (r12904)
- Fix: GCC on FreeBSD does not support -dumpmachine causing configure to fail. Use g++ instead [FS#1928] (r12876)
This commit is contained in:
rubidium 2008-04-25 19:27:27 +00:00
parent 9e03a7b23a
commit 942a752e2a
5 changed files with 35 additions and 7 deletions

View File

@ -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() {

View File

@ -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

View File

@ -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:

View File

@ -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();
}

View File

@ -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;
}