From 93e6e9f77a2833c3a70fb1f2fb21905d10541d93 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Wed, 27 Jul 2016 23:49:02 +0300 Subject: [PATCH] Adjust the name from Rocket to Missile to prevent poossible collisions when converting from name to identifier. Should close #24 --- source/Constants.cpp | 1 + source/Misc/Weapon.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/source/Constants.cpp b/source/Constants.cpp index b4e44ac1..53d5ea47 100644 --- a/source/Constants.cpp +++ b/source/Constants.cpp @@ -391,6 +391,7 @@ static const EnumElement g_WeaponEnum[] = { {_SC("Teargas"), SQMOD_WEAPON_TEARGAS}, {_SC("Molotov"), SQMOD_WEAPON_MOLOTOV}, {_SC("Rocket"), SQMOD_WEAPON_ROCKET}, + {_SC("Missile"), SQMOD_WEAPON_ROCKET}, {_SC("Colt45"), SQMOD_WEAPON_COLT45}, {_SC("Python"), SQMOD_WEAPON_PYTHON}, {_SC("Shotgun"), SQMOD_WEAPON_SHOTGUN}, diff --git a/source/Misc/Weapon.cpp b/source/Misc/Weapon.cpp index b0893ea3..3404bb96 100644 --- a/source/Misc/Weapon.cpp +++ b/source/Misc/Weapon.cpp @@ -14,7 +14,7 @@ static String CS_Weapon_Names[] = { "Nightstick", "Knife", "Baseball Bat", "Hammer", "Meat Cleaver", "Machete", "Katana", "Chainsaw", "Grenade", "Remote Detonation Grenade", "Tear Gas", "Molotov Cocktails", -"Rocket", "Colt .45", "Python", "Pump-Action Shotgun", +"Missile", "Colt .45", "Python", "Pump-Action Shotgun", "SPAS-12 Shotgun", "Stubby Shotgun", "TEC-9", "Uzi", "Silenced Ingram", "MP5", "M4", "Ruger", "Sniper Rifle", "Laserscope Sniper Rifle", "Rocket Launcher", "Flamethrower", @@ -154,6 +154,7 @@ Int32 GetWeaponID(CCStr name) // [M]achete // [M]eat Cleaver // [M]inigun + // [M]issile // [M]olotov Cocktails // [M]P5 case 'm': @@ -165,8 +166,10 @@ Int32 GetWeaponID(CCStr name) else if (b == 'a') return SQMOD_WEAPON_MACHETE; // [Me]at Cleaver else if (b == 'e') return SQMOD_WEAPON_MEATCLEAVER; - // [Mi]nigun - else if (b == 'i') return SQMOD_WEAPON_MINIGUN; + // [Min]igu[n] + else if (b == 'i' && (c == 'n' || d == 'n')) return SQMOD_WEAPON_MINIGUN; + // [Mis]sil[e] + else if (b == 'i' && (c == 's' || d == 's' || d == 'e')) return SQMOD_WEAPON_ROCKET; // [Mo]lotov Cocktails else if (b == 'o') return SQMOD_WEAPON_MOLOTOV; // [MP]5 @@ -186,14 +189,11 @@ Int32 GetWeaponID(CCStr name) // Default to unknwon else return SQMOD_UNKNOWN; // [R]emote Detonation Grenade - // [R]ocket // [R]ocket Launcher // [R]uger case 'r': // [Re]mote Detonation Grenade if (b == 'e') return SQMOD_WEAPON_REMOTE; - // [Ro]cke[t] - else if (b == 'o' && d == 't') return SQMOD_WEAPON_ROCKET; // [Ro]cket [L]aunche[r] else if (b == 'o' && (d == 'r' || d == 'l' || (len > 5 && str[6] == 'l'))) return SQMOD_WEAPON_ROCKETLAUNCHER; // [Ru]ger