changeset 14015:647624a6439f draft

(svn r18557) -Fix: (most of) gcc errors when using lto caused by some structs having different definition in different object files
author smatz <smatz@openttd.org>
date Sat, 19 Dec 2009 23:53:15 +0000
parents 71d0ae4c68f2
children ed0ca4877eeb
files src/ai/ai_instance.cpp src/ai/api/ai_company.hpp src/ai/api/ai_company.hpp.sq src/ai/api/ai_map.cpp src/ai/api/ai_map.hpp src/ai/api/ai_road.cpp src/ai/api/ai_station.cpp src/ai/api/ai_vehicle.hpp src/ai/api/ai_vehicle.hpp.sq
diffstat 9 files changed, 12 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/ai/ai_instance.cpp
+++ b/src/ai/ai_instance.cpp
@@ -21,8 +21,6 @@
 #include "../script/squirrel_helper.hpp"
 #include "../script/squirrel_class.hpp"
 
-#define DEFINE_SCRIPT_FILES
-
 #include "ai_config.hpp"
 #include "ai_storage.hpp"
 #include "ai_instance.hpp"
@@ -82,8 +80,6 @@
 #include "api/ai_waypoint.hpp.sq"
 #include "api/ai_waypointlist.hpp.sq"
 
-#undef DEFINE_SCRIPT_FILES
-
 #include "../fileio_func.h"
 
 AIStorage::~AIStorage()
--- a/src/ai/api/ai_company.hpp
+++ b/src/ai/api/ai_company.hpp
@@ -23,14 +23,10 @@
 
 	/** Different constants related to CompanyID. */
 	enum CompanyID {
-		COMPANY_INVALID = -1, //!< An invalid company.
-
-#ifdef DEFINE_SCRIPT_FILES
-		COMPANY_FIRST   = 0, //!< The first available company.
+		COMPANY_FIRST   = 0,               //!< The first available company.
 		COMPANY_LAST    = ::MAX_COMPANIES, //!< The last available company.
-#endif /* DEFINE_SCRIPT_FILES */
-
-		COMPANY_SELF    = 254, //!< Constant that gets resolved to the correct company index for your company.
+		COMPANY_SELF    = 254,             //!< Constant that gets resolved to the correct company index for your company.
+		COMPANY_INVALID = -1,              //!< An invalid company.
 	};
 
 	/** Possible genders for company presidents. */
--- a/src/ai/api/ai_company.hpp.sq
+++ b/src/ai/api/ai_company.hpp.sq
@@ -32,10 +32,10 @@
 	SQAICompany.PreRegister(engine);
 	SQAICompany.AddConstructor<void (AICompany::*)(), 1>(engine, "x");
 
-	SQAICompany.DefSQConst(engine, AICompany::COMPANY_INVALID, "COMPANY_INVALID");
 	SQAICompany.DefSQConst(engine, AICompany::COMPANY_FIRST,   "COMPANY_FIRST");
 	SQAICompany.DefSQConst(engine, AICompany::COMPANY_LAST,    "COMPANY_LAST");
 	SQAICompany.DefSQConst(engine, AICompany::COMPANY_SELF,    "COMPANY_SELF");
+	SQAICompany.DefSQConst(engine, AICompany::COMPANY_INVALID, "COMPANY_INVALID");
 	SQAICompany.DefSQConst(engine, AICompany::GENDER_MALE,     "GENDER_MALE");
 	SQAICompany.DefSQConst(engine, AICompany::GENDER_FEMALE,   "GENDER_FEMALE");
 	SQAICompany.DefSQConst(engine, AICompany::GENDER_INVALID,  "GENDER_INVALID");
--- a/src/ai/api/ai_map.cpp
+++ b/src/ai/api/ai_map.cpp
@@ -9,6 +9,7 @@
 
 /** @file ai_map.cpp Implementation of AIMap. */
 
