diff --git a/src/script/api/script_objecttype.hpp b/src/script/api/script_objecttype.hpp new file mode 100644 --- /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 . + */ + +/** @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 */