summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2013-01-22 14:31:01 +0000
committerpeter1138 <peter1138@openttd.org>2013-01-22 14:31:01 +0000
commitbef25bbdab077b60d4752669e8309add06d58d38 (patch)
treeb9f7ee57ed4712445aa8ae85488f4aa5ccf8a46e /src
parentc18446951d57c1061405b11f048dca97f730a707 (diff)
downloadopenttd-bef25bbdab077b60d4752669e8309add06d58d38.tar.xz
(svn r24933) -Fix [FS#3473]: Make group names unique per company and vehicle type.
Diffstat (limited to 'src')
-rw-r--r--src/group_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 388ccf796..e86b9de28 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -340,12 +340,12 @@ CommandCost CmdDeleteGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
return CommandCost();
}
-static bool IsUniqueGroupName(const char *name)
+static bool IsUniqueGroupNameForVehicleType(const char *name, VehicleType type)
{
const Group *g;
FOR_ALL_GROUPS(g) {
- if (g->name != NULL && strcmp(g->name, name) == 0) return false;
+ if (g->name != NULL && g->vehicle_type == type && strcmp(g->name, name) == 0) return false;
}
return true;
@@ -370,7 +370,7 @@ CommandCost CmdRenameGroup(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
if (!reset) {
if (Utf8StringLength(text) >= MAX_LENGTH_GROUP_NAME_CHARS) return CMD_ERROR;
- if (!IsUniqueGroupName(text)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
+ if (!IsUniqueGroupNameForVehicleType(text, g->vehicle_type)) return_cmd_error(STR_ERROR_NAME_MUST_BE_UNIQUE);
}
if (flags & DC_EXEC) {