(svn r12698) -Codechange: skip orders to stations that do not have a train part anymore, just like is done for road vehicles and ships.
authorrubidium
Mon, 14 Apr 2008 07:08:43 +0000
changeset 10167 6e9327b2f829
parent 10166 9124595d2295
child 10168 24907819f29b
(svn r12698) -Codechange: skip orders to stations that do not have a train part anymore, just like is done for road vehicles and ships.
src/ship_cmd.cpp
src/train_cmd.cpp
--- a/src/ship_cmd.cpp	Sun Apr 13 22:25:18 2008 +0000
+++ b/src/ship_cmd.cpp	Mon Apr 14 07:08:43 2008 +0000
@@ -243,7 +243,7 @@
 {
 	if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
 
-	Station *st = GetStation(station);
+	const Station *st = GetStation(station);
 	if (st->dock_tile != 0) {
 		return TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
 	} else {
--- a/src/train_cmd.cpp	Sun Apr 13 22:25:18 2008 +0000
+++ b/src/train_cmd.cpp	Mon Apr 14 07:08:43 2008 +0000
@@ -2563,7 +2563,14 @@
 {
 	if (station == this->last_station_visited) this->last_station_visited = INVALID_STATION;
 
-	return GetStation(station)->xy;
+	const Station *st = GetStation(station);
+	if (!(st->facilities & FACIL_TRAIN)) {
+		/* The destination station has no trainstation tiles. */
+		this->cur_order_index++;
+		return 0;
+	}
+
+	return st->xy;
 }
 
 void Train::MarkDirty()