1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-04-25 13:47:12 +02:00

Adjust remaining miscellaneous functions to use the new method of receiving formatted strings.

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 12:32:30 +02:00
parent 7fc61a28a8
commit c040b24d29
9 changed files with 27 additions and 27 deletions

View File

@ -16,7 +16,7 @@ CSStr GetModelName(Int32 /*id*/)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetModelName(Int32 /*id*/, CSStr /*name*/) void SetModelName(Int32 /*id*/, StackStrF & /*name*/)
{ {
// @TODO Implement... // @TODO Implement...
} }

View File

@ -15,7 +15,7 @@ CSStr GetModelName(Int32 id);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Modify the name associated with a model identifier. * Modify the name associated with a model identifier.
*/ */
void SetModelName(Int32 id, CSStr name); void SetModelName(Int32 id, StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* See whether the given model identifier is used a weapon model. * See whether the given model identifier is used a weapon model.

View File

@ -102,19 +102,19 @@ CCStr GetSkinName(Uint32 id)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetSkinName(Uint32 id, CCStr name) void SetSkinName(Uint32 id, StackStrF & name)
{ {
if (id <= 159) if (id <= 159)
{ {
CS_Skin_Names[id].assign(name); CS_Skin_Names[id].assign(name.mPtr);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Int32 GetSkinID(CCStr name) Int32 GetSkinID(StackStrF & name)
{ {
// Clone the string into an editable version // Clone the string into an editable version
String str(name); String str(name.mPtr, name.mLen);
// Strip non alphanumeric characters from the name // Strip non alphanumeric characters from the name
str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end());
// Convert the string to lowercase // Convert the string to lowercase

View File

@ -15,12 +15,12 @@ CCStr GetSkinName(Uint32 id);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Modify the name associated with a skin model identifier. * Modify the name associated with a skin model identifier.
*/ */
void SetSkinName(Uint32 id, CCStr name); void SetSkinName(Uint32 id, StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Convert a vehicle model name to a skin model identifier. * Convert a vehicle model name to a skin model identifier.
*/ */
Int32 GetSkinID(CCStr name); Int32 GetSkinID(StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* See whether the specified skin model identifier is valid. * See whether the specified skin model identifier is valid.

View File

@ -154,20 +154,20 @@ void Register_Misc(HSQUIRRELVM vm)
.Func(_SC("GetKeyCodeName"), &GetKeyCodeName) .Func(_SC("GetKeyCodeName"), &GetKeyCodeName)
.FmtFunc(_SC("SetKeyCodeName"), &SetKeyCodeName) .FmtFunc(_SC("SetKeyCodeName"), &SetKeyCodeName)
.Func(_SC("GetModelName"), &GetModelName) .Func(_SC("GetModelName"), &GetModelName)
.Func(_SC("SetModelName"), &SetModelName) .FmtFunc(_SC("SetModelName"), &SetModelName)
.Func(_SC("IsModelWeapon"), &IsModelWeapon) .Func(_SC("IsModelWeapon"), &IsModelWeapon)
.Func(_SC("IsModelActuallyWeapon"), &IsModelActuallyWeapon) .Func(_SC("IsModelActuallyWeapon"), &IsModelActuallyWeapon)
.Func(_SC("GetSkinName"), &GetSkinName) .Func(_SC("GetSkinName"), &GetSkinName)
.Func(_SC("SetSkinName"), &SetSkinName) .FmtFunc(_SC("SetSkinName"), &SetSkinName)
.Func(_SC("GetSkinID"), &GetSkinID) .FmtFunc(_SC("GetSkinID"), &GetSkinID)
.Func(_SC("IsSkinValid"), &IsSkinValid) .Func(_SC("IsSkinValid"), &IsSkinValid)
.Func(_SC("GetAutomobileName"), &GetAutomobileName) .Func(_SC("GetAutomobileName"), &GetAutomobileName)
.Func(_SC("SetAutomobileName"), &SetAutomobileName) .FmtFunc(_SC("SetAutomobileName"), &SetAutomobileName)
.Func(_SC("GetAutomobileID"), &GetAutomobileID) .FmtFunc(_SC("GetAutomobileID"), &GetAutomobileID)
.Func(_SC("IsAutomobileValid"), &IsAutomobileValid) .Func(_SC("IsAutomobileValid"), &IsAutomobileValid)
.Func(_SC("GetWeaponName"), &GetWeaponName) .Func(_SC("GetWeaponName"), &GetWeaponName)
.Func(_SC("SetWeaponName"), &SetWeaponName) .FmtFunc(_SC("SetWeaponName"), &SetWeaponName)
.Func(_SC("GetWeaponID"), &GetWeaponID) .FmtFunc(_SC("GetWeaponID"), &GetWeaponID)
.Func(_SC("IsWeaponValid"), &IsWeaponValid) .Func(_SC("IsWeaponValid"), &IsWeaponValid)
.Func(_SC("WeaponToModel"), &WeaponToModel) .Func(_SC("WeaponToModel"), &WeaponToModel)
.Func(_SC("IsWeaponNatural"), &IsWeaponNatural) .Func(_SC("IsWeaponNatural"), &IsWeaponNatural)

View File

@ -74,19 +74,19 @@ CSStr GetAutomobileName(Uint32 id)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetAutomobileName(Uint32 id, CSStr name) void SetAutomobileName(Uint32 id, StackStrF & name)
{ {
if (id >= 130 || id <= 236) if (id >= 130 || id <= 236)
{ {
CS_Vehicle_Names[id-130].assign(name); CS_Vehicle_Names[id-130].assign(name.mPtr);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Int32 GetAutomobileID(CSStr name) Int32 GetAutomobileID(StackStrF & name)
{ {
// Clone the string into an editable version // Clone the string into an editable version
String str(name); String str(name.mPtr, name.mLen);
// Strip non alphanumeric characters from the name // Strip non alphanumeric characters from the name
str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end());
// Convert the string to lowercase // Convert the string to lowercase

View File

@ -15,12 +15,12 @@ CSStr GetAutomobileName(Uint32 id);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Modify the name associated with a vehicle model identifier. * Modify the name associated with a vehicle model identifier.
*/ */
void SetAutomobileName(Uint32 id, CSStr name); void SetAutomobileName(Uint32 id, StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Convert a vehicle model name to a vehicle model identifier. * Convert a vehicle model name to a vehicle model identifier.
*/ */
Int32 GetAutomobileID(CSStr name); Int32 GetAutomobileID(StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* See whether the specified vehicle model identifier is valid. * See whether the specified vehicle model identifier is valid.

View File

@ -56,19 +56,19 @@ CCStr GetWeaponName(Uint32 id)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void SetWeaponName(Uint32 id, CCStr name) void SetWeaponName(Uint32 id, StackStrF & name)
{ {
if (id <= 70) if (id <= 70)
{ {
CS_Weapon_Names[id].assign(name); CS_Weapon_Names[id].assign(name.mPtr);
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Int32 GetWeaponID(CCStr name) Int32 GetWeaponID(StackStrF & name)
{ {
// Clone the string into an editable version // Clone the string into an editable version
String str(name); String str(name.mPtr, name.mLen);
// Strip non alphanumeric characters from the name // Strip non alphanumeric characters from the name
str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end());
// Convert the string to lowercase // Convert the string to lowercase

View File

@ -15,12 +15,12 @@ CSStr GetWeaponName(Uint32 id);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Modify the name associated with a weapon identifier. * Modify the name associated with a weapon identifier.
*/ */
void SetWeaponName(Uint32 id, CSStr name); void SetWeaponName(Uint32 id, StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Convert a weapon name to a weapon identifier. * Convert a weapon name to a weapon identifier.
*/ */
Int32 GetWeaponID(CSStr name); Int32 GetWeaponID(StackStrF & name);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* See whether the specified weapon identifier is valid. * See whether the specified weapon identifier is valid.