diff --git a/source/Misc/Model.cpp b/source/Misc/Model.cpp index 70503342..513a999a 100644 --- a/source/Misc/Model.cpp +++ b/source/Misc/Model.cpp @@ -16,7 +16,7 @@ CSStr GetModelName(Int32 /*id*/) } // ------------------------------------------------------------------------------------------------ -void SetModelName(Int32 /*id*/, CSStr /*name*/) +void SetModelName(Int32 /*id*/, StackStrF & /*name*/) { // @TODO Implement... } diff --git a/source/Misc/Model.hpp b/source/Misc/Model.hpp index 9a55c5b1..7d893aab 100644 --- a/source/Misc/Model.hpp +++ b/source/Misc/Model.hpp @@ -15,7 +15,7 @@ CSStr GetModelName(Int32 id); /* ------------------------------------------------------------------------------------------------ * 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. diff --git a/source/Misc/Player.cpp b/source/Misc/Player.cpp index 7afa7dc1..7ef40788 100644 --- a/source/Misc/Player.cpp +++ b/source/Misc/Player.cpp @@ -102,19 +102,19 @@ CCStr GetSkinName(Uint32 id) } // ------------------------------------------------------------------------------------------------ -void SetSkinName(Uint32 id, CCStr name) +void SetSkinName(Uint32 id, StackStrF & name) { 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 - String str(name); + String str(name.mPtr, name.mLen); // Strip non alphanumeric characters from the name str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); // Convert the string to lowercase diff --git a/source/Misc/Player.hpp b/source/Misc/Player.hpp index 46de19c9..2b4226aa 100644 --- a/source/Misc/Player.hpp +++ b/source/Misc/Player.hpp @@ -15,12 +15,12 @@ CCStr GetSkinName(Uint32 id); /* ------------------------------------------------------------------------------------------------ * 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. */ -Int32 GetSkinID(CCStr name); +Int32 GetSkinID(StackStrF & name); /* ------------------------------------------------------------------------------------------------ * See whether the specified skin model identifier is valid. diff --git a/source/Misc/Register.cpp b/source/Misc/Register.cpp index 5d57a95e..f80e2ef5 100644 --- a/source/Misc/Register.cpp +++ b/source/Misc/Register.cpp @@ -154,20 +154,20 @@ void Register_Misc(HSQUIRRELVM vm) .Func(_SC("GetKeyCodeName"), &GetKeyCodeName) .FmtFunc(_SC("SetKeyCodeName"), &SetKeyCodeName) .Func(_SC("GetModelName"), &GetModelName) - .Func(_SC("SetModelName"), &SetModelName) + .FmtFunc(_SC("SetModelName"), &SetModelName) .Func(_SC("IsModelWeapon"), &IsModelWeapon) .Func(_SC("IsModelActuallyWeapon"), &IsModelActuallyWeapon) .Func(_SC("GetSkinName"), &GetSkinName) - .Func(_SC("SetSkinName"), &SetSkinName) - .Func(_SC("GetSkinID"), &GetSkinID) + .FmtFunc(_SC("SetSkinName"), &SetSkinName) + .FmtFunc(_SC("GetSkinID"), &GetSkinID) .Func(_SC("IsSkinValid"), &IsSkinValid) .Func(_SC("GetAutomobileName"), &GetAutomobileName) - .Func(_SC("SetAutomobileName"), &SetAutomobileName) - .Func(_SC("GetAutomobileID"), &GetAutomobileID) + .FmtFunc(_SC("SetAutomobileName"), &SetAutomobileName) + .FmtFunc(_SC("GetAutomobileID"), &GetAutomobileID) .Func(_SC("IsAutomobileValid"), &IsAutomobileValid) .Func(_SC("GetWeaponName"), &GetWeaponName) - .Func(_SC("SetWeaponName"), &SetWeaponName) - .Func(_SC("GetWeaponID"), &GetWeaponID) + .FmtFunc(_SC("SetWeaponName"), &SetWeaponName) + .FmtFunc(_SC("GetWeaponID"), &GetWeaponID) .Func(_SC("IsWeaponValid"), &IsWeaponValid) .Func(_SC("WeaponToModel"), &WeaponToModel) .Func(_SC("IsWeaponNatural"), &IsWeaponNatural) diff --git a/source/Misc/Vehicle.cpp b/source/Misc/Vehicle.cpp index c0cf58df..c111ac81 100644 --- a/source/Misc/Vehicle.cpp +++ b/source/Misc/Vehicle.cpp @@ -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) { - 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 - String str(name); + String str(name.mPtr, name.mLen); // Strip non alphanumeric characters from the name str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); // Convert the string to lowercase diff --git a/source/Misc/Vehicle.hpp b/source/Misc/Vehicle.hpp index cdc8195c..09d3ea0a 100644 --- a/source/Misc/Vehicle.hpp +++ b/source/Misc/Vehicle.hpp @@ -15,12 +15,12 @@ CSStr GetAutomobileName(Uint32 id); /* ------------------------------------------------------------------------------------------------ * 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. */ -Int32 GetAutomobileID(CSStr name); +Int32 GetAutomobileID(StackStrF & name); /* ------------------------------------------------------------------------------------------------ * See whether the specified vehicle model identifier is valid. diff --git a/source/Misc/Weapon.cpp b/source/Misc/Weapon.cpp index b4db3d08..9694b875 100644 --- a/source/Misc/Weapon.cpp +++ b/source/Misc/Weapon.cpp @@ -56,19 +56,19 @@ CCStr GetWeaponName(Uint32 id) } // ------------------------------------------------------------------------------------------------ -void SetWeaponName(Uint32 id, CCStr name) +void SetWeaponName(Uint32 id, StackStrF & name) { 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 - String str(name); + String str(name.mPtr, name.mLen); // Strip non alphanumeric characters from the name str.erase(std::remove_if(str.begin(), str.end(), std::not1(std::ptr_fun(::isalnum))), str.end()); // Convert the string to lowercase diff --git a/source/Misc/Weapon.hpp b/source/Misc/Weapon.hpp index a1241bc8..754e22f8 100644 --- a/source/Misc/Weapon.hpp +++ b/source/Misc/Weapon.hpp @@ -15,12 +15,12 @@ CSStr GetWeaponName(Uint32 id); /* ------------------------------------------------------------------------------------------------ * 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. */ -Int32 GetWeaponID(CSStr name); +Int32 GetWeaponID(StackStrF & name); /* ------------------------------------------------------------------------------------------------ * See whether the specified weapon identifier is valid.