mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use SQInteger for generic numbers in script_objecttype
This commit is contained in:
parent
0293fd41e5
commit
49ea69fdef
|
@ -30,25 +30,26 @@
|
|||
return GetString(ObjectSpec::Get(object_type)->name);
|
||||
}
|
||||
|
||||
/* static */ uint8 ScriptObjectType::GetViews(ObjectType object_type)
|
||||
/* static */ SQInteger ScriptObjectType::GetViews(ObjectType object_type)
|
||||
{
|
||||
EnforcePrecondition(0, IsValidObjectType(object_type));
|
||||
|
||||
return ObjectSpec::Get(object_type)->views;
|
||||
}
|
||||
|
||||
/* static */ bool ScriptObjectType::BuildObject(ObjectType object_type, uint8 view, TileIndex tile)
|
||||
/* static */ bool ScriptObjectType::BuildObject(ObjectType object_type, SQInteger view, TileIndex tile)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidObjectType(object_type));
|
||||
EnforcePrecondition(false, view >= 0 && view < GetViews(object_type));
|
||||
EnforcePrecondition(false, ScriptMap::IsValidTile(tile));
|
||||
|
||||
return ScriptObject::Command<CMD_BUILD_OBJECT>::Do(tile, object_type, view);
|
||||
}
|
||||
|
||||
/* static */ ObjectType ScriptObjectType::ResolveNewGRFID(uint32 grfid, uint16 grf_local_id)
|
||||
/* static */ ObjectType ScriptObjectType::ResolveNewGRFID(SQInteger grfid, SQInteger grf_local_id)
|
||||
{
|
||||
EnforcePrecondition(INVALID_OBJECT_TYPE, IsInsideBS(grf_local_id, 0x00, NUM_OBJECTS_PER_GRF));
|
||||
|
||||
grfid = BSWAP32(grfid); // Match people's expectations.
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
return _object_mngr.GetID(grf_local_id, grfid);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
* @pre IsValidObjectType(object_type).
|
||||
* @return The number of views for an object.
|
||||
*/
|
||||
static uint8 GetViews(ObjectType object_type);
|
||||
static SQInteger GetViews(ObjectType object_type);
|
||||
|
||||
/**
|
||||
* Build an object of the specified type.
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
* @pre IsValidObjectType(object_type).
|
||||
* @return True if the object was successfully build.
|
||||
*/
|
||||
static bool BuildObject(ObjectType object_type, uint8 view, TileIndex tile);
|
||||
static bool BuildObject(ObjectType object_type, SQInteger view, TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get a specific object-type from a grf.
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
* @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);
|
||||
static ObjectType ResolveNewGRFID(SQInteger grfid, SQInteger grf_local_id);
|
||||
};
|
||||
|
||||
#endif /* SCRIPT_OBJECTTYPE_HPP */
|
||||
|
|
Loading…
Reference in New Issue