summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_rail.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-08-06 17:20:21 +0000
committerfrosch <frosch@openttd.org>2011-08-06 17:20:21 +0000
commitc76d1c54b721cde80494fa70455cffe254bf3350 (patch)
tree6f8da9cf15a6ad96c83b9392c2cc3de2dbe01897 /src/ai/api/ai_rail.cpp
parentba7356b520b73b9080be95bf070b691db258c647 (diff)
downloadopenttd-c76d1c54b721cde80494fa70455cffe254bf3350.tar.xz
(svn r22726) -Fix: AITile::GetCargoAcceptance, AITile::GetCargoProduction and AIRail::BuildNewGRFRailStation did not check the cargo argument for validity.
Diffstat (limited to 'src/ai/api/ai_rail.cpp')
-rw-r--r--src/ai/api/ai_rail.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp
index c6aefe714..8d4606544 100644
--- a/src/ai/api/ai_rail.cpp
+++ b/src/ai/api/ai_rail.cpp
@@ -14,6 +14,7 @@
#include "ai_map.hpp"
#include "ai_station.hpp"
#include "ai_industrytype.hpp"
+#include "ai_cargo.hpp"
#include "../../debug.h"
#include "../../station_base.h"
#include "../../company_func.h"
@@ -170,6 +171,7 @@
EnforcePrecondition(false, platform_length > 0 && platform_length <= 0xFF);
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
+ EnforcePrecondition(false, AICargo::IsValidCargo(cargo_id));
EnforcePrecondition(false, source_industry == AIIndustryType::INDUSTRYTYPE_UNKNOWN || source_industry == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(source_industry));
EnforcePrecondition(false, goal_industry == AIIndustryType::INDUSTRYTYPE_UNKNOWN || goal_industry == AIIndustryType::INDUSTRYTYPE_TOWN || AIIndustryType::IsValidIndustryType(goal_industry));