Feature: Show group name as part of the default vehicle name.

Only if the vehicle is member of a group and does not have a user defined name.
This commit is contained in:
stormcone 2020-09-13 23:24:46 +02:00 committed by Patric Stout
parent 1a67954ff9
commit ca65f19b03
3 changed files with 10 additions and 0 deletions

View File

@ -456,6 +456,8 @@ CommandCost CmdAlterGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
InvalidateWindowData(WC_REPLACE_VEHICLE, g->vehicle_type, 1);
InvalidateWindowData(GetWindowClassForVehicleType(g->vehicle_type), VehicleListIdentifier(VL_GROUP_LIST, g->vehicle_type, _current_company).Pack());
InvalidateWindowData(WC_COMPANY_COLOUR, g->owner, g->vehicle_type);
InvalidateWindowClassesData(WC_VEHICLE_VIEW);
InvalidateWindowClassesData(WC_VEHICLE_DETAILS);
}
return CommandCost();
@ -545,6 +547,8 @@ CommandCost CmdAddVehicleGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, u
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
SetWindowDirty(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowData(GetWindowClassForVehicleType(v->type), VehicleListIdentifier(VL_GROUP_LIST, v->type, _current_company).Pack());
InvalidateWindowData(WC_VEHICLE_VIEW, v->index);
InvalidateWindowData(WC_VEHICLE_DETAILS, v->index);
}
return CommandCost();

View File

@ -5037,6 +5037,7 @@ STR_FORMAT_BUOY_NAME :{TOWN} Buoy
STR_FORMAT_BUOY_NAME_SERIAL :{TOWN} Buoy #{COMMA}
STR_FORMAT_COMPANY_NUM :(Company {COMMA})
STR_FORMAT_GROUP_NAME :Group {COMMA}
STR_FORMAT_GROUP_VEHICLE_NAME :{GROUP} #{COMMA}
STR_FORMAT_INDUSTRY_NAME :{TOWN} {STRING}
STR_FORMAT_WAYPOINT_NAME :{TOWN} Waypoint
STR_FORMAT_WAYPOINT_NAME_SERIAL :{TOWN} Waypoint #{COMMA}

View File

@ -1467,6 +1467,11 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
int64 args_array[] = {(int64)(size_t)v->name.c_str()};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_JUST_RAW_STRING, &tmp_params, last);
} else if (v->group_id != DEFAULT_GROUP) {
/* The vehicle has no name, but is member of a group, so print group name */
int64 args_array[] = {v->group_id, v->unitnumber};
StringParameters tmp_params(args_array);
buff = GetStringWithArgs(buff, STR_FORMAT_GROUP_VEHICLE_NAME, &tmp_params, last);
} else {
int64 args_array[] = {v->unitnumber};
StringParameters tmp_params(args_array);