+#include "../../stdafx.h"
 #include "ai_map.hpp"
 #include "../../tile_map.h"
 
--- a/src/ai/api/ai_map.hpp
+++ b/src/ai/api/ai_map.hpp
@@ -13,15 +13,14 @@
 #define AI_MAP_HPP
 
 #include "ai_object.hpp"
+#include "../../tile_type.h"
 
 /**
  * Class that handles all map related functions.
  */
 class AIMap : public AIObject {
 public:
-#ifdef DEFINE_SCRIPT_FILES
 	static const int TILE_INVALID = (int)INVALID_TILE; //!< Invalid TileIndex.
-#endif /* DEFINE_SCRIPT_FILES */
 #ifdef DOXYGEN_SKIP
 	const static TileIndex TILE_INVALID; //!< Invalid TileIndex.
 #endif /* DOXYGEN_SKIP */
--- a/src/ai/api/ai_road.cpp
+++ b/src/ai/api/ai_road.cpp
@@ -9,6 +9,7 @@
 
 /** @file ai_road.cpp Implementation of AIRoad. */
 
+#include "../../stdafx.h"
 #include "ai_map.hpp"
 #include "ai_station.hpp"
 #include "ai_cargo.hpp"
--- a/src/ai/api/ai_station.cpp
+++ b/src/ai/api/ai_station.cpp
@@ -9,6 +9,7 @@
 
 /** @file ai_station.cpp Implementation of AIStation. */
 
+#include "../../stdafx.h"
 #include "ai_station.hpp"
 #include "ai_cargo.hpp"
 #include "ai_map.hpp"
--- a/src/ai/api/ai_vehicle.hpp
+++ b/src/ai/api/ai_vehicle.hpp
@@ -80,10 +80,6 @@
 		VT_WATER,          //!< Water type vehicle.
 		VT_AIR,            //!< Air type vehicle.
 		VT_INVALID = 0xFF, //!< Invalid vehicle type.
-
-#ifdef DEFINE_SCRIPT_FILES
-		VEHICLE_INVALID = -1, //!< Invalid VehicleID.
-#endif /* DEFINE_SCRIPT_FILES */
 	};
 
 	/**
@@ -100,6 +96,8 @@
 		VS_INVALID = 0xFF, //!< An invalid vehicle state.
 	};
 
+	static const int VEHICLE_INVALID = -1; //!< Invalid VehicleID.
+
 	/**
 	 * Checks whether the given vehicle is valid and owned by you.
 	 * @param vehicle_id The vehicle to check.
--- a/src/ai/api/ai_vehicle.hpp.sq
+++ b/src/ai/api/ai_vehicle.hpp.sq
@@ -52,7 +52,6 @@
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_WATER,                         "VT_WATER");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_AIR,                           "VT_AIR");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VT_INVALID,                       "VT_INVALID");
-	SQAIVehicle.DefSQConst(engine, AIVehicle::VEHICLE_INVALID,                  "VEHICLE_INVALID");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_RUNNING,                       "VS_RUNNING");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_STOPPED,                       "VS_STOPPED");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_IN_DEPOT,                      "VS_IN_DEPOT");
@@ -61,6 +60,8 @@
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_CRASHED,                       "VS_CRASHED");
 	SQAIVehicle.DefSQConst(engine, AIVehicle::VS_INVALID,                       "VS_INVALID");
 
+	SQAIVehicle.DefSQConst(engine, AIVehicle::VEHICLE_INVALID, "VEHICLE_INVALID");
+
 	AIError::RegisterErrorMap(STR_ERROR_TOO_MANY_VEHICLES_IN_GAME,                           AIVehicle::ERR_VEHICLE_TOO_MANY);
 	AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_NOT_AVAILABLE,                              AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);
 	AIError::RegisterErrorMap(STR_ERROR_ROAD_VEHICLE_NOT_AVAILABLE,                          AIVehicle::ERR_VEHICLE_NOT_AVAILABLE);