summaryrefslogtreecommitdiff
path: root/src/station_gui.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-12-19 23:35:14 +0000
committersmatz <smatz@openttd.org>2007-12-19 23:35:14 +0000
commit0e727b8e631837ad643b536f5af9dbe6b5444ae6 (patch)
tree0ec3573300b058bad88b58f00714b8161888ffd8 /src/station_gui.cpp
parentbe923601bfba2e76bdf0b32af6d3f7f5e862b3a9 (diff)
downloadopenttd-0e727b8e631837ad643b536f5af9dbe6b5444ae6.tar.xz
(svn r11670) -Feature [FS#1565]: list neutral stations where the player has service in the station list too
Diffstat (limited to 'src/station_gui.cpp')
-rw-r--r--src/station_gui.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index f7fa0cf23..dfde1a6a2 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -25,6 +25,7 @@
#include "helpers.hpp"
#include "cargotype.h"
#include "station_gui.h"
+#include "station.h"
typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
@@ -233,7 +234,7 @@ static void BuildStationsList(plstations_d* sl, PlayerID owner, byte facilities,
DEBUG(misc, 3, "Building station list for player %d", owner);
FOR_ALL_STATIONS(st) {
- if (st->owner == owner) {
+ if (st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy() && HasStationInUse(st->index, owner))) {
if (facilities & st->facilities) { //only stations with selected facilities
int num_waiting_cargo = 0;
for (CargoID j = 0; j < NUM_CARGO; j++) {
@@ -380,7 +381,10 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
int x;
assert(st->xy != 0);
- assert(st->owner == owner);
+
+ /* Do not do the complex check HasStationInUse here, it may be even false
+ * when the order had been removed and the station list hasn't been removed yet */
+ assert(st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy()));
SetDParam(0, st->index);
SetDParam(1, st->facilities);
@@ -410,7 +414,8 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
if (id_v >= sl->list_length) return; // click out of list bound
const Station *st = sl->sort_list[id_v];
- assert(st->owner == owner);
+ /* do not check HasStationInUse - it is slow and may be invalid */
+ assert(st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy()));
ScrollMainWindowToTile(st->xy);
break;
}