summaryrefslogtreecommitdiff
path: root/src/script/api/script_goal.hpp
diff options
context:
space:
mode:
authortruebrain <truebrain@openttd.org>2011-12-19 21:03:17 +0000
committertruebrain <truebrain@openttd.org>2011-12-19 21:03:17 +0000
commit3ada3b9cc5b63a593c2b2655aafedbcbdedcd041 (patch)
tree0b51e7b529ea4eabc3cd74a3a6b749a6526bca32 /src/script/api/script_goal.hpp
parent084f4e6aacc9b3ad8f6ac319a55027307cfa5f00 (diff)
downloadopenttd-3ada3b9cc5b63a593c2b2655aafedbcbdedcd041.tar.xz
(svn r23630) -Add: a Goal GUI to show your current goals
Diffstat (limited to 'src/script/api/script_goal.hpp')
-rw-r--r--src/script/api/script_goal.hpp73
1 files changed, 73 insertions, 0 deletions
diff --git a/src/script/api/script_goal.hpp b/src/script/api/script_goal.hpp
new file mode 100644
index 000000000..ac7d8f449
--- /dev/null
+++ b/src/script/api/script_goal.hpp
@@ -0,0 +1,73 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** @file script_goal.hpp Everything to manipulate the current running goal. */
+
+#ifndef SCRIPT_GOAL_HPP
+#define SCRIPT_GOAL_HPP
+
+#include "script_object.hpp"
+#include "script_company.hpp"
+#include "../../goal_type.h"
+
+/**
+ * Class that handles some goal related functions.
+ * @api game
+ */
+class ScriptGoal : public ScriptObject {
+public:
+ /**
+ * The goal IDs.
+ */
+ enum GoalID {
+ /* Note: these values represent part of the in-game GoalID enum */
+ GOAL_INVALID = ::INVALID_GOALTYPE, ///< An invalid goal id.
+ };
+
+ /**
+ * Goal types that can be given to a goal.
+ */
+ enum GoalType {
+ /* Note: these values represent part of the in-game GoalType enum */
+ GT_NONE = ::GT_NONE, ///< Destination is not linked.
+ GT_TILE = ::GT_TILE, ///< Destination is a tile.
+ GT_INDUSTRY = ::GT_INDUSTRY, ///< Destination is an industry.
+ GT_TOWN = ::GT_TOWN, ///< Destination is a town.
+ GT_COMPANY = ::GT_COMPANY, ///< Destination is a company.
+ };
+
+ /**
+ * Check whether this is a valid goalID.
+ * @param goal_id The GoalID to check.
+ * @return True if and only if this goal is valid.
+ */
+ static bool IsValidGoal(GoalID goal_id);
+
+ /**
+ * Create a new goal.
+ * @param company The company to create the goal for, or ScriptCompany::COMPANY_INVALID for all.
+ * @param goal The goal to add to the GUI.
+ * @param type The type of the goal.
+ * @param destination The destination of the #type type.
+ * @return The new GoalID, or GOAL_INVALID if it failed.
+ * @pre goal != NULL.
+ * @pre company == COMPANY_INVALID || ResolveCompanyID(company) != COMPANY_INVALID.
+ */
+ static GoalID New(ScriptCompany::CompanyID company, const char *goal, GoalType type, uint32 destination);
+
+ /**
+ * Remove a goal from the list.
+ * @param goal_id The goal to remove.
+ * @return True if the action succeeded.
+ * @pre IsValidGoal(goal_id).
+ */
+ static bool Remove(GoalID goal_id);
+};
+
+#endif /* SCRIPT_GOAL_HPP */