mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Make some adjustments to previously introduced feature to add names to custom vehicles.
Initial approach would throw an instance of 'std::length_error' on linux.
This commit is contained in:
parent
135e0e690f
commit
4b1e3909a4
@ -70,6 +70,18 @@ static String CS_Vehicle_Names[] = {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static String CS_Custom_Vehicle_Names[100]{};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct InitCustomVehicleNames
|
||||
{
|
||||
InitCustomVehicleNames()
|
||||
{
|
||||
for (String & s : CS_Custom_Vehicle_Names)
|
||||
{
|
||||
s.assign("");
|
||||
}
|
||||
}
|
||||
} g_InitCustomVehicleNames{};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
String GetAutomobileName(Uint32 id)
|
||||
{
|
||||
@ -98,7 +110,7 @@ void SetAutomobileName(Uint32 id, const StackStrF & name)
|
||||
}
|
||||
else if (id > 6399 && id < 6500)
|
||||
{
|
||||
CS_Custom_Vehicle_Names[id-6400].assign(name.mPtr, ConvTo< size_t >::From(name.mLen));
|
||||
CS_Custom_Vehicle_Names[id-6400].assign(name.mPtr, name.mLen < 0 ? 0 : static_cast< size_t >(name.mLen));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user