summaryrefslogtreecommitdiff
path: root/src/script/api/script_objecttype.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/api/script_objecttype.hpp')
-rw-r--r--src/script/api/script_objecttype.hpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/script/api/script_objecttype.hpp b/src/script/api/script_objecttype.hpp
new file mode 100644
index 000000000..d3f5d4a51
--- /dev/null
+++ b/src/script/api/script_objecttype.hpp
@@ -0,0 +1,57 @@
+/*
+ * 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_objecttype.hpp Everything to query and build industries. */
+
+#ifndef SCRIPT_OBJECTTYPE_HPP
+#define SCRIPT_OBJECTTYPE_HPP
+
+#include "script_list.hpp"
+
+#include "../../newgrf_object.h"
+
+/**
+ * Class that handles all object-type related functions.
+ * @api ai game
+ */
+class ScriptObjectType : public ScriptObject {
+public:
+ /**
+ * Checks whether the given object-type is valid.
+ * @param object_type The type to check.
+ * @return True if and only if the object-type is valid.
+ */
+ static bool IsValidObjectType(ObjectType object_type);
+
+ /**
+ * Get the name of an object-type.
+ * @param object_type The type to get the name for.
+ * @pre IsValidObjectType(object_type).
+ * @return The name of an object.
+ */
+ static char *GetName(ObjectType object_type);
+
+ /**
+ * Get the number of views for an object-type.
+ * @param object_type The type to get the number of views for.
+ * @pre IsValidObjectType(object_type).
+ * @return The number of views for an object.
+ */
+ static uint8 GetViews(ObjectType object_type);
+
+ /**
+ * Build an object of the specified type.
+ * @param object_type The type of the object to build.
+ * @param view The view for teh object.
+ * @param tile The tile to build the object on.
+ * @pre IsValidObjectType(object_type).
+ * @return True if the object was successfully build.
+ */
+ static bool BuildObject(ObjectType object_type, uint8 view, TileIndex tile);
+};
+
+#endif /* SCRIPT_OBJECTTYPE_HPP */