diff options
author | truebrain <truebrain@openttd.org> | 2012-01-03 16:36:24 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2012-01-03 16:36:24 +0000 |
commit | 34d90da509a27c4abe35c11d7f034b1e386cd968 (patch) | |
tree | 552a11c264ee5b26ad849818f50f45bf9927735c /src/script/api/script_event_types.hpp | |
parent | 18ac3f2bd89aa11fefa64bdada287a72937ab8d5 (diff) | |
download | openttd-34d90da509a27c4abe35c11d7f034b1e386cd968.tar.xz |
(svn r23731) -Add: add GSGoal::Question(), to ask a question to a(ll) company(ies). It can contain random text, and at most 3 buttons from a collection of 17
Diffstat (limited to 'src/script/api/script_event_types.hpp')
-rw-r--r-- | src/script/api/script_event_types.hpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/script/api/script_event_types.hpp b/src/script/api/script_event_types.hpp index a33d68524..9bce59318 100644 --- a/src/script/api/script_event_types.hpp +++ b/src/script/api/script_event_types.hpp @@ -14,6 +14,7 @@ #include "script_event.hpp" #include "script_company.hpp" +#include "script_goal.hpp" #include "script_window.hpp" /** @@ -932,4 +933,53 @@ private: uint8 widget; ///< Widget of the click. }; +/** + * Event Goal Question Answer, where you receive the answer given to your questions. + * @note It is possible that you get more than 1 answer from the same company + * (due to lag). Please keep this in mind while handling this event. + * @api game + */ +class ScriptEventGoalQuestionAnswer : public ScriptEvent { +public: + /** + * @param uniqueid The uniqueID you have given this question. + * @param company The company that is replying. + * @param button The button the company pressed. + */ + ScriptEventGoalQuestionAnswer(uint16 uniqueid, ScriptCompany::CompanyID company, ScriptGoal::QuestionButton button) : + ScriptEvent(ET_GOAL_QUESTION_ANSWER), + uniqueid(uniqueid), + company(company), + button(button) + {} + + /** + * Convert an ScriptEvent to the real instance. + * @param instance The instance to convert. + * @return The converted instance. + */ + static ScriptEventGoalQuestionAnswer *Convert(ScriptEvent *instance) { return (ScriptEventGoalQuestionAnswer *)instance; } + + /** + * Get the unique id of the question. + */ + uint16 GetUniqueID() { return this->uniqueid; } + + /** + * Get the company that pressed a button. + */ + ScriptCompany::CompanyID GetCompany() { return this->company; } + + /** + * Get the button that got pressed. + */ + ScriptGoal::QuestionButton GetButton() { return this->button; } + +private: + uint16 uniqueid; ///< The uniqueid of the question. + ScriptCompany::CompanyID company; ///< The company given the answer. + ScriptGoal::QuestionButton button; ///< The button he pressed. +}; + + #endif /* SCRIPT_EVENT_TYPES_HPP */ |