1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-31 09:57:14 +01:00

Changes required to compile on x64 and against extra compiler warnings.

This commit is contained in:
Sandu Liviu Catalin 2015-11-01 05:36:03 +02:00
parent b42bc2930c
commit 2409a896df
40 changed files with 222 additions and 51 deletions

View File

@ -390,7 +390,7 @@ const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
w = 0; w = 0;
} }
// Is the string empty? // Is the string empty?
else if (n < 0) else if (n == 0)
{ {
LogWrn("Invalid string length: %d < 0", n); LogWrn("Invalid string length: %d < 0", n);
} }
@ -430,7 +430,7 @@ const SQChar * LeftStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noexc
w = 0; w = 0;
} }
// Is the string empty? // Is the string empty?
else if (n < 0) else if (n == 0)
{ {
LogWrn("Invalid string length: %d < 0", n); LogWrn("Invalid string length: %d < 0", n);
} }
@ -471,7 +471,7 @@ const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
w = 0; w = 0;
} }
// Is the string empty? // Is the string empty?
else if (n < 0) else if (n == 0)
{ {
LogWrn("Invalid string length: %d < 0", n); LogWrn("Invalid string length: %d < 0", n);
} }
@ -511,7 +511,7 @@ const SQChar * RightStr(const SQChar * t, SQChar f, SQUint32 w, SQUint32 o) noex
w = 0; w = 0;
} }
// Is the string empty? // Is the string empty?
else if (n < 0) else if (n == 0)
{ {
LogWrn("Invalid string length: %d < 0", n); LogWrn("Invalid string length: %d < 0", n);
} }
@ -552,7 +552,7 @@ const SQChar * CenterStr(const SQChar * t, SQChar f, SQUint32 w) noexcept
w = 0; w = 0;
} }
// Is the string empty? // Is the string empty?
else if (n < 0) else if (n == 0)
{ {
LogWrn("Invalid string length: %d < 0", n); LogWrn("Invalid string length: %d < 0", n);
} }

View File

@ -296,6 +296,9 @@ static void VC_PlayerCrashReport(int player, const char * report) noexcept
static void VC_ServerPerformanceReport(int count, const char ** description, unsigned long long * millis) noexcept static void VC_ServerPerformanceReport(int count, const char ** description, unsigned long long * millis) noexcept
{ {
// Ignored for now... // Ignored for now...
SQMOD_UNUSED_VAR(count);
SQMOD_UNUSED_VAR(description);
SQMOD_UNUSED_VAR(millis);
} }
static void VC_PlayerName(int player, const char * previous, const char * current) noexcept static void VC_PlayerName(int player, const char * previous, const char * current) noexcept

View File

@ -290,6 +290,9 @@ class LocalEvent;
* VARIOUS DEFINES * VARIOUS DEFINES
*/ */
#define SQMOD_DEC_UNUSED_VAR(t, n, v) t n = v; (void)(n)
#define SQMOD_UNUSED_VAR(n) (void)(n)
#define VALID_ENTITY(e) (e >= 0) #define VALID_ENTITY(e) (e >= 0)
#define INVALID_ENTITY(e) (e < 0) #define INVALID_ENTITY(e) (e < 0)

View File

