newgrf.c
branch0.5
changeset 5497 b9c8c76d31b7
parent 5480 497f842b10bf
child 5511 fee376b81447
--- a/newgrf.c	Tue May 15 22:00:41 2007 +0000
+++ b/newgrf.c	Tue May 15 22:02:32 2007 +0000
@@ -2096,79 +2096,73 @@
 
 		len -= (int)name_length;
 
-		if (name_length == 1) {
-			DEBUG(grf, 7) ("FeatureNewName: Can't add empty name");
-		} else if (name_length > 127) {
-			DEBUG(grf, 7) ("FeatureNewName: Too long a name (%d)", name_length);
-		} else {
-			DEBUG(grf, 8) ("FeatureNewName: %d <- %s", id, name);
-
-			switch (feature) {
-				case GSF_TRAIN:
-				case GSF_ROAD:
-				case GSF_SHIP:
-				case GSF_AIRCRAFT: {
-					if (id < TOTAL_NUM_ENGINES) {
-						StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id);
-						SetCustomEngineName(id, string);
-					} else {
-						AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id);
-					}
-					break;
+		DEBUG(grf, 8) ("FeatureNewName: %d <- %s", id, name);
+
+		switch (feature) {
+			case GSF_TRAIN:
+			case GSF_ROAD:
+			case GSF_SHIP:
+			case GSF_AIRCRAFT: {
+				if (id < TOTAL_NUM_ENGINES) {
+					StringID string = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_8000_KIRBY_PAUL_TANK_STEAM + id);
+					SetCustomEngineName(id, string);
+				} else {
+					AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, id);
 				}
-
-				default:
-					switch (GB(id, 8, 8)) {
-						case 0xC4: /* Station class name */
-							if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
-								grfmsg(GMS_WARN, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring.", GB(id, 0, 8));
-							} else {
-								StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass;
-								SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
-							}
-							break;
-
-						case 0xC5: /* Station name */
-							if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
-								grfmsg(GMS_WARN, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring.", GB(id, 0, 8));
-							} else {
-								_cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
-							}
-							break;
-
-						case 0xC9:
-						case 0xD0:
-						case 0xDC:
-							AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
-							break;
-
-						default:
-							DEBUG(grf, 7) ("FeatureNewName: Unsupported ID (0x%04X)", id);
-							break;
-					}
-					break;
+				break;
+			}
+
+			default:
+				switch (GB(id, 8, 8)) {
+					case 0xC4: /* Station class name */
+						if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
+							grfmsg(GMS_WARN, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring.", GB(id, 0, 8));
+						} else {
+							StationClassID sclass = _cur_grffile->stations[GB(id, 0, 8)]->sclass;
+							SetStationClassName(sclass, AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED));
+						}
+						break;
+
+					case 0xC5: /* Station name */
+						if (_cur_grffile->stations == NULL || _cur_grffile->stations[GB(id, 0, 8)] == NULL) {
+							grfmsg(GMS_WARN, "FeatureNewName: Attempt to name undefined station 0x%X, ignoring.", GB(id, 0, 8));
+						} else {
+							_cur_grffile->stations[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
+						}
+						break;
+
+					case 0xC9:
+					case 0xD0:
+					case 0xDC:
+						AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
+						break;
+
+					default:
+						DEBUG(grf, 7) ("FeatureNewName: Unsupported ID (0x%04X)", id);
+						break;
+				}
+				break;
 
 #if 0
-				case GSF_CANAL :
-				case GSF_BRIDGE :
-				case GSF_TOWNHOUSE :
-					AddGRFString(_cur_spriteid, id, lang, name);
-					switch (GB(id, 8,8)) {
-						case 0xC9: /* House name */
-						default:
-							DEBUG(grf, 7) ("FeatureNewName: Unsupported ID (0x%04X)", id);
-					}
-					break;
-
-				case GSF_INDUSTRIES :
-				case 0x48 :   /* for generic strings */
-					AddGRFString(_cur_spriteid, id, lang, name);
-					break;
-				default :
-					DEBUG(grf,7) ("FeatureNewName: Unsupported feature (0x%02X)", feature);
-					break;
+			case GSF_CANAL :
+			case GSF_BRIDGE :
+			case GSF_TOWNHOUSE :
+				AddGRFString(_cur_spriteid, id, lang, name);
+				switch (GB(id, 8,8)) {
+					case 0xC9: /* House name */
+					default:
+						DEBUG(grf, 7) ("FeatureNewName: Unsupported ID (0x%04X)", id);
+				}
+				break;
+
+			case GSF_INDUSTRIES :
+			case 0x48 :   /* for generic strings */
+				AddGRFString(_cur_spriteid, id, lang, name);
+				break;
+			default :
+				DEBUG(grf,7) ("FeatureNewName: Unsupported feature (0x%02X)", feature);
+				break;
 #endif
-			}
 		}
 	}
 }