From f708b9a80a8287a3d12c946e63308401e436695a Mon Sep 17 00:00:00 2001 From: smatz Date: Sat, 19 Dec 2009 23:53:15 +0000 Subject: [PATCH] (svn r18557) -Fix: (most of) gcc errors when using lto caused by some structs having different definition in different object files --- src/ai/ai_instance.cpp | 4 ---- src/ai/api/ai_company.hpp | 10 +++------- src/ai/api/ai_company.hpp.sq | 2 +- src/ai/api/ai_map.cpp | 1 + src/ai/api/ai_map.hpp | 3 +-- src/ai/api/ai_road.cpp | 1 + src/ai/api/ai_station.cpp | 1 + src/ai/api/ai_vehicle.hpp | 6 ++---- src/ai/api/ai_vehicle.hpp.sq | 3 ++- 9 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/ai/ai_instance.cpp b/src/ai/ai_instance.cpp index 6ebaae46cf..41b4c42c0d 100644 --- 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() diff --git a/src/ai/api/ai_company.hpp b/src/ai/api/ai_company.hpp index 8909567575..d32579ef8e 100644 --- a/src/ai/api/ai_company.hpp +++ b/src/ai/api/ai_company.hpp @@ -23,14 +23,10 @@ public: /** 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. */ diff --git a/src/ai/api/ai_company.hpp.sq b/src/ai/api/ai_company.hpp.sq index 29fab8cb36..44937f024e 100644 --- a/src/ai/api/ai_company.hpp.sq +++ b/src/ai/api/ai_company.hpp.sq @@ -32,10 +32,10 @@ void SQAICompany_Register(Squirrel *engine) SQAICompany.PreRegister(engine); SQAICompany.AddConstructor(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"); diff --git a/src/ai/api/ai_map.cpp b/src/ai/api/ai_map.cpp index c9432fa26b..d5728b9ebc 100644 --- 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" diff --git a/src/ai/api/ai_map.hpp b/src/ai/api/ai_map.hpp index b9d609f4ea..59c102056c 100644 --- 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 */ diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp index c43eb64ecb..c221bbff0a 100644 --- 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" diff --git a/src/ai/api/ai_station.cpp b/src/ai/api/ai_station.cpp index 670355dffa..af9d184c8c 100644 --- 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" diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp index 3e050b5706..4041287a73 100644 --- a/src/ai/api/ai_vehicle.hpp +++ b/src/ai/api/ai_vehicle.hpp @@ -80,10 +80,6 @@ public: 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 @@ public: 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. diff --git a/src/ai/api/ai_vehicle.hpp.sq b/src/ai/api/ai_vehicle.hpp.sq index edd28b0190..0e35a3afd2 100644 --- a/src/ai/api/ai_vehicle.hpp.sq +++ b/src/ai/api/ai_vehicle.hpp.sq @@ -52,7 +52,6 @@ void SQAIVehicle_Register(Squirrel *engine) 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 @@ void SQAIVehicle_Register(Squirrel *engine) 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);