(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
authorpeter1138
Tue, 08 Apr 2008 07:19:29 +0000
changeset 10092 d5418dfd0eb8
parent 10085 3f6bb14b43c4
child 10097 854e70c3bea6
(svn r12624) -Codechange: Make drawing of catenary an attribute of rail types, instead of deciding by the rail type directly.
src/rail.h
src/table/railtypes.h
--- a/src/rail.h	Mon Apr 07 22:15:31 2008 +0000
+++ b/src/rail.h	Tue Apr 08 07:19:29 2008 +0000
@@ -13,6 +13,16 @@
 #include "economy_func.h"
 #include "tile_cmd.h"
 
+enum RailTypeFlag {
+	RTF_CATENARY = 0,  ///< Set if the rail type should have catenary drawn
+};
+
+enum RailTypeFlags {
+	RTFB_NONE     = 0,
+	RTFB_CATENARY = 1 << RTF_CATENARY,
+};
+DECLARE_ENUM_AS_BIT_SET(RailTypeFlags);
+
 /** This struct contains all the info that is needed to draw and construct tracks.
  */
 struct RailtypeInfo {
@@ -93,6 +103,11 @@
 	 * Multiplier for curve maximum speed advantage
 	 */
 	byte curve_speed;
+
+	/**
+	 * Bit mask of rail type flags
+	 */
+	RailTypeFlags flags;
 };
 
 
@@ -190,7 +205,7 @@
  */
 static inline bool HasCatenary(RailType rt)
 {
-	return rt == RAILTYPE_ELECTRIC;
+	return HasBit(GetRailTypeInfo(rt)->flags, RTF_CATENARY);
 }
 
 
--- a/src/table/railtypes.h	Mon Apr 07 22:15:31 2008 +0000
+++ b/src/table/railtypes.h	Tue Apr 08 07:19:29 2008 +0000
@@ -60,6 +60,9 @@
 
 		/* curve speed advantage (multiplier) */
 		0,
+
+		/* flags */
+		RTFB_NONE,
 	},
 
 	/** Electrified railway */
@@ -116,6 +119,9 @@
 
 		/* curve speed advantage (multiplier) */
 		0,
+
+		/* flags */
+		RTFB_CATENARY,
 	},
 
 	/** Monorail */
@@ -168,6 +174,9 @@
 
 		/* curve speed advantage (multiplier) */
 		1,
+
+		/* flags */
+		RTFB_NONE,
 	},
 
 	/** Maglev */
@@ -220,6 +229,9 @@
 
 		/* curve speed advantage (multiplier) */
 		2,
+
+		/* flags */
+		RTFB_NONE,
 	},
 };