(svn r14566) -Fix [FS#2397]: RV's go via order would reserve a slot at the 'via' station which it never uses, which makes it unlikely that it reserves a slot for the next station and that makes queueing fail (Aali)
authorrubidium
Fri, 07 Nov 2008 17:59:51 +0000
changeset 10321 4a43d5022b7f
parent 10320 44d201d223f9
child 10322 1a2a97853c0c
(svn r14566) -Fix [FS#2397]: RV's go via order would reserve a slot at the 'via' station which it never uses, which makes it unlikely that it reserves a slot for the next station and that makes queueing fail (Aali)
src/rail_cmd.cpp
src/rail_map.h
src/roadveh_cmd.cpp
src/smallmap_gui.cpp
--- a/src/rail_cmd.cpp	Tue Nov 04 18:44:15 2008 +0000
+++ b/src/rail_cmd.cpp	Fri Nov 07 17:59:51 2008 +0000
@@ -2108,6 +2108,8 @@
 	RailGroundType old_ground = GetRailGroundType(tile);
 	RailGroundType new_ground;
 
+	UpdateStat(tile, !EnsureNoVehicleOnGround(tile));
+
 	if (old_ground == RAIL_GROUND_WATER) {
 		TileLoop_Water(tile);
 		return;
--- a/src/rail_map.h	Tue Nov 04 18:44:15 2008 +0000
+++ b/src/rail_map.h	Fri Nov 07 17:59:51 2008 +0000
@@ -598,6 +598,15 @@
 	return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
 }
 
+static inline void UpdateStat(TileIndex t, bool on_track)
+{
+	_me[t].m7 = _me[t].m7 << 1 | !!on_track;
+}
+
+static inline byte GetStat(TileIndex t)
+{
+	return _me[t].m7;
+}
 
 static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
 {
--- a/src/roadveh_cmd.cpp	Tue Nov 04 18:44:15 2008 +0000
+++ b/src/roadveh_cmd.cpp	Fri Nov 07 17:59:51 2008 +0000
@@ -1922,7 +1922,7 @@
 	}
 
 	/* update destination */
-	if (!(this->vehstatus & VS_STOPPED) && this->current_order.IsType(OT_GOTO_STATION) && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
+	if (!(this->vehstatus & VS_STOPPED) && this->current_order.IsType(OT_GOTO_STATION) && !(this->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
 		Station *st = GetStation(this->current_order.GetDestination());
 		RoadStop *rs = st->GetPrimaryRoadStop(this);
 		RoadStop *best = NULL;
--- a/src/smallmap_gui.cpp	Tue Nov 04 18:44:15 2008 +0000
+++ b/src/smallmap_gui.cpp	Fri Nov 07 17:59:51 2008 +0000
@@ -383,6 +383,20 @@
 	return ApplyMask(MKCOLOR(0x54545454), &_smallmap_vehicles_andor[t]);
 }
 
+#define MK(x) MKCOLOR(x << 24 | x << 16 | x << 8 | x)
+
+static const uint32 _busyness[] = {
+	MK(15),
+	MK(150),
+	MK(209),
+	MK(206),
+	MK(191),
+	MK(186),
+	MK(184),
+	MK(180),
+};
+
+
 /**
  * Return the color a tile would be displayed with in the small map in mode "Routes".
  *
@@ -405,7 +419,7 @@
 		}
 	} else {
 		/* ground color */
-		bits = ApplyMask(MKCOLOR(0x54545454), &_smallmap_contours_andor[t]);
+		bits = ApplyMask(t == MP_RAILWAY ? _busyness[CountBits(GetStat(tile))] : MKCOLOR(0x54545454), &_smallmap_contours_andor[t]);
 	}
 	return bits;
 }