Merge branch 'master' into jgrpp

# Conflicts:
#	src/lang/italian.txt
#	src/lang/tamil.txt
This commit is contained in:
Jonathan G Rennison
2022-01-29 00:05:07 +00:00
10 changed files with 174 additions and 35 deletions

View File

@@ -17,6 +17,9 @@
*
* This version is not yet released. The following changes are not set in stone yet.
*
* \li AIIndustryType::ResolveNewGRFID
* \li AIObjectType::ResolveNewGRFID
*
* \b 12.0
*
* API additions:

View File

@@ -17,6 +17,9 @@
*
* This version is not yet released. The following changes are not set in stone yet.
*
* \li GSIndustryType::ResolveNewGRFID
* \li GSObjectType::ResolveNewGRFID
*
* \b 12.0
*
* API additions:

View File

@@ -153,3 +153,11 @@
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
}
/* static */ IndustryType ScriptIndustryType::ResolveNewGRFID(uint32 grfid, uint16 grf_local_id)
{
EnforcePrecondition(INVALID_INDUSTRYTYPE, IsInsideBS(grf_local_id, 0x00, NUM_INDUSTRYTYPES_PER_GRF));
grfid = BSWAP32(grfid); // Match people's expectations.
return _industry_mngr.GetID(grf_local_id, grfid);
}

View File

@@ -181,6 +181,15 @@ public:
* @return True when this type has a dock.
*/
static bool HasDock(IndustryType industry_type);
/**
* Get a specific industry-type from a grf.
* @param grf_id The ID of the NewGRF.
* @param grf_local_id The ID of the industry, local to the NewGRF.
* @pre 0x00 <= grf_local_id < NUM_INDUSTRYTYPES_PER_GRF.
* @return the industry-type ID, local to the current game (this diverges from the grf_local_id).
*/
static IndustryType ResolveNewGRFID(uint32 grfid, uint16 grf_local_id);
};
#endif /* SCRIPT_INDUSTRYTYPE_HPP */

View File

@@ -43,3 +43,11 @@
return ScriptObject::DoCommand(tile, object_type, view, CMD_BUILD_OBJECT);
}
/* static */ ObjectType ScriptObjectType::ResolveNewGRFID(uint32 grfid, uint16 grf_local_id)
{
EnforcePrecondition(INVALID_OBJECT_TYPE, IsInsideBS(grf_local_id, 0x00, NUM_OBJECTS_PER_GRF));
grfid = BSWAP32(grfid); // Match people's expectations.
return _object_mngr.GetID(grf_local_id, grfid);
}

View File

@@ -52,6 +52,15 @@ public:
* @return True if the object was successfully build.
*/
static bool BuildObject(ObjectType object_type, uint8 view, TileIndex tile);
/**
* Get a specific object-type from a grf.
* @param grf_id 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.
* @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);
};
#endif /* SCRIPT_OBJECTTYPE_HPP */