From e1447d70aec54f6a8e39b8643137199a790fe2fa Mon Sep 17 00:00:00 2001 From: cim Date: Sun, 28 Sep 2014 21:14:37 +0100 Subject: [PATCH] Fix weapon loading from shipdata --- src/Core/OOConstToString.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Core/OOConstToString.m b/src/Core/OOConstToString.m index 38a2e022..1a6f7a64 100644 --- a/src/Core/OOConstToString.m +++ b/src/Core/OOConstToString.m @@ -253,7 +253,7 @@ NSString *OOStringFromWeaponType(OOWeaponType weapon) OOWeaponType OOWeaponTypeFromString(NSString *string) { - return [OOEquipmentType equipmentTypeWithIdentifier:string]; + return OOWeaponTypeFromEquipmentIdentifierSloppy(string); } @@ -268,6 +268,14 @@ OOWeaponType OOWeaponTypeFromEquipmentIdentifierSloppy(NSString *string) OOWeaponType w = [OOEquipmentType equipmentTypeWithIdentifier:string]; if (w == nil) { + if (![string hasPrefix:@"EQ_"]) + { + w = [OOEquipmentType equipmentTypeWithIdentifier:[NSString stringWithFormat:@"EQ_%@",string]]; + if (w != nil) + { + return w; + } + } return [OOEquipmentType equipmentTypeWithIdentifier:@"EQ_WEAPON_NONE"]; } return w; @@ -302,7 +310,7 @@ OOWeaponType OOWeaponTypeFromEquipmentIdentifierLegacy(NSString *string) OOWeaponType OOWeaponTypeFromEquipmentIdentifierStrict(NSString *string) { - // there is no significant difference between the two any more + // there is no difference between the two any more return OOWeaponTypeFromEquipmentIdentifierSloppy(string); }