diff options
author | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2009-01-12 17:11:45 +0000 |
commit | a3dd7506d377b1434f913bd65c019eed52b64b6e (patch) | |
tree | ced1a262eb143ad6e64ec02f4a4c89835c0c32fd /src/engine.cpp | |
parent | 9294f9616866b9778c22076c19b5a32b4f85f788 (diff) | |
download | openttd-a3dd7506d377b1434f913bd65c019eed52b64b6e.tar.xz |
(svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
NoAI is an API (a framework) to build your own AIs in. See:
http://wiki.openttd.org/wiki/index.php/AI:Main_Page
With many thanks to:
- glx and Rubidium for their syncing, feedback and hard work
- Yexo for his feedback, patches, and AIs which tested the system very deep
- Morloth for his feedback and patches
- TJIP for hosting a challenge which kept NoAI on track
- All AI authors for testing our AI API, and all other people who helped in one way or another
-Remove: all old AIs and their cheats/hacks
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 7e7959e26..ffecb7bac 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -24,6 +24,7 @@ #include "string_func.h" #include "settings_type.h" #include "oldpool_func.h" +#include "ai/ai.hpp" #include "core/alloc_func.hpp" #include "vehicle_func.h" @@ -376,14 +377,10 @@ void EnginesDailyLoop() continue; } - if (!IsHumanCompany(best_company)) { - /* XXX - TTDBUG: TTD has a bug here ???? */ - AcceptEnginePreview(i, best_company); - } else { - e->flags |= ENGINE_OFFER_WINDOW_OPEN; - e->preview_wait = 20; - if (IsInteractiveCompany(best_company)) ShowEnginePreviewWindow(i); - } + e->flags |= ENGINE_OFFER_WINDOW_OPEN; + e->preview_wait = 20; + AI::NewEvent(best_company, new AIEventEnginePreview(i)); + if (IsInteractiveCompany(best_company)) ShowEnginePreviewWindow(i); } } } @@ -460,6 +457,8 @@ static void NewVehicleAvailable(Engine *e) FOR_ALL_COMPANIES(c) SetBit(c->avail_roadtypes, HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD); } + AI::BroadcastNewEvent(new AIEventEngineAvailable(index)); + SetDParam(0, GetEngineCategoryName(index)); SetDParam(1, index); AddNewsItem(STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE, NS_NEW_VEHICLES, index, 0); |