diff --git a/module/Core.cpp b/module/Core.cpp index fcad652b..ed69f223 100644 --- a/module/Core.cpp +++ b/module/Core.cpp @@ -1709,12 +1709,12 @@ void Core::DeallocVehicle(int32_t id, bool destroy, int32_t header, LightObj & p } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewBlip(int32_t index, int32_t world, float x, float y, float z, - int32_t scale, uint32_t color, int32_t sprid, +BlipInst & Core::NewBlip(int32_t index, int32_t world, float x, float y, float z, + int32_t scale, uint32_t color, int32_t spr_id, int32_t header, LightObj & payload) { // Request the server to create this entity - const int32_t id = _Func->CreateCoordBlip(index, world, x, y, z, scale, color, sprid); + const int32_t id = _Func->CreateCoordBlip(index, world, x, y, z, scale, color, spr_id); // See if the entity creation failed on the server if (_Func->GetLastError() == vcmpErrorPoolExhausted) { @@ -1733,11 +1733,11 @@ LightObj & Core::NewBlip(int32_t index, int32_t world, float x, float y, float z inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewCheckpoint(int32_t player, int32_t world, bool sphere, float x, float y, float z, +CheckpointInst & Core::NewCheckpoint(int32_t player, int32_t world, bool sphere, float x, float y, float z, uint8_t r, uint8_t g, uint8_t b, uint8_t a, float radius, int32_t header, LightObj & payload) { @@ -1765,11 +1765,11 @@ LightObj & Core::NewCheckpoint(int32_t player, int32_t world, bool sphere, float inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewKeyBind(int32_t slot, bool release, int32_t primary, int32_t secondary, int32_t alternative, +KeyBindInst & Core::NewKeyBind(int32_t slot, bool release, int32_t primary, int32_t secondary, int32_t alternative, int32_t header, LightObj & payload) { // Should we obtain a new keybind slot automatically? @@ -1797,11 +1797,11 @@ LightObj & Core::NewKeyBind(int32_t slot, bool release, int32_t primary, int32_t inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewObject(int32_t model, int32_t world, float x, float y, float z, int32_t alpha, +ObjectInst & Core::NewObject(int32_t model, int32_t world, float x, float y, float z, int32_t alpha, int32_t header, LightObj & payload) { // Request the server to create this entity @@ -1824,11 +1824,11 @@ LightObj & Core::NewObject(int32_t model, int32_t world, float x, float y, float inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewPickup(int32_t model, int32_t world, int32_t quantity, +PickupInst & Core::NewPickup(int32_t model, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, bool automatic, int32_t header, LightObj & payload) { @@ -1852,11 +1852,11 @@ LightObj & Core::NewPickup(int32_t model, int32_t world, int32_t quantity, inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- -LightObj & Core::NewVehicle(int32_t model, int32_t world, float x, float y, float z, +VehicleInst & Core::NewVehicle(int32_t model, int32_t world, float x, float y, float z, float angle, int32_t primary, int32_t secondary, int32_t header, LightObj & payload) { @@ -1885,7 +1885,7 @@ LightObj & Core::NewVehicle(int32_t model, int32_t world, float x, float y, floa inst.mFlags |= ENF_OWNED; } // Now we can return the script object - return inst.mObj; + return inst; } // -------------------------------------------------------------------------------------------- diff --git a/module/Core.hpp b/module/Core.hpp index cecba339..fec0d577 100644 --- a/module/Core.hpp +++ b/module/Core.hpp @@ -62,7 +62,7 @@ private: // -------------------------------------------------------------------------------------------- int32_t m_State; // Current plug-in state. #ifdef VCMP_ENABLE_OFFICIAL - bool m_Official; // Whether official support is enabked. + bool m_Official; // Whether official support is enabled. #endif HSQUIRRELVM m_VM; // Script virtual machine. Scripts m_Scripts; // Loaded scripts objects. @@ -219,7 +219,7 @@ public: } /* -------------------------------------------------------------------------------------------- - * See whether area tracking should be enabled on newlly created entities. + * See whether area tracking should be enabled on newly created entities. */ SQMOD_NODISCARD bool AreasEnabled() const { @@ -227,7 +227,7 @@ public: } /* -------------------------------------------------------------------------------------------- - * Toggle whether area tracking should be enabled on newlly created entities. + * Toggle whether area tracking should be enabled on newly created entities. */ void AreasEnabled(bool toggle) { @@ -308,7 +308,7 @@ public: } /* -------------------------------------------------------------------------------------------- - * Retrieve the postload signal if not complete. + * Retrieve the post-load signal if not complete. */ SQMOD_NODISCARD LightObj & GetPostLoadEvent() { @@ -431,7 +431,7 @@ protected: VehicleInst & AllocVehicle(int32_t id, bool owned, int32_t header, LightObj & payload); /* -------------------------------------------------------------------------------------------- - * Entity deallocator. + * Entity de-allocator. */ void DeallocBlip(int32_t id, bool destroy, int32_t header, LightObj & payload); void DeallocCheckpoint(int32_t id, bool destroy, int32_t header, LightObj & payload); @@ -445,26 +445,26 @@ public: /* -------------------------------------------------------------------------------------------- * Entity creators. */ - LightObj & NewBlip(int32_t index, int32_t world, float x, float y, float z, - int32_t scale, uint32_t color, int32_t sprid, + BlipInst & NewBlip(int32_t index, int32_t world, float x, float y, float z, + int32_t scale, uint32_t color, int32_t spr_id, int32_t header, LightObj & payload); - LightObj & NewCheckpoint(int32_t player, int32_t world, bool sphere, float x, float y, float z, + CheckpointInst & NewCheckpoint(int32_t player, int32_t world, bool sphere, float x, float y, float z, uint8_t r, uint8_t g, uint8_t b, uint8_t a, float radius, int32_t header, LightObj & payload); - LightObj & NewKeyBind(int32_t slot, bool release, + KeyBindInst & NewKeyBind(int32_t slot, bool release, int32_t primary, int32_t secondary, int32_t alternative, int32_t header, LightObj & payload); - LightObj & NewObject(int32_t model, int32_t world, float x, float y, float z, + ObjectInst & NewObject(int32_t model, int32_t world, float x, float y, float z, int32_t alpha, int32_t header, LightObj & payload); - LightObj & NewPickup(int32_t model, int32_t world, int32_t quantity, + PickupInst & NewPickup(int32_t model, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, bool automatic, int32_t header, LightObj & payload); - LightObj & NewVehicle(int32_t model, int32_t world, float x, float y, float z, + VehicleInst & NewVehicle(int32_t model, int32_t world, float x, float y, float z, float angle, int32_t primary, int32_t secondary, int32_t header, LightObj & payload); @@ -543,21 +543,21 @@ public: */ void EmitBlipCreated(int32_t blip, int32_t header, LightObj & payload); void EmitCheckpointCreated(int32_t checkpoint, int32_t header, LightObj & payload); - void EmitKeyBindCreated(int32_t keybind, int32_t header, LightObj & payload); + void EmitKeyBindCreated(int32_t key_bind, int32_t header, LightObj & payload); void EmitObjectCreated(int32_t object, int32_t header, LightObj & payload); void EmitPickupCreated(int32_t pickup, int32_t header, LightObj & payload); void EmitPlayerCreated(int32_t player, int32_t header, LightObj & payload); void EmitVehicleCreated(int32_t vehicle, int32_t header, LightObj & payload); void EmitBlipDestroyed(int32_t blip, int32_t header, LightObj & payload); void EmitCheckpointDestroyed(int32_t checkpoint, int32_t header, LightObj & payload); - void EmitKeyBindDestroyed(int32_t keybind, int32_t header, LightObj & payload); + void EmitKeyBindDestroyed(int32_t key_bind, int32_t header, LightObj & payload); void EmitObjectDestroyed(int32_t object, int32_t header, LightObj & payload); void EmitPickupDestroyed(int32_t pickup, int32_t header, LightObj & payload); void EmitPlayerDestroyed(int32_t player, int32_t header, LightObj & payload); void EmitVehicleDestroyed(int32_t vehicle, int32_t header, LightObj & payload); void EmitBlipCustom(int32_t blip, int32_t header, LightObj & payload); void EmitCheckpointCustom(int32_t checkpoint, int32_t header, LightObj & payload); - void EmitKeyBindCustom(int32_t keybind, int32_t header, LightObj & payload); + void EmitKeyBindCustom(int32_t key_bind, int32_t header, LightObj & payload); void EmitObjectCustom(int32_t object, int32_t header, LightObj & payload); void EmitPickupCustom(int32_t pickup, int32_t header, LightObj & payload); void EmitPlayerCustom(int32_t player, int32_t header, LightObj & payload); @@ -863,7 +863,7 @@ struct CoreState * Backup the current core state. */ CoreState() - : m_State(Core::Get().GetState()), m_Start(m_Start) + : m_State(Core::Get().GetState()), m_Start(m_State) { //... } @@ -945,4 +945,64 @@ protected: int m_Start; // The core state at the time when this instance was created. }; +/* ------------------------------------------------------------------------------------------------ + * Generic implementation of entity iteration. +*/ +template < class T, class F > inline void ForeachEntity(std::vector< T > & vec, F cb) +{ + for (auto & e : vec) + { + cb(e); + } +} +// Entity iteration. +template < class F > inline void ForeachBlip(F f) { ForeachEntity(Core::Get().GetBlips(), std::forward< F >(f)); } +template < class F > inline void ForeachCheckpoint(F f) { ForeachEntity(Core::Get().GetCheckpoints(), std::forward< F >(f)); } +template < class F > inline void ForeachObject(F f) { ForeachEntity(Core::Get().GetObjs(), std::forward< F >(f)); } +template < class F > inline void ForeachPickup(F f) { ForeachEntity(Core::Get().GetPickups(), std::forward< F >(f)); } +template < class F > inline void ForeachPlayer(F f) { ForeachEntity(Core::Get().GetPlayers(), std::forward< F >(f)); } +template < class F > inline void ForeachVehicle(F f) { ForeachEntity(Core::Get().GetVehicles(), std::forward< F >(f)); } + +/* ------------------------------------------------------------------------------------------------ + * Generic implementation of active entity iteration. +*/ +template < class T, class F > inline void ForeachActiveEntity(const std::vector< T > & vec, F cb) +{ + for (const auto & e : vec) + { + if (VALID_ENTITY(e.mID)) cb(e); + } +} +// Entity iteration. +template < class F > inline void ForeachActiveBlip(F f) { ForeachActiveEntity(Core::Get().GetBlips(), std::forward< F >(f)); } +template < class F > inline void ForeachActiveCheckpoint(F f) { ForeachActiveEntity(Core::Get().GetCheckpoints(), std::forward< F >(f)); } +template < class F > inline void ForeachActiveObject(F f) { ForeachActiveEntity(Core::Get().GetObjs(), std::forward< F >(f)); } +template < class F > inline void ForeachActivePickup(F f) { ForeachActiveEntity(Core::Get().GetPickups(), std::forward< F >(f)); } +template < class F > inline void ForeachActivePlayer(F f) { ForeachActiveEntity(Core::Get().GetPlayers(), std::forward< F >(f)); } +template < class F > inline void ForeachActiveVehicle(F f) { ForeachActiveEntity(Core::Get().GetVehicles(), std::forward< F >(f)); } + +/* ------------------------------------------------------------------------------------------------ + * Process the identifier of each connected player. +*/ +template < class F > inline void ForeachConnectedPlayer(F f) { + for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i) f(i); +} +/* ------------------------------------------------------------------------------------------------ + * Process the identifier of each connected player and count processed players. +*/ +template < class F > SQMOD_NODISCARD inline int32_t ForeachConnectedPlayerCount(F f) { + int32_t c = 0; + for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i) + if (f(i)) ++c; + return c; +} +/* ------------------------------------------------------------------------------------------------ + * Process the identifier of each connected player until a certain criteria is met. +*/ +template < class F > SQMOD_NODISCARD inline int32_t ForeachConnectedPlayerUntil(F f) { + for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i) + if (f(i)) return i; + return -1; +} + } // Namespace:: SqMod diff --git a/module/Core/Events.inc b/module/Core/Events.inc index 51d0ce5e..29a08234 100644 --- a/module/Core/Events.inc +++ b/module/Core/Events.inc @@ -70,10 +70,10 @@ void Core::EmitCheckpointCreated(int32_t checkpoint, int32_t header, LightObj & } // ------------------------------------------------------------------------------------------------ -void Core::EmitKeyBindCreated(int32_t keybind, int32_t header, LightObj & payload) +void Core::EmitKeyBindCreated(int32_t key_bind, int32_t header, LightObj & payload) { SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::KeyBindCreated(%d, %d, %s)", keybind, header, NULL_SQOBJ_(payload)) - (*mOnKeyBindCreated.first)(m_KeyBinds.at(static_cast< size_t >(keybind)).mObj, header, payload); + (*mOnKeyBindCreated.first)(m_KeyBinds.at(static_cast< size_t >(key_bind)).mObj, header, payload); SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::KeyBindCreated") } diff --git a/module/Entity/Blip.cpp b/module/Entity/Blip.cpp index bdb2c82c..ac4c6dad 100644 --- a/module/Entity/Blip.cpp +++ b/module/Entity/Blip.cpp @@ -223,7 +223,7 @@ static LightObj & Blip_CreateEx1a(int32_t world, float x, float y, float z, int3 uint8_t r, uint8_t g, uint8_t b, uint8_t a, int32_t spr_id) { return Core::Get().NewBlip(-1, world, x, y, z, scale, SQMOD_PACK_RGBA(r, g, b, a), spr_id, // NOLINT(hicpp-signed-bitwise) - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Blip_CreateEx1b(int32_t world, float x, float y, float z, int32_t scale, @@ -231,7 +231,7 @@ static LightObj & Blip_CreateEx1b(int32_t world, float x, float y, float z, int3 int32_t header, LightObj & payload) { return Core::Get().NewBlip(-1, world, x, y, z, scale, SQMOD_PACK_RGBA(r, g, b, a), spr_id, // NOLINT(hicpp-signed-bitwise) - header, payload); + header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -239,7 +239,7 @@ static LightObj & Blip_CreateEx2a(int32_t index, int32_t world, float x, float y int32_t scale, uint8_t r, uint8_t g, uint8_t b, uint8_t a, int32_t spr_id) { return Core::Get().NewBlip(index, world, x, y, z, scale, SQMOD_PACK_RGBA(r, g, b, a), spr_id, // NOLINT(hicpp-signed-bitwise) - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Blip_CreateEx2b(int32_t index, int32_t world, float x, float y, float z, int32_t scale, @@ -247,7 +247,7 @@ static LightObj & Blip_CreateEx2b(int32_t index, int32_t world, float x, float y int32_t header, LightObj & payload) { return Core::Get().NewBlip(index, world, x, y, z, scale, SQMOD_PACK_RGBA(r, g, b, a), spr_id, // NOLINT(hicpp-signed-bitwise) - header, payload); + header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -255,14 +255,14 @@ static LightObj & Blip_Create1a(int32_t world, const Vector3 & pos, int32_t scal int32_t spr_id) { return Core::Get().NewBlip(-1, world, pos.x, pos.y, pos.z, scale, color.GetRGBA(), spr_id, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Blip_Create1b(int32_t world, const Vector3 & pos, int32_t scale, const Color4 & color, int32_t spr_id, int32_t header, LightObj & payload) { return Core::Get().NewBlip(-1, world, pos.x, pos.y, pos.z, scale, color.GetRGBA(), spr_id, - header, payload); + header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -270,14 +270,14 @@ static LightObj & Blip_Create2a(int32_t index, int32_t world, const Vector3 & po const Color4 & color, int32_t spr_id) { return Core::Get().NewBlip(index, world, pos.x, pos.y, pos.z, scale, color.GetRGBA(), spr_id, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Blip_Create2b(int32_t index, int32_t world, const Vector3 & pos, int32_t scale, const Color4 & color, int32_t spr_id, int32_t header, LightObj & payload) { return Core::Get().NewBlip(index, world, pos.x, pos.y, pos.z, scale, color.GetRGBA(), spr_id, - header, payload); + header, payload).mObj; } // ================================================================================================ diff --git a/module/Entity/Checkpoint.cpp b/module/Entity/Checkpoint.cpp index 924a0500..57066b5f 100644 --- a/module/Entity/Checkpoint.cpp +++ b/module/Entity/Checkpoint.cpp @@ -474,7 +474,7 @@ static LightObj & Checkpoint_CreateEx1a(int32_t world, bool sphere, float x, flo uint8_t r, uint8_t g, uint8_t b, uint8_t a, float radius) { return Core::Get().NewCheckpoint(-1, world, sphere, x, y, z, r, g, b, a, radius, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Checkpoint_CreateEx1b(int32_t world, bool sphere, float x, float y, float z, @@ -482,7 +482,7 @@ static LightObj & Checkpoint_CreateEx1b(int32_t world, bool sphere, float x, flo int32_t header, LightObj & payload) { return Core::Get().NewCheckpoint(-1, world, sphere, x, y, z, r, g, b, a, - radius, header, payload); + radius, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -491,14 +491,14 @@ static LightObj & Checkpoint_Create1a(int32_t world, bool sphere, const Vector3 { return Core::Get().NewCheckpoint(-1, world, sphere, pos.x, pos.y, pos.z, color.r, color.g, color.b, color.a, radius, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Checkpoint_Create1b(int32_t world, bool sphere, const Vector3 & pos, const Color4 & color, float radius, int32_t header, LightObj & payload) { return Core::Get().NewCheckpoint(-1, world, sphere, pos.x, pos.y, pos.z, - color.r, color.g, color.b, color.a, radius, header, payload); + color.r, color.g, color.b, color.a, radius, header, payload).mObj; } // ================================================================================================ diff --git a/module/Entity/KeyBind.cpp b/module/Entity/KeyBind.cpp index 1d09bd89..69588aa6 100644 --- a/module/Entity/KeyBind.cpp +++ b/module/Entity/KeyBind.cpp @@ -151,26 +151,26 @@ static LightObj & KeyBind_CreateEx1a(int32_t slot, bool release, int32_t primary int32_t alternative) { return Core::Get().NewKeyBind(slot, release, primary, secondary, alternative, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & KeyBind_CreateEx1b(int32_t slot, bool release, int32_t primary, int32_t secondary, int32_t alternative, int32_t header, LightObj & payload) { - return Core::Get().NewKeyBind(slot, release, primary, secondary, alternative, header, payload); + return Core::Get().NewKeyBind(slot, release, primary, secondary, alternative, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ static LightObj & KeyBind_Create1a(bool release, int32_t primary, int32_t secondary, int32_t alternative) { return Core::Get().NewKeyBind(-1, release, primary, secondary, alternative, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & KeyBind_Create1b(bool release, int32_t primary, int32_t secondary, int32_t alternative, int32_t header, LightObj & payload) { - return Core::Get().NewKeyBind(-1, release, primary, secondary, alternative, header, payload); + return Core::Get().NewKeyBind(-1, release, primary, secondary, alternative, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ diff --git a/module/Entity/Object.cpp b/module/Entity/Object.cpp index 328db48e..7041cf87 100644 --- a/module/Entity/Object.cpp +++ b/module/Entity/Object.cpp @@ -838,26 +838,26 @@ void CObject::RotateByEulerZ(float z) const static LightObj & Object_CreateEx1a(int32_t model, int32_t world, float x, float y, float z, int32_t alpha) { - return Core::Get().NewObject(model, world, x, y, z, alpha, SQMOD_CREATE_DEFAULT, NullLightObj()); + return Core::Get().NewObject(model, world, x, y, z, alpha, SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Object_CreateEx1b(int32_t model, int32_t world, float x, float y, float z, int32_t alpha, int32_t header, LightObj & payload) { - return Core::Get().NewObject(model, world, x, y, z, alpha, header, payload); + return Core::Get().NewObject(model, world, x, y, z, alpha, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ static LightObj & Object_Create1a(int32_t model, int32_t world, const Vector3 & pos, int32_t alpha) { return Core::Get().NewObject(model, world, pos.x, pos.y, pos.z, alpha, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Object_Create1b(int32_t model, int32_t world, const Vector3 & pos, int32_t alpha, int32_t header, LightObj & payload) { - return Core::Get().NewObject(model, world, pos.x, pos.y, pos.z, alpha, header, payload); + return Core::Get().NewObject(model, world, pos.x, pos.y, pos.z, alpha, header, payload).mObj; } // ================================================================================================ diff --git a/module/Entity/Pickup.cpp b/module/Entity/Pickup.cpp index e77fb5a1..5cf7fa85 100644 --- a/module/Entity/Pickup.cpp +++ b/module/Entity/Pickup.cpp @@ -453,14 +453,14 @@ static LightObj & Pickup_CreateEx1a(int32_t model, int32_t world, int32_t quanti float x, float y, float z, int32_t alpha, bool automatic) { return Core::Get().NewPickup(model, world, quantity, x, y, z, alpha, automatic, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Pickup_CreateEx1b(int32_t model, int32_t world, int32_t quantity, float x, float y, float z, int32_t alpha, bool automatic, int32_t header, LightObj & payload) { - return Core::Get().NewPickup(model, world, quantity, x, y, z, alpha, automatic, header, payload); + return Core::Get().NewPickup(model, world, quantity, x, y, z, alpha, automatic, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -468,14 +468,14 @@ static LightObj & Pickup_Create1a(int32_t model, int32_t world, int32_t quantity int32_t alpha, bool automatic) { return Core::Get().NewPickup(model, world, quantity, pos.x, pos.y, pos.z, alpha, automatic, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Pickup_Create1b(int32_t model, int32_t world, int32_t quantity, const Vector3 & pos, int32_t alpha, bool automatic, int32_t header, LightObj & payload) { return Core::Get().NewPickup(model, world, quantity, pos.x, pos.y, pos.z, alpha, automatic, - header, payload); + header, payload).mObj; } // ================================================================================================ diff --git a/module/Entity/Player.cpp b/module/Entity/Player.cpp index 7b43cb4a..639eb9d1 100644 --- a/module/Entity/Player.cpp +++ b/module/Entity/Player.cpp @@ -1527,7 +1527,7 @@ LightObj & CPlayer::CreateCheckpointEx1a(int32_t world, bool sphere, float x, fl Validate(); // Perform the requested operation return Core::Get().NewCheckpoint(m_ID, world, sphere, x, y, z, r, g, b, a, radius, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } // ------------------------------------------------------------------------------------------------ @@ -1539,7 +1539,7 @@ LightObj & CPlayer::CreateCheckpointEx1b(int32_t world, bool sphere, float x, fl Validate(); // Perform the requested operation return Core::Get().NewCheckpoint(m_ID, world, sphere, x, y, z, r, g, b, a, - radius, header, payload); + radius, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -1551,7 +1551,7 @@ LightObj & CPlayer::CreateCheckpoint1a(int32_t world, bool sphere, const Vector3 // Perform the requested operation return Core::Get().NewCheckpoint(m_ID, world, sphere, pos.x, pos.y, pos.z, color.r, color.g, color.b, color.a, radius, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } // ------------------------------------------------------------------------------------------------ @@ -1562,7 +1562,7 @@ LightObj & CPlayer::CreateCheckpoint1b(int32_t world, bool sphere, const Vector3 Validate(); // Perform the requested operation return Core::Get().NewCheckpoint(m_ID, world, sphere, pos.x, pos.y, pos.z, - color.r, color.g, color.b, color.a, radius, header, payload); + color.r, color.g, color.b, color.a, radius, header, payload).mObj; } // ------------------------------------------------------------------------------------------------ diff --git a/module/Entity/Vehicle.cpp b/module/Entity/Vehicle.cpp index 69fe1f48..191390b8 100644 --- a/module/Entity/Vehicle.cpp +++ b/module/Entity/Vehicle.cpp @@ -1993,14 +1993,14 @@ static LightObj & Vehicle_CreateEx1a(int32_t model, int32_t world, float x, floa int32_t primary, int32_t secondary) { return Core::Get().NewVehicle(model, world, x, y, z, angle, primary, secondary, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Vehicle_CreateEx1b(int32_t model, int32_t world, float x, float y, float z, float angle, int32_t primary, int32_t secondary, int32_t header, LightObj & payload) { return Core::Get().NewVehicle(model, world, x, y, z, angle, primary, secondary, - header, payload); + header, payload).mObj; } // ------------------------------------------------------------------------------------------------ @@ -2008,14 +2008,14 @@ static LightObj & Vehicle_Create1a(int32_t model, int32_t world, const Vector3 & int32_t primary, int32_t secondary) { return Core::Get().NewVehicle(model, world, pos.x, pos.y, pos.z, angle, primary, secondary, - SQMOD_CREATE_DEFAULT, NullLightObj()); + SQMOD_CREATE_DEFAULT, NullLightObj()).mObj; } static LightObj & Vehicle_Create1b(int32_t model, int32_t world, const Vector3 & pos, float angle, int32_t primary, int32_t secondary, int32_t header, LightObj & payload) { return Core::Get().NewVehicle(model, world, pos.x, pos.y, pos.z, angle, primary, secondary, - header, payload); + header, payload).mObj; } // ================================================================================================