diff options
author | frosch <frosch@openttd.org> | 2010-04-17 13:31:41 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-04-17 13:31:41 +0000 |
commit | 75d4bc947ddbb92ecf660d9a9858c854d5e34a15 (patch) | |
tree | b218a672a78b894388373d2e700e6ad6ebe75b63 /src/group_cmd.cpp | |
parent | 184fa43df2e14c73162e641bc9bc83e403f069ed (diff) | |
download | openttd-75d4bc947ddbb92ecf660d9a9858c854d5e34a15.tar.xz |
(svn r19654) -Codechange: Use Extract<> in more places.
Diffstat (limited to 'src/group_cmd.cpp')
-rw-r--r-- | src/group_cmd.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index a8475a18f..6585d5084 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -10,6 +10,7 @@ /** @file group_cmd.cpp Handling of the engine groups */ #include "stdafx.h" +#include "cmd_helper.h" #include "command_func.h" #include "group.h" #include "train.h" @@ -82,7 +83,7 @@ void InitializeGroup() */ CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { - VehicleType vt = (VehicleType)p1; + VehicleType vt = Extract<VehicleType, 0, 3>(p1); if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR; if (!Group::CanAllocateItem()) return CMD_ERROR; @@ -258,13 +259,12 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u */ 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; + VehicleType type = Extract<VehicleType, 0, 3>(p2); + GroupID id_g = p1; + if (!Group::IsValidID(id_g) || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR; if (flags & DC_EXEC) { Vehicle *v; - VehicleType type = (VehicleType)p2; - GroupID id_g = p1; /* Find the first front engine which belong to the group id_g * then add all shared vehicles of this front engine to the group id_g */ @@ -298,13 +298,13 @@ CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 */ CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { - Group *g = Group::GetIfValid(p1); - VehicleType type = (VehicleType)p2; + GroupID old_g = p1; + Group *g = Group::GetIfValid(old_g); + VehicleType type = Extract<VehicleType, 0, 3>(p2); if (g == NULL || g->owner != _current_company || !IsCompanyBuildableVehicleType(type)) return CMD_ERROR; if (flags & DC_EXEC) { - GroupID old_g = p1; Vehicle *v; /* Find each Vehicle that belongs to the group old_g and add it to the default group */ |