@ -613,6 +613,7 @@ void Core::PrintCallstack() noexcept
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Core::PrintFunc(HSQUIRRELVM vm, const SQChar * str, ...) noexcept void Core::PrintFunc(HSQUIRRELVM vm, const SQChar * str, ...) noexcept
{ {
SQMOD_UNUSED_VAR(vm);
// Prepare the arguments list // Prepare the arguments list
va_list args; va_list args;
va_start(args, str); va_start(args, str);
@ -654,6 +655,7 @@ void Core::PrintFunc(HSQUIRRELVM vm, const SQChar * str, ...) noexcept
void Core::ErrorFunc(HSQUIRRELVM vm, const SQChar * str, ...) noexcept void Core::ErrorFunc(HSQUIRRELVM vm, const SQChar * str, ...) noexcept
{ {
SQMOD_UNUSED_VAR(vm);
// Prepare the arguments list // Prepare the arguments list
va_list args; va_list args;
va_start(args, str); va_start(args, str);
@ -729,6 +731,7 @@ SQInteger Core::RuntimeErrorHandler(HSQUIRRELVM vm) noexcept
void Core::CompilerErrorHandler(HSQUIRRELVM vm, const SQChar * desc, const SQChar * src, SQInteger line, SQInteger column) noexcept void Core::CompilerErrorHandler(HSQUIRRELVM vm, const SQChar * desc, const SQChar * src, SQInteger line, SQInteger column) noexcept
{ {
SQMOD_UNUSED_VAR(vm);
try try
{ {
_Core->m_ErrorMsg.assign(ToStringF("%s : %s:%d : %s", src, line, column, desc)); _Core->m_ErrorMsg.assign(ToStringF("%s : %s:%d : %s", src, line, column, desc));
@ -1558,6 +1561,7 @@ void Core::OnLogMessage(SQInt32 type, const SQChar * message) noexcept
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Core::OnPlayerUpdate(SQInt32 player, SQInt32 type) noexcept void Core::OnPlayerUpdate(SQInt32 player, SQInt32 type) noexcept
{ {
SQMOD_UNUSED_VAR(type);
Vector3 pos; Vector3 pos;
// Is this player instance tracked for the first time // Is this player instance tracked for the first time
if (m_PlayerTrack[player].Fresh) if (m_PlayerTrack[player].Fresh)
@ -1617,6 +1621,7 @@ void Core::OnPlayerUpdate(SQInt32 player, SQInt32 type) noexcept
void Core::OnVehicleUpdate(SQInt32 vehicle, SQInt32 type) noexcept void Core::OnVehicleUpdate(SQInt32 vehicle, SQInt32 type) noexcept
{ {
SQMOD_UNUSED_VAR(type);
Vector3 pos; Vector3 pos;
// Is this vehicle instance tracked for the first time // Is this vehicle instance tracked for the first time
if (m_VehicleTrack[vehicle].Fresh) if (m_VehicleTrack[vehicle].Fresh)

View File

@ -161,6 +161,7 @@ EVehicleCustom & GVehicleCustom() noexcept
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Entity(HSQUIRRELVM vm) bool Register_Entity(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }

View File

@ -198,6 +198,7 @@ private:
inst.Position.y = y; inst.Position.y = y;
inst.Position.z = z; inst.Position.z = z;
inst.Color.SetRGBA(color); inst.Color.SetRGBA(color);
SQMOD_UNUSED_VAR(index);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -359,14 +360,24 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst, SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z, static void Store(Instance & inst, SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
SQUint32 r, SQUint32 g, SQUint32 b, SQUint32 a, SQFloat radius) noexcept SQUint32 r, SQUint32 g, SQUint32 b, SQUint32 a, SQFloat radius) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
SQMOD_UNUSED_VAR(player);
SQMOD_UNUSED_VAR(world);
SQMOD_UNUSED_VAR(x);
SQMOD_UNUSED_VAR(y);
SQMOD_UNUSED_VAR(z);
SQMOD_UNUSED_VAR(r);
SQMOD_UNUSED_VAR(g);
SQMOD_UNUSED_VAR(b);
SQMOD_UNUSED_VAR(a);
SQMOD_UNUSED_VAR(radius);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -558,6 +569,7 @@ private:
inst.Secondary = secondary; inst.Secondary = secondary;
inst.Alternative = alternative; inst.Alternative = alternative;
inst.Release = release; inst.Release = release;
SQMOD_UNUSED_VAR(slot);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -727,14 +739,20 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z, static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
SQInt32 alpha) noexcept SQInt32 alpha) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
SQMOD_UNUSED_VAR(model);
SQMOD_UNUSED_VAR(world);
SQMOD_UNUSED_VAR(x);
SQMOD_UNUSED_VAR(y);
SQMOD_UNUSED_VAR(z);
SQMOD_UNUSED_VAR(alpha);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -905,14 +923,22 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQInt32 quantity, static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQInt32 quantity,
SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha, bool automatic) noexcept SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha, bool automatic) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
SQMOD_UNUSED_VAR(model);
SQMOD_UNUSED_VAR(world);
SQMOD_UNUSED_VAR(quantity);
SQMOD_UNUSED_VAR(x);
SQMOD_UNUSED_VAR(y);
SQMOD_UNUSED_VAR(z);
SQMOD_UNUSED_VAR(alpha);
SQMOD_UNUSED_VAR(automatic);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -1142,7 +1168,7 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -1222,6 +1248,7 @@ private:
static void Destroy(SQInt32 id) noexcept static void Destroy(SQInt32 id) noexcept
{ {
/* @TODO: Implement as kick. */ /* @TODO: Implement as kick. */
SQMOD_UNUSED_VAR(id);
} }
public: public:
@ -1482,14 +1509,23 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst, SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z, static void Store(Instance & inst, SQInt32 player, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
SQUint32 r, SQUint32 g, SQUint32 b, SQFloat radius) noexcept SQUint32 r, SQUint32 g, SQUint32 b, SQFloat radius) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
SQMOD_UNUSED_VAR(player);
SQMOD_UNUSED_VAR(world);
SQMOD_UNUSED_VAR(x);
SQMOD_UNUSED_VAR(y);
SQMOD_UNUSED_VAR(z);
SQMOD_UNUSED_VAR(r);
SQMOD_UNUSED_VAR(g);
SQMOD_UNUSED_VAR(b);
SQMOD_UNUSED_VAR(radius);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -1668,6 +1704,14 @@ private:
SQInt32 xr, SQInt32 yr, SQFloat angle, SQInt32 alpha, bool rel) noexcept SQInt32 xr, SQInt32 yr, SQFloat angle, SQInt32 alpha, bool rel) noexcept
{ {
inst.Path.assign(file); inst.Path.assign(file);
SQMOD_UNUSED_VAR(index);
SQMOD_UNUSED_VAR(xp);
SQMOD_UNUSED_VAR(yp);
SQMOD_UNUSED_VAR(xr);
SQMOD_UNUSED_VAR(yr);
SQMOD_UNUSED_VAR(angle);
SQMOD_UNUSED_VAR(alpha);
SQMOD_UNUSED_VAR(rel);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -1839,6 +1883,11 @@ private:
SQUint32 color, bool rel) noexcept SQUint32 color, bool rel) noexcept
{ {
inst.Text.assign(text); inst.Text.assign(text);
SQMOD_UNUSED_VAR(index);
SQMOD_UNUSED_VAR(xp);
SQMOD_UNUSED_VAR(yp);
SQMOD_UNUSED_VAR(color);
SQMOD_UNUSED_VAR(rel);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -2006,14 +2055,22 @@ private:
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst) noexcept static void Store(Instance & inst) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z, static void Store(Instance & inst, SQInt32 model, SQInt32 world, SQFloat x, SQFloat y, SQFloat z,
SQFloat angle, SQInt32 primary, SQInt32 secondary) noexcept SQFloat angle, SQInt32 primary, SQInt32 secondary) noexcept
{ {
/* ... */ SQMOD_UNUSED_VAR(inst);
SQMOD_UNUSED_VAR(model);
SQMOD_UNUSED_VAR(world);
SQMOD_UNUSED_VAR(x);
SQMOD_UNUSED_VAR(y);
SQMOD_UNUSED_VAR(z);
SQMOD_UNUSED_VAR(angle);
SQMOD_UNUSED_VAR(primary);
SQMOD_UNUSED_VAR(secondary);
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
@ -2311,12 +2368,28 @@ public:
return m_ID; return m_ID;
} }
/* --------------------------------------------------------------------------------------------
* Implicit conversion to an entity identifier.
*/
operator Int64 () const noexcept
{
return _SCI64(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to an entity identifier. * Implicit conversion to an entity identifier.
*/ */
operator SQUint32 () const noexcept operator SQUint32 () const noexcept
{ {
return static_cast< SQUint32 >(m_ID); return _SCU32(m_ID);
}
/* --------------------------------------------------------------------------------------------
* Implicit conversion to an entity identifier.
*/
operator Uint64 () const noexcept
{
return _SCU64(m_ID);
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------

View File

@ -1243,6 +1243,7 @@ template < class T > void GlobalFilter< T >::Clear(SQInt32 header) noexcept
// Now it's safe to reset the filter // Now it's safe to reset the filter
m_Filter.reset(); m_Filter.reset();
} }
SQMOD_UNUSED_VAR(header);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1264,6 +1265,7 @@ template < class T > void GlobalFilter< T >::Flip(SQInt32 header) noexcept
// Hook from the newly filtered entities // Hook from the newly filtered entities
Hook(); Hook();
} }
SQMOD_UNUSED_VAR(header);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -1257,6 +1257,7 @@ template < class T > void LocalFilter< T >::Clear(SQInt32 header) noexcept
// Now it's safe to reset the filter // Now it's safe to reset the filter
m_Filter.reset(); m_Filter.reset();
} }
SQMOD_UNUSED_VAR(header);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -1278,6 +1279,7 @@ template < class T > void LocalFilter< T >::Flip(SQInt32 header) noexcept
// Hook from the newly filtered entities // Hook from the newly filtered entities
Hook(); Hook();
} }
SQMOD_UNUSED_VAR(header);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------

