summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorstormcone <48624099+stormcone@users.noreply.github.com>2020-09-13 23:24:46 +0200
committerPatric Stout <github@truebrain.nl>2020-12-15 21:18:03 +0100
commitca65f19b03f28bd6a2283d740ca6ae449bdc01e7 (patch)
treeef81217d01e6b4c6ba870891405b62104ecbf852 /src/strings.cpp
parent1a67954ff9e6d2ebd50b1ec60dd481df195da9dc (diff)
downloadopenttd-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/strings.cpp')
-rw-r--r--src/strings.cpp5
1 files changed, 5 insertions, 0 deletions
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);