summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-05-22 12:25:47 +0000
committerfrosch <frosch@openttd.org>2010-05-22 12:25:47 +0000
commit03cacb797aa50a952cab1f38210b267d0db935db (patch)
tree1db444f3348d5ee3fab86390eb1b754d6ca4c83e /src/ai/api
parent557c3f7daadd604dbed9b7c6ae290a76eeeb2458 (diff)
downloadopenttd-03cacb797aa50a952cab1f38210b267d0db935db.tar.xz
(svn r19880) -Fix: [NoAI] AIEngine::IsValidEngine() and AIEngine::IsBuildable() returned false positives. Especially wagons of unavailable railtypes were reported available.
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_engine.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp
index d24a8b6e0..c235255ba 100644
--- a/src/ai/api/ai_engine.cpp
+++ b/src/ai/api/ai_engine.cpp
@@ -16,20 +16,21 @@
#include "../../strings_func.h"
#include "../../rail.h"
#include "../../engine_base.h"
+#include "../../engine_func.h"
#include "../../articulated_vehicles.h"
#include "table/strings.h"
/* static */ bool AIEngine::IsValidEngine(EngineID engine_id)
{
const Engine *e = ::Engine::GetIfValid(engine_id);
- return e != NULL && (HasBit(e->company_avail, _current_company) || ::Company::Get(_current_company)->num_engines[engine_id] > 0);
+ return e != NULL && (::IsEngineBuildable(engine_id, e->type, _current_company) || ::Company::Get(_current_company)->num_engines[engine_id] > 0);
}
/* static */ bool AIEngine::IsBuildable(EngineID engine_id)
{
const Engine *e = ::Engine::GetIfValid(engine_id);
- return e != NULL && HasBit(e->company_avail, _current_company);
+ return e != NULL && ::IsEngineBuildable(engine_id, e->type, _current_company);
}
/* static */ char *AIEngine::GetName(EngineID engine_id)