(svn r26789) [1.4] -Backport from trunk:

- Fix: Incorrect CFLAGS when enabling gprof profiling (r26737, r26735)
- Fix: Do not reset the last selected airport or layout, unless it is really necessary [FS#6083] (r26732)
- Fix: Use the normal search path to look for xdg-open at Unix [FS#6077] (r26724)
- Fix: Properly check for cargo acceptance of houses [FS#5997] (r26723)
This commit is contained in:
frosch 2014-09-07 15:07:22 +00:00
parent 12c3ba3095
commit 8e36fb0ada
4 changed files with 31 additions and 8 deletions

View File

@ -1450,7 +1450,11 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -noixemul"
fi
CFLAGS="-O2 -fomit-frame-pointer $CFLAGS"
if [ "$enable_profiling" = "0" ]; then
# -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
CFLAGS="-fomit-frame-pointer $CFLAGS"
fi
CFLAGS="-O2 $CFLAGS"
else
OBJS_SUBDIR="debug"
@ -1494,7 +1498,7 @@ make_cflags_and_ldflags() {
fi
if [ "$enable_profiling" != "0" ]; then
CFLAGS="$CFLAGS -p"
CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
fi

View File

@ -226,8 +226,27 @@ public:
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
this->OnInvalidateData();
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
this->SelectFirstAvailableAirport(true);
/* Ensure airport class is valid (changing NewGRFs). */
_selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
const AirportClass *ac = AirportClass::Get(_selected_airport_class);
this->vscroll->SetCount(ac->GetSpecCount());
/* Ensure the airport index is valid for this class (changing NewGRFs). */
_selected_airport_index = Clamp(_selected_airport_index, -1, ac->GetSpecCount() - 1);
/* Only when no valid airport was selected, we want to select the first airport. */
bool selectFirstAirport = true;
if (_selected_airport_index != -1) {
const AirportSpec *as = ac->GetSpec(_selected_airport_index);
if (as->IsAvailable()) {
/* Ensure the airport layout is valid. */
_selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
selectFirstAirport = false;
this->UpdateSelectSize();
}
}
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
}
virtual ~BuildAirportWindow()

View File

@ -2000,7 +2000,7 @@ struct CargoesRow {
if (!hs->enabled) continue;
for (uint j = 0; j < lengthof(hs->accepts_cargo); j++) {
if (cargo_fld->u.cargo.vertical_cargoes[i] == hs->accepts_cargo[j]) {
if (hs->cargo_acceptance[j] > 0 && cargo_fld->u.cargo.vertical_cargoes[i] == hs->accepts_cargo[j]) {
cargo_fld->ConnectCargo(cargo_fld->u.cargo.vertical_cargoes[i], false);
goto next_cargo;
}
@ -2192,7 +2192,7 @@ struct IndustryCargoesWindow : public Window {
if (!hs->enabled || !(hs->building_availability & climate_mask)) continue;
for (uint j = 0; j < lengthof(hs->accepts_cargo); j++) {
if (cargoes[i] == hs->accepts_cargo[j]) return true;
if (hs->cargo_acceptance[j] > 0 && cargoes[i] == hs->accepts_cargo[j]) return true;
}
}
}

View File

@ -365,10 +365,10 @@ void OSOpenBrowser(const char *url)
if (child_pid != 0) return;
const char *args[3];
args[0] = "/usr/bin/xdg-open";
args[0] = "xdg-open";
args[1] = url;
args[2] = NULL;
execv(args[0], const_cast<char * const *>(args));
execvp(args[0], const_cast<char * const *>(args));
DEBUG(misc, 0, "Failed to open url: %s", url);
exit(0);
}