summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-10-03 20:21:56 +0000
committerrubidium <rubidium@openttd.org>2011-10-03 20:21:56 +0000
commitf5caf07ee103dd10e134fc2a736e7716fdfe1bc8 (patch)
treefa09a2760db7372347deeddc170668ac7c5f51eb
parent83e8f8bdd3720d08dd52caecca01927726f1784a (diff)
downloadopenttd-f5caf07ee103dd10e134fc2a736e7716fdfe1bc8.tar.xz
(svn r22988) -Fix: don't return ERR_UNKNOWN when the vehicle would become too long
-rw-r--r--src/ai/api/ai_changelog.hpp1
-rw-r--r--src/ai/api/ai_vehicle.hpp2
-rw-r--r--src/ai/api/ai_vehicle.hpp.sq3
3 files changed, 6 insertions, 0 deletions
diff --git a/src/ai/api/ai_changelog.hpp b/src/ai/api/ai_changelog.hpp
index d77cb03c2..67875146e 100644
--- a/src/ai/api/ai_changelog.hpp
+++ b/src/ai/api/ai_changelog.hpp
@@ -27,6 +27,7 @@
* \li AICompany::GetQuarterlyPerformanceRating
* \li AICompany::GetQuarterlyCompanyValue
* \li AITown::GetTownAuthority
+ * \li AIVehicle::ERR_VEHICLE_TOO_LONG in case vehicle length limit is reached
*
* API removals:
* \li AICompany::GetCompanyValue, use AICompany::GetQuarterlyCompanyValue instead.
diff --git a/src/ai/api/ai_vehicle.hpp b/src/ai/api/ai_vehicle.hpp
index 7bd9120d1..bbcaac8b0 100644
--- a/src/ai/api/ai_vehicle.hpp
+++ b/src/ai/api/ai_vehicle.hpp
@@ -65,6 +65,8 @@ public:
/** Vehicle is without power */
ERR_VEHICLE_NO_POWER, // [STR_ERROR_TRAIN_START_NO_POWER]
+ /** Vehicle would get too long during construction. */
+ ERR_VEHICLE_TOO_LONG, // [STR_ERROR_TRAIN_TOO_LONG]
};
/**
diff --git a/src/ai/api/ai_vehicle.hpp.sq b/src/ai/api/ai_vehicle.hpp.sq
index 1733fd25f..933233eaf 100644
--- a/src/ai/api/ai_vehicle.hpp.sq
+++ b/src/ai/api/ai_vehicle.hpp.sq
@@ -47,6 +47,7 @@ void SQAIVehicle_Register(Squirrel *engine)
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT");
SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER");
+ SQAIVehicle.DefSQConst(engine, AIVehicle::ERR_VEHICLE_TOO_LONG, "ERR_VEHICLE_TOO_LONG");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_RAIL, "VT_RAIL");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_ROAD, "VT_ROAD");
SQAIVehicle.DefSQConst(engine, AIVehicle::VT_WATER, "VT_WATER");
@@ -95,6 +96,7 @@ void SQAIVehicle_Register(Squirrel *engine)
AIError::RegisterErrorMap(STR_ERROR_SHIP_MUST_BE_STOPPED_INSIDE_DEPOT, AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT);
AIError::RegisterErrorMap(STR_ERROR_AIRCRAFT_IS_IN_FLIGHT, AIVehicle::ERR_VEHICLE_IN_FLIGHT);
AIError::RegisterErrorMap(STR_ERROR_TRAIN_START_NO_POWER, AIVehicle::ERR_VEHICLE_NO_POWER);
+ AIError::RegisterErrorMap(STR_ERROR_TRAIN_TOO_LONG, AIVehicle::ERR_VEHICLE_TOO_LONG);
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_MANY, "ERR_VEHICLE_TOO_MANY");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_AVAILABLE, "ERR_VEHICLE_NOT_AVAILABLE");
@@ -108,6 +110,7 @@ void SQAIVehicle_Register(Squirrel *engine)
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NOT_IN_DEPOT, "ERR_VEHICLE_NOT_IN_DEPOT");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT");
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_NO_POWER, "ERR_VEHICLE_NO_POWER");
+ AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_TOO_LONG, "ERR_VEHICLE_TOO_LONG");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i");
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons, "GetNumWagons", 2, ".i");