(svn r18687) -Add [NoAI]: AIEngine::IsBuildable to check if you can build a certain engine.

-Change: AIEngine::IsValidEngine will now also return true when you have at least one vehicle of that type even if you can't build it anymore.
This commit is contained in:
yexo
2010-01-02 15:52:29 +00:00
parent 2f29975421
commit 8f50437298
9 changed files with 186 additions and 5 deletions

View File

@@ -114,7 +114,7 @@
/* static */ bool AIGroup::SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new)
{
EnforcePrecondition(false, IsValidGroup(group_id) || group_id == GROUP_ALL);
EnforcePrecondition(false, AIEngine::IsValidEngine(engine_id_new));
EnforcePrecondition(false, AIEngine::IsBuildable(engine_id_new));
return AIObject::DoCommand(0, group_id << 16, (engine_id_new << 16) | engine_id_old, CMD_SET_AUTOREPLACE);
}