mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 07:07:13 +02:00
Move away from C format to cpp::fmt.
This commit is contained in:
@ -140,7 +140,7 @@ Object & Controller::Attach(Object && obj, Listener * ptr)
|
||||
if (cmd.mHash == hash)
|
||||
{
|
||||
// Include information necessary to help identify hash collisions!
|
||||
STHROWF("Command '%s' already exists as '%s' for hash (%zu)",
|
||||
STHROWF("Command '{}' already exists as '{}' for hash ({})",
|
||||
name.c_str(), cmd.mName.c_str(), hash);
|
||||
}
|
||||
}
|
||||
@ -916,7 +916,7 @@ void Listener::ProcSpec(const SQChar * str)
|
||||
{
|
||||
if (idx >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Extraneous type specifiers: %d >= %d", idx, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Extraneous type specifiers: {} >= {}", idx, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
// Move to the next character
|
||||
++str;
|
||||
@ -1005,7 +1005,7 @@ void Listener::ProcSpec(const SQChar * str)
|
||||
}
|
||||
} break;
|
||||
// Unknown type!
|
||||
default: STHROWF("Unknown type specifier (%c) at argument: %u", *str, idx);
|
||||
default: STHROWF("Unknown type specifier ({:c}) at argument: {}", *str, idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1529,7 +1529,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
STHROWF("Argument tag (%u) is out of range (%d)", max, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument tag ({}) is out of range ({})", max, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1669,11 +1669,11 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (val >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%d) is out of total range (%d)", val, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", val, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
else if (static_cast< uint8_t >(val) > m_MaxArgc)
|
||||
{
|
||||
STHROWF("Minimum argument (%d) exceeds maximum (%u)", val, m_MaxArgc);
|
||||
STHROWF("Minimum argument ({}) exceeds maximum ({})", val, m_MaxArgc);
|
||||
}
|
||||
// Apply the specified value
|
||||
m_MinArgc = static_cast< uint8_t >(val);
|
||||
@ -1697,11 +1697,11 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (val >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%d) is out of total range (%d)", val, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", val, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
else if (static_cast< uint8_t >(val) < m_MinArgc)
|
||||
{
|
||||
STHROWF("Maximum argument (%d) exceeds minimum (%u)", val, m_MinArgc);
|
||||
STHROWF("Maximum argument ({}) exceeds minimum ({})", val, m_MinArgc);
|
||||
}
|
||||
// Apply the specified value
|
||||
m_MaxArgc = static_cast< uint8_t >(val);
|
||||
@ -1779,7 +1779,7 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (arg >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
// Return the requested information
|
||||
return m_ArgTags[arg];
|
||||
@ -1793,7 +1793,7 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (arg >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
else if ((SQ_FAILED(name.Proc())))
|
||||
{
|
||||
@ -1819,7 +1819,7 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (idx >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%u) is out of total range (%u)", idx, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", idx, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
// Return the requested information
|
||||
return m_ArgSpec[idx];
|
||||
@ -1833,7 +1833,7 @@ public:
|
||||
// Perform a range check on the specified argument index
|
||||
if (arg >= SQMOD_MAX_CMD_ARGS)
|
||||
{
|
||||
STHROWF("Argument (%u) is out of total range (%u)", arg, SQMOD_MAX_CMD_ARGS);
|
||||
STHROWF("Argument ({}) is out of total range ({})", arg, SQMOD_MAX_CMD_ARGS);
|
||||
}
|
||||
// Retrieve the argument flags
|
||||
const uint8_t f = m_ArgSpec[arg];
|
||||
|
@ -133,7 +133,7 @@ void SqThrowLastF(const SQChar * msg, ...)
|
||||
if(error_num == 0)
|
||||
{
|
||||
// Invoker is responsible for making sure this doesn't happen!
|
||||
SqThrowF("%s [Unknown error]", b.Data());
|
||||
SqThrowF("{} [Unknown error]", b.Data());
|
||||
}
|
||||
// The resulted message buffer
|
||||
LPSTR msg_buff = nullptr;
|
||||
@ -147,9 +147,9 @@ void SqThrowLastF(const SQChar * msg, ...)
|
||||
//Free the message buffer
|
||||
LocalFree(msg_buff);
|
||||
// Now it's safe to throw the error
|
||||
SqThrowF("%s [%s]", b.Data(), message.c_str());
|
||||
SqThrowF("{} [{}]", b.Data(), message);
|
||||
#else
|
||||
SqThrowF("%s [%s]", b.Data(), std::strerror(errno));
|
||||
SqThrowF("{} [{}]", b.Data(), std::strerror(errno));
|
||||
#endif // SQMOD_OS_WINDOWS
|
||||
}
|
||||
|
||||
@ -266,7 +266,7 @@ LightObj BufferToStrObj(const Buffer & b, uint32_t size)
|
||||
// Perform a range check on the specified buffer
|
||||
if (size > b.Capacity())
|
||||
{
|
||||
STHROWF("The specified buffer size is out of range: %u >= %u", size, b.Capacity());
|
||||
STHROWF("The specified buffer size is out of range: {} >= {}", size, b.Capacity());
|
||||
}
|
||||
// Obtain the initial stack size
|
||||
const StackGuard sg(SqVM());
|
||||
|
@ -1384,14 +1384,14 @@ void Core::EmitEntityPool(vcmpEntityPool entity_type, int32_t entity_id, bool is
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_BLIP_POOL))
|
||||
{
|
||||
STHROWF("Cannot allocate blip with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot allocate blip with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Retrieve the specified entity instance
|
||||
BlipInst & inst = m_Blips[entity_id];
|
||||
// Make sure that the instance isn't already allocated
|
||||
if (VALID_ENTITY(inst.mID))
|
||||
{
|
||||
STHROWF("Cannot allocate blip that already exists: %d", entity_id);
|
||||
STHROWF("Cannot allocate blip that already exists: {}", entity_id);
|
||||
}
|
||||
// Information about the blip entity
|
||||
int32_t world, scale, sprid;
|
||||
@ -1436,7 +1436,7 @@ void Core::EmitPlayerUpdate(int32_t player_id, vcmpPlayerUpdate update_type)
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(player_id, SQMOD_PLAYER_POOL))
|
||||
{
|
||||
STHROWF("Cannot update player with invalid identifier: %d", player_id);
|
||||
STHROWF("Cannot update player with invalid identifier: {}", player_id);
|
||||
}
|
||||
// Retrieve the associated tracking instance
|
||||
PlayerInst & inst = m_Players[player_id];
|
||||
@ -1631,7 +1631,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(player_id, SQMOD_PLAYER_POOL))
|
||||
{
|
||||
STHROWF("Cannot notify player with invalid identifier about streaming: %d", player_id);
|
||||
STHROWF("Cannot notify player with invalid identifier about streaming: {}", player_id);
|
||||
}
|
||||
// See what type of entity changed
|
||||
switch (entity_type)
|
||||
@ -1640,7 +1640,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_VEHICLE_POOL))
|
||||
{
|
||||
STHROWF("Cannot stream vehicle with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot stream vehicle with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Forward the event to the dedicated handler
|
||||
EmitVehicleStream(player_id, entity_id, is_deleted);
|
||||
@ -1649,7 +1649,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_OBJECT_POOL))
|
||||
{
|
||||
STHROWF("Cannot stream object with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot stream object with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Forward the event to the dedicated handler
|
||||
EmitObjectStream(player_id, entity_id, is_deleted);
|
||||
@ -1658,7 +1658,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_PICKUP_POOL))
|
||||
{
|
||||
STHROWF("Cannot stream pickup with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot stream pickup with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Forward the event to the dedicated handler
|
||||
EmitPickupStream(player_id, entity_id, is_deleted);
|
||||
@ -1667,7 +1667,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_PLAYER_POOL))
|
||||
{
|
||||
STHROWF("Cannot stream player with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot stream player with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Forward the event to the dedicated handler
|
||||
EmitPlayerStream(player_id, entity_id, is_deleted);
|
||||
@ -1676,7 +1676,7 @@ void Core::EmitEntityStreaming(int32_t player_id, int32_t entity_id, vcmpEntityP
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(entity_id, SQMOD_CHECKPOINT_POOL))
|
||||
{
|
||||
STHROWF("Cannot stream checkpoint with invalid identifier: %d", entity_id);
|
||||
STHROWF("Cannot stream checkpoint with invalid identifier: {}", entity_id);
|
||||
}
|
||||
// Forward the event to the dedicated handler
|
||||
EmitCheckpointStream(player_id, entity_id, is_deleted);
|
||||
@ -1694,7 +1694,7 @@ void Core::EmitVehicleUpdate(int32_t vehicle_id, vcmpVehicleUpdate update_type)
|
||||
// Make sure that the specified entity identifier is valid
|
||||
if (INVALID_ENTITYEX(vehicle_id, SQMOD_VEHICLE_POOL))
|
||||
{
|
||||
STHROWF("Cannot update vehicle with invalid identifier: %d", vehicle_id);
|
||||
STHROWF("Cannot update vehicle with invalid identifier: {}", vehicle_id);
|
||||
}
|
||||
// Retrieve the associated instance
|
||||
VehicleInst & inst = m_Vehicles[vehicle_id];
|
||||
@ -1850,7 +1850,7 @@ void Core::EmitClientScriptData(int32_t player_id, const uint8_t * data, size_t
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
STHROWF("%s", e.what()); // Re-package
|
||||
STHROWF("{}", e.what()); // Re-package
|
||||
}
|
||||
// Make sure the buffer cannot be null at this point
|
||||
if (o.IsNull())
|
||||
|
@ -328,7 +328,7 @@ public:
|
||||
}
|
||||
}
|
||||
// Unable to find such routine
|
||||
STHROWF("Unable to find a routine with tag (%s)", tag.mPtr);
|
||||
STHROWF("Unable to find a routine with tag ({})", tag.mPtr);
|
||||
// Should not reach this point but if it did, we have to return something
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
@ -470,7 +470,7 @@ public:
|
||||
// Validate the specified
|
||||
if (!sq_isclosure(func.GetFunc()) && !sq_isnativeclosure(func.GetFunc()))
|
||||
{
|
||||
STHROWF("Invalid callback type %s", SqTypeName(GetValid().mFunc.GetType()));
|
||||
STHROWF("Invalid callback type {}", SqTypeName(GetValid().mFunc.GetType()));
|
||||
}
|
||||
// Store the function without the environment
|
||||
GetValid().mFunc = LightObj(func.GetFunc());
|
||||
@ -644,7 +644,7 @@ public:
|
||||
// Validate the specified index
|
||||
if (idx >= 14)
|
||||
{
|
||||
STHROWF("The specified index is out of range: %u >= %u", idx, 14);
|
||||
STHROWF("The specified index is out of range: {} >= {}", idx, 14);
|
||||
}
|
||||
// Return the requested argument
|
||||
return GetValid().mArgv[idx];
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
{
|
||||
if (!mFile)
|
||||
{
|
||||
STHROWF("Unable to open script source (%s)", path);
|
||||
STHROWF("Unable to open script source ({})", path);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1621,7 +1621,7 @@ const LightObj & Signal::Fetch(StackStrF & name)
|
||||
}
|
||||
}
|
||||
// No such signal exists
|
||||
STHROWF("Unknown signal named (%s)", sname.c_str());
|
||||
STHROWF("Unknown signal named ({})", sname);
|
||||
// SHOULD NOT REACH THIS POINT!
|
||||
static LightObj slo;
|
||||
return slo;
|
||||
|
@ -459,7 +459,7 @@ const Tasks::Task & Tasks::FindByTag(int32_t id, int32_t type, StackStrF & tag)
|
||||
}
|
||||
}
|
||||
// Unable to find such task
|
||||
STHROWF("Unable to find a task with tag (%s)", tag.mPtr);
|
||||
STHROWF("Unable to find a task with tag ({})", tag.mPtr);
|
||||
// Should not reach this point but if it did, we have to return something
|
||||
SQ_UNREACHABLE
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ private:
|
||||
// Validate the specified
|
||||
if (!sq_isclosure(func.GetFunc()) && !sq_isnativeclosure(func.GetFunc()))
|
||||
{
|
||||
STHROWF("Invalid callback type %s", SqTypeName(mFunc.GetType()));
|
||||
STHROWF("Invalid callback type {}", SqTypeName(mFunc.GetType()));
|
||||
}
|
||||
// Grab the virtual machine once
|
||||
HSQUIRRELVM vm = SqVM();
|
||||
@ -257,7 +257,7 @@ private:
|
||||
// Validate the specified index
|
||||
if (idx >= argvn)
|
||||
{
|
||||
STHROWF("The specified index is out of range: %u >= %u", idx, argvn);
|
||||
STHROWF("The specified index is out of range: {} >= {}", idx, argvn);
|
||||
}
|
||||
// Return the requested argument
|
||||
return mArgv[idx];
|
||||
|
Reference in New Issue
Block a user