|
@@ -300,7 +300,7 @@ Group::Group(Owner owner)
|
|
|
* @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)
|
|
|
CommandCost CmdCreateGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
VehicleType vt = Extract<VehicleType, 0, 3>(p1);
|
|
|
if (!IsCompanyBuildableVehicleType(vt)) return CMD_ERROR;
|
|
@@ -350,7 +350,7 @@ CommandCost CmdCreateGroup(TileIndex til
|
|
|
* @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)
|
|
|
CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
|
@@ -404,14 +404,14 @@ CommandCost CmdDeleteGroup(TileIndex til
|
|
|
* @param text the new name or an empty string when resetting to the default
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|
|
|
|
|
|
if (!HasBit(p1, 16)) {
|
|
|
/* Rename group */
|
|
|
bool reset = StrEmpty(text);
|
|
|
bool reset = text.empty();
|
|
|
|
|
|
if (!reset) {
|
|
|
if (Utf8StringLength(text) >= MAX_LENGTH_GROUP_NAME_CHARS) return CMD_ERROR;
|
|
@@ -508,7 +508,7 @@ static void AddVehicleToGroup(Vehicle *v
|
|
|
* @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)
|
|
|
CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Vehicle *v = Vehicle::GetIfValid(GB(p2, 0, 20));
|
|
|
GroupID new_g = p1;
|
|
@@ -524,7 +524,7 @@ CommandCost CmdAddVehicleGroup(TileIndex
|
|
|
|
|
|
if (new_g == NEW_GROUP) {
|
|
|
/* Create new group. */
|
|
|
CommandCost ret = CmdCreateGroup(0, flags, v->type, INVALID_GROUP, nullptr);
|
|
|
CommandCost ret = CmdCreateGroup(0, flags, v->type, INVALID_GROUP, {});
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
new_g = _new_group_id;
|
|
@@ -565,7 +565,7 @@ CommandCost CmdAddVehicleGroup(TileIndex
|
|
|
* @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)
|
|
|
CommandCost CmdAddSharedVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
VehicleType type = Extract<VehicleType, 0, 3>(p2);
|
|
|
GroupID id_g = p1;
|
|
@@ -602,7 +602,7 @@ CommandCost CmdAddSharedVehicleGroup(Til
|
|
|
* @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)
|
|
|
CommandCost CmdRemoveAllVehiclesGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
GroupID old_g = p1;
|
|
|
Group *g = Group::GetIfValid(old_g);
|
|
@@ -636,7 +636,7 @@ CommandCost CmdRemoveAllVehiclesGroup(Ti
|
|
|
* - p2 bit 8 Set secondary instead of primary colour
|
|
|
* - p2 bit 16-23 Colour.
|
|
|
*/
|
|
|
CommandCost CmdSetGroupLivery(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdSetGroupLivery(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(p1);
|
|
|
bool primary = !HasBit(p2, 8);
|
|
@@ -697,7 +697,7 @@ static void SetGroupFlag(Group *g, Group
|
|
|
* @param text unused
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdSetGroupFlag(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
|
|
|
CommandCost CmdSetGroupFlag(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
|
|
|
{
|
|
|
Group *g = Group::GetIfValid(GB(p1, 0, 16));
|
|
|
if (g == nullptr || g->owner != _current_company) return CMD_ERROR;
|