Changeset - r19977:606523dc67fe
[Not reviewed]
master
0 1 0
peter1138 - 12 years ago 2013-01-22 14:31:01
peter1138@openttd.org
(svn r24933) -Fix [FS#3473]: Make group names unique per company and vehicle type.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/group_cmd.cpp
Show inline comments
 
@@ -340,12 +340,12 @@ CommandCost CmdDeleteGroup(TileIndex til
 
	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 til
 

	
 
	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) {
0 comments (0 inline, 0 general)