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

Update all existing code to always receive StackStrF as a const reference.

This commit is contained in:
Sandu Liviu Catalin 2016-11-16 15:10:33 +02:00
parent 64a2957129
commit 5f8c2f6cc5
29 changed files with 78 additions and 78 deletions

View File

@ -888,7 +888,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Run a command under a specific invoker.
*/
Int32 Run(Object & invoker, StackStrF & command)
Int32 Run(Object & invoker, const StackStrF & command)
{
return GetValid()->Run(Guard(m_Controller, invoker), command.mPtr);
}
@ -920,7 +920,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Locate and retrieve a command listener by name.
*/
const Object & FindByName(StackStrF & name)
const Object & FindByName(const StackStrF & name)
{
// Validate the specified name
if (name.mLen <= 0)
@ -1229,7 +1229,7 @@ public:
m_ArgSpec[n] = CMDARG_ANY;
}
// Apply the specified argument rules/specifications
SetSpec(const_cast< StackStrF & >(spec)); // guaranteed the value will not be modified!
SetSpec(spec); // guaranteed the value will not be modified!
// Extract the specified argument tags
SetArgTags(tags);
// Set the specified minimum and maximum allowed arguments
@ -1416,7 +1416,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Retrieve the name that triggers this command listener instance.
*/
void SetName(StackStrF & name)
void SetName(const StackStrF & name)
{
// Validate the specified name
ValidateName(name.mPtr);
@ -1464,7 +1464,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the argument specification string.
*/
void SetSpec(StackStrF & spec)
void SetSpec(const StackStrF & spec)
{
// Attempt to process the specified string
ProcSpec(spec.mPtr);
@ -1543,7 +1543,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the help message associated with this command listener instance.
*/
void SetHelp(StackStrF & help)
void SetHelp(const StackStrF & help)
{
if (help.mLen > 0)
{
@ -1566,7 +1566,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the informational message associated with this command listener instance.
*/
void SetInfo(StackStrF & info)
void SetInfo(const StackStrF & info)
{
if (info.mLen > 0)
{
@ -1831,7 +1831,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the tag of a certain argument.
*/
void SetArgTag(Uint32 arg, StackStrF & name)
void SetArgTag(Uint32 arg, const StackStrF & name)
{
// Perform a range check on the specified argument index
if (arg >= SQMOD_MAX_CMD_ARGS)

View File

@ -64,7 +64,7 @@ void CBlip::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CBlip & CBlip::ApplyTag(StackStrF & tag)
CBlip & CBlip::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -124,7 +124,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CBlip & ApplyTag(StackStrF & tag);
CBlip & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -77,7 +77,7 @@ void CCheckpoint::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CCheckpoint & CCheckpoint::ApplyTag(StackStrF & tag)
CCheckpoint & CCheckpoint::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -145,7 +145,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CCheckpoint & ApplyTag(StackStrF & tag);
CCheckpoint & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -64,7 +64,7 @@ void CKeybind::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CKeybind & CKeybind::ApplyTag(StackStrF & tag)
CKeybind & CKeybind::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -124,7 +124,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CKeybind & ApplyTag(StackStrF & tag);
CKeybind & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -77,7 +77,7 @@ void CObject::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CObject & CObject::ApplyTag(StackStrF & tag)
CObject & CObject::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -161,7 +161,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CObject & ApplyTag(StackStrF & tag);
CObject & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -69,7 +69,7 @@ void CPickup::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CPickup & CPickup::ApplyTag(StackStrF & tag)
CPickup & CPickup::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -143,7 +143,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CPickup & ApplyTag(StackStrF & tag);
CPickup & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -99,7 +99,7 @@ void CPlayer::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CPlayer & CPlayer::ApplyTag(StackStrF & tag)
CPlayer & CPlayer::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;
@ -331,7 +331,7 @@ CSStr CPlayer::GetName() const
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetName(StackStrF & name) const
void CPlayer::SetName(const StackStrF & name) const
{
// Validate the managed identifier
Validate();
@ -1469,7 +1469,7 @@ const String & CPlayer::GetMessagePrefix(Uint32 index) const
}
// ------------------------------------------------------------------------------------------------
void CPlayer::SetMessagePrefix(Uint32 index, StackStrF & prefix)
void CPlayer::SetMessagePrefix(Uint32 index, const StackStrF & prefix)
{
// Perform a range check on the specified prefix index
if (index >= SQMOD_PLAYER_MSG_PREFIXES)
@ -1646,7 +1646,7 @@ void CPlayer::StreamFloat(SQFloat val)
}
// ------------------------------------------------------------------------------------------------
void CPlayer::StreamString(StackStrF & val)
void CPlayer::StreamString(const StackStrF & val)
{
// Validate the managed identifier
Validate();
@ -1660,7 +1660,7 @@ void CPlayer::StreamString(StackStrF & val)
}
// ------------------------------------------------------------------------------------------------
void CPlayer::StreamRawString(StackStrF & val)
void CPlayer::StreamRawString(const StackStrF & val)
{
// Validate the managed identifier
Validate();

View File

@ -212,7 +212,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CPlayer & ApplyTag(StackStrF & tag);
CPlayer & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.
@ -302,7 +302,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the nick name of the managed player entity.
*/
void SetName(StackStrF & name) const;
void SetName(const StackStrF & name) const;
/* --------------------------------------------------------------------------------------------
* Retrieve the current state of the managed player entity.
@ -783,7 +783,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the message prefix at the specified index for the managed player entity.
*/
void SetMessagePrefix(Uint32 index, StackStrF & prefix);
void SetMessagePrefix(Uint32 index, const StackStrF & prefix);
/* --------------------------------------------------------------------------------------------
* Retrieve the amount of tracked position changes for the managed player entity.
@ -878,12 +878,12 @@ public:
/* --------------------------------------------------------------------------------------------
* Write a string to the stream buffer.
*/
void StreamString(StackStrF & val);
void StreamString(const StackStrF & val);
/* --------------------------------------------------------------------------------------------
* Write a raw string to the stream buffer.
*/
void StreamRawString(StackStrF & val);
void StreamRawString(const StackStrF & val);
/* --------------------------------------------------------------------------------------------
* Send the data in the stream buffer to the client.

View File

@ -73,7 +73,7 @@ void CVehicle::SetTag(const StackStrF & tag)
}
// ------------------------------------------------------------------------------------------------
CVehicle & CVehicle::ApplyTag(StackStrF & tag)
CVehicle & CVehicle::ApplyTag(const StackStrF & tag)
{
SetTag(tag);
return *this;

View File

@ -149,7 +149,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag.
*/
CVehicle & ApplyTag(StackStrF & tag);
CVehicle & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Retrieve the associated user data.

View File

@ -108,7 +108,7 @@ CSStr GetKeyCodeName(Uint8 keycode)
}
// ------------------------------------------------------------------------------------------------
void SetKeyCodeName(Uint8 keycode, StackStrF & name)
void SetKeyCodeName(Uint8 keycode, const StackStrF & name)
{
CS_Keycode_Names[keycode].assign(name.mPtr);
}
@ -162,13 +162,13 @@ Table GetPluginInfo(Int32 plugin_id)
}
// ------------------------------------------------------------------------------------------------
Int32 FindPlugin(StackStrF & name)
Int32 FindPlugin(const StackStrF & name)
{
return _Func->FindPlugin(name.mPtr);
}
// ------------------------------------------------------------------------------------------------
void SendPluginCommand(Uint32 identifier, StackStrF & payload)
void SendPluginCommand(Uint32 identifier, const StackStrF & payload)
{
_Func->SendPluginCommand(identifier, payload.mPtr);
}
@ -180,7 +180,7 @@ const ULongInt & GetTime()
}
// ------------------------------------------------------------------------------------------------
void SendLogMessage(StackStrF & msg)
void SendLogMessage(const StackStrF & msg)
{
if (_Func->LogMessage("%s", msg.mPtr) == vcmpErrorTooLargeInput)
{
@ -267,7 +267,7 @@ CSStr GetServerName()
}
// ------------------------------------------------------------------------------------------------
void SetServerName(StackStrF & name)
void SetServerName(const StackStrF & name)
{
_Func->SetServerName(name.mPtr);
}
@ -285,7 +285,7 @@ CSStr GetServerPassword()
}
// ------------------------------------------------------------------------------------------------
void SetServerPassword(StackStrF & passwd)
void SetServerPassword(const StackStrF & passwd)
{
_Func->SetServerPassword(passwd.mPtr);
}
@ -303,13 +303,13 @@ CSStr GetGameModeText()
}
// ------------------------------------------------------------------------------------------------
void SetGameModeText(StackStrF & text)
void SetGameModeText(const StackStrF & text)
{
_Func->SetGameModeText(text.mPtr);
}
// ------------------------------------------------------------------------------------------------
void CreateRadioStream(bool listed, const StackStrF & name, StackStrF & url)
void CreateRadioStream(bool listed, const StackStrF & name, const StackStrF & url)
{
if (_Func->AddRadioStream(-1, name.mPtr, url.mPtr, listed) == vcmpErrorArgumentOutOfBounds)
{
@ -318,7 +318,7 @@ void CreateRadioStream(bool listed, const StackStrF & name, StackStrF & url)
}
// ------------------------------------------------------------------------------------------------
void CreateRadioStreamEx(Int32 id, bool listed, const StackStrF & name, StackStrF & url)
void CreateRadioStreamEx(Int32 id, bool listed, const StackStrF & name, const StackStrF & url)
{
if (_Func->AddRadioStream(id, name.mPtr, url.mPtr, listed) == vcmpErrorArgumentOutOfBounds)
{
@ -744,25 +744,25 @@ void SetSpawnCameraLookAtEx(Float32 x, Float32 y, Float32 z)
}
// ------------------------------------------------------------------------------------------------
void BanIP(StackStrF & addr)
void BanIP(const StackStrF & addr)
{
_Func->BanIP(const_cast< SStr >(addr.mPtr));
}
// ------------------------------------------------------------------------------------------------
bool UnbanIP(StackStrF & addr)
bool UnbanIP(const StackStrF & addr)
{
return _Func->UnbanIP(const_cast< SStr >(addr.mPtr));
}
// ------------------------------------------------------------------------------------------------
bool IsIPBanned(StackStrF & addr)
bool IsIPBanned(const StackStrF & addr)
{
return _Func->IsIPBanned(const_cast< SStr >(addr.mPtr));
}
// ------------------------------------------------------------------------------------------------
Int32 GetPlayerIdFromName(StackStrF & name)
Int32 GetPlayerIdFromName(const StackStrF & name)
{
return _Func->GetPlayerIdFromName(name.mPtr);
}

View File

@ -15,7 +15,7 @@ CSStr GetKeyCodeName(Uint8 keycode);
/* ------------------------------------------------------------------------------------------------
* Modify the name of a certain key-code.
*/
void SetKeyCodeName(Uint8 keycode, StackStrF & name);
void SetKeyCodeName(Uint8 keycode, const StackStrF & name);
/* ------------------------------------------------------------------------------------------------
* Retrieve the server version.
@ -40,12 +40,12 @@ Table GetPluginInfo(Int32 plugin_id);
/* ------------------------------------------------------------------------------------------------
* Attempt to find a plug-in identifier by it's name.
*/
Int32 FindPlugin(StackStrF & name);
Int32 FindPlugin(const StackStrF & name);
/* ------------------------------------------------------------------------------------------------
* Send a custom command to the loaded plug-ins.
*/
void SendPluginCommand(Uint32 identifier, StackStrF & payload);
void SendPluginCommand(Uint32 identifier, const StackStrF & payload);
/* ------------------------------------------------------------------------------------------------
* Retrieve the server time.
@ -55,7 +55,7 @@ const ULongInt & GetTime();
/* ------------------------------------------------------------------------------------------------
* Send a log message to the server.
*/
void SendLogMessage(StackStrF & msg);
void SendLogMessage(const StackStrF & msg);
/* ------------------------------------------------------------------------------------------------
* Retrieve the last error that occurred on the server.
@ -115,7 +115,7 @@ CSStr GetServerName();
/* ------------------------------------------------------------------------------------------------
* Modify the server name.
*/
void SetServerName(StackStrF & name);
void SetServerName(const StackStrF & name);
/* ------------------------------------------------------------------------------------------------
* Retrieve the server password.
@ -125,7 +125,7 @@ CSStr GetServerPassword();
/* ------------------------------------------------------------------------------------------------
* Modify the server password.
*/
void SetServerPassword(StackStrF & passwd);
void SetServerPassword(const StackStrF & passwd);
/* ------------------------------------------------------------------------------------------------
* Retrieve the game-mode text.
@ -135,17 +135,17 @@ CSStr GetGameModeText();
/* ------------------------------------------------------------------------------------------------
* Modify the game-mode text.
*/
void SetGameModeText(StackStrF & text);
void SetGameModeText(const StackStrF & text);
/* ------------------------------------------------------------------------------------------------
* Create a radio stream.
*/
void CreateRadioStream(bool listed, const StackStrF & name, StackStrF & url);
void CreateRadioStream(bool listed, const StackStrF & name, const StackStrF & url);
/* ------------------------------------------------------------------------------------------------
* Create a radio stream.
*/
void CreateRadioStreamEx(Int32 id, bool listed, const StackStrF & name, StackStrF & url);
void CreateRadioStreamEx(Int32 id, bool listed, const StackStrF & name, const StackStrF & url);
/* ------------------------------------------------------------------------------------------------
* Remove a radio stream.
@ -422,22 +422,22 @@ void SetSpawnCameraLookAtEx(Float32 x, Float32 y, Float32 z);
/* ------------------------------------------------------------------------------------------------
* Ban an IP address from the server.
*/
void BanIP(StackStrF & addr);
void BanIP(const StackStrF & addr);
/* ------------------------------------------------------------------------------------------------
* Unban an IP address from the server.
*/
bool UnbanIP(StackStrF & addr);
bool UnbanIP(const StackStrF & addr);
/* ------------------------------------------------------------------------------------------------
* See if an IP address is banned from the server.
*/
bool IsIPBanned(StackStrF & addr);
bool IsIPBanned(const StackStrF & addr);
/* ------------------------------------------------------------------------------------------------
* Retrieve the identifier of the player with the specified name.
*/
Int32 GetPlayerIdFromName(StackStrF & name);
Int32 GetPlayerIdFromName(const StackStrF & name);
/* ------------------------------------------------------------------------------------------------
* See if a player with the specified identifier is connected.

View File

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

View File

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

View File

@ -102,7 +102,7 @@ CCStr GetSkinName(Uint32 id)
}
// ------------------------------------------------------------------------------------------------
void SetSkinName(Uint32 id, StackStrF & name)
void SetSkinName(Uint32 id, const StackStrF & name)
{
if (id <= 159)
{
@ -111,7 +111,7 @@ void SetSkinName(Uint32 id, StackStrF & name)
}
// ------------------------------------------------------------------------------------------------
Int32 GetSkinID(StackStrF & name)
Int32 GetSkinID(const StackStrF & name)
{
// Clone the string into an editable version
String str(name.mPtr, name.mLen);

View File

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

View File

@ -56,7 +56,7 @@ Object Signal::CreateFree()
}
// ------------------------------------------------------------------------------------------------
Object Signal::Create(StackStrF & name)
Object Signal::Create(const StackStrF & name)
{
// Validate the signal name
if (name.mLen <= 0)
@ -92,7 +92,7 @@ Object Signal::Create(StackStrF & name)
}
// ------------------------------------------------------------------------------------------------
void Signal::Remove(StackStrF & name)
void Signal::Remove(const StackStrF & name)
{
// Validate the signal name
if (name.mLen <= 0)
@ -126,7 +126,7 @@ void Signal::Remove(StackStrF & name)
}
// ------------------------------------------------------------------------------------------------
Object Signal::Fetch(StackStrF & name)
Object Signal::Fetch(const StackStrF & name)
{
// Validate the signal name
if (name.mLen <= 0)

View File

@ -521,17 +521,17 @@ public:
/* --------------------------------------------------------------------------------------------
* Create a new signal with the specified name.
*/
static Object Create(StackStrF & name);
static Object Create(const StackStrF & name);
/* --------------------------------------------------------------------------------------------
* Remove the signal with the specified name.
*/
static void Remove(StackStrF & name);
static void Remove(const StackStrF & name);
/* --------------------------------------------------------------------------------------------
* Retrieve the signal with the specified name.
*/
static Object Fetch(StackStrF & name);
static Object Fetch(const StackStrF & name);
};
} // Namespace:: SqMod

View File

@ -74,7 +74,7 @@ CSStr GetAutomobileName(Uint32 id)
}
// ------------------------------------------------------------------------------------------------
void SetAutomobileName(Uint32 id, StackStrF & name)
void SetAutomobileName(Uint32 id, const StackStrF & name)
{
if (id >= 130 || id <= 236)
{
@ -83,7 +83,7 @@ void SetAutomobileName(Uint32 id, StackStrF & name)
}
// ------------------------------------------------------------------------------------------------
Int32 GetAutomobileID(StackStrF & name)
Int32 GetAutomobileID(const StackStrF & name)
{
// Clone the string into an editable version
String str(name.mPtr, name.mLen);

View File

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

View File

@ -56,7 +56,7 @@ CCStr GetWeaponName(Uint32 id)
}
// ------------------------------------------------------------------------------------------------
void SetWeaponName(Uint32 id, StackStrF & name)
void SetWeaponName(Uint32 id, const StackStrF & name)
{
if (id <= 70)
{
@ -65,7 +65,7 @@ void SetWeaponName(Uint32 id, StackStrF & name)
}
// ------------------------------------------------------------------------------------------------
Int32 GetWeaponID(StackStrF & name)
Int32 GetWeaponID(const StackStrF & name)
{
// Clone the string into an editable version
String str(name.mPtr, name.mLen);

View File

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

View File

@ -635,7 +635,7 @@ void Routine::SetData(Object & data)
}
// ------------------------------------------------------------------------------------------------
Routine & Routine::ApplyTag(StackStrF & tag)
Routine & Routine::ApplyTag(const StackStrF & tag)
{
if (tag.mLen)
{

View File

@ -332,7 +332,7 @@ public:
/* --------------------------------------------------------------------------------------------
* Modify the associated user tag and allow chaining of operations.
*/
Routine & ApplyTag(StackStrF & tag);
Routine & ApplyTag(const StackStrF & tag);
/* --------------------------------------------------------------------------------------------
* Modify the associated user data and allow chaining of operations.