diff options
author | stormcone <48624099+stormcone@users.noreply.github.com> | 2020-09-13 23:24:46 +0200 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2020-12-15 21:18:03 +0100 |
commit | ca65f19b03f28bd6a2283d740ca6ae449bdc01e7 (patch) | |
tree | ef81217d01e6b4c6ba870891405b62104ecbf852 /src | |
parent | 1a67954ff9e6d2ebd50b1ec60dd481df195da9dc (diff) | |
download | openttd-ca65f19b03f28bd6a2283d740ca6ae449bdc01e7.tar.xz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/group_cmd.cpp | 4 | ||||
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/strings.cpp | 5 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index fd63bd153..bf25dae86 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -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(); diff --git a/src/lang/english.txt b/src/lang/english.txt index b8756049d..f08272d37 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -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} diff --git a/src/strings.cpp b/src/strings.cpp index c2edf8e17..ae0ab2c90 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -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); |