mirror of https://github.com/OpenTTD/OpenTTD
Add: ScriptGroup::GetOwner for Game Scripts
parent
d009bfc47b
commit
68a9f6e774
|
@ -27,6 +27,7 @@
|
|||
* \li GSCargo::CC_NON_POURABLE
|
||||
* \li GSCargo::CC_POTABLE
|
||||
* \li GSCargo::CC_NON_POTABLE
|
||||
* \li GSGroup::GetOwner
|
||||
*
|
||||
* Other changes:
|
||||
* \li GSBridge::GetBridgeID renamed to GSBridge::GetBridgeType
|
||||
|
|
|
@ -31,6 +31,13 @@
|
|||
return g != nullptr && g->owner == ScriptObject::GetCompany();
|
||||
}
|
||||
|
||||
/* static */ ScriptCompany::CompanyID ScriptGroup::GetOwner(GroupID group_id)
|
||||
{
|
||||
if (!IsValidGroup(group_id)) return ScriptCompany::COMPANY_INVALID;
|
||||
|
||||
return ScriptCompany::ToScriptCompanyID(::Group::Get(group_id)->owner);
|
||||
}
|
||||
|
||||
/* static */ GroupID ScriptGroup::CreateGroup(ScriptVehicle::VehicleType vehicle_type, GroupID parent_group_id)
|
||||
{
|
||||
EnforceCompanyModeValid(GROUP_INVALID);
|
||||
|
|
|
@ -31,6 +31,15 @@ public:
|
|||
*/
|
||||
static bool IsValidGroup(GroupID group_id);
|
||||
|
||||
/**
|
||||
* Get the owner of a group.
|
||||
* @param group_id The group to get the owner of.
|
||||
* @pre IsValidGroup(group_id).
|
||||
* @return The owner the group has.
|
||||
* @api -ai
|
||||
*/
|
||||
static ScriptCompany::CompanyID GetOwner(GroupID group_id);
|
||||
|
||||
/**
|
||||
* Create a new group.
|
||||
* @param vehicle_type The type of vehicle to create a group for.
|
||||
|
|
Loading…
Reference in New Issue