diff options
author | rubidium <rubidium@openttd.org> | 2009-09-01 12:57:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-01 12:57:04 +0000 |
commit | 4c84db16361c17e6c3def857b400b9a974f90d44 (patch) | |
tree | 57d6185c490b3a04178e78f6bbcca714ac1b3824 /src/ai/api/ai_event_types.hpp | |
parent | 4abf4602e7a0b624de9836b5a58d3d606612c2fa (diff) | |
download | openttd-4c84db16361c17e6c3def857b400b9a974f90d44.tar.xz |
(svn r17345) -Fix [FS#2769]: one wasn't offered to take over bankrupt companies anymore; caused by the introduction NoAI, although NewAI had the same problem too.
Diffstat (limited to 'src/ai/api/ai_event_types.hpp')
-rw-r--r-- | src/ai/api/ai_event_types.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/ai/api/ai_event_types.hpp b/src/ai/api/ai_event_types.hpp index 7c5112949..774df7c44 100644 --- a/src/ai/api/ai_event_types.hpp +++ b/src/ai/api/ai_event_types.hpp @@ -359,6 +359,54 @@ private: }; /** + * Event Company Ask Merger, indicating a company can be bought (cheaply) by you. + */ +class AIEventCompanyAskMerger : public AIEvent { +public: + static const char *GetClassName() { return "AIEventCompanyAskMerger"; } + + /** + * @param owner The company that can be bough. + * @param value The value/costs of buying the company. + */ + AIEventCompanyAskMerger(Owner owner, int32 value) : + AIEvent(AI_ET_COMPANY_MERGER), + owner((AICompany::CompanyID)owner), + value(value) + {} + + /** + * Convert an AIEvent to the real instance. + * @param instance The instance to convert. + * @return The converted instance. + */ + static AIEventCompanyAskMerger *Convert(AIEvent *instance) { return (AIEventCompanyAskMerger *)instance; } + + /** + * Get the CompanyID of the company that can be bought. + * @return The CompanyID of the company that can be bought. + * @note If the company is bought this will become invalid. + */ + AICompany::CompanyID GetCompanyID() { return this->owner; } + + /** + * Get the value of the new company. + * @return The value of the new company. + */ + int32 GetValue() { return this->value; } + + /** + * Take over the company for this merger. + * @return true if the merger was a success. + */ + bool AcceptMerger(); + +private: + AICompany::CompanyID owner; + int32 value; +}; + +/** * Event Company Merger, indicating a company has been bought by another * company. */ |