summaryrefslogtreecommitdiff
path: root/src/script/api/script_event_types.hpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-05-26 14:16:32 +0000
committerfrosch <frosch@openttd.org>2012-05-26 14:16:32 +0000
commit66a37e28a69411f4666158cce03c6fd29e9a15e1 (patch)
tree5735dafdf64c8ea7e57c1b9592f256ff37ccd687 /src/script/api/script_event_types.hpp
parent9ad9d72c4ae6fb28e7381bbd50ddeb2502b7d925 (diff)
downloadopenttd-66a37e28a69411f4666158cce03c6fd29e9a15e1.tar.xz
(svn r24289) -Add: [Script] Base class for script events involving a company and a town.
Diffstat (limited to 'src/script/api/script_event_types.hpp')
-rw-r--r--src/script/api/script_event_types.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/script/api/script_event_types.hpp b/src/script/api/script_event_types.hpp
index d5a97bbdd..e416c6f04 100644
--- a/src/script/api/script_event_types.hpp
+++ b/src/script/api/script_event_types.hpp
@@ -980,5 +980,47 @@ private:
ScriptGoal::QuestionButton button; ///< The button he pressed.
};
+/**
+ * Base class for events involving a town and a company.
+ * @api ai game
+ */
+class ScriptEventCompanyTown : public ScriptEvent {
+public:
+ /**
+ * @param event The eventtype.
+ * @param company The company.
+ * @param town The town.
+ */
+ ScriptEventCompanyTown(ScriptEventType event, ScriptCompany::CompanyID company, TownID town) :
+ ScriptEvent(event),
+ company(company),
+ town(town)
+ {}
+
+ /**
+ * Convert an ScriptEvent to the real instance.
+ * @param instance The instance to convert.
+ * @return The converted instance.
+ */
+ static ScriptEventCompanyTown *Convert(ScriptEvent *instance) { return (ScriptEventCompanyTown *)instance; }
+
+ /**
+ * Get the CompanyID of the company.
+ * @return The CompanyID of the company involved into the event.
+ */
+ ScriptCompany::CompanyID GetCompanyID() { return this->company; }
+
+ /**
+ * Get the TownID of the town.
+ * @return The TownID of the town involved into the event.
+ */
+ TownID GetTownID() { return this->town; }
+
+private:
+ ScriptCompany::CompanyID company; ///< The company involved into the event.
+ TownID town; ///< The town involved into the event.
+};
+
+
#endif /* SCRIPT_EVENT_TYPES_HPP */