1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Adjust range checks when converting vehicle name to identifier.

This commit is contained in:
Sandu Liviu Catalin 2016-07-28 00:14:02 +03:00
parent 7b3b7cb6c2
commit 7735070ef8

View File

@ -64,16 +64,16 @@ Int32 GetAutomobileID(CSStr name)
return SQMOD_UNKNOWN;
}
// Grab the actual length of the string
Uint32 len = static_cast< Uint32 >(str.length());
const Uint32 len = static_cast< Uint32 >(str.length());
// Get the most significant characters used to identify a vehicle
CharT a = str[0], b = 0, c = 0, d = str[len-1];
// Look for deeper specifiers
if(len >= 3)
if(len > 2)
{
c = str[2];
b = str[1];
}
else if(len >= 2)
else if(len > 1)
{
b = str[1];
}