diff src/vehicle.cpp @ 10656:39feee39693a draft

(svn r14958) -Codechange [FS#1923]: when checking for unique names, compare only with manually set names There are situations that aren't solvable (because of different language files), so if the user really wants to have duplicated name, allow him to do so. It solves desyncs between server and clients using different languages. It behaves the same in SP and MP, so users won't see the different behaviour as a bug (and even checking in SP could be worked around by the user).
author smatz <smatz@openttd.org>
date Sat, 10 Jan 2009 15:54:07 +0000
parents 92ff04e7b1d9
children da30046c7acf
line wrap: on
line diff
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1525,32 +1525,9 @@
 static bool IsUniqueVehicleName(const char *name)
 {
 	const Vehicle *v;
-	char buf[512];
 
 	FOR_ALL_VEHICLES(v) {
-		switch (v->type) {
-			case VEH_TRAIN:
-				if (!IsTrainEngine(v)) continue;
-				break;
-
-			case VEH_ROAD:
-				if (!IsRoadVehFront(v)) continue;
-				break;
-
-			case VEH_AIRCRAFT:
-				if (!IsNormalAircraft(v)) continue;
-				break;
-
-			case VEH_SHIP:
-				break;
-
-			default:
-				continue;
-		}
-
-		SetDParam(0, v->index);
-		GetString(buf, STR_VEHICLE_NAME, lastof(buf));
-		if (strcmp(buf, name) == 0) return false;
+		if (v->name != NULL && strcmp(v->name, name) == 0) return false;
 	}
 
 	return true;