Add: Add parent_group_id parameter to CreateGroup()
This commit is contained in:

committed by
Niels Martin Hansen

parent
5d3ccae6c5
commit
5a5944867d
@@ -26,7 +26,7 @@ void SQAIGroup_Register(Squirrel *engine)
|
||||
SQAIGroup.DefSQConst(engine, ScriptGroup::GROUP_INVALID, "GROUP_INVALID");
|
||||
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::IsValidGroup, "IsValidGroup", 2, ".i");
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::CreateGroup, "CreateGroup", 2, ".i");
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::CreateGroup, "CreateGroup", 3, ".ii");
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::DeleteGroup, "DeleteGroup", 2, ".i");
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::GetVehicleType, "GetVehicleType", 2, ".i");
|
||||
SQAIGroup.DefSQStaticMethod(engine, &ScriptGroup::SetName, "SetName", 3, ".i.");
|
||||
|
@@ -29,6 +29,7 @@
|
||||
*
|
||||
* Other changes:
|
||||
* \li AIBridge::GetName takes one extra parameter to refer the vehicle type
|
||||
* \li AIGroup::CreateGroup gains parent_group_id parameter
|
||||
*
|
||||
* \b 1.8.0
|
||||
*
|
||||
|
@@ -28,9 +28,9 @@
|
||||
return g != NULL && g->owner == ScriptObject::GetCompany();
|
||||
}
|
||||
|
||||
/* static */ ScriptGroup::GroupID ScriptGroup::CreateGroup(ScriptVehicle::VehicleType vehicle_type)
|
||||
/* static */ ScriptGroup::GroupID ScriptGroup::CreateGroup(ScriptVehicle::VehicleType vehicle_type, GroupID parent_group_id)
|
||||
{
|
||||
if (!ScriptObject::DoCommand(0, (::VehicleType)vehicle_type, INVALID_GROUP, CMD_CREATE_GROUP, NULL, &ScriptInstance::DoCommandReturnGroupID)) return GROUP_INVALID;
|
||||
if (!ScriptObject::DoCommand(0, (::VehicleType)vehicle_type, parent_group_id, CMD_CREATE_GROUP, NULL, &ScriptInstance::DoCommandReturnGroupID)) return GROUP_INVALID;
|
||||
|
||||
/* In case of test-mode, we return GroupID 0 */
|
||||
return (ScriptGroup::GroupID)0;
|
||||
|
@@ -42,11 +42,12 @@ public:
|
||||
/**
|
||||
* Create a new group.
|
||||
* @param vehicle_type The type of vehicle to create a group for.
|
||||
* @param parent_group_id The parent group id to create this group under, INVALID_GROUP for top-level.
|
||||
* @return The GroupID of the new group, or an invalid GroupID when
|
||||
* it failed. Check the return value using IsValidGroup(). In test-mode
|
||||
* 0 is returned if it was successful; any other value indicates failure.
|
||||
*/
|
||||
static GroupID CreateGroup(ScriptVehicle::VehicleType vehicle_type);
|
||||
static GroupID CreateGroup(ScriptVehicle::VehicleType vehicle_type, GroupID parent_group_id);
|
||||
|
||||
/**
|
||||
* Delete the given group. When the deletion succeeds all vehicles in the
|
||||
|
Reference in New Issue
Block a user