mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Code cleanup. Most of it via linting.
This commit is contained in:
parent
e92f99c55e
commit
a557805090
@ -282,10 +282,13 @@ private:
|
|||||||
{
|
{
|
||||||
ThrowMemExcept("Attempting to push invalid node");
|
ThrowMemExcept("Attempting to push invalid node");
|
||||||
}
|
}
|
||||||
// Demote the current head node
|
else
|
||||||
node->mNext = s_Nodes;
|
{
|
||||||
// Promote as the head node
|
// Demote the current head node
|
||||||
s_Nodes = node;
|
node->mNext = s_Nodes;
|
||||||
|
// Promote as the head node
|
||||||
|
s_Nodes = node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Implicit conversion to boolean for use in boolean operations.
|
* Implicit conversion to boolean for use in boolean operations.
|
||||||
*/
|
*/
|
||||||
operator bool () const
|
operator bool () const // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
|
||||||
{
|
{
|
||||||
return m_Ptr;
|
return static_cast<bool>(m_Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
@ -16,7 +16,7 @@ void Core::EmitCustomEvent(Int32 group, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitBlipCreated(Int32 blip, Int32 header, LightObj & payload)
|
void Core::EmitBlipCreated(Int32 blip, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipCreated(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipCreated(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnBlipCreated.first)(m_Blips.at(blip).mObj, header, payload);
|
(*mOnBlipCreated.first)(m_Blips.at(static_cast< size_t >(blip)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ void Core::EmitBlipCreated(Int32 blip, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitCheckpointCreated(Int32 checkpoint, Int32 header, LightObj & payload)
|
void Core::EmitCheckpointCreated(Int32 checkpoint, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointCreated(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointCreated(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnCheckpointCreated.first)(m_Checkpoints.at(checkpoint).mObj, header, payload);
|
(*mOnCheckpointCreated.first)(m_Checkpoints.at(static_cast< size_t >(checkpoint)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ void Core::EmitCheckpointCreated(Int32 checkpoint, Int32 header, LightObj & payl
|
|||||||
void Core::EmitKeybindCreated(Int32 keybind, Int32 header, LightObj & payload)
|
void Core::EmitKeybindCreated(Int32 keybind, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindCreated(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindCreated(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnKeybindCreated.first)(m_Keybinds.at(keybind).mObj, header, payload);
|
(*mOnKeybindCreated.first)(m_Keybinds.at(static_cast< size_t >(keybind)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ void Core::EmitKeybindCreated(Int32 keybind, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitObjectCreated(Int32 object, Int32 header, LightObj & payload)
|
void Core::EmitObjectCreated(Int32 object, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectCreated(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectCreated(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnObjectCreated.first)(m_Objects.at(object).mObj, header, payload);
|
(*mOnObjectCreated.first)(m_Objects.at(static_cast< size_t >(object)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ void Core::EmitObjectCreated(Int32 object, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPickupCreated(Int32 pickup, Int32 header, LightObj & payload)
|
void Core::EmitPickupCreated(Int32 pickup, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCreated(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCreated(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnPickupCreated.first)(m_Pickups.at(pickup).mObj, header, payload);
|
(*mOnPickupCreated.first)(m_Pickups.at(static_cast< size_t >(pickup)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ void Core::EmitPickupCreated(Int32 pickup, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPlayerCreated(Int32 player, Int32 header, LightObj & payload)
|
void Core::EmitPlayerCreated(Int32 player, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCreated(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCreated(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnPlayerCreated.first)(m_Players.at(player).mObj, header, payload);
|
(*mOnPlayerCreated.first)(m_Players.at(static_cast< size_t >(player)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ void Core::EmitPlayerCreated(Int32 player, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitVehicleCreated(Int32 vehicle, Int32 header, LightObj & payload)
|
void Core::EmitVehicleCreated(Int32 vehicle, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleCreated(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleCreated(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
||||||
(*mOnVehicleCreated.first)(m_Vehicles.at(vehicle).mObj, header, payload);
|
(*mOnVehicleCreated.first)(m_Vehicles.at(static_cast< size_t >(vehicle)).mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleCreated")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleCreated")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void Core::EmitVehicleCreated(Int32 vehicle, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitBlipDestroyed(Int32 blip, Int32 header, LightObj & payload)
|
void Core::EmitBlipDestroyed(Int32 blip, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipDestroyed(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipDestroyed(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
||||||
BlipInst & _blip = m_Blips.at(blip);
|
BlipInst & _blip = m_Blips.at(static_cast< size_t >(blip));
|
||||||
(*_blip.mOnDestroyed.first)(header, payload);
|
(*_blip.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnBlipDestroyed.first)(_blip.mObj, header, payload);
|
(*mOnBlipDestroyed.first)(_blip.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipDestroyed")
|
||||||
@ -82,7 +82,7 @@ void Core::EmitBlipDestroyed(Int32 blip, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitCheckpointDestroyed(Int32 checkpoint, Int32 header, LightObj & payload)
|
void Core::EmitCheckpointDestroyed(Int32 checkpoint, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointDestroyed(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointDestroyed(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint));
|
||||||
(*_checkpoint.mOnDestroyed.first)(header, payload);
|
(*_checkpoint.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnCheckpointDestroyed.first)(_checkpoint.mObj, header, payload);
|
(*mOnCheckpointDestroyed.first)(_checkpoint.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointDestroyed")
|
||||||
@ -92,7 +92,7 @@ void Core::EmitCheckpointDestroyed(Int32 checkpoint, Int32 header, LightObj & pa
|
|||||||
void Core::EmitKeybindDestroyed(Int32 keybind, Int32 header, LightObj & payload)
|
void Core::EmitKeybindDestroyed(Int32 keybind, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindDestroyed(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindDestroyed(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
||||||
KeybindInst & _keybind = m_Keybinds.at(keybind);
|
KeybindInst & _keybind = m_Keybinds.at(static_cast< size_t >(keybind));
|
||||||
(*_keybind.mOnDestroyed.first)(header, payload);
|
(*_keybind.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnKeybindDestroyed.first)(_keybind.mObj, header, payload);
|
(*mOnKeybindDestroyed.first)(_keybind.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindDestroyed")
|
||||||
@ -102,7 +102,7 @@ void Core::EmitKeybindDestroyed(Int32 keybind, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitObjectDestroyed(Int32 object, Int32 header, LightObj & payload)
|
void Core::EmitObjectDestroyed(Int32 object, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectDestroyed(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectDestroyed(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
||||||
ObjectInst & _object = m_Objects.at(object);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object));
|
||||||
(*_object.mOnDestroyed.first)(header, payload);
|
(*_object.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnObjectDestroyed.first)(_object.mObj, header, payload);
|
(*mOnObjectDestroyed.first)(_object.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectDestroyed")
|
||||||
@ -112,7 +112,7 @@ void Core::EmitObjectDestroyed(Int32 object, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPickupDestroyed(Int32 pickup, Int32 header, LightObj & payload)
|
void Core::EmitPickupDestroyed(Int32 pickup, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupDestroyed(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupDestroyed(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup));
|
||||||
(*_pickup.mOnDestroyed.first)(header, payload);
|
(*_pickup.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnPickupDestroyed.first)(_pickup.mObj, header, payload);
|
(*mOnPickupDestroyed.first)(_pickup.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupDestroyed")
|
||||||
@ -122,7 +122,7 @@ void Core::EmitPickupDestroyed(Int32 pickup, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPlayerDestroyed(Int32 player, Int32 header, LightObj & payload)
|
void Core::EmitPlayerDestroyed(Int32 player, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerDestroyed(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerDestroyed(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
||||||
PlayerInst & _player = m_Players.at(player);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player));
|
||||||
(*_player.mOnDestroyed.first)(header, payload);
|
(*_player.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnPlayerDestroyed.first)(_player.mObj, header, payload);
|
(*mOnPlayerDestroyed.first)(_player.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerDestroyed")
|
||||||
@ -132,7 +132,7 @@ void Core::EmitPlayerDestroyed(Int32 player, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitVehicleDestroyed(Int32 vehicle, Int32 header, LightObj & payload)
|
void Core::EmitVehicleDestroyed(Int32 vehicle, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleDestroyed(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleDestroyed(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle));
|
||||||
(*_vehicle.mOnDestroyed.first)(header, payload);
|
(*_vehicle.mOnDestroyed.first)(header, payload);
|
||||||
(*mOnVehicleDestroyed.first)(_vehicle.mObj, header, payload);
|
(*mOnVehicleDestroyed.first)(_vehicle.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleDestroyed")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleDestroyed")
|
||||||
@ -142,7 +142,7 @@ void Core::EmitVehicleDestroyed(Int32 vehicle, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitBlipCustom(Int32 blip, Int32 header, LightObj & payload)
|
void Core::EmitBlipCustom(Int32 blip, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipCustom(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::BlipCustom(%d, %d, %s)", blip, header, NULL_SQOBJ_(payload))
|
||||||
BlipInst & _blip = m_Blips.at(blip);
|
BlipInst & _blip = m_Blips.at(static_cast< size_t >(blip));
|
||||||
(*_blip.mOnCustom.first)(header, payload);
|
(*_blip.mOnCustom.first)(header, payload);
|
||||||
(*mOnBlipCustom.first)(_blip.mObj, header, payload);
|
(*mOnBlipCustom.first)(_blip.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::BlipCustom")
|
||||||
@ -152,7 +152,7 @@ void Core::EmitBlipCustom(Int32 blip, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitCheckpointCustom(Int32 checkpoint, Int32 header, LightObj & payload)
|
void Core::EmitCheckpointCustom(Int32 checkpoint, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointCustom(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointCustom(%d, %d, %s)", checkpoint, header, NULL_SQOBJ_(payload))
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint));
|
||||||
(*_checkpoint.mOnCustom.first)(header, payload);
|
(*_checkpoint.mOnCustom.first)(header, payload);
|
||||||
(*mOnCheckpointCustom.first)(_checkpoint.mObj, header, payload);
|
(*mOnCheckpointCustom.first)(_checkpoint.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointCustom")
|
||||||
@ -162,7 +162,7 @@ void Core::EmitCheckpointCustom(Int32 checkpoint, Int32 header, LightObj & paylo
|
|||||||
void Core::EmitKeybindCustom(Int32 keybind, Int32 header, LightObj & payload)
|
void Core::EmitKeybindCustom(Int32 keybind, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindCustom(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeybindCustom(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload))
|
||||||
KeybindInst & _keybind = m_Keybinds.at(keybind);
|
KeybindInst & _keybind = m_Keybinds.at(static_cast< size_t >(keybind));
|
||||||
(*_keybind.mOnCustom.first)(header, payload);
|
(*_keybind.mOnCustom.first)(header, payload);
|
||||||
(*mOnKeybindCustom.first)(_keybind.mObj, header, payload);
|
(*mOnKeybindCustom.first)(_keybind.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeybindCustom")
|
||||||
@ -172,7 +172,7 @@ void Core::EmitKeybindCustom(Int32 keybind, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitObjectCustom(Int32 object, Int32 header, LightObj & payload)
|
void Core::EmitObjectCustom(Int32 object, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectCustom(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectCustom(%d, %d, %s)", object, header, NULL_SQOBJ_(payload))
|
||||||
ObjectInst & _object = m_Objects.at(object);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object));
|
||||||
(*_object.mOnCustom.first)(header, payload);
|
(*_object.mOnCustom.first)(header, payload);
|
||||||
(*mOnObjectCustom.first)(_object.mObj, header, payload);
|
(*mOnObjectCustom.first)(_object.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectCustom")
|
||||||
@ -182,7 +182,7 @@ void Core::EmitObjectCustom(Int32 object, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPickupCustom(Int32 pickup, Int32 header, LightObj & payload)
|
void Core::EmitPickupCustom(Int32 pickup, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCustom(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCustom(%d, %d, %s)", pickup, header, NULL_SQOBJ_(payload))
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup));
|
||||||
(*_pickup.mOnCustom.first)(header, payload);
|
(*_pickup.mOnCustom.first)(header, payload);
|
||||||
(*mOnPickupCustom.first)(_pickup.mObj, header, payload);
|
(*mOnPickupCustom.first)(_pickup.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupCustom")
|
||||||
@ -192,7 +192,7 @@ void Core::EmitPickupCustom(Int32 pickup, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitPlayerCustom(Int32 player, Int32 header, LightObj & payload)
|
void Core::EmitPlayerCustom(Int32 player, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCustom(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCustom(%d, %d, %s)", player, header, NULL_SQOBJ_(payload))
|
||||||
PlayerInst & _player = m_Players.at(player);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player));
|
||||||
(*_player.mOnCustom.first)(header, payload);
|
(*_player.mOnCustom.first)(header, payload);
|
||||||
(*mOnPlayerCustom.first)(_player.mObj, header, payload);
|
(*mOnPlayerCustom.first)(_player.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCustom")
|
||||||
@ -202,7 +202,7 @@ void Core::EmitPlayerCustom(Int32 player, Int32 header, LightObj & payload)
|
|||||||
void Core::EmitVehicleCustom(Int32 vehicle, Int32 header, LightObj & payload)
|
void Core::EmitVehicleCustom(Int32 vehicle, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleCustom(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleCustom(%d, %d, %s)", vehicle, header, NULL_SQOBJ_(payload))
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle));
|
||||||
(*_vehicle.mOnCustom.first)(header, payload);
|
(*_vehicle.mOnCustom.first)(header, payload);
|
||||||
(*mOnVehicleCustom.first)(_vehicle.mObj, header, payload);
|
(*mOnVehicleCustom.first)(_vehicle.mObj, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleCustom")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleCustom")
|
||||||
@ -277,7 +277,7 @@ void Core::EmitIncomingConnection(CStr player_name, size_t name_buffer_size, CCS
|
|||||||
void Core::EmitPlayerRequestClass(Int32 player_id, Int32 offset)
|
void Core::EmitPlayerRequestClass(Int32 player_id, Int32 offset)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRequestClass(%d, %d)", player_id, offset)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRequestClass(%d, %d)", player_id, offset)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnRequestClass.first)(offset);
|
(*_player.mOnRequestClass.first)(offset);
|
||||||
(*mOnPlayerRequestClass.first)(_player.mObj, offset);
|
(*mOnPlayerRequestClass.first)(_player.mObj, offset);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerRequestClass")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerRequestClass")
|
||||||
@ -287,7 +287,7 @@ void Core::EmitPlayerRequestClass(Int32 player_id, Int32 offset)
|
|||||||
void Core::EmitPlayerRequestSpawn(Int32 player_id)
|
void Core::EmitPlayerRequestSpawn(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRequestSpawn(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRequestSpawn(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnRequestSpawn.first)();
|
(*_player.mOnRequestSpawn.first)();
|
||||||
(*mOnPlayerRequestSpawn.first)(_player.mObj);
|
(*mOnPlayerRequestSpawn.first)(_player.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerRequestSpawn")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerRequestSpawn")
|
||||||
@ -297,7 +297,7 @@ void Core::EmitPlayerRequestSpawn(Int32 player_id)
|
|||||||
void Core::EmitPlayerSpawn(Int32 player_id)
|
void Core::EmitPlayerSpawn(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSpawn(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSpawn(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnSpawn.first)();
|
(*_player.mOnSpawn.first)();
|
||||||
(*mOnPlayerSpawn.first)(_player.mObj);
|
(*mOnPlayerSpawn.first)(_player.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSpawn")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSpawn")
|
||||||
@ -307,7 +307,7 @@ void Core::EmitPlayerSpawn(Int32 player_id)
|
|||||||
void Core::EmitPlayerWasted(Int32 player_id, Int32 reason)
|
void Core::EmitPlayerWasted(Int32 player_id, Int32 reason)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWasted(%d, %d)", player_id, reason)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWasted(%d, %d)", player_id, reason)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnWasted.first)(reason);
|
(*_player.mOnWasted.first)(reason);
|
||||||
(*mOnPlayerWasted.first)(_player.mObj, reason);
|
(*mOnPlayerWasted.first)(_player.mObj, reason);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWasted")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWasted")
|
||||||
@ -317,8 +317,8 @@ void Core::EmitPlayerWasted(Int32 player_id, Int32 reason)
|
|||||||
void Core::EmitPlayerKilled(Int32 player_id, Int32 killer_id, Int32 reason, vcmpBodyPart body_part, bool team_kill)
|
void Core::EmitPlayerKilled(Int32 player_id, Int32 killer_id, Int32 reason, vcmpBodyPart body_part, bool team_kill)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKilled(%d, %d, %d, %d, %d)", player_id, killer_id, reason, body_part, team_kill)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKilled(%d, %d, %d, %d, %d)", player_id, killer_id, reason, body_part, team_kill)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
PlayerInst & _killer = m_Players.at(killer_id);
|
PlayerInst & _killer = m_Players.at(static_cast< size_t >(killer_id));
|
||||||
(*_player.mOnKilled.first)(_killer.mObj, reason, static_cast< Int32 >(body_part), team_kill);
|
(*_player.mOnKilled.first)(_killer.mObj, reason, static_cast< Int32 >(body_part), team_kill);
|
||||||
(*mOnPlayerKilled.first)(_player.mObj, _killer.mObj, reason, static_cast< Int32 >(body_part), team_kill);
|
(*mOnPlayerKilled.first)(_player.mObj, _killer.mObj, reason, static_cast< Int32 >(body_part), team_kill);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerKilled")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerKilled")
|
||||||
@ -328,8 +328,8 @@ void Core::EmitPlayerKilled(Int32 player_id, Int32 killer_id, Int32 reason, vcmp
|
|||||||
void Core::EmitPlayerEmbarking(Int32 player_id, Int32 vehicle_id, Int32 slot_index)
|
void Core::EmitPlayerEmbarking(Int32 player_id, Int32 vehicle_id, Int32 slot_index)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEmbarking(%d, %d, %d)", player_id, vehicle_id, slot_index)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEmbarking(%d, %d, %d)", player_id, vehicle_id, slot_index)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_player.mOnEmbarking.first)(_vehicle.mObj, slot_index);
|
(*_player.mOnEmbarking.first)(_vehicle.mObj, slot_index);
|
||||||
(*_vehicle.mOnEmbarking.first)(_player.mObj, slot_index);
|
(*_vehicle.mOnEmbarking.first)(_player.mObj, slot_index);
|
||||||
(*mOnPlayerEmbarking.first)(_player.mObj, _vehicle.mObj, slot_index);
|
(*mOnPlayerEmbarking.first)(_player.mObj, _vehicle.mObj, slot_index);
|
||||||
@ -340,8 +340,8 @@ void Core::EmitPlayerEmbarking(Int32 player_id, Int32 vehicle_id, Int32 slot_ind
|
|||||||
void Core::EmitPlayerEmbarked(Int32 player_id, Int32 vehicle_id, Int32 slot_index)
|
void Core::EmitPlayerEmbarked(Int32 player_id, Int32 vehicle_id, Int32 slot_index)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEmbarked(%d, %d, %d)", player_id, vehicle_id, slot_index)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEmbarked(%d, %d, %d)", player_id, vehicle_id, slot_index)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_player.mOnEmbarked.first)(_vehicle.mObj, slot_index);
|
(*_player.mOnEmbarked.first)(_vehicle.mObj, slot_index);
|
||||||
(*_vehicle.mOnEmbarked.first)(_player.mObj, slot_index);
|
(*_vehicle.mOnEmbarked.first)(_player.mObj, slot_index);
|
||||||
(*mOnPlayerEmbarked.first)(_player.mObj, _vehicle.mObj, slot_index);
|
(*mOnPlayerEmbarked.first)(_player.mObj, _vehicle.mObj, slot_index);
|
||||||
@ -352,8 +352,8 @@ void Core::EmitPlayerEmbarked(Int32 player_id, Int32 vehicle_id, Int32 slot_inde
|
|||||||
void Core::EmitPlayerDisembark(Int32 player_id, Int32 vehicle_id)
|
void Core::EmitPlayerDisembark(Int32 player_id, Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerDisembark(%d, %d)", player_id, vehicle_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerDisembark(%d, %d)", player_id, vehicle_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_player.mOnDisembark.first)(_vehicle.mObj);
|
(*_player.mOnDisembark.first)(_vehicle.mObj);
|
||||||
(*_vehicle.mOnDisembark.first)(_player.mObj);
|
(*_vehicle.mOnDisembark.first)(_player.mObj);
|
||||||
(*mOnPlayerDisembark.first)(_player.mObj, _vehicle.mObj);
|
(*mOnPlayerDisembark.first)(_player.mObj, _vehicle.mObj);
|
||||||
@ -364,7 +364,7 @@ void Core::EmitPlayerDisembark(Int32 player_id, Int32 vehicle_id)
|
|||||||
void Core::EmitPlayerRename(Int32 player_id, CCStr old_name, CCStr new_name)
|
void Core::EmitPlayerRename(Int32 player_id, CCStr old_name, CCStr new_name)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRename(%d, %s, %s)", player_id, old_name, new_name)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerRename(%d, %s, %s)", player_id, old_name, new_name)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
LightObj oname(old_name, -1), nname(new_name, -1);
|
LightObj oname(old_name, -1), nname(new_name, -1);
|
||||||
(*_player.mOnRename.first)(oname, nname);
|
(*_player.mOnRename.first)(oname, nname);
|
||||||
(*mOnPlayerRename.first)(_player.mObj, oname, nname);
|
(*mOnPlayerRename.first)(_player.mObj, oname, nname);
|
||||||
@ -375,7 +375,7 @@ void Core::EmitPlayerRename(Int32 player_id, CCStr old_name, CCStr new_name)
|
|||||||
void Core::EmitPlayerState(Int32 player_id, Int32 old_state, Int32 new_state)
|
void Core::EmitPlayerState(Int32 player_id, Int32 old_state, Int32 new_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerState(%d, %d, %d)", player_id, old_state, new_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerState(%d, %d, %d)", player_id, old_state, new_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnState.first)(old_state, new_state);
|
(*_player.mOnState.first)(old_state, new_state);
|
||||||
(*mOnPlayerState.first)(_player.mObj, old_state, new_state);
|
(*mOnPlayerState.first)(_player.mObj, old_state, new_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerState")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerState")
|
||||||
@ -385,7 +385,7 @@ void Core::EmitPlayerState(Int32 player_id, Int32 old_state, Int32 new_state)
|
|||||||
void Core::EmitStateNone(Int32 player_id, Int32 old_state)
|
void Core::EmitStateNone(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateNone(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateNone(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateNone.first)(old_state);
|
(*_player.mOnStateNone.first)(old_state);
|
||||||
(*mOnStateNone.first)(_player.mObj, old_state);
|
(*mOnStateNone.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateNone")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateNone")
|
||||||
@ -395,7 +395,7 @@ void Core::EmitStateNone(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateNormal(Int32 player_id, Int32 old_state)
|
void Core::EmitStateNormal(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateNormal(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateNormal(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateNormal.first)(old_state);
|
(*_player.mOnStateNormal.first)(old_state);
|
||||||
(*mOnStateNormal.first)(_player.mObj, old_state);
|
(*mOnStateNormal.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateNormal")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateNormal")
|
||||||
@ -405,7 +405,7 @@ void Core::EmitStateNormal(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateAim(Int32 player_id, Int32 old_state)
|
void Core::EmitStateAim(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateAim(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateAim(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateAim.first)(old_state);
|
(*_player.mOnStateAim.first)(old_state);
|
||||||
(*mOnStateAim.first)(_player.mObj, old_state);
|
(*mOnStateAim.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateAim")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateAim")
|
||||||
@ -415,7 +415,7 @@ void Core::EmitStateAim(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateDriver(Int32 player_id, Int32 old_state)
|
void Core::EmitStateDriver(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateDriver(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateDriver(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateDriver.first)(old_state);
|
(*_player.mOnStateDriver.first)(old_state);
|
||||||
(*mOnStateDriver.first)(_player.mObj, old_state);
|
(*mOnStateDriver.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateDriver")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateDriver")
|
||||||
@ -425,7 +425,7 @@ void Core::EmitStateDriver(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStatePassenger(Int32 player_id, Int32 old_state)
|
void Core::EmitStatePassenger(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StatePassenger(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StatePassenger(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStatePassenger.first)(old_state);
|
(*_player.mOnStatePassenger.first)(old_state);
|
||||||
(*mOnStatePassenger.first)(_player.mObj, old_state);
|
(*mOnStatePassenger.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StatePassenger")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StatePassenger")
|
||||||
@ -435,7 +435,7 @@ void Core::EmitStatePassenger(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateEnterDriver(Int32 player_id, Int32 old_state)
|
void Core::EmitStateEnterDriver(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateEnterDriver(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateEnterDriver(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateEnterDriver.first)(old_state);
|
(*_player.mOnStateEnterDriver.first)(old_state);
|
||||||
(*mOnStateEnterDriver.first)(_player.mObj, old_state);
|
(*mOnStateEnterDriver.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateEnterDriver")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateEnterDriver")
|
||||||
@ -445,7 +445,7 @@ void Core::EmitStateEnterDriver(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateEnterPassenger(Int32 player_id, Int32 old_state)
|
void Core::EmitStateEnterPassenger(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateEnterPassenger(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateEnterPassenger(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateEnterPassenger.first)(old_state);
|
(*_player.mOnStateEnterPassenger.first)(old_state);
|
||||||
(*mOnStateEnterPassenger.first)(_player.mObj, old_state);
|
(*mOnStateEnterPassenger.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateEnterPassenger")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateEnterPassenger")
|
||||||
@ -455,7 +455,7 @@ void Core::EmitStateEnterPassenger(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateExit(Int32 player_id, Int32 old_state)
|
void Core::EmitStateExit(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateExit(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateExit(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateExit.first)(old_state);
|
(*_player.mOnStateExit.first)(old_state);
|
||||||
(*mOnStateExit.first)(_player.mObj, old_state);
|
(*mOnStateExit.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateExit")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateExit")
|
||||||
@ -465,7 +465,7 @@ void Core::EmitStateExit(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitStateUnspawned(Int32 player_id, Int32 old_state)
|
void Core::EmitStateUnspawned(Int32 player_id, Int32 old_state)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateUnspawned(%d, %d)", player_id, old_state)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::StateUnspawned(%d, %d)", player_id, old_state)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStateUnspawned.first)(old_state);
|
(*_player.mOnStateUnspawned.first)(old_state);
|
||||||
(*mOnStateUnspawned.first)(_player.mObj, old_state);
|
(*mOnStateUnspawned.first)(_player.mObj, old_state);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateUnspawned")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::StateUnspawned")
|
||||||
@ -475,7 +475,7 @@ void Core::EmitStateUnspawned(Int32 player_id, Int32 old_state)
|
|||||||
void Core::EmitPlayerAction(Int32 player_id, Int32 old_action, Int32 new_action)
|
void Core::EmitPlayerAction(Int32 player_id, Int32 old_action, Int32 new_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAction(%d, %d, %d)", player_id, old_action, new_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAction(%d, %d, %d)", player_id, old_action, new_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnAction.first)(old_action, new_action);
|
(*_player.mOnAction.first)(old_action, new_action);
|
||||||
(*mOnPlayerAction.first)(_player.mObj, old_action, new_action);
|
(*mOnPlayerAction.first)(_player.mObj, old_action, new_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAction")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAction")
|
||||||
@ -485,7 +485,7 @@ void Core::EmitPlayerAction(Int32 player_id, Int32 old_action, Int32 new_action)
|
|||||||
void Core::EmitActionNone(Int32 player_id, Int32 old_action)
|
void Core::EmitActionNone(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionNone(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionNone(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionNone.first)(old_action);
|
(*_player.mOnActionNone.first)(old_action);
|
||||||
(*mOnActionNone.first)(_player.mObj, old_action);
|
(*mOnActionNone.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionNone")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionNone")
|
||||||
@ -495,7 +495,7 @@ void Core::EmitActionNone(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionNormal(Int32 player_id, Int32 old_action)
|
void Core::EmitActionNormal(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionNormal(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionNormal(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionNormal.first)(old_action);
|
(*_player.mOnActionNormal.first)(old_action);
|
||||||
(*mOnActionNormal.first)(_player.mObj, old_action);
|
(*mOnActionNormal.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionNormal")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionNormal")
|
||||||
@ -505,7 +505,7 @@ void Core::EmitActionNormal(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionAiming(Int32 player_id, Int32 old_action)
|
void Core::EmitActionAiming(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionAiming(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionAiming(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionAiming.first)(old_action);
|
(*_player.mOnActionAiming.first)(old_action);
|
||||||
(*mOnActionAiming.first)(_player.mObj, old_action);
|
(*mOnActionAiming.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionAiming")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionAiming")
|
||||||
@ -515,7 +515,7 @@ void Core::EmitActionAiming(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionShooting(Int32 player_id, Int32 old_action)
|
void Core::EmitActionShooting(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionShooting(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionShooting(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionShooting.first)(old_action);
|
(*_player.mOnActionShooting.first)(old_action);
|
||||||
(*mOnActionShooting.first)(_player.mObj, old_action);
|
(*mOnActionShooting.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionShooting")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionShooting")
|
||||||
@ -525,7 +525,7 @@ void Core::EmitActionShooting(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionJumping(Int32 player_id, Int32 old_action)
|
void Core::EmitActionJumping(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionJumping(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionJumping(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionJumping.first)(old_action);
|
(*_player.mOnActionJumping.first)(old_action);
|
||||||
(*mOnActionJumping.first)(_player.mObj, old_action);
|
(*mOnActionJumping.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionJumping")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionJumping")
|
||||||
@ -535,7 +535,7 @@ void Core::EmitActionJumping(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionLieDown(Int32 player_id, Int32 old_action)
|
void Core::EmitActionLieDown(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionLieDown(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionLieDown(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionLieDown.first)(old_action);
|
(*_player.mOnActionLieDown.first)(old_action);
|
||||||
(*mOnActionLieDown.first)(_player.mObj, old_action);
|
(*mOnActionLieDown.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionLieDown")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionLieDown")
|
||||||
@ -545,7 +545,7 @@ void Core::EmitActionLieDown(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionGettingUp(Int32 player_id, Int32 old_action)
|
void Core::EmitActionGettingUp(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionGettingUp(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionGettingUp(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionGettingUp.first)(old_action);
|
(*_player.mOnActionGettingUp.first)(old_action);
|
||||||
(*mOnActionGettingUp.first)(_player.mObj, old_action);
|
(*mOnActionGettingUp.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionGettingUp")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionGettingUp")
|
||||||
@ -555,7 +555,7 @@ void Core::EmitActionGettingUp(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionJumpVehicle(Int32 player_id, Int32 old_action)
|
void Core::EmitActionJumpVehicle(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionJumpVehicle(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionJumpVehicle(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionJumpVehicle.first)(old_action);
|
(*_player.mOnActionJumpVehicle.first)(old_action);
|
||||||
(*mOnActionJumpVehicle.first)(_player.mObj, old_action);
|
(*mOnActionJumpVehicle.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionJumpVehicle")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionJumpVehicle")
|
||||||
@ -565,7 +565,7 @@ void Core::EmitActionJumpVehicle(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionDriving(Int32 player_id, Int32 old_action)
|
void Core::EmitActionDriving(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDriving(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDriving(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionDriving.first)(old_action);
|
(*_player.mOnActionDriving.first)(old_action);
|
||||||
(*mOnActionDriving.first)(_player.mObj, old_action);
|
(*mOnActionDriving.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDriving")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDriving")
|
||||||
@ -575,7 +575,7 @@ void Core::EmitActionDriving(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionDying(Int32 player_id, Int32 old_action)
|
void Core::EmitActionDying(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDying(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDying(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionDying.first)(old_action);
|
(*_player.mOnActionDying.first)(old_action);
|
||||||
(*mOnActionDying.first)(_player.mObj, old_action);
|
(*mOnActionDying.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDying")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDying")
|
||||||
@ -585,7 +585,7 @@ void Core::EmitActionDying(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionWasted(Int32 player_id, Int32 old_action)
|
void Core::EmitActionWasted(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionWasted(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionWasted(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionWasted.first)(old_action);
|
(*_player.mOnActionWasted.first)(old_action);
|
||||||
(*mOnActionWasted.first)(_player.mObj, old_action);
|
(*mOnActionWasted.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionWasted")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionWasted")
|
||||||
@ -595,7 +595,7 @@ void Core::EmitActionWasted(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionEmbarking(Int32 player_id, Int32 old_action)
|
void Core::EmitActionEmbarking(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionEmbarking(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionEmbarking(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionEmbarking.first)(old_action);
|
(*_player.mOnActionEmbarking.first)(old_action);
|
||||||
(*mOnActionEmbarking.first)(_player.mObj, old_action);
|
(*mOnActionEmbarking.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionEmbarking")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionEmbarking")
|
||||||
@ -605,7 +605,7 @@ void Core::EmitActionEmbarking(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitActionDisembarking(Int32 player_id, Int32 old_action)
|
void Core::EmitActionDisembarking(Int32 player_id, Int32 old_action)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDisembarking(%d, %d)", player_id, old_action)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ActionDisembarking(%d, %d)", player_id, old_action)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnActionDisembarking.first)(old_action);
|
(*_player.mOnActionDisembarking.first)(old_action);
|
||||||
(*mOnActionDisembarking.first)(_player.mObj, old_action);
|
(*mOnActionDisembarking.first)(_player.mObj, old_action);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDisembarking")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ActionDisembarking")
|
||||||
@ -615,7 +615,7 @@ void Core::EmitActionDisembarking(Int32 player_id, Int32 old_action)
|
|||||||
void Core::EmitPlayerBurning(Int32 player_id, bool is_on_fire)
|
void Core::EmitPlayerBurning(Int32 player_id, bool is_on_fire)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerBurning(%d, %d)", player_id, is_on_fire)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerBurning(%d, %d)", player_id, is_on_fire)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnBurning.first)(is_on_fire);
|
(*_player.mOnBurning.first)(is_on_fire);
|
||||||
(*mOnPlayerBurning.first)(_player.mObj, is_on_fire);
|
(*mOnPlayerBurning.first)(_player.mObj, is_on_fire);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerBurning")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerBurning")
|
||||||
@ -625,7 +625,7 @@ void Core::EmitPlayerBurning(Int32 player_id, bool is_on_fire)
|
|||||||
void Core::EmitPlayerCrouching(Int32 player_id, bool is_crouching)
|
void Core::EmitPlayerCrouching(Int32 player_id, bool is_crouching)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCrouching(%d, %d)", player_id, is_crouching)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCrouching(%d, %d)", player_id, is_crouching)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnCrouching.first)(is_crouching);
|
(*_player.mOnCrouching.first)(is_crouching);
|
||||||
(*mOnPlayerCrouching.first)(_player.mObj, is_crouching);
|
(*mOnPlayerCrouching.first)(_player.mObj, is_crouching);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCrouching")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerCrouching")
|
||||||
@ -635,7 +635,7 @@ void Core::EmitPlayerCrouching(Int32 player_id, bool is_crouching)
|
|||||||
void Core::EmitPlayerGameKeys(Int32 player_id, Uint32 old_keys, Uint32 new_keys)
|
void Core::EmitPlayerGameKeys(Int32 player_id, Uint32 old_keys, Uint32 new_keys)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerGameKeys(%d, %u, %u)", player_id, old_keys, new_keys)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerGameKeys(%d, %u, %u)", player_id, old_keys, new_keys)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnGameKeys.first)(old_keys, new_keys);
|
(*_player.mOnGameKeys.first)(old_keys, new_keys);
|
||||||
(*mOnPlayerGameKeys.first)(_player.mObj, old_keys, new_keys);
|
(*mOnPlayerGameKeys.first)(_player.mObj, old_keys, new_keys);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerGameKeys")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerGameKeys")
|
||||||
@ -645,7 +645,7 @@ void Core::EmitPlayerGameKeys(Int32 player_id, Uint32 old_keys, Uint32 new_keys)
|
|||||||
void Core::EmitPlayerStartTyping(Int32 player_id)
|
void Core::EmitPlayerStartTyping(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerStartTyping(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerStartTyping(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStartTyping.first)();
|
(*_player.mOnStartTyping.first)();
|
||||||
(*mOnPlayerStartTyping.first)(_player.mObj);
|
(*mOnPlayerStartTyping.first)(_player.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerStartTyping")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerStartTyping")
|
||||||
@ -655,7 +655,7 @@ void Core::EmitPlayerStartTyping(Int32 player_id)
|
|||||||
void Core::EmitPlayerStopTyping(Int32 player_id)
|
void Core::EmitPlayerStopTyping(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerStopTyping(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerStopTyping(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnStopTyping.first)();
|
(*_player.mOnStopTyping.first)();
|
||||||
(*mOnPlayerStopTyping.first)(_player.mObj);
|
(*mOnPlayerStopTyping.first)(_player.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerStopTyping")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerStopTyping")
|
||||||
@ -665,7 +665,7 @@ void Core::EmitPlayerStopTyping(Int32 player_id)
|
|||||||
void Core::EmitPlayerAway(Int32 player_id, bool is_away)
|
void Core::EmitPlayerAway(Int32 player_id, bool is_away)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAway(%d, %d)", player_id, is_away)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAway(%d, %d)", player_id, is_away)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnAway.first)(is_away);
|
(*_player.mOnAway.first)(is_away);
|
||||||
(*mOnPlayerAway.first)(_player.mObj, is_away);
|
(*mOnPlayerAway.first)(_player.mObj, is_away);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAway")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAway")
|
||||||
@ -675,7 +675,7 @@ void Core::EmitPlayerAway(Int32 player_id, bool is_away)
|
|||||||
void Core::EmitPlayerMessage(Int32 player_id, CCStr message)
|
void Core::EmitPlayerMessage(Int32 player_id, CCStr message)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerMessage(%d, %s)", player_id, message)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerMessage(%d, %s)", player_id, message)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
LightObj msg(message, -1);
|
LightObj msg(message, -1);
|
||||||
(*_player.mOnMessage.first)(msg);
|
(*_player.mOnMessage.first)(msg);
|
||||||
(*mOnPlayerMessage.first)(_player.mObj, msg);
|
(*mOnPlayerMessage.first)(_player.mObj, msg);
|
||||||
@ -686,7 +686,7 @@ void Core::EmitPlayerMessage(Int32 player_id, CCStr message)
|
|||||||
void Core::EmitPlayerCommand(Int32 player_id, CCStr message)
|
void Core::EmitPlayerCommand(Int32 player_id, CCStr message)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCommand(%d, %s)", player_id, message)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCommand(%d, %s)", player_id, message)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
LightObj msg(message, -1);
|
LightObj msg(message, -1);
|
||||||
(*_player.mOnCommand.first)(msg);
|
(*_player.mOnCommand.first)(msg);
|
||||||
(*mOnPlayerCommand.first)(_player.mObj, msg);
|
(*mOnPlayerCommand.first)(_player.mObj, msg);
|
||||||
@ -697,8 +697,8 @@ void Core::EmitPlayerCommand(Int32 player_id, CCStr message)
|
|||||||
void Core::EmitPlayerPrivateMessage(Int32 player_id, Int32 target_player_id, CCStr message)
|
void Core::EmitPlayerPrivateMessage(Int32 player_id, Int32 target_player_id, CCStr message)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerPrivateMessage(%d, %d, %s)", player_id, target_player_id, message)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerPrivateMessage(%d, %d, %s)", player_id, target_player_id, message)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
PlayerInst & _receiver = m_Players.at(target_player_id);
|
PlayerInst & _receiver = m_Players.at(static_cast< size_t >(target_player_id));
|
||||||
LightObj msg(message, -1);
|
LightObj msg(message, -1);
|
||||||
(*_player.mOnMessage.first)(_receiver.mObj, msg);
|
(*_player.mOnMessage.first)(_receiver.mObj, msg);
|
||||||
(*mOnPlayerPrivateMessage.first)(_player.mObj, _receiver.mObj, msg);
|
(*mOnPlayerPrivateMessage.first)(_player.mObj, _receiver.mObj, msg);
|
||||||
@ -709,8 +709,8 @@ void Core::EmitPlayerPrivateMessage(Int32 player_id, Int32 target_player_id, CCS
|
|||||||
void Core::EmitPlayerKeyPress(Int32 player_id, Int32 bind_id)
|
void Core::EmitPlayerKeyPress(Int32 player_id, Int32 bind_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKeyPress(%d, %d)", player_id, bind_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKeyPress(%d, %d)", player_id, bind_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
KeybindInst & _keybind = m_Keybinds.at(bind_id);
|
KeybindInst & _keybind = m_Keybinds.at(static_cast< size_t >(bind_id));
|
||||||
(*_player.mOnKeyPress.first)(_keybind.mObj);
|
(*_player.mOnKeyPress.first)(_keybind.mObj);
|
||||||
(*_keybind.mOnKeyPress.first)(_player.mObj);
|
(*_keybind.mOnKeyPress.first)(_player.mObj);
|
||||||
(*mOnPlayerKeyPress.first)(_player.mObj, _keybind.mObj);
|
(*mOnPlayerKeyPress.first)(_player.mObj, _keybind.mObj);
|
||||||
@ -721,8 +721,8 @@ void Core::EmitPlayerKeyPress(Int32 player_id, Int32 bind_id)
|
|||||||
void Core::EmitPlayerKeyRelease(Int32 player_id, Int32 bind_id)
|
void Core::EmitPlayerKeyRelease(Int32 player_id, Int32 bind_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKeyRelease(%d, %d)", player_id, bind_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerKeyRelease(%d, %d)", player_id, bind_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
KeybindInst & _keybind = m_Keybinds.at(bind_id);
|
KeybindInst & _keybind = m_Keybinds.at(static_cast< size_t >(bind_id));
|
||||||
(*_keybind.mOnKeyRelease.first)(_player.mObj);
|
(*_keybind.mOnKeyRelease.first)(_player.mObj);
|
||||||
(*_player.mOnKeyRelease.first)(_keybind.mObj);
|
(*_player.mOnKeyRelease.first)(_keybind.mObj);
|
||||||
(*mOnPlayerKeyRelease.first)(_player.mObj, _keybind.mObj);
|
(*mOnPlayerKeyRelease.first)(_player.mObj, _keybind.mObj);
|
||||||
@ -733,8 +733,8 @@ void Core::EmitPlayerKeyRelease(Int32 player_id, Int32 bind_id)
|
|||||||
void Core::EmitPlayerSpectate(Int32 player_id, Int32 target_player_id)
|
void Core::EmitPlayerSpectate(Int32 player_id, Int32 target_player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSpectate(%d, %d)", player_id, target_player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSpectate(%d, %d)", player_id, target_player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
PlayerInst & _target = m_Players.at(target_player_id);
|
PlayerInst & _target = m_Players.at(static_cast< size_t >(target_player_id));
|
||||||
(*_player.mOnSpectate.first)(_target.mObj);
|
(*_player.mOnSpectate.first)(_target.mObj);
|
||||||
(*mOnPlayerSpectate.first)(_player.mObj, _target.mObj);
|
(*mOnPlayerSpectate.first)(_player.mObj, _target.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSpectate")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSpectate")
|
||||||
@ -744,7 +744,7 @@ void Core::EmitPlayerSpectate(Int32 player_id, Int32 target_player_id)
|
|||||||
void Core::EmitPlayerUnspectate(Int32 player_id)
|
void Core::EmitPlayerUnspectate(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerUnspectate(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerUnspectate(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnUnspectate.first)();
|
(*_player.mOnUnspectate.first)();
|
||||||
(*mOnPlayerUnspectate.first)(_player.mObj);
|
(*mOnPlayerUnspectate.first)(_player.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerUnspectate")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerUnspectate")
|
||||||
@ -754,7 +754,7 @@ void Core::EmitPlayerUnspectate(Int32 player_id)
|
|||||||
void Core::EmitPlayerCrashreport(Int32 player_id, CCStr report)
|
void Core::EmitPlayerCrashreport(Int32 player_id, CCStr report)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCrashreport(%d, %s)", player_id, report)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerCrashreport(%d, %s)", player_id, report)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
LightObj rep(report, -1);
|
LightObj rep(report, -1);
|
||||||
(*_player.mOnCrashreport.first)(rep);
|
(*_player.mOnCrashreport.first)(rep);
|
||||||
(*mOnPlayerCrashreport.first)(_player.mObj, rep);
|
(*mOnPlayerCrashreport.first)(_player.mObj, rep);
|
||||||
@ -765,7 +765,7 @@ void Core::EmitPlayerCrashreport(Int32 player_id, CCStr report)
|
|||||||
void Core::EmitPlayerModuleList(Int32 player_id, CCStr list)
|
void Core::EmitPlayerModuleList(Int32 player_id, CCStr list)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerModuleList(%d, %s)", player_id, list)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerModuleList(%d, %s)", player_id, list)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
LightObj rep(list, -1);
|
LightObj rep(list, -1);
|
||||||
(*_player.mOnModuleList.first)(rep);
|
(*_player.mOnModuleList.first)(rep);
|
||||||
(*mOnPlayerModuleList.first)(_player.mObj, rep);
|
(*mOnPlayerModuleList.first)(_player.mObj, rep);
|
||||||
@ -776,7 +776,7 @@ void Core::EmitPlayerModuleList(Int32 player_id, CCStr list)
|
|||||||
void Core::EmitVehicleExplode(Int32 vehicle_id)
|
void Core::EmitVehicleExplode(Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleExplode(%d)", vehicle_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleExplode(%d)", vehicle_id)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnExplode.first)();
|
(*_vehicle.mOnExplode.first)();
|
||||||
(*mOnVehicleExplode.first)(_vehicle.mObj);
|
(*mOnVehicleExplode.first)(_vehicle.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleExplode")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleExplode")
|
||||||
@ -786,7 +786,7 @@ void Core::EmitVehicleExplode(Int32 vehicle_id)
|
|||||||
void Core::EmitVehicleRespawn(Int32 vehicle_id)
|
void Core::EmitVehicleRespawn(Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRespawn(%d)", vehicle_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRespawn(%d)", vehicle_id)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnRespawn.first)();
|
(*_vehicle.mOnRespawn.first)();
|
||||||
(*mOnVehicleRespawn.first)(_vehicle.mObj);
|
(*mOnVehicleRespawn.first)(_vehicle.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRespawn")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRespawn")
|
||||||
@ -796,8 +796,8 @@ void Core::EmitVehicleRespawn(Int32 vehicle_id)
|
|||||||
void Core::EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id)
|
void Core::EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectShot(%d, %d, %d)", object_id, player_id, weapon_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectShot(%d, %d, %d)", object_id, player_id, weapon_id)
|
||||||
ObjectInst & _object = m_Objects.at(object_id);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_object.mOnShot.first)(_player.mObj, weapon_id);
|
(*_object.mOnShot.first)(_player.mObj, weapon_id);
|
||||||
(*_player.mOnObjectShot.first)(_object.mObj, weapon_id);
|
(*_player.mOnObjectShot.first)(_object.mObj, weapon_id);
|
||||||
(*mOnObjectShot.first)(_player.mObj, _object.mObj, weapon_id);
|
(*mOnObjectShot.first)(_player.mObj, _object.mObj, weapon_id);
|
||||||
@ -808,8 +808,8 @@ void Core::EmitObjectShot(Int32 object_id, Int32 player_id, Int32 weapon_id)
|
|||||||
void Core::EmitObjectTouched(Int32 object_id, Int32 player_id)
|
void Core::EmitObjectTouched(Int32 object_id, Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectTouched(%d, %d)", object_id, player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectTouched(%d, %d)", object_id, player_id)
|
||||||
ObjectInst & _object = m_Objects.at(object_id);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_object.mOnTouched.first)(_player.mObj);
|
(*_object.mOnTouched.first)(_player.mObj);
|
||||||
(*_player.mOnObjectTouched.first)(_object.mObj);
|
(*_player.mOnObjectTouched.first)(_object.mObj);
|
||||||
(*mOnObjectTouched.first)(_player.mObj, _object.mObj);
|
(*mOnObjectTouched.first)(_player.mObj, _object.mObj);
|
||||||
@ -820,8 +820,8 @@ void Core::EmitObjectTouched(Int32 object_id, Int32 player_id)
|
|||||||
void Core::EmitPickupClaimed(Int32 pickup_id, Int32 player_id)
|
void Core::EmitPickupClaimed(Int32 pickup_id, Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupClaimed(%d, %d)", pickup_id, player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupClaimed(%d, %d)", pickup_id, player_id)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_pickup.mOnClaimed.first)(_player.mObj);
|
(*_pickup.mOnClaimed.first)(_player.mObj);
|
||||||
(*_player.mOnPickupClaimed.first)(_pickup.mObj);
|
(*_player.mOnPickupClaimed.first)(_pickup.mObj);
|
||||||
(*mOnPickupClaimed.first)(_player.mObj, _pickup.mObj);
|
(*mOnPickupClaimed.first)(_player.mObj, _pickup.mObj);
|
||||||
@ -832,8 +832,8 @@ void Core::EmitPickupClaimed(Int32 pickup_id, Int32 player_id)
|
|||||||
void Core::EmitPickupCollected(Int32 pickup_id, Int32 player_id)
|
void Core::EmitPickupCollected(Int32 pickup_id, Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCollected(%d, %d)", pickup_id, player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupCollected(%d, %d)", pickup_id, player_id)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_pickup.mOnCollected.first)(_player.mObj);
|
(*_pickup.mOnCollected.first)(_player.mObj);
|
||||||
(*_player.mOnPickupCollected.first)(_pickup.mObj);
|
(*_player.mOnPickupCollected.first)(_pickup.mObj);
|
||||||
(*mOnPickupCollected.first)(_player.mObj, _pickup.mObj);
|
(*mOnPickupCollected.first)(_player.mObj, _pickup.mObj);
|
||||||
@ -844,7 +844,7 @@ void Core::EmitPickupCollected(Int32 pickup_id, Int32 player_id)
|
|||||||
void Core::EmitPickupRespawn(Int32 pickup_id)
|
void Core::EmitPickupRespawn(Int32 pickup_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupRespawn(%d)", pickup_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupRespawn(%d)", pickup_id)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnRespawn.first)();
|
(*_pickup.mOnRespawn.first)();
|
||||||
(*mOnPickupRespawn.first)(_pickup.mObj);
|
(*mOnPickupRespawn.first)(_pickup.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupRespawn")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupRespawn")
|
||||||
@ -854,8 +854,8 @@ void Core::EmitPickupRespawn(Int32 pickup_id)
|
|||||||
void Core::EmitCheckpointEntered(Int32 checkpoint_id, Int32 player_id)
|
void Core::EmitCheckpointEntered(Int32 checkpoint_id, Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointEntered(%d, %d)", checkpoint_id, player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointEntered(%d, %d)", checkpoint_id, player_id)
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint_id);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_checkpoint.mOnEntered.first)(_player.mObj);
|
(*_checkpoint.mOnEntered.first)(_player.mObj);
|
||||||
(*_player.mOnCheckpointEntered.first)(_checkpoint.mObj);
|
(*_player.mOnCheckpointEntered.first)(_checkpoint.mObj);
|
||||||
(*mOnCheckpointEntered.first)(_player.mObj, _checkpoint.mObj);
|
(*mOnCheckpointEntered.first)(_player.mObj, _checkpoint.mObj);
|
||||||
@ -866,8 +866,8 @@ void Core::EmitCheckpointEntered(Int32 checkpoint_id, Int32 player_id)
|
|||||||
void Core::EmitCheckpointExited(Int32 checkpoint_id, Int32 player_id)
|
void Core::EmitCheckpointExited(Int32 checkpoint_id, Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointExited(%d, %d)", checkpoint_id, player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointExited(%d, %d)", checkpoint_id, player_id)
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint_id);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint_id));
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_checkpoint.mOnExited.first)(_player.mObj);
|
(*_checkpoint.mOnExited.first)(_player.mObj);
|
||||||
(*_player.mOnCheckpointExited.first)(_checkpoint.mObj);
|
(*_player.mOnCheckpointExited.first)(_checkpoint.mObj);
|
||||||
(*mOnCheckpointExited.first)(_player.mObj, _checkpoint.mObj);
|
(*mOnCheckpointExited.first)(_player.mObj, _checkpoint.mObj);
|
||||||
@ -878,7 +878,7 @@ void Core::EmitCheckpointExited(Int32 checkpoint_id, Int32 player_id)
|
|||||||
void Core::EmitCheckpointWorld(Int32 checkpoint_id, Int32 old_world, Int32 new_world)
|
void Core::EmitCheckpointWorld(Int32 checkpoint_id, Int32 old_world, Int32 new_world)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointWorld(%d, %d, %d)", checkpoint_id, old_world, new_world)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointWorld(%d, %d, %d)", checkpoint_id, old_world, new_world)
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint_id);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint_id));
|
||||||
(*_checkpoint.mOnWorld.first)(old_world, new_world);
|
(*_checkpoint.mOnWorld.first)(old_world, new_world);
|
||||||
(*mOnCheckpointWorld.first)(_checkpoint.mObj, old_world, new_world);
|
(*mOnCheckpointWorld.first)(_checkpoint.mObj, old_world, new_world);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointWorld")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointWorld")
|
||||||
@ -888,7 +888,7 @@ void Core::EmitCheckpointWorld(Int32 checkpoint_id, Int32 old_world, Int32 new_w
|
|||||||
void Core::EmitCheckpointRadius(Int32 checkpoint_id, Float32 old_radius, Float32 new_radius)
|
void Core::EmitCheckpointRadius(Int32 checkpoint_id, Float32 old_radius, Float32 new_radius)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointRadius(%d, %f, %f)", checkpoint_id, old_radius, new_radius)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::CheckpointRadius(%d, %f, %f)", checkpoint_id, old_radius, new_radius)
|
||||||
CheckpointInst & _checkpoint = m_Checkpoints.at(checkpoint_id);
|
CheckpointInst & _checkpoint = m_Checkpoints.at(static_cast< size_t >(checkpoint_id));
|
||||||
(*_checkpoint.mOnRadius.first)(old_radius, new_radius);
|
(*_checkpoint.mOnRadius.first)(old_radius, new_radius);
|
||||||
(*mOnCheckpointRadius.first)(_checkpoint.mObj, old_radius, new_radius);
|
(*mOnCheckpointRadius.first)(_checkpoint.mObj, old_radius, new_radius);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointRadius")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::CheckpointRadius")
|
||||||
@ -898,7 +898,7 @@ void Core::EmitCheckpointRadius(Int32 checkpoint_id, Float32 old_radius, Float32
|
|||||||
void Core::EmitObjectWorld(Int32 object_id, Int32 old_world, Int32 new_world)
|
void Core::EmitObjectWorld(Int32 object_id, Int32 old_world, Int32 new_world)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectWorld(%d, %d, %d)", object_id, old_world, new_world)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectWorld(%d, %d, %d)", object_id, old_world, new_world)
|
||||||
ObjectInst & _object = m_Objects.at(object_id);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object_id));
|
||||||
(*_object.mOnWorld.first)(old_world, new_world);
|
(*_object.mOnWorld.first)(old_world, new_world);
|
||||||
(*mOnObjectWorld.first)(_object.mObj, old_world, new_world);
|
(*mOnObjectWorld.first)(_object.mObj, old_world, new_world);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectWorld")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectWorld")
|
||||||
@ -908,7 +908,7 @@ void Core::EmitObjectWorld(Int32 object_id, Int32 old_world, Int32 new_world)
|
|||||||
void Core::EmitObjectAlpha(Int32 object_id, Int32 old_alpha, Int32 new_alpha, Int32 time)
|
void Core::EmitObjectAlpha(Int32 object_id, Int32 old_alpha, Int32 new_alpha, Int32 time)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectAlpha(%d, %d, %d, %d)", object_id, old_alpha, new_alpha, time)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectAlpha(%d, %d, %d, %d)", object_id, old_alpha, new_alpha, time)
|
||||||
ObjectInst & _object = m_Objects.at(object_id);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object_id));
|
||||||
(*_object.mOnAlpha.first)(old_alpha, new_alpha, time);
|
(*_object.mOnAlpha.first)(old_alpha, new_alpha, time);
|
||||||
(*mOnObjectAlpha.first)(_object.mObj, old_alpha, new_alpha, time);
|
(*mOnObjectAlpha.first)(_object.mObj, old_alpha, new_alpha, time);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectAlpha")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectAlpha")
|
||||||
@ -918,7 +918,7 @@ void Core::EmitObjectAlpha(Int32 object_id, Int32 old_alpha, Int32 new_alpha, In
|
|||||||
void Core::EmitPickupWorld(Int32 pickup_id, Int32 old_world, Int32 new_world)
|
void Core::EmitPickupWorld(Int32 pickup_id, Int32 old_world, Int32 new_world)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupWorld(%d, %d, %d)", pickup_id, old_world, new_world)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupWorld(%d, %d, %d)", pickup_id, old_world, new_world)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnWorld.first)(old_world, new_world);
|
(*_pickup.mOnWorld.first)(old_world, new_world);
|
||||||
(*mOnPickupWorld.first)(_pickup.mObj, old_world, new_world);
|
(*mOnPickupWorld.first)(_pickup.mObj, old_world, new_world);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupWorld")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupWorld")
|
||||||
@ -928,7 +928,7 @@ void Core::EmitPickupWorld(Int32 pickup_id, Int32 old_world, Int32 new_world)
|
|||||||
void Core::EmitPickupAlpha(Int32 pickup_id, Int32 old_alpha, Int32 new_alpha)
|
void Core::EmitPickupAlpha(Int32 pickup_id, Int32 old_alpha, Int32 new_alpha)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAlpha(%d, %d, %d)", pickup_id, old_alpha, new_alpha)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAlpha(%d, %d, %d)", pickup_id, old_alpha, new_alpha)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnAlpha.first)(old_alpha, new_alpha);
|
(*_pickup.mOnAlpha.first)(old_alpha, new_alpha);
|
||||||
(*mOnPickupAlpha.first)(_pickup.mObj, old_alpha, new_alpha);
|
(*mOnPickupAlpha.first)(_pickup.mObj, old_alpha, new_alpha);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAlpha")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAlpha")
|
||||||
@ -938,7 +938,7 @@ void Core::EmitPickupAlpha(Int32 pickup_id, Int32 old_alpha, Int32 new_alpha)
|
|||||||
void Core::EmitPickupAutomatic(Int32 pickup_id, bool old_status, bool new_status)
|
void Core::EmitPickupAutomatic(Int32 pickup_id, bool old_status, bool new_status)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAutomatic(%d, %d, %d)", pickup_id, old_status, new_status)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAutomatic(%d, %d, %d)", pickup_id, old_status, new_status)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnAutomatic.first)(old_status, new_status);
|
(*_pickup.mOnAutomatic.first)(old_status, new_status);
|
||||||
(*mOnPickupAutomatic.first)(_pickup.mObj, old_status, new_status);
|
(*mOnPickupAutomatic.first)(_pickup.mObj, old_status, new_status);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAutomatic")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAutomatic")
|
||||||
@ -948,7 +948,7 @@ void Core::EmitPickupAutomatic(Int32 pickup_id, bool old_status, bool new_status
|
|||||||
void Core::EmitPickupAutoTimer(Int32 pickup_id, Int32 old_timer, Int32 new_timer)
|
void Core::EmitPickupAutoTimer(Int32 pickup_id, Int32 old_timer, Int32 new_timer)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAutoTimer(%d, %d, %d)", pickup_id, old_timer, new_timer)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupAutoTimer(%d, %d, %d)", pickup_id, old_timer, new_timer)
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnAutoTimer.first)(old_timer, new_timer);
|
(*_pickup.mOnAutoTimer.first)(old_timer, new_timer);
|
||||||
(*mOnPickupAutoTimer.first)(_pickup.mObj, old_timer, new_timer);
|
(*mOnPickupAutoTimer.first)(_pickup.mObj, old_timer, new_timer);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAutoTimer")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupAutoTimer")
|
||||||
@ -959,7 +959,7 @@ void Core::EmitPickupOption(Int32 pickup_id, Int32 option_id, bool value,
|
|||||||
Int32 header, LightObj & payload)
|
Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupOption(%d, %d, %d, %d, %s)", pickup_id, option_id, value, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PickupOption(%d, %d, %d, %d, %s)", pickup_id, option_id, value, header, NULL_SQOBJ_(payload))
|
||||||
PickupInst & _pickup = m_Pickups.at(pickup_id);
|
PickupInst & _pickup = m_Pickups.at(static_cast< size_t >(pickup_id));
|
||||||
(*_pickup.mOnOption.first)(option_id, value, header, payload);
|
(*_pickup.mOnOption.first)(option_id, value, header, payload);
|
||||||
(*mOnPickupOption.first)(_pickup.mObj, option_id, value, header, payload);
|
(*mOnPickupOption.first)(_pickup.mObj, option_id, value, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupOption")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PickupOption")
|
||||||
@ -969,7 +969,7 @@ void Core::EmitPickupOption(Int32 pickup_id, Int32 option_id, bool value,
|
|||||||
void Core::EmitObjectReport(Int32 object_id, bool old_status, bool new_status, bool touched)
|
void Core::EmitObjectReport(Int32 object_id, bool old_status, bool new_status, bool touched)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectReport(%d, %d, %d)", object_id, new_status, touched)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ObjectReport(%d, %d, %d)", object_id, new_status, touched)
|
||||||
ObjectInst & _object = m_Objects.at(object_id);
|
ObjectInst & _object = m_Objects.at(static_cast< size_t >(object_id));
|
||||||
(*_object.mOnReport.first)(old_status, new_status, touched);
|
(*_object.mOnReport.first)(old_status, new_status, touched);
|
||||||
(*mOnObjectReport.first)(_object.mObj, old_status, new_status, touched);
|
(*mOnObjectReport.first)(_object.mObj, old_status, new_status, touched);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectReport")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ObjectReport")
|
||||||
@ -979,7 +979,7 @@ void Core::EmitObjectReport(Int32 object_id, bool old_status, bool new_status, b
|
|||||||
void Core::EmitPlayerHealth(Int32 player_id, Float32 old_health, Float32 new_health)
|
void Core::EmitPlayerHealth(Int32 player_id, Float32 old_health, Float32 new_health)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerHealth(%d, %f, %f)", player_id, old_health, new_health)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerHealth(%d, %f, %f)", player_id, old_health, new_health)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnHealth.first)(old_health, new_health);
|
(*_player.mOnHealth.first)(old_health, new_health);
|
||||||
(*mOnPlayerHealth.first)(_player.mObj, old_health, new_health);
|
(*mOnPlayerHealth.first)(_player.mObj, old_health, new_health);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerHealth")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerHealth")
|
||||||
@ -989,7 +989,7 @@ void Core::EmitPlayerHealth(Int32 player_id, Float32 old_health, Float32 new_hea
|
|||||||
void Core::EmitPlayerArmour(Int32 player_id, Float32 old_armour, Float32 new_armour)
|
void Core::EmitPlayerArmour(Int32 player_id, Float32 old_armour, Float32 new_armour)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerArmour(%d, %f, %f)", player_id, old_armour, new_armour)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerArmour(%d, %f, %f)", player_id, old_armour, new_armour)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnArmour.first)(old_armour, new_armour);
|
(*_player.mOnArmour.first)(old_armour, new_armour);
|
||||||
(*mOnPlayerArmour.first)(_player.mObj, old_armour, new_armour);
|
(*mOnPlayerArmour.first)(_player.mObj, old_armour, new_armour);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerArmour")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerArmour")
|
||||||
@ -999,7 +999,7 @@ void Core::EmitPlayerArmour(Int32 player_id, Float32 old_armour, Float32 new_arm
|
|||||||
void Core::EmitPlayerWeapon(Int32 player_id, Int32 old_weapon, Int32 new_weapon)
|
void Core::EmitPlayerWeapon(Int32 player_id, Int32 old_weapon, Int32 new_weapon)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWeapon(%d, %d, %d)", player_id, old_weapon, new_weapon)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWeapon(%d, %d, %d)", player_id, old_weapon, new_weapon)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnWeapon.first)(old_weapon, new_weapon);
|
(*_player.mOnWeapon.first)(old_weapon, new_weapon);
|
||||||
(*mOnPlayerWeapon.first)(_player.mObj, old_weapon, new_weapon);
|
(*mOnPlayerWeapon.first)(_player.mObj, old_weapon, new_weapon);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWeapon")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWeapon")
|
||||||
@ -1009,7 +1009,7 @@ void Core::EmitPlayerWeapon(Int32 player_id, Int32 old_weapon, Int32 new_weapon)
|
|||||||
void Core::EmitPlayerHeading(Int32 player_id, Float32 old_heading, Float32 new_heading)
|
void Core::EmitPlayerHeading(Int32 player_id, Float32 old_heading, Float32 new_heading)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerHeading(%d, %f, %f)", player_id, old_heading, new_heading)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerHeading(%d, %f, %f)", player_id, old_heading, new_heading)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnHeading.first)(old_heading, new_heading);
|
(*_player.mOnHeading.first)(old_heading, new_heading);
|
||||||
(*mOnPlayerHeading.first)(_player.mObj, old_heading, new_heading);
|
(*mOnPlayerHeading.first)(_player.mObj, old_heading, new_heading);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerHeading")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerHeading")
|
||||||
@ -1019,7 +1019,7 @@ void Core::EmitPlayerHeading(Int32 player_id, Float32 old_heading, Float32 new_h
|
|||||||
void Core::EmitPlayerPosition(Int32 player_id)
|
void Core::EmitPlayerPosition(Int32 player_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerPosition(%d)", player_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerPosition(%d)", player_id)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnPosition.first)(_player.mTrackPositionHeader, _player.mTrackPositionPayload);
|
(*_player.mOnPosition.first)(_player.mTrackPositionHeader, _player.mTrackPositionPayload);
|
||||||
(*mOnPlayerPosition.first)(_player.mObj, _player.mTrackPositionHeader, _player.mTrackPositionPayload);
|
(*mOnPlayerPosition.first)(_player.mObj, _player.mTrackPositionHeader, _player.mTrackPositionPayload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerPosition")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerPosition")
|
||||||
@ -1030,7 +1030,7 @@ void Core::EmitPlayerOption(Int32 player_id, Int32 option_id, bool value,
|
|||||||
Int32 header, LightObj & payload)
|
Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerOption(%d, %d, %d, %d, %s)", player_id, option_id, value, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerOption(%d, %d, %d, %d, %s)", player_id, option_id, value, header, NULL_SQOBJ_(payload))
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnOption.first)(option_id, value, header, payload);
|
(*_player.mOnOption.first)(option_id, value, header, payload);
|
||||||
(*mOnPlayerOption.first)(_player.mObj, option_id, value, header, payload);
|
(*mOnPlayerOption.first)(_player.mObj, option_id, value, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerOption")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerOption")
|
||||||
@ -1040,7 +1040,7 @@ void Core::EmitPlayerOption(Int32 player_id, Int32 option_id, bool value,
|
|||||||
void Core::EmitPlayerAdmin(Int32 player_id, bool old_status, bool new_status)
|
void Core::EmitPlayerAdmin(Int32 player_id, bool old_status, bool new_status)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAdmin(%d, %d, %d)", player_id, old_status, new_status)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAdmin(%d, %d, %d)", player_id, old_status, new_status)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnAdmin.first)(old_status, new_status);
|
(*_player.mOnAdmin.first)(old_status, new_status);
|
||||||
(*mOnPlayerAdmin.first)(_player.mObj, old_status, new_status);
|
(*mOnPlayerAdmin.first)(_player.mObj, old_status, new_status);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAdmin")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAdmin")
|
||||||
@ -1050,7 +1050,7 @@ void Core::EmitPlayerAdmin(Int32 player_id, bool old_status, bool new_status)
|
|||||||
void Core::EmitPlayerWorld(Int32 player_id, Int32 old_world, Int32 new_world, bool secondary)
|
void Core::EmitPlayerWorld(Int32 player_id, Int32 old_world, Int32 new_world, bool secondary)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWorld(%d, %d, %d, %d)", player_id, old_world, new_world, secondary)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWorld(%d, %d, %d, %d)", player_id, old_world, new_world, secondary)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnWorld.first)(old_world, new_world, secondary);
|
(*_player.mOnWorld.first)(old_world, new_world, secondary);
|
||||||
(*mOnPlayerWorld.first)(_player.mObj, old_world, new_world, secondary);
|
(*mOnPlayerWorld.first)(_player.mObj, old_world, new_world, secondary);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWorld")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWorld")
|
||||||
@ -1060,7 +1060,7 @@ void Core::EmitPlayerWorld(Int32 player_id, Int32 old_world, Int32 new_world, bo
|
|||||||
void Core::EmitPlayerTeam(Int32 player_id, Int32 old_team, Int32 new_team)
|
void Core::EmitPlayerTeam(Int32 player_id, Int32 old_team, Int32 new_team)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerTeam(%d, %d, %d)", player_id, old_team, new_team)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerTeam(%d, %d, %d)", player_id, old_team, new_team)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnTeam.first)(old_team, new_team);
|
(*_player.mOnTeam.first)(old_team, new_team);
|
||||||
(*mOnPlayerTeam.first)(_player.mObj, old_team, new_team);
|
(*mOnPlayerTeam.first)(_player.mObj, old_team, new_team);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerTeam")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerTeam")
|
||||||
@ -1070,7 +1070,7 @@ void Core::EmitPlayerTeam(Int32 player_id, Int32 old_team, Int32 new_team)
|
|||||||
void Core::EmitPlayerSkin(Int32 player_id, Int32 old_skin, Int32 new_skin)
|
void Core::EmitPlayerSkin(Int32 player_id, Int32 old_skin, Int32 new_skin)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSkin(%d, %d, %d)", player_id, old_skin, new_skin)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerSkin(%d, %d, %d)", player_id, old_skin, new_skin)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnSkin.first)(old_skin, new_skin);
|
(*_player.mOnSkin.first)(old_skin, new_skin);
|
||||||
(*mOnPlayerSkin.first)(_player.mObj, old_skin, new_skin);
|
(*mOnPlayerSkin.first)(_player.mObj, old_skin, new_skin);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSkin")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerSkin")
|
||||||
@ -1080,7 +1080,7 @@ void Core::EmitPlayerSkin(Int32 player_id, Int32 old_skin, Int32 new_skin)
|
|||||||
void Core::EmitPlayerMoney(Int32 player_id, Int32 old_money, Int32 new_money)
|
void Core::EmitPlayerMoney(Int32 player_id, Int32 old_money, Int32 new_money)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerMoney(%d, %d, %d)", player_id, old_money, new_money)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerMoney(%d, %d, %d)", player_id, old_money, new_money)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnMoney.first)(old_money, new_money);
|
(*_player.mOnMoney.first)(old_money, new_money);
|
||||||
(*mOnPlayerMoney.first)(_player.mObj, old_money, new_money);
|
(*mOnPlayerMoney.first)(_player.mObj, old_money, new_money);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerMoney")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerMoney")
|
||||||
@ -1090,7 +1090,7 @@ void Core::EmitPlayerMoney(Int32 player_id, Int32 old_money, Int32 new_money)
|
|||||||
void Core::EmitPlayerScore(Int32 player_id, Int32 old_score, Int32 new_score)
|
void Core::EmitPlayerScore(Int32 player_id, Int32 old_score, Int32 new_score)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerScore(%d, %d, %d)", player_id, old_score, new_score)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerScore(%d, %d, %d)", player_id, old_score, new_score)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnScore.first)(old_score, new_score);
|
(*_player.mOnScore.first)(old_score, new_score);
|
||||||
(*mOnPlayerScore.first)(_player.mObj, old_score, new_score);
|
(*mOnPlayerScore.first)(_player.mObj, old_score, new_score);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerScore")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerScore")
|
||||||
@ -1100,7 +1100,7 @@ void Core::EmitPlayerScore(Int32 player_id, Int32 old_score, Int32 new_score)
|
|||||||
void Core::EmitPlayerWantedLevel(Int32 player_id, Int32 old_level, Int32 new_level)
|
void Core::EmitPlayerWantedLevel(Int32 player_id, Int32 old_level, Int32 new_level)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWantedLevel(%d, %d, %d)", player_id, old_level, new_level)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerWantedLevel(%d, %d, %d)", player_id, old_level, new_level)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnWantedLevel.first)(old_level, new_level);
|
(*_player.mOnWantedLevel.first)(old_level, new_level);
|
||||||
(*mOnPlayerWantedLevel.first)(_player.mObj, old_level, new_level);
|
(*mOnPlayerWantedLevel.first)(_player.mObj, old_level, new_level);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWantedLevel")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerWantedLevel")
|
||||||
@ -1110,7 +1110,7 @@ void Core::EmitPlayerWantedLevel(Int32 player_id, Int32 old_level, Int32 new_lev
|
|||||||
void Core::EmitPlayerImmunity(Int32 player_id, Int32 old_immunity, Int32 new_immunity)
|
void Core::EmitPlayerImmunity(Int32 player_id, Int32 old_immunity, Int32 new_immunity)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerImmunity(%d, %d, %d)", player_id, old_immunity, new_immunity)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerImmunity(%d, %d, %d)", player_id, old_immunity, new_immunity)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnImmunity.first)(old_immunity, new_immunity);
|
(*_player.mOnImmunity.first)(old_immunity, new_immunity);
|
||||||
(*mOnPlayerImmunity.first)(_player.mObj, old_immunity, new_immunity);
|
(*mOnPlayerImmunity.first)(_player.mObj, old_immunity, new_immunity);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerImmunity")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerImmunity")
|
||||||
@ -1120,7 +1120,7 @@ void Core::EmitPlayerImmunity(Int32 player_id, Int32 old_immunity, Int32 new_imm
|
|||||||
void Core::EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, Int32 fade)
|
void Core::EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, Int32 fade)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAlpha(%d, %d, %d, %d)", player_id, old_alpha, new_alpha, fade)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerAlpha(%d, %d, %d, %d)", player_id, old_alpha, new_alpha, fade)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnAlpha.first)(old_alpha, new_alpha, fade);
|
(*_player.mOnAlpha.first)(old_alpha, new_alpha, fade);
|
||||||
(*mOnPlayerAlpha.first)(_player.mObj, old_alpha, new_alpha, fade);
|
(*mOnPlayerAlpha.first)(_player.mObj, old_alpha, new_alpha, fade);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAlpha")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerAlpha")
|
||||||
@ -1130,7 +1130,7 @@ void Core::EmitPlayerAlpha(Int32 player_id, Int32 old_alpha, Int32 new_alpha, In
|
|||||||
void Core::EmitPlayerEnterArea(Int32 player_id, LightObj & area_obj)
|
void Core::EmitPlayerEnterArea(Int32 player_id, LightObj & area_obj)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEnterArea(%d, %s)", player_id, NULL_SQOBJ_(area_obj))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerEnterArea(%d, %s)", player_id, NULL_SQOBJ_(area_obj))
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnEnterArea.first)(area_obj);
|
(*_player.mOnEnterArea.first)(area_obj);
|
||||||
(*mOnPlayerEnterArea.first)(_player.mObj, area_obj);
|
(*mOnPlayerEnterArea.first)(_player.mObj, area_obj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerEnterArea")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerEnterArea")
|
||||||
@ -1140,7 +1140,7 @@ void Core::EmitPlayerEnterArea(Int32 player_id, LightObj & area_obj)
|
|||||||
void Core::EmitPlayerLeaveArea(Int32 player_id, LightObj & area_obj)
|
void Core::EmitPlayerLeaveArea(Int32 player_id, LightObj & area_obj)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerLeaveArea(%d, %s)", player_id, NULL_SQOBJ_(area_obj))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::PlayerLeaveArea(%d, %s)", player_id, NULL_SQOBJ_(area_obj))
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
(*_player.mOnLeaveArea.first)(area_obj);
|
(*_player.mOnLeaveArea.first)(area_obj);
|
||||||
(*mOnPlayerLeaveArea.first)(_player.mObj, area_obj);
|
(*mOnPlayerLeaveArea.first)(_player.mObj, area_obj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerLeaveArea")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::PlayerLeaveArea")
|
||||||
@ -1150,7 +1150,7 @@ void Core::EmitPlayerLeaveArea(Int32 player_id, LightObj & area_obj)
|
|||||||
void Core::EmitVehicleColor(Int32 vehicle_id, Int32 changed)
|
void Core::EmitVehicleColor(Int32 vehicle_id, Int32 changed)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleColor(%d, %d)", vehicle_id, changed)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleColor(%d, %d)", vehicle_id, changed)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnColor.first)(changed);
|
(*_vehicle.mOnColor.first)(changed);
|
||||||
(*mOnVehicleColor.first)(_vehicle.mObj, changed);
|
(*mOnVehicleColor.first)(_vehicle.mObj, changed);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleColor")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleColor")
|
||||||
@ -1160,7 +1160,7 @@ void Core::EmitVehicleColor(Int32 vehicle_id, Int32 changed)
|
|||||||
void Core::EmitVehicleHealth(Int32 vehicle_id, Float32 old_health, Float32 new_health)
|
void Core::EmitVehicleHealth(Int32 vehicle_id, Float32 old_health, Float32 new_health)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleHealth(%d, %f, %f)", vehicle_id, old_health, new_health)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleHealth(%d, %f, %f)", vehicle_id, old_health, new_health)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnHealth.first)(old_health, new_health);
|
(*_vehicle.mOnHealth.first)(old_health, new_health);
|
||||||
(*mOnVehicleHealth.first)(_vehicle.mObj, old_health, new_health);
|
(*mOnVehicleHealth.first)(_vehicle.mObj, old_health, new_health);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleHealth")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleHealth")
|
||||||
@ -1170,7 +1170,7 @@ void Core::EmitVehicleHealth(Int32 vehicle_id, Float32 old_health, Float32 new_h
|
|||||||
void Core::EmitVehiclePosition(Int32 vehicle_id)
|
void Core::EmitVehiclePosition(Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehiclePosition(%d)", vehicle_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehiclePosition(%d)", vehicle_id)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnPosition.first)();
|
(*_vehicle.mOnPosition.first)();
|
||||||
(*mOnVehiclePosition.first)(_vehicle.mObj);
|
(*mOnVehiclePosition.first)(_vehicle.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehiclePosition")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehiclePosition")
|
||||||
@ -1180,7 +1180,7 @@ void Core::EmitVehiclePosition(Int32 vehicle_id)
|
|||||||
void Core::EmitVehicleRotation(Int32 vehicle_id)
|
void Core::EmitVehicleRotation(Int32 vehicle_id)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRotation(%d)", vehicle_id)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRotation(%d)", vehicle_id)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnRotation.first)();
|
(*_vehicle.mOnRotation.first)();
|
||||||
(*mOnVehicleRotation.first)(_vehicle.mObj);
|
(*mOnVehicleRotation.first)(_vehicle.mObj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRotation")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRotation")
|
||||||
@ -1191,7 +1191,7 @@ void Core::EmitVehicleOption(Int32 vehicle_id, Int32 option_id, bool value,
|
|||||||
Int32 header, LightObj & payload)
|
Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleOption(%d, %d, %d, %d, %s)", vehicle_id, option_id, value, header, NULL_SQOBJ_(payload))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleOption(%d, %d, %d, %d, %s)", vehicle_id, option_id, value, header, NULL_SQOBJ_(payload))
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnOption.first)(option_id, value, header, payload);
|
(*_vehicle.mOnOption.first)(option_id, value, header, payload);
|
||||||
(*mOnVehicleOption.first)(_vehicle.mObj, option_id, value, header, payload);
|
(*mOnVehicleOption.first)(_vehicle.mObj, option_id, value, header, payload);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleOption")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleOption")
|
||||||
@ -1201,7 +1201,7 @@ void Core::EmitVehicleOption(Int32 vehicle_id, Int32 option_id, bool value,
|
|||||||
void Core::EmitVehicleWorld(Int32 vehicle_id, Int32 old_world, Int32 new_world)
|
void Core::EmitVehicleWorld(Int32 vehicle_id, Int32 old_world, Int32 new_world)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleWorld(%d, %d, %d)", vehicle_id, old_world, new_world)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleWorld(%d, %d, %d)", vehicle_id, old_world, new_world)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnWorld.first)(old_world, new_world);
|
(*_vehicle.mOnWorld.first)(old_world, new_world);
|
||||||
(*mOnVehicleWorld.first)(_vehicle.mObj, old_world, new_world);
|
(*mOnVehicleWorld.first)(_vehicle.mObj, old_world, new_world);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleWorld")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleWorld")
|
||||||
@ -1211,7 +1211,7 @@ void Core::EmitVehicleWorld(Int32 vehicle_id, Int32 old_world, Int32 new_world)
|
|||||||
void Core::EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_immunity)
|
void Core::EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_immunity)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleImmunity(%d, %d, %d)", vehicle_id, old_immunity, new_immunity)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleImmunity(%d, %d, %d)", vehicle_id, old_immunity, new_immunity)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnImmunity.first)(old_immunity, new_immunity);
|
(*_vehicle.mOnImmunity.first)(old_immunity, new_immunity);
|
||||||
(*mOnVehicleImmunity.first)(_vehicle.mObj, old_immunity, new_immunity);
|
(*mOnVehicleImmunity.first)(_vehicle.mObj, old_immunity, new_immunity);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleImmunity")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleImmunity")
|
||||||
@ -1221,7 +1221,7 @@ void Core::EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_i
|
|||||||
void Core::EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status, Int32 new_status)
|
void Core::EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status, Int32 new_status)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehiclePartStatus(%d, %d, %d, %d)", vehicle_id, part, old_status, new_status)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehiclePartStatus(%d, %d, %d, %d)", vehicle_id, part, old_status, new_status)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnPartStatus.first)(part, old_status, new_status);
|
(*_vehicle.mOnPartStatus.first)(part, old_status, new_status);
|
||||||
(*mOnVehiclePartStatus.first)(_vehicle.mObj, part, old_status, new_status);
|
(*mOnVehiclePartStatus.first)(_vehicle.mObj, part, old_status, new_status);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehiclePartStatus")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehiclePartStatus")
|
||||||
@ -1231,7 +1231,7 @@ void Core::EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status,
|
|||||||
void Core::EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status, Int32 new_status)
|
void Core::EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status, Int32 new_status)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleTyreStatus(%d, %d, %d, %d)", vehicle_id, tyre, old_status, new_status)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleTyreStatus(%d, %d, %d, %d)", vehicle_id, tyre, old_status, new_status)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnTyreStatus.first)(tyre, old_status, new_status);
|
(*_vehicle.mOnTyreStatus.first)(tyre, old_status, new_status);
|
||||||
(*mOnVehicleTyreStatus.first)(_vehicle.mObj, tyre, old_status, new_status);
|
(*mOnVehicleTyreStatus.first)(_vehicle.mObj, tyre, old_status, new_status);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleTyreStatus")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleTyreStatus")
|
||||||
@ -1241,7 +1241,7 @@ void Core::EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status,
|
|||||||
void Core::EmitVehicleDamageData(Int32 vehicle_id, Uint32 old_data, Uint32 new_data)
|
void Core::EmitVehicleDamageData(Int32 vehicle_id, Uint32 old_data, Uint32 new_data)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleDamageData(%d, %u, %u)", vehicle_id, old_data, new_data)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleDamageData(%d, %u, %u)", vehicle_id, old_data, new_data)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnDamageData.first)(old_data, new_data);
|
(*_vehicle.mOnDamageData.first)(old_data, new_data);
|
||||||
(*mOnVehicleDamageData.first)(_vehicle.mObj, old_data, new_data);
|
(*mOnVehicleDamageData.first)(_vehicle.mObj, old_data, new_data);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleDamageData")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleDamageData")
|
||||||
@ -1251,7 +1251,7 @@ void Core::EmitVehicleDamageData(Int32 vehicle_id, Uint32 old_data, Uint32 new_d
|
|||||||
void Core::EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio)
|
void Core::EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRadio(%d, %d, %d)", vehicle_id, old_radio, new_radio)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleRadio(%d, %d, %d)", vehicle_id, old_radio, new_radio)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnRadio.first)(old_radio, new_radio);
|
(*_vehicle.mOnRadio.first)(old_radio, new_radio);
|
||||||
(*mOnVehicleRadio.first)(_vehicle.mObj, old_radio, new_radio);
|
(*mOnVehicleRadio.first)(_vehicle.mObj, old_radio, new_radio);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRadio")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleRadio")
|
||||||
@ -1261,7 +1261,7 @@ void Core::EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio)
|
|||||||
void Core::EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_data, Float32 new_data)
|
void Core::EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_data, Float32 new_data)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleHandlingRule(%d, %d, %f, %f)", vehicle_id, rule, old_data, new_data)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleHandlingRule(%d, %d, %f, %f)", vehicle_id, rule, old_data, new_data)
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnHandlingRule.first)(rule, old_data, new_data);
|
(*_vehicle.mOnHandlingRule.first)(rule, old_data, new_data);
|
||||||
(*mOnVehicleHandlingRule.first)(_vehicle.mObj, rule, old_data, new_data);
|
(*mOnVehicleHandlingRule.first)(_vehicle.mObj, rule, old_data, new_data);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleHandlingRule")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleHandlingRule")
|
||||||
@ -1271,7 +1271,7 @@ void Core::EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_dat
|
|||||||
void Core::EmitVehicleEnterArea(Int32 vehicle_id, LightObj & area_obj)
|
void Core::EmitVehicleEnterArea(Int32 vehicle_id, LightObj & area_obj)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleEnterArea(%d, %s)", vehicle_id, NULL_SQOBJ_(area_obj))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleEnterArea(%d, %s)", vehicle_id, NULL_SQOBJ_(area_obj))
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnEnterArea.first)(area_obj);
|
(*_vehicle.mOnEnterArea.first)(area_obj);
|
||||||
(*mOnVehicleEnterArea.first)(_vehicle.mObj, area_obj);
|
(*mOnVehicleEnterArea.first)(_vehicle.mObj, area_obj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleEnterArea")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleEnterArea")
|
||||||
@ -1281,7 +1281,7 @@ void Core::EmitVehicleEnterArea(Int32 vehicle_id, LightObj & area_obj)
|
|||||||
void Core::EmitVehicleLeaveArea(Int32 vehicle_id, LightObj & area_obj)
|
void Core::EmitVehicleLeaveArea(Int32 vehicle_id, LightObj & area_obj)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleLeaveArea(%d, %s)", vehicle_id, NULL_SQOBJ_(area_obj))
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::VehicleLeaveArea(%d, %s)", vehicle_id, NULL_SQOBJ_(area_obj))
|
||||||
VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
|
VehicleInst & _vehicle = m_Vehicles.at(static_cast< size_t >(vehicle_id));
|
||||||
(*_vehicle.mOnLeaveArea.first)(area_obj);
|
(*_vehicle.mOnLeaveArea.first)(area_obj);
|
||||||
(*mOnVehicleLeaveArea.first)(_vehicle.mObj, area_obj);
|
(*mOnVehicleLeaveArea.first)(_vehicle.mObj, area_obj);
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleLeaveArea")
|
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::VehicleLeaveArea")
|
||||||
@ -1812,7 +1812,7 @@ void Core::EmitVehicleUpdate(Int32 vehicle_id, vcmpVehicleUpdate update_type)
|
|||||||
void Core::EmitClientScriptData(Int32 player_id, const uint8_t * data, size_t size)
|
void Core::EmitClientScriptData(Int32 player_id, const uint8_t * data, size_t size)
|
||||||
{
|
{
|
||||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ClientScriptData(%d, [byte stream], %" PRINT_SZ_FMT ")", player_id, size)
|
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ClientScriptData(%d, [byte stream], %" PRINT_SZ_FMT ")", player_id, size)
|
||||||
PlayerInst & _player = m_Players.at(player_id);
|
PlayerInst & _player = m_Players.at(static_cast< size_t >(player_id));
|
||||||
// Don't even bother if there's no one listening
|
// Don't even bother if there's no one listening
|
||||||
if (_player.mOnClientScriptData.first->IsEmpty() && mOnClientScriptData.first->IsEmpty())
|
if (_player.mOnClientScriptData.first->IsEmpty() && mOnClientScriptData.first->IsEmpty())
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "Entity/Vehicle.hpp"
|
#include "Entity/Vehicle.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#define SQMOD_VALID_NAME_STR(t) if (!t) { STHROWF("The specified name is invalid"); }
|
#define SQMOD_VALID_NAME_STR(t) if (!(t)) { STHROWF("The specified name is invalid"); }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
@ -119,8 +119,8 @@ static const LightObj & Blip_FindBySprID(Int32 sprid)
|
|||||||
STHROWF("The specified sprite identifier is invalid: %d", sprid);
|
STHROWF("The specified sprite identifier is invalid: %d", sprid);
|
||||||
}
|
}
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Blips::const_iterator itr = Core::Get().GetBlips().cbegin();
|
auto itr = Core::Get().GetBlips().cbegin();
|
||||||
Core::Blips::const_iterator end = Core::Get().GetBlips().cend();
|
auto end = Core::Get().GetBlips().cend();
|
||||||
// Process each entity in the pool
|
// Process each entity in the pool
|
||||||
for (; itr != end; ++itr)
|
for (; itr != end; ++itr)
|
||||||
{
|
{
|
||||||
@ -467,7 +467,7 @@ static inline Uint32 Player_EachWhereNameMatchesData(bool neg, bool cs, CSStr na
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Count all entities of this type where the name matches or not the specified one.
|
* Count all entities of this type where the name matches or not the specified one.
|
||||||
*/
|
*/
|
||||||
static inline Uint32 Player_CountWhereNameEquals(bool neg, bool cs, CSStr name)
|
static inline CountElemFunc <CPlayer> Player_CountWhereNameEquals(bool neg, bool cs, CSStr name)
|
||||||
{
|
{
|
||||||
SQMOD_VALID_NAME_STR(name)
|
SQMOD_VALID_NAME_STR(name)
|
||||||
// Create a new element counter
|
// Create a new element counter
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#define SQMOD_VALID_TAG_STR(t) if (!t) { STHROWF("The specified tag is invalid"); }
|
#define SQMOD_VALID_TAG_STR(t) if (!(t)) { STHROWF("The specified tag is invalid"); }
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
@ -20,7 +20,7 @@ namespace Algo {
|
|||||||
*/
|
*/
|
||||||
inline CSStr sqmod_stristr(CSStr haystack, CSStr needle)
|
inline CSStr sqmod_stristr(CSStr haystack, CSStr needle)
|
||||||
{
|
{
|
||||||
for (const SQChar chr = std::tolower(*needle); *haystack != '\0'; ++haystack)
|
for (const auto chr = static_cast< const SQChar >(std::tolower(*needle)); *haystack != '\0'; ++haystack)
|
||||||
{
|
{
|
||||||
if (static_cast< SQChar >(std::tolower(*haystack)) != chr)
|
if (static_cast< SQChar >(std::tolower(*haystack)) != chr)
|
||||||
{
|
{
|
||||||
@ -241,7 +241,7 @@ void EachBegins(Iterator first, Iterator last,
|
|||||||
// Compare the string
|
// Compare the string
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
collect(*first);
|
collect(*first);
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ void EachBeginsWhile(Iterator first, Iterator last,
|
|||||||
// Compare the string
|
// Compare the string
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
if (!collect(*first))
|
if (!collect(*first))
|
||||||
{
|
{
|
||||||
@ -311,7 +311,7 @@ void EachEnds(Iterator first, Iterator last,
|
|||||||
// Compare the tag
|
// Compare the tag
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
collect(*first);
|
collect(*first);
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ void EachEndsWhile(Iterator first, Iterator last,
|
|||||||
// Compare the tag
|
// Compare the tag
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
if (!collect(*first))
|
if (!collect(*first))
|
||||||
{
|
{
|
||||||
@ -477,7 +477,7 @@ void FirstBegins(Iterator first, Iterator last,
|
|||||||
// Compare the string
|
// Compare the string
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
receive(*first);
|
receive(*first);
|
||||||
break;
|
break;
|
||||||
@ -511,7 +511,7 @@ void FirstEnds(Iterator first, Iterator last,
|
|||||||
// Compare the string
|
// Compare the string
|
||||||
if (s.size() >= len)
|
if (s.size() >= len)
|
||||||
{
|
{
|
||||||
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), len, cs) == 0) == neg)
|
if ((CompareStr(s.c_str(), str, static_cast< Uint32 >(s.size() - len), static_cast< Uint32 >(len), cs) == 0) == neg)
|
||||||
{
|
{
|
||||||
receive(*first);
|
receive(*first);
|
||||||
break;
|
break;
|
||||||
@ -895,7 +895,7 @@ template < typename T > struct AppendElemFunc
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Base constructor.
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
AppendElemFunc(SQInteger idx = -2, HSQUIRRELVM vm = DefaultVM::Get())
|
explicit AppendElemFunc(SQInteger idx = -2, HSQUIRRELVM vm = DefaultVM::Get())
|
||||||
: mIdx(idx), mVM(vm)
|
: mIdx(idx), mVM(vm)
|
||||||
{
|
{
|
||||||
/* ... */
|
/* ... */
|
||||||
@ -979,7 +979,7 @@ public:
|
|||||||
// Push the element instance on the stack
|
// Push the element instance on the stack
|
||||||
sq_pushobject(vm, inst.mObj.mObj);
|
sq_pushobject(vm, inst.mObj.mObj);
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
SQRESULT res = sq_call(vm, 2, true, ErrorHandling::IsEnabled());
|
SQRESULT res = sq_call(vm, 2, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Make sure the callback object and return value are popped from the stack
|
// Make sure the callback object and return value are popped from the stack
|
||||||
const SqPopGuard pg(vm, 2);
|
const SqPopGuard pg(vm, 2);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -1009,7 +1009,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Implicit cast to the count value.
|
* Implicit cast to the count value.
|
||||||
*/
|
*/
|
||||||
operator Uint32 () const
|
operator Uint32 () const // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
|
||||||
{
|
{
|
||||||
return mCount;
|
return mCount;
|
||||||
}
|
}
|
||||||
@ -1055,7 +1055,7 @@ public:
|
|||||||
// Push the iteration context on the stack
|
// Push the iteration context on the stack
|
||||||
sq_pushobject(vm, mData.mObj);
|
sq_pushobject(vm, mData.mObj);
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
SQRESULT res = sq_call(vm, 3, true, ErrorHandling::IsEnabled());
|
SQRESULT res = sq_call(vm, 3, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Make sure the callback object and return value are popped from the stack
|
// Make sure the callback object and return value are popped from the stack
|
||||||
const SqPopGuard pg(vm, 2);
|
const SqPopGuard pg(vm, 2);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -1085,7 +1085,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Implicit cast to the count value.
|
* Implicit cast to the count value.
|
||||||
*/
|
*/
|
||||||
operator Uint32 () const
|
operator Uint32 () const // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
|
||||||
{
|
{
|
||||||
return mCount;
|
return mCount;
|
||||||
}
|
}
|
||||||
@ -1121,7 +1121,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Implicit cast to the count value.
|
* Implicit cast to the count value.
|
||||||
*/
|
*/
|
||||||
operator Uint32 () const
|
operator Uint32 () const // NOLINT(google-explicit-constructor,hicpp-explicit-conversions)
|
||||||
{
|
{
|
||||||
return mCount;
|
return mCount;
|
||||||
}
|
}
|
||||||
@ -1629,14 +1629,14 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Count all entities of this type where the tag matches the specified filter.
|
* Count all entities of this type where the tag matches the specified filter.
|
||||||
*/
|
*/
|
||||||
static inline Uint32 CountWhereTagMatches(bool neg, bool cs, CSStr tag)
|
static inline CountElem CountWhereTagMatches(bool neg, bool cs, CSStr tag)
|
||||||
{
|
{
|
||||||
SQMOD_VALID_TAG_STR(tag)
|
SQMOD_VALID_TAG_STR(tag)
|
||||||
// Create a new element counter
|
// Create a new element counter
|
||||||
CountElem cnt;
|
CountElem cnt;
|
||||||
// Process each entity in the pool
|
// Process each entity in the pool
|
||||||
EachMatches(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
EachMatches(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||||
std::reference_wrapper< CountElem >(cnt), tag, !neg, cs);
|
std::reference_wrapper< CountElem >(cnt), tag, !neg, static_cast< bool >(cs));
|
||||||
// Return the count
|
// Return the count
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,8 @@ SQMODE_DECL_TYPENAME(AreaTypename, _SC("SqArea"))
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
AreaManager AreaManager::s_Inst;
|
AreaManager AreaManager::s_Inst;
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "UnusedValue"
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void Area::AddArray(const Sqrat::Array & a)
|
void Area::AddArray(const Sqrat::Array & a)
|
||||||
{
|
{
|
||||||
@ -45,6 +47,7 @@ void Area::AddArray(const Sqrat::Array & a)
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool Area::Manage()
|
bool Area::Manage()
|
||||||
@ -115,9 +118,9 @@ bool Area::IsInside(float x, float y) const
|
|||||||
const float dy = (b.y - a.y);
|
const float dy = (b.y - a.y);
|
||||||
float k;
|
float k;
|
||||||
|
|
||||||
if (fabs(dx) < 0.000001f)
|
if (fabsf(dx) < 0.000001f)
|
||||||
{
|
{
|
||||||
k = 0xffffffff;
|
k = 0xffffffffu; // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -138,7 +141,7 @@ bool Area::IsInside(float x, float y) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
AreaManager::AreaManager(size_t sz)
|
AreaManager::AreaManager(size_t sz) noexcept
|
||||||
: m_Queue(), m_ProcList(), m_Grid{}
|
: m_Queue(), m_ProcList(), m_Grid{}
|
||||||
{
|
{
|
||||||
// Negative half grid size (left)
|
// Negative half grid size (left)
|
||||||
@ -150,12 +153,11 @@ AreaManager::AreaManager(size_t sz)
|
|||||||
// Positive half grid size (top)
|
// Positive half grid size (top)
|
||||||
int t = abs(l);
|
int t = abs(l);
|
||||||
// Initialize the grid cells
|
// Initialize the grid cells
|
||||||
for (int y = 0; y < GRIDN; ++y)
|
for (auto & a : m_Grid)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < GRIDN; ++x)
|
for (auto & c : a)
|
||||||
{
|
{
|
||||||
// Grab a reference to the cell
|
// Grab a reference to the cell
|
||||||
AreaCell & c = m_Grid[y][x];
|
|
||||||
// Configure the range of the cell
|
// Configure the range of the cell
|
||||||
c.mL = static_cast< float >(l);
|
c.mL = static_cast< float >(l);
|
||||||
c.mB = static_cast< float >(b);
|
c.mB = static_cast< float >(b);
|
||||||
@ -215,7 +217,7 @@ void AreaManager::Remove(AreaCell & c, Area & a)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Attempt to locate this area in the cell
|
// Attempt to locate this area in the cell
|
||||||
AreaCell::Areas::iterator itr = std::find_if(c.mAreas.begin(), c.mAreas.end(),
|
auto itr = std::find_if(c.mAreas.begin(), c.mAreas.end(),
|
||||||
[&a](AreaCell::Areas::reference p) -> bool {
|
[&a](AreaCell::Areas::reference p) -> bool {
|
||||||
return (p.first == &a);
|
return (p.first == &a);
|
||||||
});
|
});
|
||||||
@ -226,7 +228,7 @@ void AreaManager::Remove(AreaCell & c, Area & a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Dissociate the area with this cell so it can be managed again (even while in the queue)
|
// Dissociate the area with this cell so it can be managed again (even while in the queue)
|
||||||
Area::Cells::iterator itr = std::find(a.mCells.begin(), a.mCells.end(), &c);
|
auto itr = std::find(a.mCells.begin(), a.mCells.end(), &c);
|
||||||
// Was is associated?
|
// Was is associated?
|
||||||
if (itr != a.mCells.end())
|
if (itr != a.mCells.end())
|
||||||
{
|
{
|
||||||
@ -238,7 +240,7 @@ void AreaManager::Remove(AreaCell & c, Area & a)
|
|||||||
void AreaManager::ProcQueue()
|
void AreaManager::ProcQueue()
|
||||||
{
|
{
|
||||||
// Look for actions that can be completed
|
// Look for actions that can be completed
|
||||||
for (Queue::iterator itr = m_Queue.begin(); itr != m_Queue.end(); ++itr)
|
for (auto itr = m_Queue.begin(); itr != m_Queue.end(); ++itr)
|
||||||
{
|
{
|
||||||
// Was this cell unlocked in the meantime?
|
// Was this cell unlocked in the meantime?
|
||||||
if (itr->mCell->mLocks <= 0)
|
if (itr->mCell->mLocks <= 0)
|
||||||
@ -293,11 +295,10 @@ void AreaManager::InsertArea(Area & a, LightObj & obj)
|
|||||||
return; // Already managed or nothing to manage
|
return; // Already managed or nothing to manage
|
||||||
}
|
}
|
||||||
// Go through each cell and check if the area touches it
|
// Go through each cell and check if the area touches it
|
||||||
for (int y = 0; y < GRIDN; ++y)
|
for (auto & y : m_Grid)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < GRIDN; ++x)
|
for (auto & c : y)
|
||||||
{
|
{
|
||||||
AreaCell & c = m_Grid[y][x];
|
|
||||||
// Does the bounding box of this cell intersect with the one of the area?
|
// Does the bounding box of this cell intersect with the one of the area?
|
||||||
if (a.mL <= c.mR && c.mL <= a.mR && a.mB <= c.mT && c.mB <= a.mT)
|
if (a.mL <= c.mR && c.mL <= a.mR && a.mB <= c.mT && c.mB <= a.mT)
|
||||||
{
|
{
|
||||||
@ -330,7 +331,7 @@ Vector2i AreaManager::LocateCell(float x, float y)
|
|||||||
// Make sure the cell coordinates are within range
|
// Make sure the cell coordinates are within range
|
||||||
if (xca > (GRIDH+1) || yca > (GRIDH+1))
|
if (xca > (GRIDH+1) || yca > (GRIDH+1))
|
||||||
{
|
{
|
||||||
return Vector2i(NOCELL, NOCELL); // Out of our scanning area
|
return {NOCELL, NOCELL}; // Out of our scanning area
|
||||||
}
|
}
|
||||||
// Clamp the x coordinate if necessary
|
// Clamp the x coordinate if necessary
|
||||||
if (xca >= (GRIDH))
|
if (xca >= (GRIDH))
|
||||||
@ -343,7 +344,7 @@ Vector2i AreaManager::LocateCell(float x, float y)
|
|||||||
yc = xc < 0 ? -(GRIDH-1) : (GRIDH-1);
|
yc = xc < 0 ? -(GRIDH-1) : (GRIDH-1);
|
||||||
}
|
}
|
||||||
// Return the identified cell row and column
|
// Return the identified cell row and column
|
||||||
return Vector2i(GRIDH+xc, GRIDH-yc);
|
return {GRIDH+xc, GRIDH-yc};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
@ -73,7 +73,7 @@ struct Area
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Named constructor.
|
* Named constructor.
|
||||||
*/
|
*/
|
||||||
Area(StackStrF & name)
|
explicit Area(StackStrF & name)
|
||||||
: Area(16, name)
|
: Area(16, name)
|
||||||
{
|
{
|
||||||
//...
|
//...
|
||||||
@ -83,7 +83,7 @@ struct Area
|
|||||||
*/
|
*/
|
||||||
Area(SQInteger sz, StackStrF & name)
|
Area(SQInteger sz, StackStrF & name)
|
||||||
: mL(DEF_L), mB(DEF_B), mR(DEF_R), mT(DEF_T), mPoints(), mID(0), mCells()
|
: mL(DEF_L), mB(DEF_B), mR(DEF_R), mT(DEF_T), mPoints(), mID(0), mCells()
|
||||||
, mName(name.mPtr, name.mLen <= 0 ? 0 : name.mLen)
|
, mName(name.mPtr, static_cast< size_t >(name.mLen <= 0 ? 0 : name.mLen))
|
||||||
|
|
||||||
{
|
{
|
||||||
// Should we reserve some space for points in advance?
|
// Should we reserve some space for points in advance?
|
||||||
@ -142,7 +142,7 @@ struct Area
|
|||||||
*/
|
*/
|
||||||
Area(float ax, float ay, float bx, float by, float cx, float cy, SQInteger sz, StackStrF & name)
|
Area(float ax, float ay, float bx, float by, float cx, float cy, SQInteger sz, StackStrF & name)
|
||||||
: mL(DEF_L), mB(DEF_B), mR(DEF_R), mT(DEF_T), mPoints(), mID(0), mCells()
|
: mL(DEF_L), mB(DEF_B), mR(DEF_R), mT(DEF_T), mPoints(), mID(0), mCells()
|
||||||
, mName(name.mPtr, name.mLen <= 0 ? 0 : name.mLen)
|
, mName(name.mPtr, static_cast<size_t>(name.mLen <= 0 ? 0 : name.mLen))
|
||||||
{
|
{
|
||||||
// Should we reserve some space for points in advance?
|
// Should we reserve some space for points in advance?
|
||||||
if (sz > 0)
|
if (sz > 0)
|
||||||
@ -169,14 +169,6 @@ struct Area
|
|||||||
*/
|
*/
|
||||||
Area(Area && o) = delete;
|
Area(Area && o) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
~Area()
|
|
||||||
{
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy assignment operator. (disabled)
|
* Copy assignment operator. (disabled)
|
||||||
*/
|
*/
|
||||||
@ -278,7 +270,7 @@ struct Area
|
|||||||
*/
|
*/
|
||||||
Vector2 GetCenter() const
|
Vector2 GetCenter() const
|
||||||
{
|
{
|
||||||
return Vector2((mL * 0.5f) + (mR * 0.5f), (mB * 0.5f) + (mT * 0.5f));
|
return {(mL * 0.5f) + (mR * 0.5f), (mB * 0.5f) + (mT * 0.5f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -286,7 +278,7 @@ struct Area
|
|||||||
*/
|
*/
|
||||||
Vector4 GetBoundingBox() const
|
Vector4 GetBoundingBox() const
|
||||||
{
|
{
|
||||||
return Vector4(mL, mB, mR, mT);
|
return {mL, mB, mR, mT};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -472,43 +464,13 @@ protected:
|
|||||||
*/
|
*/
|
||||||
class AreaManager
|
class AreaManager
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------
|
||||||
static AreaManager s_Inst; // Manager instance.
|
static AreaManager s_Inst; // Manager instance.
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Base constructor.
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
AreaManager(size_t sz = 16);
|
explicit AreaManager(size_t sz = 16) noexcept;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copy constructor. (disabled)
|
|
||||||
*/
|
|
||||||
AreaManager(const AreaManager & o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Move constructor. (disabled)
|
|
||||||
*/
|
|
||||||
AreaManager(AreaManager && o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
~AreaManager()
|
|
||||||
{
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copy assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
AreaManager & operator = (const AreaManager & o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Move assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
AreaManager & operator = (AreaManager && o) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -521,7 +483,7 @@ protected:
|
|||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
* Base constructor.
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
CellGuard(AreaCell & cell)
|
explicit CellGuard(AreaCell & cell)
|
||||||
: mCell(cell)
|
: mCell(cell)
|
||||||
{
|
{
|
||||||
++(cell.mLocks); // Place a lock on the cell to prevent iterator invalidation
|
++(cell.mLocks); // Place a lock on the cell to prevent iterator invalidation
|
||||||
@ -580,7 +542,7 @@ protected:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Move constructor.
|
* Move constructor.
|
||||||
*/
|
*/
|
||||||
QueueElement(QueueElement && o)
|
QueueElement(QueueElement && o) noexcept
|
||||||
: mCell(o.mCell), mArea(o.mArea), mObj(std::move(o.mObj))
|
: mCell(o.mCell), mArea(o.mArea), mObj(std::move(o.mObj))
|
||||||
{
|
{
|
||||||
// Take ownership
|
// Take ownership
|
||||||
@ -588,14 +550,6 @@ protected:
|
|||||||
o.mArea = nullptr;
|
o.mArea = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Destructor.
|
|
||||||
*/
|
|
||||||
~QueueElement()
|
|
||||||
{
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy assignment operator. (disabled)
|
* Copy assignment operator. (disabled)
|
||||||
*/
|
*/
|
||||||
@ -604,7 +558,7 @@ protected:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Move assignment operator.
|
* Move assignment operator.
|
||||||
*/
|
*/
|
||||||
QueueElement & operator = (QueueElement && o)
|
QueueElement & operator = (QueueElement && o) noexcept
|
||||||
{
|
{
|
||||||
// Avoid self assignment
|
// Avoid self assignment
|
||||||
if (this != &o)
|
if (this != &o)
|
||||||
@ -645,6 +599,26 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Copy constructor. (disabled)
|
||||||
|
*/
|
||||||
|
AreaManager(const AreaManager & o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Move constructor. (disabled)
|
||||||
|
*/
|
||||||
|
AreaManager(AreaManager && o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Copy assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
AreaManager & operator = (const AreaManager & o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Move assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
AreaManager & operator = (AreaManager && o) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the core instance.
|
* Retrieve the core instance.
|
||||||
*/
|
*/
|
||||||
@ -676,7 +650,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Clear all cell lists and release any script references.
|
* Clear all cell lists and release any script references.
|
||||||
*/
|
*/
|
||||||
Vector2i LocateCell(float x, float y);
|
static Vector2i LocateCell(float x, float y);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Test a point to see whether it intersects with any areas
|
* Test a point to see whether it intersects with any areas
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include "Core.hpp"
|
#include "Core.hpp"
|
||||||
#include "Base/Shared.hpp"
|
|
||||||
#include "Base/Color3.hpp"
|
#include "Base/Color3.hpp"
|
||||||
#include "Base/Color4.hpp"
|
|
||||||
#include "Entity/Player.hpp"
|
#include "Entity/Player.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -26,7 +24,7 @@ static inline bool SqCanBeInteger(HSQUIRRELVM vm, Int32 idx)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int32 & msgidx)
|
SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int32 & msgidx)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Is the color argument a Color3/Color4 instance?
|
// Is the color argument a Color3/Color4 instance?
|
||||||
if (sq_gettype(vm, idx) == OT_INSTANCE)
|
if (sq_gettype(vm, idx) == OT_INSTANCE)
|
||||||
{
|
{
|
||||||
@ -35,7 +33,7 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
// Attempt to extract a Color3 value
|
// Attempt to extract a Color3 value
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
color = (Var< Color3 >(vm, idx).value.GetRGBA() | 0xFF);
|
color = (Var< Color3 >(vm, idx).value.GetRGBA() | 0xFFu);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@ -78,7 +76,7 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
color = SQMOD_PACK_RGBA(ConvTo< Uint8 >::From(PopStackInteger(vm, idx)),
|
color = SQMOD_PACK_RGBA(ConvTo< Uint8 >::From(PopStackInteger(vm, idx)),
|
||||||
ConvTo< Uint8 >::From(PopStackInteger(vm, idx+1)),
|
ConvTo< Uint8 >::From(PopStackInteger(vm, idx+1)),
|
||||||
ConvTo< Uint8 >::From(PopStackInteger(vm, idx+2)),
|
ConvTo< Uint8 >::From(PopStackInteger(vm, idx+2)),
|
||||||
0xFF);
|
0xFFu);
|
||||||
// The message starts right after the color
|
// The message starts right after the color
|
||||||
msgidx += 3;
|
msgidx += 3;
|
||||||
}
|
}
|
||||||
@ -119,43 +117,44 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
color = 0x000000FF;
|
color = 0x000000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
color <<= 28;
|
color <<= 28u;
|
||||||
color |= 0x00000FF;
|
color |= 0x00000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
color <<= 24;
|
color <<= 24u;
|
||||||
color |= 0x0000FF;
|
color |= 0x0000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
color <<= 20;
|
color <<= 20u;
|
||||||
color |= 0x000FF;
|
color |= 0x000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
color <<= 16;
|
color <<= 16u;
|
||||||
color |= 0x00FF;
|
color |= 0x00FFu;
|
||||||
} break;
|
} break;
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
color <<= 12;
|
color <<= 12u;
|
||||||
color |= 0x0FF;
|
color |= 0x0FFu;
|
||||||
} break;
|
} break;
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
color <<= 8;
|
color <<= 8u;
|
||||||
color |= 0xFF;
|
color |= 0xFFu;
|
||||||
} break;
|
} break;
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
color <<= 4;
|
color <<= 4u;
|
||||||
color |= 0x0;
|
color |= 0x0u;
|
||||||
} break;
|
} break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Are the first characters 0x so we can treat this as hex?
|
// Are the first characters 0x so we can treat this as hex?
|
||||||
@ -168,43 +167,44 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
color = 0x000000FF;
|
color = 0x000000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
color <<= 28;
|
color <<= 28u;
|
||||||
color |= 0x00000FF;
|
color |= 0x00000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
color <<= 24;
|
color <<= 24u;
|
||||||
color |= 0x0000FF;
|
color |= 0x0000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
color <<= 20;
|
color <<= 20u;
|
||||||
color |= 0x000FF;
|
color |= 0x000FFu;
|
||||||
} break;
|
} break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
color <<= 16;
|
color <<= 16u;
|
||||||
color |= 0x00FF;
|
color |= 0x00FFu;
|
||||||
} break;
|
} break;
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
color <<= 12;
|
color <<= 12u;
|
||||||
color |= 0x0FF;
|
color |= 0x0FFu;
|
||||||
} break;
|
} break;
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
color <<= 8;
|
color <<= 8u;
|
||||||
color |= 0xFF;
|
color |= 0xFFu;
|
||||||
} break;
|
} break;
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
color <<= 4;
|
color <<= 4u;
|
||||||
color |= 0x0;
|
color |= 0x0u;
|
||||||
} break;
|
} break;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -212,7 +212,7 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
// Attempt to treat the value as a color name
|
// Attempt to treat the value as a color name
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
color = (::SqMod::GetColorStr(str).GetRGBA() | 0xFF);
|
color = (::SqMod::GetColorStr(str).GetRGBA() | 0xFFu);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
@ -234,7 +234,7 @@ SQRESULT SqGrabPlayerMessageColor(HSQUIRRELVM vm, Int32 idx, Uint32 & color, Int
|
|||||||
static SQInteger SqBroadcastMsg(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastMsg(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
// The function needs at least 2 arguments
|
// The function needs at least 2 arguments
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the message color specified?
|
// Was the message color specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -267,8 +267,8 @@ static SQInteger SqBroadcastMsg(HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
@ -307,7 +307,7 @@ static SQInteger SqBroadcastMsg(HSQUIRRELVM vm)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the index of the message prefix specified?
|
// Was the index of the message prefix specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -346,10 +346,10 @@ static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm)
|
|||||||
return val.mRes; // Propagate the error!
|
return val.mRes; // Propagate the error!
|
||||||
}
|
}
|
||||||
|
|
||||||
vcmpError result = vcmpErrorNone;
|
vcmpError result;
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
@ -395,7 +395,7 @@ static SQInteger SqBroadcastMsgP(HSQUIRRELVM vm)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the index of the message prefix specified?
|
// Was the index of the message prefix specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -451,10 +451,10 @@ static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm)
|
|||||||
return val.mRes; // Propagate the error!
|
return val.mRes; // Propagate the error!
|
||||||
}
|
}
|
||||||
|
|
||||||
vcmpError result = vcmpErrorNone;
|
vcmpError result;
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
@ -500,7 +500,7 @@ static SQInteger SqBroadcastMsgEx(HSQUIRRELVM vm)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger SqBroadcastMessage(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastMessage(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the message value specified?
|
// Was the message value specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -516,8 +516,8 @@ static SQInteger SqBroadcastMessage(HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
@ -556,7 +556,7 @@ static SQInteger SqBroadcastMessage(HSQUIRRELVM vm)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger SqBroadcastAnnounce(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastAnnounce(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the announcement value specified?
|
// Was the announcement value specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -572,8 +572,8 @@ static SQInteger SqBroadcastAnnounce(HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
@ -617,7 +617,7 @@ static SQInteger SqBroadcastAnnounce(HSQUIRRELVM vm)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger SqBroadcastAnnounceEx(HSQUIRRELVM vm)
|
static SQInteger SqBroadcastAnnounceEx(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
const Int32 top = sq_gettop(vm);
|
const auto top = static_cast< Int32 >(sq_gettop(vm));
|
||||||
// Was the announcement style specified?
|
// Was the announcement style specified?
|
||||||
if (top <= 1)
|
if (top <= 1)
|
||||||
{
|
{
|
||||||
@ -649,8 +649,8 @@ static SQInteger SqBroadcastAnnounceEx(HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the ends of the entity pool
|
// Obtain the ends of the entity pool
|
||||||
Core::Players::const_iterator itr = Core::Get().GetPlayers().cbegin();
|
auto itr = Core::Get().GetPlayers().cbegin();
|
||||||
Core::Players::const_iterator end = Core::Get().GetPlayers().cend();
|
auto end = Core::Get().GetPlayers().cend();
|
||||||
// The number of players that the message was sent to
|
// The number of players that the message was sent to
|
||||||
Uint32 count = 0;
|
Uint32 count = 0;
|
||||||
// Currently processed player
|
// Currently processed player
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
#include "Misc/Command.hpp"
|
#include "Misc/Command.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -16,8 +19,8 @@ SQMODE_DECL_TYPENAME(ManagerTypename, _SC("SqCmdManager"))
|
|||||||
SQMODE_DECL_TYPENAME(ListenerTypename, _SC("SqCmdListener"))
|
SQMODE_DECL_TYPENAME(ListenerTypename, _SC("SqCmdListener"))
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Guard::Guard(const CtrRef & ctr, Object & invoker)
|
Guard::Guard(CtrRef ctr, Object & invoker)
|
||||||
: mController(ctr)
|
: mController(std::move(ctr))
|
||||||
, mPrevious(mController->m_Context)
|
, mPrevious(mController->m_Context)
|
||||||
, mCurrent(new Context(invoker))
|
, mCurrent(new Context(invoker))
|
||||||
{
|
{
|
||||||
@ -31,8 +34,8 @@ Guard::~Guard()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Command::Command(std::size_t hash, const String & name, Listener * ptr, const CtrPtr & ctr)
|
Command::Command(std::size_t hash, String name, Listener * ptr, CtrPtr ctr)
|
||||||
: mHash(hash), mName(name), mPtr(ptr), mObj(ptr), mCtr(ctr)
|
: mHash(hash), mName(std::move(name)), mPtr(ptr), mObj(ptr), mCtr(std::move(ctr))
|
||||||
{
|
{
|
||||||
if (mPtr)
|
if (mPtr)
|
||||||
{
|
{
|
||||||
@ -40,8 +43,8 @@ Command::Command(std::size_t hash, const String & name, Listener * ptr, const Ct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Command::Command(std::size_t hash, const String & name, const Object & obj, const CtrPtr & ctr)
|
Command::Command(std::size_t hash, String name, const Object & obj, CtrPtr ctr)
|
||||||
: mHash(hash), mName(name), mPtr(obj.Cast< Listener * >()), mObj(obj), mCtr(ctr)
|
: mHash(hash), mName(std::move(name)), mPtr(obj.Cast< Listener * >()), mObj(obj), mCtr(std::move(ctr))
|
||||||
{
|
{
|
||||||
if (mPtr)
|
if (mPtr)
|
||||||
{
|
{
|
||||||
@ -50,8 +53,8 @@ Command::Command(std::size_t hash, const String & name, const Object & obj, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Command::Command(std::size_t hash, const String & name, Object && obj, const CtrPtr & ctr)
|
Command::Command(std::size_t hash, String name, Object && obj, CtrPtr ctr)
|
||||||
: mHash(hash), mName(name), mPtr(obj.Cast< Listener * >()), mObj(obj), mCtr(ctr)
|
: mHash(hash), mName(std::move(name)), mPtr(obj.Cast< Listener * >()), mObj(obj), mCtr(std::move(ctr))
|
||||||
{
|
{
|
||||||
if (mPtr)
|
if (mPtr)
|
||||||
{
|
{
|
||||||
@ -60,8 +63,8 @@ Command::Command(std::size_t hash, const String & name, Object && obj, const Ctr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Command::Command(std::size_t hash, const String & name, Listener * ptr, const Object & obj, const CtrPtr & ctr)
|
Command::Command(std::size_t hash, String name, Listener * ptr, const Object & obj, CtrPtr ctr) // NOLINT(modernize-pass-by-value)
|
||||||
: mHash(hash), mName(name), mPtr(ptr), mObj(obj), mCtr(ctr)
|
: mHash(hash), mName(std::move(name)), mPtr(ptr), mObj(obj), mCtr(std::move(ctr))
|
||||||
{
|
{
|
||||||
if (mPtr)
|
if (mPtr)
|
||||||
{
|
{
|
||||||
@ -70,8 +73,8 @@ Command::Command(std::size_t hash, const String & name, Listener * ptr, const Ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Command::Command(std::size_t hash, const String & name, Listener * ptr, Object && obj, const CtrPtr & ctr)
|
Command::Command(std::size_t hash, String name, Listener * ptr, Object && obj, CtrPtr ctr)
|
||||||
: mHash(hash), mName(name), mPtr(ptr), mObj(obj), mCtr(ctr)
|
: mHash(hash), mName(std::move(name)), mPtr(ptr), mObj(obj), mCtr(std::move(ctr))
|
||||||
{
|
{
|
||||||
if (mPtr)
|
if (mPtr)
|
||||||
{
|
{
|
||||||
@ -382,7 +385,7 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
// Let's store the exception message
|
// Let's store the exception message
|
||||||
ctx.mBuffer.Write(0, e.what(), e.Message().size());
|
ctx.mBuffer.Write(0, e.what(), static_cast< Buffer::SzType >(e.Message().size()));
|
||||||
// Specify that the command execution failed
|
// Specify that the command execution failed
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
@ -404,7 +407,7 @@ Int32 Controller::Exec(Context & ctx)
|
|||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
// Let's store the exception message
|
// Let's store the exception message
|
||||||
ctx.mBuffer.Write(0, e.what(), e.Message().size());
|
ctx.mBuffer.Write(0, e.what(), static_cast< Buffer::SzType >(e.Message().size()));
|
||||||
// Specify that the command execution failed
|
// Specify that the command execution failed
|
||||||
failed = true;
|
failed = true;
|
||||||
}
|
}
|
||||||
@ -480,7 +483,7 @@ bool Controller::Parse(Context & ctx)
|
|||||||
// Obtain the flags of the currently processed argument
|
// Obtain the flags of the currently processed argument
|
||||||
Uint8 arg_flags = ctx.mInstance->m_ArgSpec[ctx.mArgc];
|
Uint8 arg_flags = ctx.mInstance->m_ArgSpec[ctx.mArgc];
|
||||||
// Adjust the internal buffer if necessary (mostly never)
|
// Adjust the internal buffer if necessary (mostly never)
|
||||||
ctx.mBuffer.Adjust(ctx.mArgument.size());
|
ctx.mBuffer.Adjust(static_cast< Buffer::SzType >(ctx.mArgument.size()));
|
||||||
// The iterator to the currently processed character
|
// The iterator to the currently processed character
|
||||||
String::const_iterator itr = ctx.mArgument.cbegin();
|
String::const_iterator itr = ctx.mArgument.cbegin();
|
||||||
// Previous and currently processed character
|
// Previous and currently processed character
|
||||||
@ -633,7 +636,7 @@ bool Controller::Parse(Context & ctx)
|
|||||||
// Obtain both ends of the argument string
|
// Obtain both ends of the argument string
|
||||||
CCStr str = &(*itr), end = &(*pos);
|
CCStr str = &(*itr), end = &(*pos);
|
||||||
// Compute the argument string size
|
// Compute the argument string size
|
||||||
const Uint32 sz = std::distance(itr, pos);
|
const auto sz = static_cast< const Uint32 >(std::distance(itr, pos));
|
||||||
// Update the main iterator position
|
// Update the main iterator position
|
||||||
itr = pos;
|
itr = pos;
|
||||||
// Update the currently processed character
|
// Update the currently processed character
|
||||||
@ -696,7 +699,7 @@ bool Controller::Parse(Context & ctx)
|
|||||||
// Fill the temporary buffer with data from the internal buffer
|
// Fill the temporary buffer with data from the internal buffer
|
||||||
for (; sptr < end; ++sptr, ++bptr)
|
for (; sptr < end; ++sptr, ++bptr)
|
||||||
{
|
{
|
||||||
*bptr = std::tolower(*sptr);
|
*bptr = static_cast< char >(std::tolower(*sptr));
|
||||||
}
|
}
|
||||||
// Terminate the copied string portion
|
// Terminate the copied string portion
|
||||||
*bptr = '\0';
|
*bptr = '\0';
|
||||||
@ -706,7 +709,7 @@ bool Controller::Parse(Context & ctx)
|
|||||||
if (std::strcmp(lc, "true") == 0 || std::strcmp(lc, "on") == 0)
|
if (std::strcmp(lc, "true") == 0 || std::strcmp(lc, "on") == 0)
|
||||||
{
|
{
|
||||||
// Transform it into a script object
|
// Transform it into a script object
|
||||||
sq_pushbool(DefaultVM::Get(), true);
|
sq_pushbool(DefaultVM::Get(), static_cast< SQBool >(true));
|
||||||
// We've identified the correct value type
|
// We've identified the correct value type
|
||||||
identified = true;
|
identified = true;
|
||||||
}
|
}
|
||||||
@ -714,7 +717,7 @@ bool Controller::Parse(Context & ctx)
|
|||||||
else if (std::strcmp(lc, "false") == 0 || std::strcmp(lc, "off") == 0)
|
else if (std::strcmp(lc, "false") == 0 || std::strcmp(lc, "off") == 0)
|
||||||
{
|
{
|
||||||
// Transform it into a script object
|
// Transform it into a script object
|
||||||
sq_pushbool(DefaultVM::Get(), false);
|
sq_pushbool(DefaultVM::Get(), static_cast< SQBool >(false));
|
||||||
// We've identified the correct value type
|
// We've identified the correct value type
|
||||||
identified = true;
|
identified = true;
|
||||||
}
|
}
|
||||||
@ -1012,7 +1015,7 @@ void Listener::ProcSpec(CSStr str)
|
|||||||
// Reset all argument specifiers if failed
|
// Reset all argument specifiers if failed
|
||||||
std::memset(m_ArgSpec, CMDARG_ANY, sizeof(m_ArgSpec));
|
std::memset(m_ArgSpec, CMDARG_ANY, sizeof(m_ArgSpec));
|
||||||
// Propagate the exception back to the caller
|
// Propagate the exception back to the caller
|
||||||
throw e;
|
throw e; // NOLINT(hicpp-exception-baseclass,cert-err60-cpp)
|
||||||
}
|
}
|
||||||
// Attempt to generate an informational message
|
// Attempt to generate an informational message
|
||||||
GenerateInfo(false);
|
GenerateInfo(false);
|
||||||
@ -1051,22 +1054,14 @@ void Register(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("GetTable"), &Manager::GetCommandsTable)
|
.Func(_SC("GetTable"), &Manager::GetCommandsTable)
|
||||||
.Func(_SC("Foreach"), &Manager::ForeachCommand)
|
.Func(_SC("Foreach"), &Manager::ForeachCommand)
|
||||||
// Member Overloads
|
// Member Overloads
|
||||||
.Overload< Object (Manager::*)(StackStrF &) >
|
.Overload(_SC("Create"), &Manager::Create1)
|
||||||
(_SC("Create"), &Manager::Create)
|
.Overload(_SC("Create"), &Manager::Create2)
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &) >
|
.Overload(_SC("Create"), &Manager::Create3)
|
||||||
(_SC("Create"), &Manager::Create)
|
.Overload(_SC("Create"), &Manager::Create4)
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Array &) >
|
.Overload(_SC("Create"), &Manager::Create5)
|
||||||
(_SC("Create"), &Manager::Create)
|
.Overload(_SC("Create"), &Manager::Create6)
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Uint8, Uint8) >
|
.Overload(_SC("Create"), &Manager::Create7)
|
||||||
(_SC("Create"), &Manager::Create)
|
.Overload(_SC("Create"), &Manager::Create)
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Array &, Uint8, Uint8) >
|
|
||||||
(_SC("Create"), &Manager::Create)
|
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Array &, Uint8, Uint8, SQInteger) >
|
|
||||||
(_SC("Create"), &Manager::Create)
|
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Array &, Uint8, Uint8, SQInteger, bool) >
|
|
||||||
(_SC("Create"), &Manager::Create)
|
|
||||||
.Overload< Object (Manager::*)(StackStrF &, StackStrF &, Array &, Uint8, Uint8, SQInteger, bool, bool) >
|
|
||||||
(_SC("Create"), &Manager::Create)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
cmdns.Bind(_SC("Listener"),
|
cmdns.Bind(_SC("Listener"),
|
||||||
|
@ -53,14 +53,14 @@ typedef std::vector< Controller * > Controllers; // List of active controllers.
|
|||||||
*/
|
*/
|
||||||
enum CmdArgType
|
enum CmdArgType
|
||||||
{
|
{
|
||||||
CMDARG_ANY = 0,
|
CMDARG_ANY = 0u,
|
||||||
CMDARG_INTEGER = (1 << 1),
|
CMDARG_INTEGER = (1u << 1u),
|
||||||
CMDARG_FLOAT = (1 << 2),
|
CMDARG_FLOAT = (1u << 2u),
|
||||||
CMDARG_BOOLEAN = (1 << 3),
|
CMDARG_BOOLEAN = (1u << 3u),
|
||||||
CMDARG_STRING = (1 << 4),
|
CMDARG_STRING = (1u << 4u),
|
||||||
CMDARG_LOWER = (1 << 5),
|
CMDARG_LOWER = (1u << 5u),
|
||||||
CMDARG_UPPER = (1 << 6),
|
CMDARG_UPPER = (1u << 6u),
|
||||||
CMDARG_GREEDY = (1 << 7)
|
CMDARG_GREEDY = (1u << 7u)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
@ -69,7 +69,7 @@ enum CmdArgType
|
|||||||
enum CmdError
|
enum CmdError
|
||||||
{
|
{
|
||||||
// The command failed for unknown reasons
|
// The command failed for unknown reasons
|
||||||
CMDERR_UNKNOWN = 0,
|
CMDERR_UNKNOWN = 0u,
|
||||||
// The command failed to execute because there was nothing to execute
|
// The command failed to execute because there was nothing to execute
|
||||||
CMDERR_EMPTY_COMMAND,
|
CMDERR_EMPTY_COMMAND,
|
||||||
// The command failed to execute because the command name was invalid after processing
|
// The command failed to execute because the command name was invalid after processing
|
||||||
@ -115,7 +115,9 @@ inline CSStr ValidateName(CSStr name)
|
|||||||
// Create iterator to name start
|
// Create iterator to name start
|
||||||
CSStr str = name;
|
CSStr str = name;
|
||||||
// Inspect name characters
|
// Inspect name characters
|
||||||
while (*str != '\0')
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCDFAInspection"
|
||||||
|
while ('\0' != *str)
|
||||||
{
|
{
|
||||||
// Does it contain spaces?
|
// Does it contain spaces?
|
||||||
if (std::isspace(*str) != 0)
|
if (std::isspace(*str) != 0)
|
||||||
@ -125,6 +127,7 @@ inline CSStr ValidateName(CSStr name)
|
|||||||
// Move to the next character
|
// Move to the next character
|
||||||
++str;
|
++str;
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
// Return the name
|
// Return the name
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -170,7 +173,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Context(Object & invoker)
|
explicit Context(Object & invoker)
|
||||||
: mBuffer(512)
|
: mBuffer(512)
|
||||||
, mInvoker(invoker)
|
, mInvoker(invoker)
|
||||||
, mCommand()
|
, mCommand()
|
||||||
@ -221,7 +224,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Guard(const CtrRef & ctr, Object & invoker);
|
Guard(CtrRef ctr, Object & invoker);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
@ -264,27 +267,27 @@ struct Command
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Construct a command and the also create a script object from the specified listener.
|
* Construct a command and the also create a script object from the specified listener.
|
||||||
*/
|
*/
|
||||||
Command(std::size_t hash, const String & name, Listener * ptr, const CtrPtr & ctr);
|
Command(std::size_t hash, String name, Listener * ptr, CtrPtr ctr);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Construct a command and extract the listener from the specified script object.
|
* Construct a command and extract the listener from the specified script object.
|
||||||
*/
|
*/
|
||||||
Command(std::size_t hash, const String & name, const Object & obj, const CtrPtr & ctr);
|
Command(std::size_t hash, String name, const Object & obj, CtrPtr ctr);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Construct a command and extract the listener from the specified script object.
|
* Construct a command and extract the listener from the specified script object.
|
||||||
*/
|
*/
|
||||||
Command(std::size_t hash, const String & name, Object && obj, const CtrPtr & ctr);
|
Command(std::size_t hash, String name, Object && obj, CtrPtr ctr);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Construct a command with the given parameters.
|
* Construct a command with the given parameters.
|
||||||
*/
|
*/
|
||||||
Command(std::size_t hash, const String & name, Listener * ptr, const Object & obj, const CtrPtr & ctr);
|
Command(std::size_t hash, String name, Listener * ptr, const Object & obj, CtrPtr ctr);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Construct a command with the given parameters.
|
* Construct a command with the given parameters.
|
||||||
*/
|
*/
|
||||||
Command(std::size_t hash, const String & name, Listener * ptr, Object && obj, const CtrPtr & ctr);
|
Command(std::size_t hash, String name, Listener * ptr, Object && obj, CtrPtr ctr);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
@ -294,12 +297,12 @@ struct Command
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Move constructor.
|
* Move constructor.
|
||||||
*/
|
*/
|
||||||
Command(Command && o)
|
Command(Command && o) noexcept
|
||||||
: mHash(o.mHash)
|
: mHash(o.mHash)
|
||||||
, mName(std::move(o.mName))
|
, mName(std::forward< String >(o.mName))
|
||||||
, mPtr(o.mPtr)
|
, mPtr(o.mPtr)
|
||||||
, mObj(o.mObj)
|
, mObj(std::forward< Object >(o.mObj))
|
||||||
, mCtr(o.mCtr)
|
, mCtr(std::forward< CtrPtr >(o.mCtr))
|
||||||
{
|
{
|
||||||
o.mPtr = nullptr;
|
o.mPtr = nullptr;
|
||||||
}
|
}
|
||||||
@ -317,14 +320,14 @@ struct Command
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Move assignment operator.
|
* Move assignment operator.
|
||||||
*/
|
*/
|
||||||
Command & operator = (Command && o)
|
Command & operator = (Command && o) noexcept
|
||||||
{
|
{
|
||||||
if (this != &o)
|
if (this != &o)
|
||||||
{
|
{
|
||||||
mHash = o.mHash;
|
mHash = o.mHash;
|
||||||
mName = std::move(o.mName);
|
mName = std::forward< String >(o.mName);
|
||||||
mPtr = o.mPtr;
|
mPtr = o.mPtr;
|
||||||
mObj = o.mObj;
|
mObj = std::forward< Object >(o.mObj);
|
||||||
mCtr = o.mCtr;
|
mCtr = o.mCtr;
|
||||||
o.mPtr = nullptr;
|
o.mPtr = nullptr;
|
||||||
}
|
}
|
||||||
@ -363,7 +366,7 @@ protected:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Controller(Manager * mgr)
|
explicit Controller(Manager * mgr)
|
||||||
: m_Commands()
|
: m_Commands()
|
||||||
, m_Context()
|
, m_Context()
|
||||||
, m_OnFail()
|
, m_OnFail()
|
||||||
@ -373,26 +376,6 @@ protected:
|
|||||||
s_Controllers.push_back(this);
|
s_Controllers.push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copy constructor. (disabled)
|
|
||||||
*/
|
|
||||||
Controller(const Controller & o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Move constructor. (disabled)
|
|
||||||
*/
|
|
||||||
Controller(Controller && o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copy assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
Controller & operator = (const Controller & o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Move assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
Controller & operator = (Controller && o) = delete;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -461,7 +444,7 @@ protected:
|
|||||||
// Obtain the unique identifier of the specified name
|
// Obtain the unique identifier of the specified name
|
||||||
const std::size_t hash = std::hash< String >()(name);
|
const std::size_t hash = std::hash< String >()(name);
|
||||||
// Iterator to the found command, if any
|
// Iterator to the found command, if any
|
||||||
Commands::const_iterator itr = m_Commands.cbegin();
|
auto itr = m_Commands.cbegin();
|
||||||
// Attempt to find the specified command
|
// Attempt to find the specified command
|
||||||
for (; itr != m_Commands.cend(); ++itr)
|
for (; itr != m_Commands.cend(); ++itr)
|
||||||
{
|
{
|
||||||
@ -484,7 +467,7 @@ protected:
|
|||||||
void Detach(Listener * ptr)
|
void Detach(Listener * ptr)
|
||||||
{
|
{
|
||||||
// Iterator to the found command, if any
|
// Iterator to the found command, if any
|
||||||
Commands::const_iterator itr = m_Commands.cbegin();
|
auto itr = m_Commands.cbegin();
|
||||||
// Attempt to find the specified command
|
// Attempt to find the specified command
|
||||||
for (; itr != m_Commands.cend(); ++itr)
|
for (; itr != m_Commands.cend(); ++itr)
|
||||||
{
|
{
|
||||||
@ -503,6 +486,26 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Copy constructor. (disabled)
|
||||||
|
*/
|
||||||
|
Controller(const Controller & o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Move constructor. (disabled)
|
||||||
|
*/
|
||||||
|
Controller(Controller && o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Copy assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
Controller & operator = (const Controller & o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Move assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
Controller & operator = (Controller && o) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Terminate the all controllers by releasing their command listeners and callbacks.
|
* Terminate the all controllers by releasing their command listeners and callbacks.
|
||||||
*/
|
*/
|
||||||
@ -891,7 +894,7 @@ public:
|
|||||||
{
|
{
|
||||||
if ((SQ_FAILED(command.Proc())))
|
if ((SQ_FAILED(command.Proc())))
|
||||||
{
|
{
|
||||||
return command.mRes;
|
return static_cast< Int32 >(command.mRes);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -938,7 +941,7 @@ public:
|
|||||||
STHROWF("Invalid or empty command name");
|
STHROWF("Invalid or empty command name");
|
||||||
}
|
}
|
||||||
// Attempt to return the requested command
|
// Attempt to return the requested command
|
||||||
return GetValid()->FindByName(String(name.mPtr, name.mLen));
|
return GetValid()->FindByName(String(name.mPtr, static_cast< size_t >(name.mLen)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
@ -1056,7 +1059,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name)
|
Object Create1(StackStrF & name)
|
||||||
{
|
{
|
||||||
return Create(name, DummyStackStrF(), NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
return Create(name, DummyStackStrF(), NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
||||||
}
|
}
|
||||||
@ -1064,7 +1067,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec)
|
Object Create2(StackStrF & name, StackStrF & spec)
|
||||||
{
|
{
|
||||||
return Create(name, spec, NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
return Create(name, spec, NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
||||||
}
|
}
|
||||||
@ -1072,7 +1075,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec, Array & tags)
|
Object Create3(StackStrF & name, StackStrF & spec, Array & tags)
|
||||||
{
|
{
|
||||||
return Create(name, spec, tags, 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
return Create(name, spec, tags, 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false);
|
||||||
}
|
}
|
||||||
@ -1080,7 +1083,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec, Uint8 min, Uint8 max)
|
Object Create4(StackStrF & name, StackStrF & spec, Uint8 min, Uint8 max)
|
||||||
{
|
{
|
||||||
return Create(name, spec, NullArray(), min, max, -1, false, false);
|
return Create(name, spec, NullArray(), min, max, -1, false, false);
|
||||||
}
|
}
|
||||||
@ -1088,7 +1091,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max)
|
Object Create5(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max)
|
||||||
{
|
{
|
||||||
return Create(name, spec, tags, min, max, -1, false, false);
|
return Create(name, spec, tags, min, max, -1, false, false);
|
||||||
}
|
}
|
||||||
@ -1096,7 +1099,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max, SQInteger auth)
|
Object Create6(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max, SQInteger auth)
|
||||||
{
|
{
|
||||||
return Create(name, spec, tags, min, max, auth, auth >= 0, false);
|
return Create(name, spec, tags, min, max, auth, auth >= 0, false);
|
||||||
}
|
}
|
||||||
@ -1104,7 +1107,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Create command instances and obtain the associated object.
|
* Create command instances and obtain the associated object.
|
||||||
*/
|
*/
|
||||||
Object Create(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max, SQInteger auth, bool prot)
|
Object Create7(StackStrF & name, StackStrF & spec, Array & tags, Uint8 min, Uint8 max, SQInteger auth, bool prot)
|
||||||
{
|
{
|
||||||
return Create(name, spec, tags, min, max, auth, prot, false);
|
return Create(name, spec, tags, min, max, auth, prot, false);
|
||||||
}
|
}
|
||||||
@ -1149,7 +1152,7 @@ public:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Convenience constructor.
|
* Convenience constructor.
|
||||||
*/
|
*/
|
||||||
Listener(StackStrF & name)
|
explicit Listener(StackStrF & name)
|
||||||
: Listener(name, DummyStackStrF(), NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false)
|
: Listener(name, DummyStackStrF(), NullArray(), 0, SQMOD_MAX_CMD_ARGS-1, -1, false, false)
|
||||||
{
|
{
|
||||||
/* ... */
|
/* ... */
|
||||||
@ -1239,11 +1242,11 @@ public:
|
|||||||
STHROWF("Unable to extract a valid listener name");
|
STHROWF("Unable to extract a valid listener name");
|
||||||
}
|
}
|
||||||
// Validate the specified name and assign it
|
// Validate the specified name and assign it
|
||||||
m_Name.assign(ValidateName(name.mPtr), name.mLen);
|
m_Name.assign(ValidateName(name.mPtr), static_cast< size_t >(name.mLen));
|
||||||
// Initialize the specifiers to default values
|
// Initialize the specifiers to default values
|
||||||
for (Uint8 n = 0; n < SQMOD_MAX_CMD_ARGS; ++n)
|
for (unsigned char & n : m_ArgSpec)
|
||||||
{
|
{
|
||||||
m_ArgSpec[n] = CMDARG_ANY;
|
n = CMDARG_ANY;
|
||||||
}
|
}
|
||||||
// Apply the specified argument rules/specifications
|
// Apply the specified argument rules/specifications
|
||||||
SetSpec(spec); // guaranteed the value will not be modified!
|
SetSpec(spec); // guaranteed the value will not be modified!
|
||||||
@ -1449,13 +1452,13 @@ public:
|
|||||||
// Detach from the current name if necessary
|
// Detach from the current name if necessary
|
||||||
ctr->Detach(this);
|
ctr->Detach(this);
|
||||||
// Now it's safe to assign the new name
|
// Now it's safe to assign the new name
|
||||||
m_Name.assign(name.mPtr, name.mLen);
|
m_Name.assign(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
// We know the new name is valid
|
// We know the new name is valid
|
||||||
ctr->Attach(NullObject(), this);
|
ctr->Attach(NullObject(), this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_Name.assign(name.mPtr, name.mLen); // Just assign the name
|
m_Name.assign(name.mPtr, static_cast< size_t >(name.mLen)); // Just assign the name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1498,7 +1501,7 @@ public:
|
|||||||
// Assign the specifier, if any
|
// Assign the specifier, if any
|
||||||
if (spec.mLen > 0)
|
if (spec.mLen > 0)
|
||||||
{
|
{
|
||||||
m_Spec.assign(spec.mPtr, spec.mLen);
|
m_Spec.assign(spec.mPtr, static_cast< size_t >(spec.mLen));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1530,9 +1533,9 @@ public:
|
|||||||
// Preliminary checks before even attempting anything
|
// Preliminary checks before even attempting anything
|
||||||
if (tags.GetType() != OT_ARRAY || tags.IsNull())
|
if (tags.GetType() != OT_ARRAY || tags.IsNull())
|
||||||
{
|
{
|
||||||
for (Uint8 n = 0; n < SQMOD_MAX_CMD_ARGS; ++n)
|
for (auto & m_ArgTag : m_ArgTags)
|
||||||
{
|
{
|
||||||
m_ArgTags[n].clear();
|
m_ArgTag.clear();
|
||||||
}
|
}
|
||||||
// We're done here!
|
// We're done here!
|
||||||
return;
|
return;
|
||||||
@ -1542,9 +1545,9 @@ public:
|
|||||||
// If no tags were specified then clear current tags
|
// If no tags were specified then clear current tags
|
||||||
if (!max)
|
if (!max)
|
||||||
{
|
{
|
||||||
for (Uint8 n = 0; n < SQMOD_MAX_CMD_ARGS; ++n)
|
for (auto & m_ArgTag : m_ArgTags)
|
||||||
{
|
{
|
||||||
m_ArgTags[n].clear();
|
m_ArgTag.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// See if we're in range
|
// See if we're in range
|
||||||
@ -1578,7 +1581,7 @@ public:
|
|||||||
}
|
}
|
||||||
else if (help.mLen > 0)
|
else if (help.mLen > 0)
|
||||||
{
|
{
|
||||||
m_Help.assign(help.mPtr, help.mLen);
|
m_Help.assign(help.mPtr, static_cast< size_t >(help.mLen));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1605,7 +1608,7 @@ public:
|
|||||||
}
|
}
|
||||||
else if (info.mLen > 0)
|
else if (info.mLen > 0)
|
||||||
{
|
{
|
||||||
m_Info.assign(info.mPtr, info.mLen);
|
m_Info.assign(info.mPtr, static_cast< size_t >(info.mLen));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1880,7 +1883,7 @@ public:
|
|||||||
// The string type doesn't appreciate null values
|
// The string type doesn't appreciate null values
|
||||||
else if (name.mLen > 0)
|
else if (name.mLen > 0)
|
||||||
{
|
{
|
||||||
m_ArgTags[arg].assign(name.mPtr, name.mLen);
|
m_ArgTags[arg].assign(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
}
|
}
|
||||||
// Clear previous name in this case
|
// Clear previous name in this case
|
||||||
else
|
else
|
||||||
@ -1925,10 +1928,7 @@ public:
|
|||||||
bool AuthCheck(const Object & invoker)
|
bool AuthCheck(const Object & invoker)
|
||||||
{
|
{
|
||||||
// Do we need explicit authority verification?
|
// Do we need explicit authority verification?
|
||||||
if (!m_Protected)
|
if (!m_Protected) { /* Anyone can invoke this command */ }
|
||||||
{
|
|
||||||
return true; // Anyone can invoke this command
|
|
||||||
}
|
|
||||||
// Was there a custom authority inspector specified?
|
// Was there a custom authority inspector specified?
|
||||||
else if (!m_OnAuth.IsNull())
|
else if (!m_OnAuth.IsNull())
|
||||||
{
|
{
|
||||||
|
@ -37,9 +37,9 @@ static const EnumElement g_SqMod[] = {
|
|||||||
{_SC("MinFloat32"), std::numeric_limits< Float32 >::min()},
|
{_SC("MinFloat32"), std::numeric_limits< Float32 >::min()},
|
||||||
{_SC("MaxFloat32"), std::numeric_limits< Float32 >::max()},
|
{_SC("MaxFloat32"), std::numeric_limits< Float32 >::max()},
|
||||||
{_SC("FpNormal"), FP_NORMAL},
|
{_SC("FpNormal"), FP_NORMAL},
|
||||||
{_SC("FpSubnormal"), FP_SUBNORMAL},
|
{_SC("FpSubnormal"), FP_SUBNORMAL}, // NOLINT(hicpp-signed-bitwise)
|
||||||
{_SC("FpZero"), FP_ZERO},
|
{_SC("FpZero"), FP_ZERO},
|
||||||
{_SC("FpInfinite"), FP_INFINITE},
|
{_SC("FpInfinite"), FP_INFINITE}, // NOLINT(hicpp-signed-bitwise)
|
||||||
{_SC("FpNan"), FP_NAN},
|
{_SC("FpNan"), FP_NAN},
|
||||||
#ifdef SQUSEDOUBLE
|
#ifdef SQUSEDOUBLE
|
||||||
{_SC("HugeVal"), HUGE_VAL},
|
{_SC("HugeVal"), HUGE_VAL},
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
#include "Core.hpp"
|
#include "Core.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <cmath>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -25,7 +23,7 @@ static HSQUIRRELVM GetSquirrelVM()
|
|||||||
static SQRESULT SqModImpl_LoadScript(const SQChar * filepath, SQBool delay)
|
static SQRESULT SqModImpl_LoadScript(const SQChar * filepath, SQBool delay)
|
||||||
{
|
{
|
||||||
// Attempt to add the specified script to the load queue
|
// Attempt to add the specified script to the load queue
|
||||||
if (Core::Get().LoadScript(filepath, delay))
|
if (Core::Get().LoadScript(filepath, static_cast< bool >(delay)))
|
||||||
{
|
{
|
||||||
return SQ_OK; // The script as added or already existed
|
return SQ_OK; // The script as added or already existed
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ Int32 GetMaxPlayers(void)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void SetMaxPlayers(Int32 max)
|
void SetMaxPlayers(Int32 max)
|
||||||
{
|
{
|
||||||
_Func->SetMaxPlayers(max);
|
_Func->SetMaxPlayers(static_cast< uint32_t >(max));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -338,7 +338,7 @@ void SetGameModeText(StackStrF & text)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CreateRadioStream(bool listed, StackStrF & name, StackStrF & url)
|
void CreateRadioStream(bool listed, StackStrF & name, StackStrF & url)
|
||||||
{
|
{
|
||||||
if (_Func->AddRadioStream(-1, name.mPtr, url.mPtr, listed) == vcmpErrorArgumentOutOfBounds)
|
if (_Func->AddRadioStream(-1, name.mPtr, url.mPtr, static_cast< uint8_t >(listed)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Invalid radio stream identifier");
|
STHROWF("Invalid radio stream identifier");
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ void CreateRadioStream(bool listed, StackStrF & name, StackStrF & url)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CreateRadioStreamEx(Int32 id, bool listed, StackStrF & name, StackStrF & url)
|
void CreateRadioStreamEx(Int32 id, bool listed, StackStrF & name, StackStrF & url)
|
||||||
{
|
{
|
||||||
if (_Func->AddRadioStream(id, name.mPtr, url.mPtr, listed) == vcmpErrorArgumentOutOfBounds)
|
if (_Func->AddRadioStream(id, name.mPtr, url.mPtr, static_cast< uint8_t >(listed)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Invalid radio stream identifier");
|
STHROWF("Invalid radio stream identifier");
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ bool GetServerOption(Int32 option_id)
|
|||||||
void SetServerOption(Int32 option_id, bool toggle)
|
void SetServerOption(Int32 option_id, bool toggle)
|
||||||
{
|
{
|
||||||
if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id),
|
if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id),
|
||||||
toggle) == vcmpErrorArgumentOutOfBounds)
|
static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Unknown option identifier: %d", option_id);
|
STHROWF("Unknown option identifier: %d", option_id);
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ void SetServerOption(Int32 option_id, bool toggle)
|
|||||||
void SetServerOptionEx(Int32 option_id, bool toggle, Int32 header, LightObj & payload)
|
void SetServerOptionEx(Int32 option_id, bool toggle, Int32 header, LightObj & payload)
|
||||||
{
|
{
|
||||||
if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id),
|
if (_Func->SetServerOption(static_cast< vcmpServerOption >(option_id),
|
||||||
toggle) == vcmpErrorArgumentOutOfBounds)
|
static_cast< uint8_t >(toggle)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Unknown option identifier: %d", option_id);
|
STHROWF("Unknown option identifier: %d", option_id);
|
||||||
}
|
}
|
||||||
@ -469,7 +469,7 @@ void SetWastedSettings(Uint32 dt, Uint32 ft, Float32 fis, Float32 fos,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
Uint32 GetTimeRate(void)
|
Int32 GetTimeRate(void)
|
||||||
{
|
{
|
||||||
return _Func->GetTimeRate();
|
return _Func->GetTimeRate();
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ void SetVehiclesForcedRespawnHeight(Float32 height)
|
|||||||
void CreateExplosion(Int32 world, Int32 type, const Vector3 & pos, CPlayer & source, bool grounded)
|
void CreateExplosion(Int32 world, Int32 type, const Vector3 & pos, CPlayer & source, bool grounded)
|
||||||
{
|
{
|
||||||
if (_Func->CreateExplosion(world, type, pos.x, pos.y, pos.z,
|
if (_Func->CreateExplosion(world, type, pos.x, pos.y, pos.z,
|
||||||
source.GetID(), grounded) == vcmpErrorArgumentOutOfBounds)
|
source.GetID(), static_cast< uint8_t >(grounded)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Argument value out of bounds");
|
STHROWF("Argument value out of bounds");
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ void CreateExplosion(Int32 world, Int32 type, const Vector3 & pos, CPlayer & sou
|
|||||||
void CreateExplosionEx(Int32 world, Int32 type, Float32 x, Float32 y, Float32 z, CPlayer & source, bool grounded)
|
void CreateExplosionEx(Int32 world, Int32 type, Float32 x, Float32 y, Float32 z, CPlayer & source, bool grounded)
|
||||||
{
|
{
|
||||||
if (_Func->CreateExplosion(world, type, x, y, z,
|
if (_Func->CreateExplosion(world, type, x, y, z,
|
||||||
source.GetID(), grounded) == vcmpErrorArgumentOutOfBounds)
|
source.GetID(), static_cast< uint8_t >(grounded)) == vcmpErrorArgumentOutOfBounds)
|
||||||
{
|
{
|
||||||
STHROWF("Argument value out of bounds");
|
STHROWF("Argument value out of bounds");
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ Uint32 GetServerFlags();
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the maximum number of clients allowed on the server.
|
* Retrieve the maximum number of clients allowed on the server.
|
||||||
*/
|
*/
|
||||||
Int32 GetMaxPlayers(void);
|
Int32 GetMaxPlayers();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the maximum number of clients allowed on the server.
|
* Modify the maximum number of clients allowed on the server.
|
||||||
@ -200,7 +200,7 @@ void SetWastedSettings(Uint32 dt, Uint32 ft, Float32 fis, Float32 fos,
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the current time-rate.
|
* Retrieve the current time-rate.
|
||||||
*/
|
*/
|
||||||
Uint32 GetTimeRate(void);
|
Int32 GetTimeRate();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the current time-rate.
|
* Modify the current time-rate.
|
||||||
@ -210,7 +210,7 @@ void SetTimeRate(Uint32 rate);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the game hour.
|
* Retrieve the game hour.
|
||||||
*/
|
*/
|
||||||
Int32 GetHour(void);
|
Int32 GetHour();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the game hour.
|
* Modify the game hour.
|
||||||
@ -220,7 +220,7 @@ void SetHour(Int32 hour);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the game minute.
|
* Retrieve the game minute.
|
||||||
*/
|
*/
|
||||||
Int32 GetMinute(void);
|
Int32 GetMinute();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the game minute.
|
* Modify the game minute.
|
||||||
@ -230,7 +230,7 @@ void SetMinute(Int32 minute);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the weather effects.
|
* Retrieve the weather effects.
|
||||||
*/
|
*/
|
||||||
Int32 GetWeather(void);
|
Int32 GetWeather();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the weather effects.
|
* Modify the weather effects.
|
||||||
@ -240,7 +240,7 @@ void SetWeather(Int32 weather);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the game gravity.
|
* Retrieve the game gravity.
|
||||||
*/
|
*/
|
||||||
Float32 GetGravity(void);
|
Float32 GetGravity();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the game gravity.
|
* Modify the game gravity.
|
||||||
@ -250,7 +250,7 @@ void SetGravity(Float32 gravity);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the game speed.
|
* Retrieve the game speed.
|
||||||
*/
|
*/
|
||||||
Float32 GetGameSpeed(void);
|
Float32 GetGameSpeed();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the game speed.
|
* Modify the game speed.
|
||||||
@ -260,7 +260,7 @@ void SetGameSpeed(Float32 speed);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the water level.
|
* Retrieve the water level.
|
||||||
*/
|
*/
|
||||||
Float32 GetWaterLevel(void);
|
Float32 GetWaterLevel();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the water level.
|
* Modify the water level.
|
||||||
@ -270,7 +270,7 @@ void SetWaterLevel(Float32 level);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the maximum flight altitude.
|
* Retrieve the maximum flight altitude.
|
||||||
*/
|
*/
|
||||||
Float32 GetMaximumFlightAltitude(void);
|
Float32 GetMaximumFlightAltitude();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the maximum flight altitude.
|
* Modify the maximum flight altitude.
|
||||||
@ -280,7 +280,7 @@ void SetMaximumFlightAltitude(Float32 height);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the kill command delay.
|
* Retrieve the kill command delay.
|
||||||
*/
|
*/
|
||||||
Int32 GetKillCommandDelay(void);
|
Int32 GetKillCommandDelay();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the kill command delay.
|
* Modify the kill command delay.
|
||||||
@ -290,7 +290,7 @@ void SetKillCommandDelay(Int32 delay);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve the vehicles forced respawn height.
|
* Retrieve the vehicles forced respawn height.
|
||||||
*/
|
*/
|
||||||
Float32 GetVehiclesForcedRespawnHeight(void);
|
Float32 GetVehiclesForcedRespawnHeight();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Modify the vehicles forced respawn height.
|
* Modify the vehicles forced respawn height.
|
||||||
@ -355,7 +355,7 @@ void ShowMapObjectRaw(Int32 model, Int16 x, Int16 y, Int16 z);
|
|||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Make all map objects visible again.
|
* Make all map objects visible again.
|
||||||
*/
|
*/
|
||||||
void ShowAllMapObjects(void);
|
void ShowAllMapObjects();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Retrieve field data of a certain weapon.
|
* Retrieve field data of a certain weapon.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static String CS_Skin_Names[] = {
|
static String CS_Skin_Names[] = { // NOLINT(cert-err58-cpp)
|
||||||
/* 0 */ "Tommy Vercetti", /* 1 */ "Cop",
|
/* 0 */ "Tommy Vercetti", /* 1 */ "Cop",
|
||||||
/* 2 */ "SWAT", /* 3 */ "FBI",
|
/* 2 */ "SWAT", /* 3 */ "FBI",
|
||||||
/* 4 */ "Army", /* 5 */ "Paramedic",
|
/* 4 */ "Army", /* 5 */ "Paramedic",
|
||||||
@ -114,7 +114,7 @@ void SetSkinName(Uint32 id, StackStrF & name)
|
|||||||
Int32 GetSkinID(StackStrF & name)
|
Int32 GetSkinID(StackStrF & name)
|
||||||
{
|
{
|
||||||
// Clone the string into an editable version
|
// Clone the string into an editable version
|
||||||
String str(name.mPtr, name.mLen);
|
String str(name.mPtr, static_cast< size_t >(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
|
||||||
@ -154,6 +154,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'r':
|
case 'r':
|
||||||
if (c == 'a') return SQMOD_SKIN_ARABIC_GUY;
|
if (c == 'a') return SQMOD_SKIN_ARABIC_GUY;
|
||||||
else if (c == 'm') return SQMOD_SKIN_ARMY;
|
else if (c == 'm') return SQMOD_SKIN_ARMY;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [B]each guy (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)/(#8|H)
|
// [B]each guy (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)/(#8|H)
|
||||||
// [B]each lady (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)
|
// [B]each lady (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)
|
||||||
@ -184,6 +185,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'g': return SQMOD_SKIN_BEACH_GUY_G;
|
case 'g': return SQMOD_SKIN_BEACH_GUY_G;
|
||||||
case '8':
|
case '8':
|
||||||
case 'h': return SQMOD_SKIN_BEACH_GUY_H;
|
case 'h': return SQMOD_SKIN_BEACH_GUY_H;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Be]ach [l]ady (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)
|
// [Be]ach [l]ady (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)/(#7|G)
|
||||||
@ -205,6 +207,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'f': return SQMOD_SKIN_BEACH_LADY_F;
|
case 'f': return SQMOD_SKIN_BEACH_LADY_F;
|
||||||
case '7':
|
case '7':
|
||||||
case 'g': return SQMOD_SKIN_BEACH_LADY_G;
|
case 'g': return SQMOD_SKIN_BEACH_LADY_G;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Bi]ker (#1|A)/(#2|B)
|
// [Bi]ker (#1|A)/(#2|B)
|
||||||
@ -248,6 +251,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'e': return SQMOD_SKIN_BUSINESS_MAN_E;
|
case 'e': return SQMOD_SKIN_BUSINESS_MAN_E;
|
||||||
case '6':
|
case '6':
|
||||||
case 'f': return SQMOD_SKIN_BUSINESS_MAN_F;
|
case 'f': return SQMOD_SKIN_BUSINESS_MAN_F;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [C]am, [C]am (Robber), [C]andy Suxx, [C]hef
|
// [C]am, [C]am (Robber), [C]andy Suxx, [C]hef
|
||||||
@ -315,6 +319,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'c': return SQMOD_SKIN_COOL_GUY_C;
|
case 'c': return SQMOD_SKIN_COOL_GUY_C;
|
||||||
case '4':
|
case '4':
|
||||||
case 'd': return SQMOD_SKIN_COOL_GUY_D;
|
case 'd': return SQMOD_SKIN_COOL_GUY_D;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Cop]
|
// [Cop]
|
||||||
@ -346,6 +351,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'g':
|
case 'g':
|
||||||
if (d == '1' || d == 'a') return SQMOD_SKIN_DIAZ_GUY_A;
|
if (d == '1' || d == 'a') return SQMOD_SKIN_DIAZ_GUY_A;
|
||||||
else if (d == '2' || d == 'b') return SQMOD_SKIN_DIAZ_GUY_B;
|
else if (d == '2' || d == 'b') return SQMOD_SKIN_DIAZ_GUY_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [F]BI, [F]ireman, [F]ood lady, [F]rench guy
|
// [F]BI, [F]ireman, [F]ood lady, [F]rench guy
|
||||||
// fall through
|
// fall through
|
||||||
@ -363,6 +369,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
// [Fr]ench [g]uy
|
// [Fr]ench [g]uy
|
||||||
case 'r':
|
case 'r':
|
||||||
case 'g': return SQMOD_SKIN_FRENCH_GUY;
|
case 'g': return SQMOD_SKIN_FRENCH_GUY;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [G]arbageman (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)
|
// [G]arbageman (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)
|
||||||
// [G]olf guy (#1|A)/(#2|B)/(#3|C)
|
// [G]olf guy (#1|A)/(#2|B)/(#3|C)
|
||||||
@ -385,6 +392,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'd': return SQMOD_SKIN_GARBAGEMAN_D;
|
case 'd': return SQMOD_SKIN_GARBAGEMAN_D;
|
||||||
case '5':
|
case '5':
|
||||||
case 'e': return SQMOD_SKIN_GARBAGEMAN_E;
|
case 'e': return SQMOD_SKIN_GARBAGEMAN_E;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Go]lf [g]uy (#1|A)/(#2|B)/(#3|C)
|
// [Go]lf [g]uy (#1|A)/(#2|B)/(#3|C)
|
||||||
@ -398,6 +406,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_GOLF_GUY_B;
|
case 'b': return SQMOD_SKIN_GOLF_GUY_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_GOLF_GUY_C;
|
case 'c': return SQMOD_SKIN_GOLF_GUY_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Go]lf [l]ady
|
// [Go]lf [l]ady
|
||||||
@ -434,6 +443,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'd': return SQMOD_SKIN_HATIAN_D;
|
case 'd': return SQMOD_SKIN_HATIAN_D;
|
||||||
case '5':
|
case '5':
|
||||||
case 'e': return SQMOD_SKIN_HATIAN_E;
|
case 'e': return SQMOD_SKIN_HATIAN_E;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Hi]lary ([R]obbe[r])
|
// [Hi]lary ([R]obbe[r])
|
||||||
@ -453,7 +463,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'l':
|
case 'l':
|
||||||
//[Lan]ce ([C]o[p])
|
//[Lan]ce ([C]o[p])
|
||||||
if ((b == 'a') && (c == 'n') && ((len > 5 && str[5] == 'c') || d == 'p'))
|
if ((b == 'a') && (c == 'n') && ((len > 5 && str[5] == 'c') || d == 'p'))
|
||||||
return SQMOD_SKIN_LANCE_COP;
|
return SQMOD_SKIN_LANCE_COP; // NOLINT(bugprone-branch-clone)
|
||||||
else if (b && (b == 'c' || (b == 'a' && (c == 'n'))))
|
else if (b && (b == 'c' || (b == 'a' && (c == 'n'))))
|
||||||
return SQMOD_SKIN_LANCE_COP;
|
return SQMOD_SKIN_LANCE_COP;
|
||||||
// [La]nce (#1|A)/(#1|B)
|
// [La]nce (#1|A)/(#1|B)
|
||||||
@ -476,6 +486,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_LOVE_FIST_C;
|
case 'c': return SQMOD_SKIN_LOVE_FIST_C;
|
||||||
case 'd': return SQMOD_SKIN_LOVE_FIST_D;
|
case 'd': return SQMOD_SKIN_LOVE_FIST_D;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [M]ercades
|
// [M]ercades
|
||||||
@ -526,6 +537,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'e': return SQMOD_SKIN_PROSTITUTE_E;
|
case 'e': return SQMOD_SKIN_PROSTITUTE_E;
|
||||||
case '4':
|
case '4':
|
||||||
case 'f': return SQMOD_SKIN_PROSTITUTE_F;
|
case 'f': return SQMOD_SKIN_PROSTITUTE_F;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Pu]nk (#1|A)/(#2|B)/(#3|C)
|
// [Pu]nk (#1|A)/(#2|B)/(#3|C)
|
||||||
@ -539,6 +551,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_PUNK_B;
|
case 'b': return SQMOD_SKIN_PUNK_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_PUNK_C;
|
case 'c': return SQMOD_SKIN_PUNK_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [R]ich guy, [R]ockstar guy
|
// [R]ich guy, [R]ockstar guy
|
||||||
@ -572,6 +585,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_SAILOR_B;
|
case 'b': return SQMOD_SKIN_SAILOR_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_SAILOR_C;
|
case 'c': return SQMOD_SKIN_SAILOR_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [S]hark (#1|A)/(#2|B)
|
// [S]hark (#1|A)/(#2|B)
|
||||||
@ -583,6 +597,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_SHARK_A;
|
case 'a': return SQMOD_SKIN_SHARK_A;
|
||||||
case '2':
|
case '2':
|
||||||
case 'b': return SQMOD_SKIN_SHARK_B;
|
case 'b': return SQMOD_SKIN_SHARK_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [S]hopper (#1|A)/(#2|B)
|
// [S]hopper (#1|A)/(#2|B)
|
||||||
@ -594,6 +609,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_SHOPPER_A;
|
case 'a': return SQMOD_SKIN_SHOPPER_A;
|
||||||
case '2':
|
case '2':
|
||||||
case 'b': return SQMOD_SKIN_SHOPPER_B;
|
case 'b': return SQMOD_SKIN_SHOPPER_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Sk]ate [g]uy
|
// [Sk]ate [g]uy
|
||||||
@ -605,7 +621,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
// [So]nny
|
// [So]nny
|
||||||
// [So]nny guy (#1|A)/(#2|B)/(#3|C)
|
// [So]nny guy (#1|A)/(#2|B)/(#3|C)
|
||||||
else if (b == 'o')
|
else if (b == 'o')
|
||||||
{
|
{ // NOLINT(bugprone-branch-clone)
|
||||||
switch (d)
|
switch (d)
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
@ -614,6 +630,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_SONNY_GUY_B;
|
case 'b': return SQMOD_SKIN_SONNY_GUY_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_SONNY_GUY_C;
|
case 'c': return SQMOD_SKIN_SONNY_GUY_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (b == 'g')
|
else if (b == 'g')
|
||||||
@ -626,6 +643,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_SONNY_GUY_B;
|
case 'b': return SQMOD_SKIN_SONNY_GUY_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_SONNY_GUY_C;
|
case 'c': return SQMOD_SKIN_SONNY_GUY_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Sp]andE[x] (#1|A)/(#2|B)
|
// [Sp]andE[x] (#1|A)/(#2|B)
|
||||||
@ -637,6 +655,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_SPANDEX_GUY_A;
|
case 'a': return SQMOD_SKIN_SPANDEX_GUY_A;
|
||||||
case '2':
|
case '2':
|
||||||
case 'b': return SQMOD_SKIN_SPANDEX_GUY_B;
|
case 'b': return SQMOD_SKIN_SPANDEX_GUY_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Sp]anish [g]uy
|
// [Sp]anish [g]uy
|
||||||
@ -655,6 +674,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'c': return SQMOD_SKIN_SPANISH_LADY_C;
|
case 'c': return SQMOD_SKIN_SPANISH_LADY_C;
|
||||||
case '4':
|
case '4':
|
||||||
case 'd': return SQMOD_SKIN_SPANISH_LADY_D;
|
case 'd': return SQMOD_SKIN_SPANISH_LADY_D;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Sto]re clerk
|
// [Sto]re clerk
|
||||||
@ -670,6 +690,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_STRIPPER_B;
|
case 'b': return SQMOD_SKIN_STRIPPER_B;
|
||||||
case '3':
|
case '3':
|
||||||
case 'c': return SQMOD_SKIN_STRIPPER_C;
|
case 'c': return SQMOD_SKIN_STRIPPER_C;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [Sw]at
|
// [Sw]at
|
||||||
@ -693,6 +714,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'b': return SQMOD_SKIN_TAXI_DRIVER_B;
|
case 'b': return SQMOD_SKIN_TAXI_DRIVER_B;
|
||||||
case 'c': return SQMOD_SKIN_TAXI_DRIVER_C;
|
case 'c': return SQMOD_SKIN_TAXI_DRIVER_C;
|
||||||
case 'd': return SQMOD_SKIN_TAXI_DRIVER_D;
|
case 'd': return SQMOD_SKIN_TAXI_DRIVER_D;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [Th]ug (#1|A)/(#2|B)
|
// [Th]ug (#1|A)/(#2|B)
|
||||||
case 'h':
|
case 'h':
|
||||||
@ -702,6 +724,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_THUG_A;
|
case 'a': return SQMOD_SKIN_THUG_A;
|
||||||
case '5':
|
case '5':
|
||||||
case 'b': return SQMOD_SKIN_THUG_B;
|
case 'b': return SQMOD_SKIN_THUG_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [To]mmy [V]ercetti
|
// [To]mmy [V]ercetti
|
||||||
// [To]urist (#1|A)/(#2|B)
|
// [To]urist (#1|A)/(#2|B)
|
||||||
@ -712,6 +735,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
else if (c == 'u' && (d == '2' || d == 'b')) return SQMOD_SKIN_TOURIST_B;
|
else if (c == 'u' && (d == '2' || d == 'b')) return SQMOD_SKIN_TOURIST_B;
|
||||||
// fall through
|
// fall through
|
||||||
case 'r': return SQMOD_SKIN_TRANNY;
|
case 'r': return SQMOD_SKIN_TRANNY;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [U]ndercover cop (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)
|
// [U]ndercover cop (#1|A)/(#2|B)/(#3|C)/(#4|D)/(#5|E)/(#6|F)
|
||||||
case 'u':
|
case 'u':
|
||||||
@ -729,6 +753,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'e': return SQMOD_SKIN_UNDERCOVER_COP_E;
|
case 'e': return SQMOD_SKIN_UNDERCOVER_COP_E;
|
||||||
case '6':
|
case '6':
|
||||||
case 'f': return SQMOD_SKIN_UNDERCOVER_COP_F;
|
case 'f': return SQMOD_SKIN_UNDERCOVER_COP_F;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [V]ercetti guy (#1|A)/(#2|B)
|
// [V]ercetti guy (#1|A)/(#2|B)
|
||||||
case 'v':
|
case 'v':
|
||||||
@ -738,6 +763,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_VERCETTI_GUY_A;
|
case 'a': return SQMOD_SKIN_VERCETTI_GUY_A;
|
||||||
case '2':
|
case '2':
|
||||||
case 'b': return SQMOD_SKIN_VERCETTI_GUY_B;
|
case 'b': return SQMOD_SKIN_VERCETTI_GUY_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// [W]aitress (#1|A)/(#2|B)
|
// [W]aitress (#1|A)/(#2|B)
|
||||||
case 'w':
|
case 'w':
|
||||||
@ -747,6 +773,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
case 'a': return SQMOD_SKIN_WAITRESS_A;
|
case 'a': return SQMOD_SKIN_WAITRESS_A;
|
||||||
case '2':
|
case '2':
|
||||||
case 'b': return SQMOD_SKIN_WAITRESS_B;
|
case 'b': return SQMOD_SKIN_WAITRESS_B;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
// Default to unknown
|
// Default to unknown
|
||||||
default: return SQMOD_UNKNOWN;
|
default: return SQMOD_UNKNOWN;
|
||||||
@ -756,7 +783,7 @@ Int32 GetSkinID(StackStrF & name)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool IsSkinValid(Int32 id)
|
bool IsSkinValid(Int32 id)
|
||||||
{
|
{
|
||||||
CSStr name = GetSkinName(id);
|
CSStr name = GetSkinName(static_cast<Uint32>(id));
|
||||||
return (name && *name != '\0');
|
return (name && *name != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include "Core.hpp"
|
#include "Core.hpp"
|
||||||
#include "Base/Shared.hpp"
|
|
||||||
#include "Base/Color3.hpp"
|
#include "Base/Color3.hpp"
|
||||||
#include "Base/Vector2.hpp"
|
#include "Base/Vector2.hpp"
|
||||||
#include "Base/Vector3.hpp"
|
|
||||||
#include "Entity/Player.hpp"
|
#include "Entity/Player.hpp"
|
||||||
#include "Library/Numeric/LongInt.hpp"
|
#include "Library/Numeric/LongInt.hpp"
|
||||||
|
|
||||||
|
@ -3,12 +3,9 @@
|
|||||||
#include "Library/Chrono.hpp"
|
#include "Library/Chrono.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
@ -37,7 +34,7 @@ void Routine::Process()
|
|||||||
// Get the current time-stamp
|
// Get the current time-stamp
|
||||||
s_Last = Chrono::GetCurrentSysTime();
|
s_Last = Chrono::GetCurrentSysTime();
|
||||||
// Calculate the elapsed time
|
// Calculate the elapsed time
|
||||||
const Int32 delta = Int32((s_Last - s_Prev) / 1000L);
|
const auto delta = Int32((s_Last - s_Prev) / 1000L);
|
||||||
// Process all active routines
|
// Process all active routines
|
||||||
for (Interval * itr = s_Intervals; itr != (s_Intervals + SQMOD_MAX_ROUTINES); ++itr)
|
for (Interval * itr = s_Intervals; itr != (s_Intervals + SQMOD_MAX_ROUTINES); ++itr)
|
||||||
{
|
{
|
||||||
@ -251,7 +248,7 @@ SQInteger Routine::Create(HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alright, at this point we can initialize the slot
|
// Alright, at this point we can initialize the slot
|
||||||
inst.Init(env, func, obj, intrv, itr);
|
inst.Init(env, func, obj, intrv, static_cast< Iterator >(itr));
|
||||||
// Now initialize the timer
|
// Now initialize the timer
|
||||||
s_Intervals[slot] = intrv;
|
s_Intervals[slot] = intrv;
|
||||||
// We have the created routine on the stack, so let's return it
|
// We have the created routine on the stack, so let's return it
|
||||||
@ -267,7 +264,7 @@ bool Routine::IsWithTag(StackStrF & tag)
|
|||||||
// Iterate routine list
|
// Iterate routine list
|
||||||
for (const auto & r : s_Instances)
|
for (const auto & r : s_Instances)
|
||||||
{
|
{
|
||||||
if (!r.mInst.IsNull() && r.mTag.compare(tag.mPtr) == 0)
|
if (!r.mInst.IsNull() && r.mTag == tag.mPtr)
|
||||||
{
|
{
|
||||||
return true; // Yup, we're doing this
|
return true; // Yup, we're doing this
|
||||||
}
|
}
|
||||||
@ -286,7 +283,7 @@ bool Routine::TerminateWithTag(StackStrF & tag)
|
|||||||
// Iterate routine list
|
// Iterate routine list
|
||||||
for (auto & r : s_Instances)
|
for (auto & r : s_Instances)
|
||||||
{
|
{
|
||||||
if (!r.mInst.IsNull() && r.mTag.compare(tag.mPtr) == 0)
|
if (!r.mInst.IsNull() && r.mTag == tag.mPtr)
|
||||||
{
|
{
|
||||||
r.Terminate(); // Yup, we're doing this
|
r.Terminate(); // Yup, we're doing this
|
||||||
return true; // A routine was terminated
|
return true; // A routine was terminated
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Instance()
|
Instance() noexcept
|
||||||
: mEnv()
|
: mEnv()
|
||||||
, mFunc()
|
, mFunc()
|
||||||
, mInst()
|
, mInst()
|
||||||
@ -160,7 +160,7 @@ private:
|
|||||||
sq_pushobject(vm, mArgv[n].mObj);
|
sq_pushobject(vm, mArgv[n].mObj);
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
const SQRESULT res = sq_call(vm, mArgc + 1, false, !mQuiet);
|
const SQRESULT res = sq_call(vm, mArgc + 1, static_cast< SQBool >(false), static_cast< SQBool >(!mQuiet));
|
||||||
// Pop the callback object from the stack
|
// Pop the callback object from the stack
|
||||||
sq_pop(vm, 1);
|
sq_pop(vm, 1);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -235,12 +235,30 @@ protected:
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Routine(Uint32 slot)
|
explicit Routine(Uint32 slot)
|
||||||
: m_Slot(slot)
|
: m_Slot(slot)
|
||||||
{
|
{
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Find an unoccupied routine slot.
|
||||||
|
*/
|
||||||
|
static SQInteger FindUnused()
|
||||||
|
{
|
||||||
|
for (const auto & r : s_Instances)
|
||||||
|
{
|
||||||
|
if (r.mInst.IsNull())
|
||||||
|
{
|
||||||
|
return (&r - s_Instances); // Return the index of this element
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// No available slot
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy constructor. (disabled)
|
* Copy constructor. (disabled)
|
||||||
*/
|
*/
|
||||||
@ -261,24 +279,6 @@ protected:
|
|||||||
*/
|
*/
|
||||||
Routine & operator = (Routine && o) = delete;
|
Routine & operator = (Routine && o) = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Find an unoccupied routine slot.
|
|
||||||
*/
|
|
||||||
static SQInteger FindUnused()
|
|
||||||
{
|
|
||||||
for (const auto & r : s_Instances)
|
|
||||||
{
|
|
||||||
if (r.mInst.IsNull())
|
|
||||||
{
|
|
||||||
return (&r - s_Instances); // Return the index of this element
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No available slot
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the number of used routine slots.
|
* Retrieve the number of used routine slots.
|
||||||
*/
|
*/
|
||||||
@ -310,7 +310,7 @@ public:
|
|||||||
// Iterate routine list
|
// Iterate routine list
|
||||||
for (const auto & r : s_Instances)
|
for (const auto & r : s_Instances)
|
||||||
{
|
{
|
||||||
if (!r.mInst.IsNull() && r.mTag.compare(tag.mPtr) == 0)
|
if (!r.mInst.IsNull() && r.mTag == tag.mPtr)
|
||||||
{
|
{
|
||||||
return r.mInst; // Return this routine instance
|
return r.mInst; // Return this routine instance
|
||||||
}
|
}
|
||||||
@ -318,7 +318,10 @@ public:
|
|||||||
// Unable to find such routine
|
// Unable to find such routine
|
||||||
STHROWF("Unable to find a routine with tag (%s)", tag.mPtr);
|
STHROWF("Unable to find a routine with tag (%s)", tag.mPtr);
|
||||||
// Should not reach this point but if it did, we have to return something
|
// Should not reach this point but if it did, we have to return something
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Warray-bounds"
|
||||||
return s_Instances[SQMOD_MAX_ROUTINES].mInst; // Intentional Buffer overflow!
|
return s_Instances[SQMOD_MAX_ROUTINES].mInst; // Intentional Buffer overflow!
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Check if a routine with a certain tag exists.
|
* Check if a routine with a certain tag exists.
|
||||||
@ -405,7 +408,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetTag(StackStrF & tag)
|
void SetTag(StackStrF & tag)
|
||||||
{
|
{
|
||||||
GetValid().mTag.assign(tag.mPtr, ClampMin(tag.mLen, 0));
|
GetValid().mTag.assign(tag.mPtr, static_cast< size_t >(ClampMin(tag.mLen, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
@ -30,11 +30,12 @@ struct SignalWrapper
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Explicit constructor.
|
* Explicit constructor.
|
||||||
*/
|
*/
|
||||||
SignalWrapper(HSQUIRRELVM vm, bool extra = false)
|
explicit SignalWrapper(HSQUIRRELVM vm, bool extra = false)
|
||||||
: mSignal(nullptr)
|
: mSignal(nullptr)
|
||||||
, mSlot()
|
, mSlot()
|
||||||
, mVM(vm)
|
, mVM(vm)
|
||||||
, mRes(Initialize(vm, extra))
|
, mRes(Initialize(vm, extra))
|
||||||
|
, mOne(false), mAppend(false)
|
||||||
{
|
{
|
||||||
//...
|
//...
|
||||||
}
|
}
|
||||||
@ -236,7 +237,7 @@ template < class Slot > struct MatchThis
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Base constructor.
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
MatchThis(SQHash t)
|
explicit MatchThis(SQHash t)
|
||||||
: mThisHash(t)
|
: mThisHash(t)
|
||||||
{
|
{
|
||||||
//...
|
//...
|
||||||
@ -262,7 +263,7 @@ template < class Slot > struct MatchFunc
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Base constructor.
|
* Base constructor.
|
||||||
*/
|
*/
|
||||||
MatchFunc(SQHash f)
|
explicit MatchFunc(SQHash f)
|
||||||
: mFuncHash(f)
|
: mFuncHash(f)
|
||||||
{
|
{
|
||||||
//...
|
//...
|
||||||
@ -612,10 +613,10 @@ bool Signal::AdjustSlots(SizeType capacity)
|
|||||||
// Calculate the next optimal size of the buffer
|
// Calculate the next optimal size of the buffer
|
||||||
while (size < capacity)
|
while (size < capacity)
|
||||||
{
|
{
|
||||||
size += (size + 1) >> 1;
|
size += (size + 1u) >> 1u;
|
||||||
}
|
}
|
||||||
// Attempt to allocate a memory buffer of the resulted size
|
// Attempt to allocate a memory buffer of the resulted size
|
||||||
Pointer slots = reinterpret_cast< Pointer >(new uint8_t[size * sizeof(Slot)]);
|
auto slots = reinterpret_cast< Pointer >(new uint8_t[size * sizeof(Slot)]);
|
||||||
// See if the memory could be allocated
|
// See if the memory could be allocated
|
||||||
if (slots == nullptr)
|
if (slots == nullptr)
|
||||||
{
|
{
|
||||||
@ -626,7 +627,7 @@ bool Signal::AdjustSlots(SizeType capacity)
|
|||||||
// Are there any existing slots?
|
// Are there any existing slots?
|
||||||
if (m_Used)
|
if (m_Used)
|
||||||
{
|
{
|
||||||
// Grab the range of slots to be transfered
|
// Grab the range of slots to be transferred
|
||||||
Pointer src = m_Slots, end = (m_Slots + m_Used);
|
Pointer src = m_Slots, end = (m_Slots + m_Used);
|
||||||
// Transfer the existing slots
|
// Transfer the existing slots
|
||||||
while (src != end)
|
while (src != end)
|
||||||
@ -728,7 +729,7 @@ SQInteger Signal::Exists(SignalWrapper & w)
|
|||||||
const bool r = ExistsIf(MatchSlot< Slot >(w.mSlot.mThisHash, w.mSlot.mFuncHash),
|
const bool r = ExistsIf(MatchSlot< Slot >(w.mSlot.mThisHash, w.mSlot.mFuncHash),
|
||||||
m_Slots, m_Slots + m_Used);
|
m_Slots, m_Slots + m_Used);
|
||||||
// Push the resulted value on the stack
|
// Push the resulted value on the stack
|
||||||
sq_pushbool(w.mVM, r);
|
sq_pushbool(w.mVM, static_cast< SQBool >(r));
|
||||||
// Specify that we returned a value
|
// Specify that we returned a value
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -739,7 +740,7 @@ SQInteger Signal::ExistsThis(SignalWrapper & w)
|
|||||||
// Forward the call to the actual function
|
// Forward the call to the actual function
|
||||||
const bool r = ExistsIf(MatchThis< Slot >(w.mSlot.mThisHash), m_Slots, m_Slots + m_Used);
|
const bool r = ExistsIf(MatchThis< Slot >(w.mSlot.mThisHash), m_Slots, m_Slots + m_Used);
|
||||||
// Push the resulted value on the stack
|
// Push the resulted value on the stack
|
||||||
sq_pushbool(w.mVM, r);
|
sq_pushbool(w.mVM, static_cast< SQBool >(r));
|
||||||
// Specify that we returned a value
|
// Specify that we returned a value
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -750,7 +751,7 @@ SQInteger Signal::ExistsFunc(SignalWrapper & w)
|
|||||||
// Forward the call to the actual function
|
// Forward the call to the actual function
|
||||||
const bool r = ExistsIf(MatchFunc< Slot >(w.mSlot.mFuncHash), m_Slots, m_Slots + m_Used);
|
const bool r = ExistsIf(MatchFunc< Slot >(w.mSlot.mFuncHash), m_Slots, m_Slots + m_Used);
|
||||||
// Push the resulted value on the stack
|
// Push the resulted value on the stack
|
||||||
sq_pushbool(w.mVM, r);
|
sq_pushbool(w.mVM, static_cast< SQBool >(r));
|
||||||
// Specify that we returned a value
|
// Specify that we returned a value
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1000,7 +1001,7 @@ SQInteger Signal::Emit(HSQUIRRELVM vm, SQInteger top)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, top, false, ErrorHandling::IsEnabled());
|
res = sq_call(vm, top, static_cast< SQBool >(false), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Pop the callback object from the stack
|
// Pop the callback object from the stack
|
||||||
sq_pop(vm, 1);
|
sq_pop(vm, 1);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -1083,7 +1084,7 @@ SQInteger Signal::Query(HSQUIRRELVM vm, SQInteger top)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, top-2, true, ErrorHandling::IsEnabled());
|
res = sq_call(vm, top-2, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Validate the result
|
// Validate the result
|
||||||
if (SQ_FAILED(res))
|
if (SQ_FAILED(res))
|
||||||
{
|
{
|
||||||
@ -1098,7 +1099,7 @@ SQInteger Signal::Query(HSQUIRRELVM vm, SQInteger top)
|
|||||||
// Push the returned value
|
// Push the returned value
|
||||||
sq_push(vm, -3);
|
sq_push(vm, -3);
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, 2, false, ErrorHandling::IsEnabled());
|
res = sq_call(vm, 2, static_cast< SQBool >(false), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Pop the callback object, return value and collector from the stack
|
// Pop the callback object, return value and collector from the stack
|
||||||
sq_pop(vm, 3);
|
sq_pop(vm, 3);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -1149,7 +1150,7 @@ SQInteger Signal::Consume(HSQUIRRELVM vm, SQInteger top)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, top, true, ErrorHandling::IsEnabled());
|
res = sq_call(vm, top, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Validate the result
|
// Validate the result
|
||||||
if (SQ_FAILED(res))
|
if (SQ_FAILED(res))
|
||||||
{
|
{
|
||||||
@ -1224,7 +1225,7 @@ SQInteger Signal::Approve(HSQUIRRELVM vm, SQInteger top)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, top, true, ErrorHandling::IsEnabled());
|
res = sq_call(vm, top, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Validate the result
|
// Validate the result
|
||||||
if (SQ_FAILED(res))
|
if (SQ_FAILED(res))
|
||||||
{
|
{
|
||||||
@ -1297,7 +1298,7 @@ SQInteger Signal::Request(HSQUIRRELVM vm, SQInteger top)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
res = sq_call(vm, top, true, ErrorHandling::IsEnabled());
|
res = sq_call(vm, top, static_cast< SQBool >(true), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Validate the result
|
// Validate the result
|
||||||
if (SQ_FAILED(res))
|
if (SQ_FAILED(res))
|
||||||
{
|
{
|
||||||
@ -1328,7 +1329,7 @@ SQInteger Signal::SqEmit(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
const SQInteger top = sq_gettop(vm);
|
const SQInteger top = sq_gettop(vm);
|
||||||
// Contains the last received result
|
// Contains the last received result
|
||||||
SQRESULT res = SQ_OK;
|
SQRESULT res;
|
||||||
// Attempt to forward the call to the signal instance
|
// Attempt to forward the call to the signal instance
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1368,7 +1369,7 @@ SQInteger Signal::SqQuery(HSQUIRRELVM vm)
|
|||||||
return sq_throwerror(vm, "Missing collector callback");
|
return sq_throwerror(vm, "Missing collector callback");
|
||||||
}
|
}
|
||||||
// Contains the last received result
|
// Contains the last received result
|
||||||
SQRESULT res = SQ_OK;
|
SQRESULT res;
|
||||||
// Attempt to forward the call to the signal instance
|
// Attempt to forward the call to the signal instance
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1398,7 +1399,7 @@ SQInteger Signal::SqConsume(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
const SQInteger top = sq_gettop(vm);
|
const SQInteger top = sq_gettop(vm);
|
||||||
// Contains the last received result
|
// Contains the last received result
|
||||||
SQRESULT res = SQ_OK;
|
SQRESULT res;
|
||||||
// Attempt to forward the call to the signal instance
|
// Attempt to forward the call to the signal instance
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1428,7 +1429,7 @@ SQInteger Signal::SqApprove(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
const SQInteger top = sq_gettop(vm);
|
const SQInteger top = sq_gettop(vm);
|
||||||
// Contains the last received result
|
// Contains the last received result
|
||||||
SQRESULT res = SQ_OK;
|
SQRESULT res;
|
||||||
// Attempt to forward the call to the signal instance
|
// Attempt to forward the call to the signal instance
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1458,7 +1459,7 @@ SQInteger Signal::SqRequest(HSQUIRRELVM vm)
|
|||||||
{
|
{
|
||||||
const SQInteger top = sq_gettop(vm);
|
const SQInteger top = sq_gettop(vm);
|
||||||
// Contains the last received result
|
// Contains the last received result
|
||||||
SQRESULT res = SQ_OK;
|
SQRESULT res;
|
||||||
// Attempt to forward the call to the signal instance
|
// Attempt to forward the call to the signal instance
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -1536,7 +1537,7 @@ LightObj Signal::Create(StackStrF & name)
|
|||||||
return CreateFree();
|
return CreateFree();
|
||||||
}
|
}
|
||||||
// Create a copy of the name
|
// Create a copy of the name
|
||||||
String sname(name.mPtr, name.mLen);
|
String sname(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
// Compute the hash of the specified name
|
// Compute the hash of the specified name
|
||||||
const std::size_t hash = std::hash< String >{}(sname);
|
const std::size_t hash = std::hash< String >{}(sname);
|
||||||
// See if the signal already exists
|
// See if the signal already exists
|
||||||
@ -1572,11 +1573,11 @@ void Signal::Remove(StackStrF & name)
|
|||||||
STHROWF("Signals without names cannot be removed manually");
|
STHROWF("Signals without names cannot be removed manually");
|
||||||
}
|
}
|
||||||
// Create a copy of the name
|
// Create a copy of the name
|
||||||
const String sname(name.mPtr, name.mLen);
|
const String sname(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
// Compute the hash of the specified name
|
// Compute the hash of the specified name
|
||||||
const std::size_t hash = std::hash< String >{}(sname);
|
const std::size_t hash = std::hash< String >{}(sname);
|
||||||
// Iterator to the existing signal, if any
|
// Iterator to the existing signal, if any
|
||||||
SignalPool::const_iterator itr = s_Signals.cbegin();
|
auto itr = s_Signals.cbegin();
|
||||||
// Search for a signal with this name
|
// Search for a signal with this name
|
||||||
for (; itr != s_Signals.cend(); ++itr)
|
for (; itr != s_Signals.cend(); ++itr)
|
||||||
{
|
{
|
||||||
@ -1606,7 +1607,7 @@ const LightObj & Signal::Fetch(StackStrF & name)
|
|||||||
STHROWF("Signals without names cannot be retrieved manually");
|
STHROWF("Signals without names cannot be retrieved manually");
|
||||||
}
|
}
|
||||||
// Create a copy of the name
|
// Create a copy of the name
|
||||||
const String sname(name.mPtr, name.mLen);
|
const String sname(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
// Compute the hash of the specified name
|
// Compute the hash of the specified name
|
||||||
const std::size_t hash = std::hash< String >{}(sname);
|
const std::size_t hash = std::hash< String >{}(sname);
|
||||||
// Search for a signal with this name
|
// Search for a signal with this name
|
||||||
|
@ -53,7 +53,7 @@ struct Signal
|
|||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Signal(String && name);
|
explicit Signal(String && name);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Copy constructor (disabled).
|
* Copy constructor (disabled).
|
||||||
@ -183,7 +183,7 @@ protected:
|
|||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
* Move constructor.
|
* Move constructor.
|
||||||
*/
|
*/
|
||||||
Slot(Slot && o)
|
Slot(Slot && o) noexcept
|
||||||
: mThisHash(o.mThisHash)
|
: mThisHash(o.mThisHash)
|
||||||
, mFuncHash(o.mFuncHash)
|
, mFuncHash(o.mFuncHash)
|
||||||
, mThisRef(o.mThisRef)
|
, mThisRef(o.mThisRef)
|
||||||
@ -227,7 +227,7 @@ protected:
|
|||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
* Move assignment operator.
|
* Move assignment operator.
|
||||||
*/
|
*/
|
||||||
Slot & operator = (Slot && o)
|
Slot & operator = (Slot && o) noexcept
|
||||||
{
|
{
|
||||||
if (this != &o)
|
if (this != &o)
|
||||||
{
|
{
|
||||||
@ -665,6 +665,8 @@ protected:
|
|||||||
static SignalPool s_Signals; // List of all created signals.
|
static SignalPool s_Signals; // List of all created signals.
|
||||||
static FreeSignals s_FreeSignals; // List of signals without a name.
|
static FreeSignals s_FreeSignals; // List of signals without a name.
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "MemberFunctionCanBeStatic"
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Specialization for when there are no arguments given.
|
* Specialization for when there are no arguments given.
|
||||||
*/
|
*/
|
||||||
@ -672,6 +674,7 @@ protected:
|
|||||||
{
|
{
|
||||||
//...
|
//...
|
||||||
}
|
}
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Specialization for when there's only one argument given/remaining.
|
* Specialization for when there's only one argument given/remaining.
|
||||||
@ -749,13 +752,13 @@ public:
|
|||||||
// Push the given parameters on the stack
|
// Push the given parameters on the stack
|
||||||
PushParameters(args...);
|
PushParameters(args...);
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
const SQRESULT res = sq_call(vm, 1 + sizeof...(Args), false, ErrorHandling::IsEnabled());
|
const SQRESULT res = sq_call(vm, 1 + sizeof...(Args), static_cast< SQBool >(false), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Pop the callback object from the stack
|
// Pop the callback object from the stack
|
||||||
sq_pop(vm, 1);
|
sq_pop(vm, 1);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
if (SQ_FAILED(res))
|
if (SQ_FAILED(res))
|
||||||
{
|
{
|
||||||
SQTHROW(vm, LastErrorString(vm)); // Stop emitting signals
|
SQTHROW(vm, LastErrorString(vm)); // Stop emitting signals NOLINT(hicpp-exception-baseclass,cert-err60-cpp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,9 @@
|
|||||||
#include "Library/Chrono.hpp"
|
#include "Library/Chrono.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
@ -62,7 +59,7 @@ void Tasks::Task::Release()
|
|||||||
mIterations = 0;
|
mIterations = 0;
|
||||||
mInterval = 0;
|
mInterval = 0;
|
||||||
mEntity = -1;
|
mEntity = -1;
|
||||||
mType = -1;
|
mType = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
@ -85,7 +82,7 @@ Tasks::Interval Tasks::Task::Execute()
|
|||||||
sq_pushobject(vm, mArgv[n].mObj);
|
sq_pushobject(vm, mArgv[n].mObj);
|
||||||
}
|
}
|
||||||
// Make the function call and store the result
|
// Make the function call and store the result
|
||||||
const SQRESULT res = sq_call(vm, mArgc + 1, false, ErrorHandling::IsEnabled());
|
const SQRESULT res = sq_call(vm, mArgc + 1, static_cast< SQBool >(false), static_cast< SQBool >(ErrorHandling::IsEnabled()));
|
||||||
// Pop the callback object from the stack
|
// Pop the callback object from the stack
|
||||||
sq_pop(vm, 1);
|
sq_pop(vm, 1);
|
||||||
// Validate the result
|
// Validate the result
|
||||||
@ -117,7 +114,7 @@ void Tasks::Process()
|
|||||||
// Get the current time-stamp
|
// Get the current time-stamp
|
||||||
s_Last = Chrono::GetCurrentSysTime();
|
s_Last = Chrono::GetCurrentSysTime();
|
||||||
// Calculate the elapsed time
|
// Calculate the elapsed time
|
||||||
const Int32 delta = Int32((s_Last - s_Prev) / 1000L);
|
const auto delta = Int32((s_Last - s_Prev) / 1000L);
|
||||||
// Process all active tasks
|
// Process all active tasks
|
||||||
for (Interval * itr = s_Intervals; itr != (s_Intervals + SQMOD_MAX_TASKS); ++itr)
|
for (Interval * itr = s_Intervals; itr != (s_Intervals + SQMOD_MAX_TASKS); ++itr)
|
||||||
{
|
{
|
||||||
@ -317,7 +314,7 @@ SQInteger Tasks::Create(Int32 id, Int32 type, HSQUIRRELVM vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alright, at this point we can initialize the slot
|
// Alright, at this point we can initialize the slot
|
||||||
task.Init(func, inst, intrv, itr, id, type);
|
task.Init(func, inst, intrv, static_cast< Iterator >(itr), id, type);
|
||||||
// Now initialize the timer
|
// Now initialize the timer
|
||||||
s_Intervals[slot] = intrv;
|
s_Intervals[slot] = intrv;
|
||||||
// Push the tag instance on the stack
|
// Push the tag instance on the stack
|
||||||
@ -445,7 +442,7 @@ SQInteger Tasks::Exists(Int32 id, Int32 type, HSQUIRRELVM vm)
|
|||||||
return res; // Propagate the error
|
return res; // Propagate the error
|
||||||
}
|
}
|
||||||
// Push a boolean on whether this task was found
|
// Push a boolean on whether this task was found
|
||||||
sq_pushbool(vm, pos >= 0);
|
sq_pushbool(vm, static_cast< SQBool >(pos >= 0));
|
||||||
// Specify that we're returning a value
|
// Specify that we're returning a value
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -456,7 +453,7 @@ const Tasks::Task & Tasks::FindByTag(Int32 id, Int32 type, StackStrF & tag)
|
|||||||
// Attempt to find the requested task
|
// Attempt to find the requested task
|
||||||
for (const auto & t : s_Tasks)
|
for (const auto & t : s_Tasks)
|
||||||
{
|
{
|
||||||
if (t.mEntity == id && t.mType == type && t.mTag.compare(tag.mPtr) == 0)
|
if (t.mEntity == id && t.mType == type && t.mTag == tag.mPtr)
|
||||||
{
|
{
|
||||||
return t; // Return this task instance
|
return t; // Return this task instance
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
Task()
|
Task() noexcept
|
||||||
: mHash(0)
|
: mHash(0)
|
||||||
, mTag()
|
, mTag()
|
||||||
, mSelf()
|
, mSelf()
|
||||||
@ -55,7 +55,7 @@ private:
|
|||||||
, mIterations(0)
|
, mIterations(0)
|
||||||
, mInterval(0)
|
, mInterval(0)
|
||||||
, mEntity(-1)
|
, mEntity(-1)
|
||||||
, mType(-1)
|
, mType(0)
|
||||||
, mArgc(0)
|
, mArgc(0)
|
||||||
, mArgv()
|
, mArgv()
|
||||||
{
|
{
|
||||||
@ -149,7 +149,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
void SetTag(StackStrF & tag)
|
void SetTag(StackStrF & tag)
|
||||||
{
|
{
|
||||||
mTag.assign(tag.mPtr, ClampMin(tag.mLen, 0));
|
mTag.assign(tag.mPtr, static_cast< size_t >(ClampMin(tag.mLen, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------------------
|
||||||
@ -270,7 +270,19 @@ private:
|
|||||||
static Interval s_Intervals[SQMOD_MAX_TASKS]; // List of intervals to be processed.
|
static Interval s_Intervals[SQMOD_MAX_TASKS]; // List of intervals to be processed.
|
||||||
static Task s_Tasks[SQMOD_MAX_TASKS]; // List of tasks to be executed.
|
static Task s_Tasks[SQMOD_MAX_TASKS]; // List of tasks to be executed.
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Copy assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
Tasks & operator = (const Tasks & o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Move assignment operator. (disabled)
|
||||||
|
*/
|
||||||
|
Tasks & operator = (Tasks && o) = delete;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Default constructor. (disabled)
|
* Default constructor. (disabled)
|
||||||
*/
|
*/
|
||||||
Tasks() = delete;
|
Tasks() = delete;
|
||||||
@ -290,18 +302,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
~Tasks() = delete;
|
~Tasks() = delete;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Copy assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
Tasks & operator = (const Tasks & o) = delete;
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
|
||||||
* Move assignment operator. (disabled)
|
|
||||||
*/
|
|
||||||
Tasks & operator = (Tasks && o) = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Process all active tasks and update elapsed time.
|
* Process all active tasks and update elapsed time.
|
||||||
*/
|
*/
|
||||||
@ -402,7 +402,10 @@ public:
|
|||||||
STHROWF("Invalid entity instance");
|
STHROWF("Invalid entity instance");
|
||||||
}
|
}
|
||||||
// Validate the actual entity instance
|
// Validate the actual entity instance
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCDFAInspection"
|
||||||
inst->Validate();
|
inst->Validate();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
@ -430,7 +433,10 @@ public:
|
|||||||
STHROWF("Invalid entity instance");
|
STHROWF("Invalid entity instance");
|
||||||
}
|
}
|
||||||
// Validate the actual entity instance
|
// Validate the actual entity instance
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCDFAInspection"
|
||||||
inst->Validate();
|
inst->Validate();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
@ -458,7 +464,10 @@ public:
|
|||||||
STHROWF("Invalid entity instance");
|
STHROWF("Invalid entity instance");
|
||||||
}
|
}
|
||||||
// Validate the actual entity instance
|
// Validate the actual entity instance
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCDFAInspection"
|
||||||
inst->Validate();
|
inst->Validate();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
@ -491,7 +500,10 @@ public:
|
|||||||
STHROWF("Invalid entity instance");
|
STHROWF("Invalid entity instance");
|
||||||
}
|
}
|
||||||
// Validate the actual entity instance
|
// Validate the actual entity instance
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma ide diagnostic ignored "OCDFAInspection"
|
||||||
inst->Validate();
|
inst->Validate();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
}
|
}
|
||||||
catch (const Sqrat::Exception & e)
|
catch (const Sqrat::Exception & e)
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static String CS_Vehicle_Names[] = {
|
static String CS_Vehicle_Names[] = { // NOLINT(cert-err58-cpp)
|
||||||
/* 130 */ "Landstalker", /* 131 */ "Idaho",
|
/* 130 */ "Landstalker", /* 131 */ "Idaho",
|
||||||
/* 132 */ "Stinger", /* 133 */ "Linerunner",
|
/* 132 */ "Stinger", /* 133 */ "Linerunner",
|
||||||
/* 134 */ "Perennial", /* 135 */ "Sentinel",
|
/* 134 */ "Perennial", /* 135 */ "Sentinel",
|
||||||
@ -73,7 +73,7 @@ static String CS_Custom_Vehicle_Names[100]{};
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
struct InitCustomVehicleNames
|
struct InitCustomVehicleNames
|
||||||
{
|
{
|
||||||
InitCustomVehicleNames()
|
InitCustomVehicleNames() noexcept
|
||||||
{
|
{
|
||||||
for (String & s : CS_Custom_Vehicle_Names)
|
for (String & s : CS_Custom_Vehicle_Names)
|
||||||
{
|
{
|
||||||
@ -122,7 +122,7 @@ void SetAutomobileName(Uint32 id, StackStrF & name)
|
|||||||
Int32 GetAutomobileID(StackStrF & name)
|
Int32 GetAutomobileID(StackStrF & name)
|
||||||
{
|
{
|
||||||
// Clone the string into an editable version
|
// Clone the string into an editable version
|
||||||
String str(name.mPtr, name.mLen);
|
String str(name.mPtr, static_cast< size_t >(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
|
||||||
@ -205,11 +205,11 @@ Int32 GetAutomobileID(StackStrF & name)
|
|||||||
// [Bl]oodring Banger #2
|
// [Bl]oodring Banger #2
|
||||||
case 'l':
|
case 'l':
|
||||||
// [Bli]sta [C]ompact
|
// [Bli]sta [C]ompact
|
||||||
if (b == 'c' || c == 'i') return SQMOD_VEHICLE_BLISTACOMPACT;
|
if (c == 'i') return SQMOD_VEHICLE_BLISTACOMPACT;
|
||||||
// [Blo]odring [B]anger (#1|A)
|
// [Blo]odring [B]anger (#1|A)
|
||||||
else if ((b == 'b' || c == 'o') && (d == '1' || d == 'a')) return SQMOD_VEHICLE_BLOODRINGBANGER1;
|
else if ((c == 'o') && (d == '1' || d == 'a')) return SQMOD_VEHICLE_BLOODRINGBANGER1;
|
||||||
// [Blo]odring [B]anger (#2|B)
|
// [Blo]odring [B]anger (#2|B)
|
||||||
else if ((b == 'b' || c == 'o') && (d == '2' || d == 'b')) return SQMOD_VEHICLE_BLOODRINGBANGER2;
|
else if ((c == 'o') && (d == '2' || d == 'b')) return SQMOD_VEHICLE_BLOODRINGBANGER2;
|
||||||
// Default to unknwon
|
// Default to unknwon
|
||||||
else return SQMOD_UNKNOWN;
|
else return SQMOD_UNKNOWN;
|
||||||
// [Bo]bcat
|
// [Bo]bcat
|
||||||
@ -303,9 +303,9 @@ Int32 GetAutomobileID(StackStrF & name)
|
|||||||
// [E]nforcer
|
// [E]nforcer
|
||||||
case 'e':
|
case 'e':
|
||||||
// [Es]peranto
|
// [Es]peranto
|
||||||
if (b && b == 's') return SQMOD_VEHICLE_ESPERANTO;
|
if (b == 's') return SQMOD_VEHICLE_ESPERANTO;
|
||||||
// [En]forcer
|
// [En]forcer
|
||||||
else if (b && b == 'n') return SQMOD_VEHICLE_ENFORCER;
|
else if (b == 'n') return SQMOD_VEHICLE_ENFORCER;
|
||||||
// Default to unknwon
|
// Default to unknwon
|
||||||
else return SQMOD_UNKNOWN;
|
else return SQMOD_UNKNOWN;
|
||||||
// [F]aggio
|
// [F]aggio
|
||||||
@ -390,9 +390,9 @@ Int32 GetAutomobileID(StackStrF & name)
|
|||||||
// [I]nfernus
|
// [I]nfernus
|
||||||
case 'i':
|
case 'i':
|
||||||
// [Id]aho
|
// [Id]aho
|
||||||
if (b && b == 'd') return SQMOD_VEHICLE_IDAHO;
|
if (b == 'd') return SQMOD_VEHICLE_IDAHO;
|
||||||
// [In]fernus
|
// [In]fernus
|
||||||
else if (b && b == 'n') return SQMOD_VEHICLE_INFERNUS;
|
else if (b == 'n') return SQMOD_VEHICLE_INFERNUS;
|
||||||
// Default to unknwon
|
// Default to unknwon
|
||||||
else return SQMOD_UNKNOWN;
|
else return SQMOD_UNKNOWN;
|
||||||
// [K]aufman Cab
|
// [K]aufman Cab
|
||||||
@ -604,7 +604,7 @@ Int32 GetAutomobileID(StackStrF & name)
|
|||||||
// [Spa]nd [E]xpres[s]
|
// [Spa]nd [E]xpres[s]
|
||||||
if (c == 'a' || ((len > 5 && str[5] == 'e') || d == 's')) return SQMOD_VEHICLE_SPANDEXPRESS;
|
if (c == 'a' || ((len > 5 && str[5] == 'e') || d == 's')) return SQMOD_VEHICLE_SPANDEXPRESS;
|
||||||
// [Spa]rro[w]
|
// [Spa]rro[w]
|
||||||
else if (d == 'w' && (c == 'a' && d == 'w')) return SQMOD_VEHICLE_SPARROW;
|
else if (d == 'w') return SQMOD_VEHICLE_SPARROW;
|
||||||
// [Spe]ede[r]
|
// [Spe]ede[r]
|
||||||
else if (c == 'e' || d == 'r') return SQMOD_VEHICLE_SPEEDER;
|
else if (c == 'e' || d == 'r') return SQMOD_VEHICLE_SPEEDER;
|
||||||
// Default to unknwon
|
// Default to unknwon
|
||||||
@ -695,7 +695,7 @@ bool IsAutomobileValid(Int32 id)
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return !GetAutomobileName(id).empty();
|
return !GetAutomobileName(static_cast< Uint32 >(id)).empty();
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static String CS_Weapon_Names[] = {
|
static String CS_Weapon_Names[] = { // NOLINT(cert-err58-cpp)
|
||||||
/* 0 */ "Unarmed", /* 1 */ "Brass Knuckles",
|
/* 0 */ "Unarmed", /* 1 */ "Brass Knuckles",
|
||||||
/* 2 */ "Screwdriver", /* 3 */ "Golf Club",
|
/* 2 */ "Screwdriver", /* 3 */ "Golf Club",
|
||||||
/* 4 */ "Nightstick", /* 5 */ "Knife",
|
/* 4 */ "Nightstick", /* 5 */ "Knife",
|
||||||
@ -138,7 +138,7 @@ void SetWeaponName(Uint32 id, StackStrF & name)
|
|||||||
if (IsCustomWeapon(id))
|
if (IsCustomWeapon(id))
|
||||||
{
|
{
|
||||||
// Attempt to insert or update the name into the custom weapon table
|
// Attempt to insert or update the name into the custom weapon table
|
||||||
CS_Custom_Weapon_Names[id] = String(name.mPtr, name.mLen);
|
CS_Custom_Weapon_Names[id] = String(name.mPtr, static_cast< size_t >(name.mLen));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -163,7 +163,7 @@ void ClearCustomWeaponNamePool()
|
|||||||
Int32 GetWeaponID(StackStrF & name)
|
Int32 GetWeaponID(StackStrF & name)
|
||||||
{
|
{
|
||||||
// Clone the string into an editable version
|
// Clone the string into an editable version
|
||||||
String str(name.mPtr, name.mLen);
|
String str(name.mPtr, static_cast< size_t >(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
|
||||||
@ -340,7 +340,7 @@ Int32 GetWeaponID(StackStrF & name)
|
|||||||
// [Su]icide
|
// [Su]icide
|
||||||
else if (b == 'u') return SQMOD_WEAPON_SUICIDE;
|
else if (b == 'u') return SQMOD_WEAPON_SUICIDE;
|
||||||
// Pump action [Sh]otgun
|
// Pump action [Sh]otgun
|
||||||
else if (b == 'h') return SQMOD_WEAPON_SHOTGUN;
|
else if (b == 'h') return SQMOD_WEAPON_SHOTGUN;
|
||||||
// Default to unknwon
|
// Default to unknwon
|
||||||
else return SQMOD_UNKNOWN;
|
else return SQMOD_UNKNOWN;
|
||||||
// [T]ear Gas
|
// [T]ear Gas
|
||||||
@ -371,7 +371,7 @@ Int32 GetWeaponID(StackStrF & name)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
bool IsWeaponValid(Int32 id)
|
bool IsWeaponValid(Int32 id)
|
||||||
{
|
{
|
||||||
CSStr name = GetWeaponName(id);
|
CSStr name = GetWeaponName(static_cast< Uint32 >(id));
|
||||||
return (name && *name != '\0');
|
return (name && *name != '\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,6 @@ Uint32 GetCustomWeaponNamePoolSize();
|
|||||||
*/
|
*/
|
||||||
void ClearCustomWeaponNamePool();
|
void ClearCustomWeaponNamePool();
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
|
||||||
* Modify the name associated with a weapon identifier.
|
|
||||||
*/
|
|
||||||
void SetWeaponName(Uint32 id, StackStrF & name);
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Convert a weapon name to a weapon identifier.
|
* Convert a weapon name to a weapon identifier.
|
||||||
*/
|
*/
|
||||||
|
@ -624,12 +624,12 @@ enum EntityType
|
|||||||
* COLOR PACKING
|
* COLOR PACKING
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SQMOD_PACK_RGB(r, g, b) static_cast< Uint32 >(r << 16 | g << 8 | b)
|
#define SQMOD_PACK_RGB(r, g, b) static_cast< Uint32 >(r << 16u | g << 8u | b)
|
||||||
#define SQMOD_PACK_RGBA(r, g, b, a) static_cast< Uint32 >(r << 24 | g << 16 | b << 8 | a)
|
#define SQMOD_PACK_RGBA(r, g, b, a) static_cast< Uint32 >(r << 24u | g << 16u | b << 8u | a)
|
||||||
#define SQMOD_PACK_ARGB(a, r, g, b) static_cast< Uint32 >(a << 24 | r << 16 | g << 8 | b)
|
#define SQMOD_PACK_ARGB(a, r, g, b) static_cast< Uint32 >(a << 24u | r << 16u | g << 8u | b)
|
||||||
|
|
||||||
#define SQMOD_PACK_RGB_TO_RGBA(r, g, b) static_cast< Uint32 >(r << 24 | g << 16 | b << 8 | 0)
|
#define SQMOD_PACK_RGB_TO_RGBA(r, g, b) static_cast< Uint32 >(r << 24u | g << 16u | b << 8u | 0u)
|
||||||
#define SQMOD_PACK_RGB_TO_ARGB(r, g, b) static_cast< Uint32 >(0 << 24 | r << 16 | g << 8 | b)
|
#define SQMOD_PACK_RGB_TO_ARGB(r, g, b) static_cast< Uint32 >(0u << 24u | r << 16u | g << 8u | b)
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* GENERAL RESPONSES
|
* GENERAL RESPONSES
|
||||||
|
@ -70,49 +70,49 @@ struct EnumElement
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructors that can identify the type and perform the proper conversion.
|
/// Constructors that can identify the type and perform the proper conversion.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
EnumElement(const SQChar * name, const SQChar * value)
|
EnumElement(const SQChar * name, const SQChar * value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mSTR(value), Type(SQET_STRING)
|
: Name(name), mSTR(value), Type(SQET_STRING)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, bool value)
|
EnumElement(const SQChar * name, bool value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mBOOL(value), Type(SQET_BOOL)
|
: Name(name), mBOOL(value), Type(SQET_BOOL)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, signed char value)
|
EnumElement(const SQChar * name, signed char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, unsigned char value)
|
EnumElement(const SQChar * name, unsigned char value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, signed short value)
|
EnumElement(const SQChar * name, signed short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, unsigned short value)
|
EnumElement(const SQChar * name, unsigned short value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, signed int value)
|
EnumElement(const SQChar * name, signed int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, unsigned int value)
|
EnumElement(const SQChar * name, unsigned int value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, signed long value)
|
EnumElement(const SQChar * name, signed long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, unsigned long value)
|
EnumElement(const SQChar * name, unsigned long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, signed long long value)
|
EnumElement(const SQChar * name, signed long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, unsigned long long value)
|
EnumElement(const SQChar * name, unsigned long long value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, float value)
|
EnumElement(const SQChar * name, float value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
|
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
EnumElement(const SQChar * name, double value)
|
EnumElement(const SQChar * name, double value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
|
: Name(name), mREAL(static_cast< SQFloat >(value)), Type(SQET_REAL)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
template < typename T > EnumElement(const SQChar * name, T value)
|
template < typename T > EnumElement(const SQChar * name, T value) noexcept // NOLINT(hicpp-member-init,cppcoreguidelines-pro-type-member-init)
|
||||||
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
: Name(name), mINT(static_cast< SQInteger >(value)), Type(SQET_INT)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
};
|
};
|
||||||
@ -132,28 +132,28 @@ struct EnumElements
|
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructor that can identify the number of values at compile-time.
|
/// Constructor that can identify the number of values at compile-time.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template < size_t N > EnumElements(const EnumElement(&values)[N])
|
template < size_t N > explicit EnumElements(const EnumElement(&values)[N]) noexcept
|
||||||
: EnumElements(nullptr, values, N)
|
: EnumElements(nullptr, values, N)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructor that takes an explicit number of values at run-time.
|
/// Constructor that takes an explicit number of values at run-time.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
EnumElements(const EnumElement * values, unsigned int count)
|
EnumElements(const EnumElement * values, unsigned int count) noexcept
|
||||||
: EnumElements(nullptr, values, count)
|
: EnumElements(nullptr, values, count)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructor that can identify the number of values at compile-time.
|
/// Constructor that can identify the number of values at compile-time.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
template < size_t N > EnumElements(const SQChar * name, const EnumElement(&values)[N])
|
template < size_t N > EnumElements(const SQChar * name, const EnumElement(&values)[N]) noexcept
|
||||||
: EnumElements(name, values, N)
|
: EnumElements(name, values, N)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructor that takes an explicit number of values at run-time.
|
/// Constructor that takes an explicit number of values at run-time.
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
EnumElements(const SQChar * name, const EnumElement * values, unsigned int count)
|
EnumElements(const SQChar * name, const EnumElement * values, unsigned int count) noexcept
|
||||||
: Name(name), Values(values), Count(count)
|
: Name(name), Values(values), Count(count)
|
||||||
{ /* ... */ }
|
{ /* ... */ }
|
||||||
|
|
||||||
|
@ -77,34 +77,34 @@ struct SQOuter;
|
|||||||
#define SQUIRREL_EOB 0
|
#define SQUIRREL_EOB 0
|
||||||
#define SQ_BYTECODE_STREAM_TAG 0xFAFA
|
#define SQ_BYTECODE_STREAM_TAG 0xFAFA
|
||||||
|
|
||||||
#define SQOBJECT_REF_COUNTED 0x08000000
|
#define SQOBJECT_REF_COUNTED 0x08000000u
|
||||||
#define SQOBJECT_NUMERIC 0x04000000
|
#define SQOBJECT_NUMERIC 0x04000000u
|
||||||
#define SQOBJECT_DELEGABLE 0x02000000
|
#define SQOBJECT_DELEGABLE 0x02000000u
|
||||||
#define SQOBJECT_CANBEFALSE 0x01000000
|
#define SQOBJECT_CANBEFALSE 0x01000000u
|
||||||
|
|
||||||
#define SQ_MATCHTYPEMASKSTRING (-99999)
|
#define SQ_MATCHTYPEMASKSTRING (-99999)
|
||||||
|
|
||||||
#define _RT_MASK 0x00FFFFFF
|
#define _RT_MASK 0x00FFFFFFu
|
||||||
#define _RAW_TYPE(type) (type&_RT_MASK)
|
#define _RAW_TYPE(type) (type&_RT_MASK)
|
||||||
|
|
||||||
#define _RT_NULL 0x00000001
|
#define _RT_NULL 0x00000001u
|
||||||
#define _RT_INTEGER 0x00000002
|
#define _RT_INTEGER 0x00000002u
|
||||||
#define _RT_FLOAT 0x00000004
|
#define _RT_FLOAT 0x00000004u
|
||||||
#define _RT_BOOL 0x00000008
|
#define _RT_BOOL 0x00000008u
|
||||||
#define _RT_STRING 0x00000010
|
#define _RT_STRING 0x00000010u
|
||||||
#define _RT_TABLE 0x00000020
|
#define _RT_TABLE 0x00000020u
|
||||||
#define _RT_ARRAY 0x00000040
|
#define _RT_ARRAY 0x00000040u
|
||||||
#define _RT_USERDATA 0x00000080
|
#define _RT_USERDATA 0x00000080u
|
||||||
#define _RT_CLOSURE 0x00000100
|
#define _RT_CLOSURE 0x00000100u
|
||||||
#define _RT_NATIVECLOSURE 0x00000200
|
#define _RT_NATIVECLOSURE 0x00000200u
|
||||||
#define _RT_GENERATOR 0x00000400
|
#define _RT_GENERATOR 0x00000400u
|
||||||
#define _RT_USERPOINTER 0x00000800
|
#define _RT_USERPOINTER 0x00000800u
|
||||||
#define _RT_THREAD 0x00001000
|
#define _RT_THREAD 0x00001000u
|
||||||
#define _RT_FUNCPROTO 0x00002000
|
#define _RT_FUNCPROTO 0x00002000u
|
||||||
#define _RT_CLASS 0x00004000
|
#define _RT_CLASS 0x00004000u
|
||||||
#define _RT_INSTANCE 0x00008000
|
#define _RT_INSTANCE 0x00008000u
|
||||||
#define _RT_WEAKREF 0x00010000
|
#define _RT_WEAKREF 0x00010000u
|
||||||
#define _RT_OUTER 0x00020000
|
#define _RT_OUTER 0x00020000u
|
||||||
|
|
||||||
typedef enum tagSQObjectType{
|
typedef enum tagSQObjectType{
|
||||||
OT_NULL = (_RT_NULL|SQOBJECT_CANBEFALSE),
|
OT_NULL = (_RT_NULL|SQOBJECT_CANBEFALSE),
|
||||||
|
Loading…
Reference in New Issue
Block a user