GRF: Initial support for > 255 objects per GRF

This commit is contained in:
Jonathan G Rennison
2023-02-11 00:30:16 +00:00
parent 26dc69ff13
commit c0c9c66f7b
7 changed files with 19 additions and 26 deletions

View File

@@ -46,7 +46,7 @@
/* static */ ObjectType ScriptObjectType::ResolveNewGRFID(uint32 grfid, uint16 grf_local_id)
{
EnforcePrecondition(INVALID_OBJECT_TYPE, IsInsideBS(grf_local_id, 0x00, NUM_OBJECTS_PER_GRF));
EnforcePrecondition(INVALID_OBJECT_TYPE, IsInsideBS(grf_local_id, 0x00, NUM_OBJECTS));
grfid = BSWAP32(grfid); // Match people's expectations.
return _object_mngr.GetID(grf_local_id, grfid);

View File

@@ -57,7 +57,7 @@ public:
* Get a specific object-type from a grf.
* @param grfid The ID of the NewGRF.
* @param grf_local_id The ID of the object, local to the NewGRF.
* @pre 0x00 <= grf_local_id < NUM_OBJECTS_PER_GRF.
* @pre 0x00 <= grf_local_id < NUM_OBJECTS.
* @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);