|
@@ -72,14 +72,17 @@ void InitializeGroup()
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Create a new vehicle group.
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 vehicle type
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
VehicleType vt = (VehicleType)p1;
|
|
|
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
|
|
|
|
|
@@ -99,15 +102,18 @@ CommandCost CmdCreateGroup(TileIndex til
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Add all vehicles in the given group to the default group and then deletes the group.
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 unused
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
if (g == NULL || g->owner != _current_company) return CMD_ERROR;
|
|
|
|
|
@@ -156,15 +162,18 @@ static bool IsUniqueGroupName(const char
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Rename a group
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 unused
|
|
|
* @param text the new name or an empty string when resetting to the default
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdRenameGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
if (g == NULL || g->owner != _current_company) return CMD_ERROR;
|
|
|
|
|
@@ -188,16 +197,19 @@ CommandCost CmdRenameGroup(TileIndex til
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Add a vehicle to a group
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 vehicle to add to a group
|
|
|
* - p2 bit 0-15 : VehicleID
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
Vehicle *v = Vehicle::GetIfValid(p2);
|
|
|
GroupID new_g = p1;
|
|
|
|
|
@@ -235,15 +247,18 @@ CommandCost CmdAddVehicleGroup(TileIndex
|
|
|
return CommandCost();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Add all shared vehicles of all vehicles from a group
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 type of vehicles
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
VehicleType type = (VehicleType)p2;
|
|
|
if (!Group::IsValidID(p1) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR;
|
|
|
|
|
@@ -272,15 +287,18 @@ CommandCost CmdAddSharedVehicleGroup(Til
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* Remove all vehicles from a group
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 type of vehicles
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
VehicleType type = (VehicleType)p2;
|
|
|
|
|
@@ -307,16 +325,19 @@ CommandCost CmdRemoveAllVehiclesGroup(Ti
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* (Un)set global replace protection from a group
|
|
|
* @param tile unused
|
|
|
* @param flags type of operation
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2
|
|
|
* - p2 bit 0 : 1 to set or 0 to clear protection.
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSetGroupReplaceProtection(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
if (g == NULL || g->owner != _current_company) return CMD_ERROR;
|
|
|
|