(svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel noai
authortruelight
Thu, 19 Jul 2007 22:26:26 +0000
branchnoai
changeset 9681 3997f1ce203a
parent 9680 5ed7bbfd51c7
child 9682 d031eb183733
(svn r10630) [NoAI] -Fix: allow enums to not have a predefined value for Squirrel
src/ai/api/ai_abstractlist.hpp
src/ai/api/ai_airport.hpp
src/ai/api/ai_pathfinder.hpp
src/ai/api/squirrel_export.awk
--- a/src/ai/api/ai_abstractlist.hpp	Thu Jul 19 19:42:54 2007 +0000
+++ b/src/ai/api/ai_abstractlist.hpp	Thu Jul 19 22:26:26 2007 +0000
@@ -18,8 +18,8 @@
 public:
 	/** Type of sorter */
 	enum SorterType {
-		SORT_BY_VALUE = 0,
-		SORT_BY_ITEM  = 1,
+		SORT_BY_VALUE,
+		SORT_BY_ITEM,
 	};
 
 private:
--- a/src/ai/api/ai_airport.hpp	Thu Jul 19 19:42:54 2007 +0000
+++ b/src/ai/api/ai_airport.hpp	Thu Jul 19 22:26:26 2007 +0000
@@ -16,6 +16,7 @@
 	 * The types of airports available in the game.
 	 */
 	enum AirportType {
+		/* Note: the values _are_ important as they represent an in-game value */
 		AT_SMALL         =   0,
 		AT_LARGE         =   1,
 		AT_HELIPORT      =   2,
--- a/src/ai/api/ai_pathfinder.hpp	Thu Jul 19 19:42:54 2007 +0000
+++ b/src/ai/api/ai_pathfinder.hpp	Thu Jul 19 22:26:26 2007 +0000
@@ -19,8 +19,8 @@
 	 * The type of pathfinders known in the game.
 	 */
 	enum PathFinderType {
-		PATHFINDER_ROAD = 0,
-		PATHFINDER_RAIL = 1,
+		PATHFINDER_ROAD,
+		PATHFINDER_RAIL,
 	};
 
 	/**
--- a/src/ai/api/squirrel_export.awk	Thu Jul 19 19:42:54 2007 +0000
+++ b/src/ai/api/squirrel_export.awk	Thu Jul 19 22:26:26 2007 +0000
@@ -229,6 +229,7 @@
 {
 	if (in_enum == "true") {
 		enum_value_size++
+		sub(",", "", $1)
 		enum_value[enum_value_size] = $1
 		next
 	}