|
@@ -90,13 +90,13 @@ static WindowClass GetWCForVT(VehicleTyp
|
|
|
/**
|
|
|
* Add a vehicle to a group
|
|
|
* @param tile unused
|
|
|
* @param p1 vehicle type
|
|
|
* @param p2 unused
|
|
|
*/
|
|
|
int32 CmdCreateGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdCreateGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
VehicleType vt = (VehicleType)p1;
|
|
|
if (!IsPlayerBuildableVehicleType(vt)) return CMD_ERROR;
|
|
|
|
|
|
Group *g = AllocateGroup();
|
|
|
if (g == NULL) return CMD_ERROR;
|
|
@@ -118,13 +118,13 @@ int32 CmdCreateGroup(TileIndex tile, uin
|
|
|
* Add a vehicle to a group
|
|
|
* @param tile unused
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 unused
|
|
|
*/
|
|
|
int32 CmdDeleteGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdDeleteGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
if (!IsValidGroupID(p1)) return CMD_ERROR;
|
|
|
|
|
|
Group *g = GetGroup(p1);
|
|
|
if (g->owner != _current_player) return CMD_ERROR;
|
|
|
|
|
@@ -164,13 +164,13 @@ int32 CmdDeleteGroup(TileIndex tile, uin
|
|
|
* Rename a group
|
|
|
* @param tile unused
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 unused
|
|
|
*/
|
|
|
int32 CmdRenameGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdRenameGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
if (!IsValidGroupID(p1) || StrEmpty(_cmd_text)) return CMD_ERROR;
|
|
|
|
|
|
Group *g = GetGroup(p1);
|
|
|
if (g->owner != _current_player) return CMD_ERROR;
|
|
|
|
|
@@ -196,13 +196,13 @@ int32 CmdRenameGroup(TileIndex tile, uin
|
|
|
* @param tile unused
|
|
|
* @param p1 index of array group
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 vehicle to add to a group
|
|
|
* - p2 bit 0-15 : VehicleID
|
|
|
*/
|
|
|
int32 CmdAddVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdAddVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
GroupID new_g = p1;
|
|
|
|
|
|
if (!IsValidVehicleID(p2) || (!IsValidGroupID(new_g) && !IsDefaultGroupID(new_g))) return CMD_ERROR;
|
|
|
|
|
|
if (IsValidGroupID(new_g)) {
|
|
@@ -242,13 +242,13 @@ int32 CmdAddVehicleGroup(TileIndex tile,
|
|
|
* Add all shared vehicles of all vehicles from a group
|
|
|
* @param tile unused
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 type of vehicles
|
|
|
*/
|
|
|
int32 CmdAddSharedVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
VehicleType type = (VehicleType)p2;
|
|
|
if (!IsValidGroupID(p1) || !IsPlayerBuildableVehicleType(type)) return CMD_ERROR;
|
|
|
|
|
|
if (flags & DC_EXEC) {
|
|
|
Vehicle *v;
|
|
@@ -279,13 +279,13 @@ int32 CmdAddSharedVehicleGroup(TileIndex
|
|
|
* Remove all vehicles from a group
|
|
|
* @param tile unused
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2 type of vehicles
|
|
|
*/
|
|
|
int32 CmdRemoveAllVehiclesGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
VehicleType type = (VehicleType)p2;
|
|
|
if (!IsValidGroupID(p1) || !IsPlayerBuildableVehicleType(type)) return CMD_ERROR;
|
|
|
|
|
|
Group *g = GetGroup(p1);
|
|
|
if (g->owner != _current_player) return CMD_ERROR;
|
|
@@ -316,13 +316,13 @@ int32 CmdRemoveAllVehiclesGroup(TileInde
|
|
|
* @param tile unused
|
|
|
* @param p1 index of group array
|
|
|
* - p1 bit 0-15 : GroupID
|
|
|
* @param p2
|
|
|
* - p2 bit 0 : 1 to set or 0 to clear protection.
|
|
|
*/
|
|
|
int32 CmdSetGroupReplaceProtection(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
CommandCost CmdSetGroupReplaceProtection(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
if (!IsValidGroupID(p1)) return CMD_ERROR;
|
|
|
|
|
|
Group *g = GetGroup(p1);
|
|
|
if (g->owner != _current_player) return CMD_ERROR;
|
|
|
|