From fd6f474c88b49da01cdf2062b782007b88a7e1ae Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 28 Jun 2007 19:14:29 +0000 Subject: (svn r10380) -Fix (r10364): when checking for unique names, only check vehicles that can have names, and skip inactive players. --- src/vehicle.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/vehicle.cpp') diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 45222cd69..775113536 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2405,17 +2405,26 @@ static bool IsUniqueVehicleName(const char *name) FOR_ALL_VEHICLES(v) { switch (v->type) { case VEH_TRAIN: + if (!IsTrainEngine(v)) continue; + break; + case VEH_ROAD: + break; + case VEH_AIRCRAFT: + if (!IsNormalAircraft(v)) continue; + break; + case VEH_SHIP: - SetDParam(0, v->index); - GetString(buf, STR_VEHICLE_NAME, lastof(buf)); - if (strcmp(buf, name) == 0) return false; break; default: - break; + continue; } + + SetDParam(0, v->index); + GetString(buf, STR_VEHICLE_NAME, lastof(buf)); + if (strcmp(buf, name) == 0) return false; } return true; -- cgit v1.2.3-54-g00ecf