2021-09-25 13:39:40 +02:00
|
|
|
/*
|
|
|
|
* 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);
|
2022-01-20 22:33:37 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a specific object-type from a grf.
|
2023-01-25 23:40:57 +01:00
|
|
|
* @param grfid The ID of the NewGRF.
|
2022-01-20 22:33:37 +01:00
|
|
|
* @param grf_local_id The ID of the object, local to the NewGRF.
|
|
|
|
* @pre 0x00 <= grf_local_id < NUM_OBJECTS_PER_GRF.
|
|
|
|
* @return the object-type ID, local to the current game (this diverges from the grf_local_id).
|
|
|
|
*/
|
|
|
|
static ObjectType ResolveNewGRFID(uint32 grfid, uint16 grf_local_id);
|
2021-09-25 13:39:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCRIPT_OBJECTTYPE_HPP */
|