Changeset - r23388:9018bccbcd7e
[Not reviewed]
master
0 1 0
Peter Nelson - 6 years ago 2019-02-26 21:07:22
peter1138@openttd.org
Change: Allow vehicle group names to be non-unique.

Group names are visual identifiers, and do not need to be unique.
Group sorting already falls back to group ID if names are the same, so that sorted
list position is stable.
1 file changed with 0 insertions and 12 deletions:
0 comments (0 inline, 0 general)
src/group_cmd.cpp
Show inline comments
 
@@ -408,17 +408,6 @@ CommandCost CmdDeleteGroup(TileIndex til
 
	return CommandCost();
 
}
 

	
 
static bool IsUniqueGroupNameForVehicleType(const char *name, VehicleType type)
 
{
 
	const Group *g;
 

	
 
	FOR_ALL_GROUPS(g) {
 
		if (g->name != NULL && g->vehicle_type == type && strcmp(g->name, name) == 0) return false;
 
	}
 

	
 
	return true;
 
}
 

	
 
/**
 
 * Alter a group
 
 * @param tile unused
 
@@ -442,7 +431,6 @@ CommandCost CmdAlterGroup(TileIndex tile
 

	
 
		if (!reset) {
 
			if (Utf8StringLength(text) >= MAX_LENGTH_GROUP_NAME_CHARS) return CMD_ERROR;
 
			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)