View File

@ -1,5 +1,6 @@
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
#include "Event/Shared.hpp" #include "Event/Shared.hpp"
#include "Config.hpp"
#include "Register.hpp" #include "Register.hpp"
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -314,6 +315,7 @@ bool CanBeInversed(SQInt32 type) noexcept
// ================================================================================================ // ================================================================================================
bool Register_Event(HSQUIRRELVM vm) bool Register_Event(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Datetime(HSQUIRRELVM vm) bool Register_Datetime(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_FileIO(HSQUIRRELVM vm) bool Register_FileIO(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -160,6 +160,7 @@ String GetFormatStr(HSQUIRRELVM vm, const String & fstr, SQInteger arg, SQInteg
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Format(HSQUIRRELVM vm) bool Register_Format(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_INI(HSQUIRRELVM vm) bool Register_INI(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -55,6 +55,7 @@ Session::~Session()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Session::Process(SQFloat delta) noexcept void Session::Process(SQFloat delta) noexcept
{ {
SQMOD_UNUSED_VAR(delta);
// Make sure that the IRC session is connected // Make sure that the IRC session is connected
if (!irc_is_connected(m_Session)) if (!irc_is_connected(m_Session))
{ {
@ -197,12 +198,22 @@ void Session::ForwardEvent(Function & listener, unsigned int event, const char *
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, irc_dcc_t dccid) noexcept void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, irc_dcc_t dccid) noexcept
{ {
SQMOD_UNUSED_VAR(listener);
SQMOD_UNUSED_VAR(nick);
SQMOD_UNUSED_VAR(addr);
SQMOD_UNUSED_VAR(dccid);
/* @TODO: Implement! */ /* @TODO: Implement! */
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid) noexcept void Session::ForwardEvent(Function & listener, const char * nick, const char * addr, const char * filename, unsigned long size, irc_dcc_t dccid) noexcept
{ {
SQMOD_UNUSED_VAR(listener);
SQMOD_UNUSED_VAR(nick);
SQMOD_UNUSED_VAR(addr);
SQMOD_UNUSED_VAR(filename);
SQMOD_UNUSED_VAR(size);
SQMOD_UNUSED_VAR(dccid);
/* @TODO: Implement! */ /* @TODO: Implement! */
} }

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_JSON(HSQUIRRELVM vm) bool Register_JSON(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,6 +7,7 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_LongInt(HSQUIRRELVM vm) bool Register_LongInt(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
/* /*
Sqrat::RootTable(vm).Bind(_SC("SLongInt"), Sqrat::Class<SLongInt>(vm, _SC("SLongInt")) Sqrat::RootTable(vm).Bind(_SC("SLongInt"), Sqrat::Class<SLongInt>(vm, _SC("SLongInt"))
.Ctor() .Ctor()

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Math(HSQUIRRELVM vm) bool Register_Math(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Numeric(HSQUIRRELVM vm) bool Register_Numeric(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -1,12 +1,16 @@
#include "Library/Shared.hpp" #include "Library/Shared.hpp"
#include "Register.hpp" #include "Register.hpp"
// ------------------------------------------------------------------------------------------------
#include "Config.hpp"
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
namespace SqMod { namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Library(HSQUIRRELVM vm) bool Register_Library(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_String(HSQUIRRELVM vm) bool Register_String(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_SysPath(HSQUIRRELVM vm) bool Register_SysPath(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_System(HSQUIRRELVM vm) bool Register_System(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Timer(HSQUIRRELVM vm) bool Register_Timer(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Utils(HSQUIRRELVM vm) bool Register_Utils(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -7,7 +7,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_XML(HSQUIRRELVM vm) bool Register_XML(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -102,6 +102,14 @@ public:
return m_ID; return m_ID;
} }
/* --------------------------------------------------------------------------------------------
* Implicit conversion to model identifier.
*/
operator Int64 () const noexcept
{
return _SCI64(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to boolean. * Implicit conversion to boolean.
*/ */

View File

@ -1,13 +1,17 @@
#include "Misc/Functions.hpp" #include "Misc/Functions.hpp"
#include "Register.hpp" #include "Register.hpp"
// ------------------------------------------------------------------------------------------------
#include "Config.hpp"
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
namespace SqMod { namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_Functions(HSQUIRRELVM vm) bool Register_Functions(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -214,6 +214,7 @@ const SQChar * CModel::GetName() const noexcept
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CModel::SetName(const SQChar * name) noexcept void CModel::SetName(const SQChar * name) noexcept
{ {
SQMOD_UNUSED_VAR(name);
m_ID = -1; /* @TODO Implement! */ m_ID = -1; /* @TODO Implement! */
} }

View File

@ -102,6 +102,14 @@ public:
return m_ID; return m_ID;
} }
/* --------------------------------------------------------------------------------------------
* Implicit conversion to model identifier.
*/
operator Int64 () const noexcept
{
return _SCI64(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to boolean. * Implicit conversion to boolean.
*/ */

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CPlayerImmunity(HSQUIRRELVM vm) bool Register_CPlayerImmunity(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CRadio(HSQUIRRELVM vm) bool Register_CRadio(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -2450,10 +2450,9 @@ SQInt32 WeaponToModel(SQInt32 id)
bool Register_Misc(HSQUIRRELVM vm) bool Register_Misc(HSQUIRRELVM vm)
{ {
// Output debugging information // Output debugging information
LogDbg("Beginning registration of <Misc> API"); LogDbg("Beginning registration of <Miscellaneous> API");
// Attempt to register the specified API // Attempt to register the specified API
Sqrat::RootTable(vm) Sqrat::RootTable(vm)
.Func(_SC("GetKeyCodeName"), &GetKeyCodeName) .Func(_SC("GetKeyCodeName"), &GetKeyCodeName)
.Func(_SC("GetModelName"), &GetModelName) .Func(_SC("GetModelName"), &GetModelName)
.Func(_SC("IsModelWeapon"), &IsModelWeapon) .Func(_SC("IsModelWeapon"), &IsModelWeapon)
@ -2469,12 +2468,12 @@ bool Register_Misc(HSQUIRRELVM vm)
.Func(_SC("GetWeaponID"), &GetWeaponID) .Func(_SC("GetWeaponID"), &GetWeaponID)
.Func(_SC("IsWeaponValid"), &IsWeaponValid) .Func(_SC("IsWeaponValid"), &IsWeaponValid)
.Func(_SC("IsWeaponNatural"), &IsWeaponNatural) .Func(_SC("IsWeaponNatural"), &IsWeaponNatural)
.Func(_SC("WeaponToModel"), &WeaponToModel) .Func(_SC("WeaponToModel"), &WeaponToModel);
/* END REGISTRATION STATEMENT */ ; /* END REGISTRATION STATEMENT */ ;
// Output debugging information // Output debugging information
LogDbg("Registration of <Misc> API was successful"); LogDbg("Registration of <Miscellaneous> API was successful");
// Registration succeeded // Registration succeeded
return true; return true;
} }

View File

@ -14,7 +14,7 @@ namespace SqMod {
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Attempt to convert the specified key code to a name. * Attempt to convert the specified key code to a name.
*/ */
const SQChar * GetKeyCodeName(SQInteger keycode); const SQChar * GetKeyCodeName(SQInt32 keycode);
/* ------------------------------------------------------------------------------------------------ /* ------------------------------------------------------------------------------------------------
* Attemp to convert the specified model identifier to a name. * Attemp to convert the specified model identifier to a name.

View File

@ -97,17 +97,34 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to skin identifier. * Implicit conversion to skin identifier.
*/ */
operator SQInt32 () const noexcept { return m_ID; } operator SQInt32 () const noexcept
{
return m_ID;
}
/* --------------------------------------------------------------------------------------------
* Implicit conversion to skin identifier.
*/
operator Int64 () const noexcept
{
return _SCI64(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to boolean. * Implicit conversion to boolean.
*/ */
operator bool () const noexcept { return IsSkinValid(m_ID); } operator bool () const noexcept
{
return IsSkinValid(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Negation operator. * Negation operator.
*/ */
bool operator ! () const noexcept { return !IsSkinValid(m_ID); } bool operator ! () const noexcept
{
return !IsSkinValid(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Used by the script to compare two instances of this type. * Used by the script to compare two instances of this type.

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CSound(HSQUIRRELVM vm) bool Register_CSound(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CVehicleImmunity(HSQUIRRELVM vm) bool Register_CVehicleImmunity(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CWastedSettings(HSQUIRRELVM vm) bool Register_CWastedSettings(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -100,13 +100,21 @@ public:
bool operator >= (const CWeapon & w) const noexcept; bool operator >= (const CWeapon & w) const noexcept;
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to model identifier. * Implicit conversion to weapon identifier.
*/ */
operator SQInt32 () const noexcept operator SQInt32 () const noexcept
{ {
return m_ID; return m_ID;
} }
/* --------------------------------------------------------------------------------------------
* Implicit conversion to weapon identifier.
*/
operator Int64 () const noexcept
{
return _SCI64(m_ID);
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Implicit conversion to boolean. * Implicit conversion to boolean.
*/ */

View File

@ -6,7 +6,8 @@ namespace SqMod {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Register_CWorldBounds(HSQUIRRELVM vm) bool Register_CWorldBounds(HSQUIRRELVM vm)
{ {
SQMOD_UNUSED_VAR(vm);
return true; return true;
} }
} // Namespace:: SqMod } // Namespace:: SqMod

View File

@ -240,29 +240,29 @@ public:
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void Emit(Args &... args) template <typename... Uref> void Emit(Uref &&... args)
{ {
for (Node * node = m_Nodes.m_Head; node; node = node->m_Next) for (Node * node = m_Nodes.m_Head; node; node = node->m_Next)
{ {
(*node->m_Exec)(node->m_This, std::forward<Args>(args)...); (*node->m_Exec)(node->m_This, std::forward<Uref>(args)...);
} }
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
template <typename T> void Query(T && collecter, Args &... args) template <typename T, typename... Uref> void Query(T && collecter, Uref &&... args)
{ {
for (Node * node = m_Nodes.m_Head; node; node = node->m_Next) for (Node * node = m_Nodes.m_Head; node; node = node->m_Next)
{ {
collecter( ( (*node->m_Exec) (node->m_This, std::forward<Args>(args)...) ) ); collecter( ( (*node->m_Exec) (node->m_This, std::forward<Uref>(args)...) ) );
} }
} }
// -------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------
void operator () (Args &... args) template <typename... Uref> void operator () (Uref &&... args)
{ {
for (Node * node = m_Nodes.m_Head; node; node = node->m_Next) for (Node * node = m_Nodes.m_Head; node; node = node->m_Next)
{ {
(*node->m_Exec)(node->m_This, std::forward<Args>(args)...); (*node->m_Exec)(node->m_This, std::forward<Uref>(args)...);
} }
} }