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

Compare commits

..

No commits in common. "6419fc0f4d4506fba842bb48f1d286bac426e421" and "3e9f25502b6622b79c0d77970ab465ba2eb5c636" have entirely different histories.

3 changed files with 12 additions and 43 deletions

View File

@ -549,8 +549,6 @@ void Register_Routine(HSQUIRRELVM vm)
.Prop(_SC("Inactive"), &Routine::GetInactive) .Prop(_SC("Inactive"), &Routine::GetInactive)
.Prop(_SC("Persistent"), &Routine::GetPersistent, &Routine::SetPersistent) .Prop(_SC("Persistent"), &Routine::GetPersistent, &Routine::SetPersistent)
.Prop(_SC("Yields"), &Routine::GetYields, &Routine::SetYields) .Prop(_SC("Yields"), &Routine::GetYields, &Routine::SetYields)
.Prop(_SC("Elapsed"), &Routine::GetElapsed)
.Prop(_SC("Remaining"), &Routine::GetRemaining)
.Prop(_SC("Terminated"), &Routine::GetTerminated) .Prop(_SC("Terminated"), &Routine::GetTerminated)
.Prop(_SC("Arguments"), &Routine::GetArguments) .Prop(_SC("Arguments"), &Routine::GetArguments)
// Member Methods // Member Methods

View File

@ -408,6 +408,7 @@ public:
} }
// Unable to find such routine // Unable to find such routine
STHROWF("Unable to fetch a routine with tag ({}). No such routine", tag.mPtr); STHROWF("Unable to fetch a routine with tag ({}). No such routine", tag.mPtr);
SQ_UNREACHABLE
// 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
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic push #pragma clang diagnostic push
@ -417,7 +418,6 @@ public:
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
SQ_UNREACHABLE
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -804,32 +804,6 @@ public:
return (m_Slot == SQMOD_MAX_ROUTINES); return (m_Slot == SQMOD_MAX_ROUTINES);
} }
/* --------------------------------------------------------------------------------------------
* Retrieve the time elapsed since the routine was created or invoked.
*/
SQMOD_NODISCARD SQInteger GetElapsed() const
{
if (m_Slot >= SQMOD_MAX_ROUTINES)
{
STHROWF("This instance does not reference a valid routine");
}
// We know it's valid so let's return it
return s_Instances[m_Slot].mInterval - s_Intervals[m_Slot];
}
/* --------------------------------------------------------------------------------------------
* Retrieve the time remaining until the routine is invoked.
*/
SQMOD_NODISCARD SQInteger GetRemaining() const
{
if (m_Slot >= SQMOD_MAX_ROUTINES)
{
STHROWF("This instance does not reference a valid routine");
}
// We know it's valid so let's return it
return s_Intervals[m_Slot];
}
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the number of arguments to be forwarded. * Retrieve the number of arguments to be forwarded.
*/ */

View File

@ -1547,7 +1547,7 @@ SQMOD_NODISCARD SQInteger LgGetObjectCount() {
} }
SQMOD_NODISCARD SQInteger LgGetPlayers() { return ForeachConnectedPlayerCount([](int32_t) { return true; }); } SQMOD_NODISCARD SQInteger LgGetPlayers() { return ForeachConnectedPlayerCount([](int32_t) { return true; }); }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LgSetVehiclesForcedRespawnHeight(SQFloat height) { _Func->SetVehiclesForcedRespawnHeight(static_cast< float >(height)); } static void LgSetVehiclesForcedRespawnHeight(SQFloat height) { _Func->SetVehiclesForcedRespawnHeight(height); }
SQMOD_NODISCARD static SQFloat LgGetVehiclesForcedRespawnHeight() { return _Func->GetVehiclesForcedRespawnHeight(); } SQMOD_NODISCARD static SQFloat LgGetVehiclesForcedRespawnHeight() { return _Func->GetVehiclesForcedRespawnHeight(); }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQMOD_NODISCARD static SQInteger LgFindPlayer(HSQUIRRELVM vm) { SQMOD_NODISCARD static SQInteger LgFindPlayer(HSQUIRRELVM vm) {
@ -1634,11 +1634,10 @@ SQMOD_NODISCARD static SQInteger LgInPolyProcStack(HSQUIRRELVM vm) {
points.reserve(static_cast<unsigned long long int>((top - 1) / 2)); points.reserve(static_cast<unsigned long long int>((top - 1) / 2));
for (SQInteger idx = 4; idx < top;) { for (SQInteger idx = 4; idx < top;) {
points.emplace_back(); points.emplace_back();
points.back().x = SQMOD_DOUBLE_OR(static_cast< Vector2::Value >(PopStackFloat(vm, idx++)), PopStackFloat(vm, idx++)); points.back().x = PopStackFloat(vm, idx++);
points.back().y = SQMOD_DOUBLE_OR(static_cast< Vector2::Value >(PopStackFloat(vm, idx++)), PopStackFloat(vm, idx++)); points.back().y = PopStackFloat(vm, idx++);
} }
sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(SQMOD_DOUBLE_OR(static_cast< float >(x), x), sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(x, y, points.size(), points.data())));
SQMOD_DOUBLE_OR(static_cast< float >(y), y), points.size(), points.data())));
return 1; return 1;
} }
SQMOD_NODISCARD static SQInteger LgInPolyProcString(HSQUIRRELVM vm) { SQMOD_NODISCARD static SQInteger LgInPolyProcString(HSQUIRRELVM vm) {
@ -1655,8 +1654,7 @@ SQMOD_NODISCARD static SQInteger LgInPolyProcString(HSQUIRRELVM vm) {
ss >> points.back().y >> c; ss >> points.back().y >> c;
else break; else break;
} }
sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(SQMOD_DOUBLE_OR(static_cast< float >(x), x), sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(x, y, points.size(), points.data())));
SQMOD_DOUBLE_OR(static_cast< float >(y), y), points.size(), points.data())));
return 1; return 1;
} }
SQMOD_NODISCARD static SQInteger LgInPolyProcArray(HSQUIRRELVM vm) { SQMOD_NODISCARD static SQInteger LgInPolyProcArray(HSQUIRRELVM vm) {
@ -1667,14 +1665,13 @@ SQMOD_NODISCARD static SQInteger LgInPolyProcArray(HSQUIRRELVM vm) {
arr.Foreach([&](HSQUIRRELVM vm, SQInteger i) -> SQRESULT { arr.Foreach([&](HSQUIRRELVM vm, SQInteger i) -> SQRESULT {
if ((i & 1) == 0) { if ((i & 1) == 0) {
points.emplace_back(); points.emplace_back();
points.back().x = SQMOD_DOUBLE_OR(static_cast< Vector2::Value >(PopStackFloat(vm, -1)), PopStackFloat(vm, -1)); points.back().x = PopStackFloat(vm, -1);
} else { } else {
points.back().y = SQMOD_DOUBLE_OR(static_cast< Vector2::Value >(PopStackFloat(vm, -1)), PopStackFloat(vm, -1)); points.back().y = PopStackFloat(vm, -1);
} }
return SQ_OK; return SQ_OK;
}); });
sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(SQMOD_DOUBLE_OR(static_cast< float >(x), x), sq_pushbool(vm, static_cast< SQBool >(LgInternal_InPoly(x, y, points.size(), points.data())));
SQMOD_DOUBLE_OR(static_cast< float >(y), y), points.size(), points.data())));
return 1; return 1;
} }
SQMOD_NODISCARD static SQInteger LgInPoly(HSQUIRRELVM vm) { SQMOD_NODISCARD static SQInteger LgInPoly(HSQUIRRELVM vm) {
@ -1755,10 +1752,10 @@ void Register_Official_Functions(HSQUIRRELVM vm)
.Func(_SC("SetMaxHeight"), LgSetMaxHeight) .Func(_SC("SetMaxHeight"), LgSetMaxHeight)
.Func(_SC("SetFallTimer"), LgSetFallTimer) .Func(_SC("SetFallTimer"), LgSetFallTimer)
.SquirrelFunc(_SC("GetServerName"), LgGetServerName) .Func(_SC("GetServerName"), LgGetServerName)
.Func(_SC("GetMaxPlayers"), LgGetMaxPlayers) .Func(_SC("GetMaxPlayers"), LgGetMaxPlayers)
.SquirrelFunc(_SC("GetPassword"), LgGetServerPassword) .Func(_SC("GetPassword"), LgGetServerPassword)
.SquirrelFunc(_SC("GetGameModeName"), LgGetGameModeText) .Func(_SC("GetGameModeName"), LgGetGameModeText)
.Func(_SC("GetTimeRate"), LgGetTimeRate) .Func(_SC("GetTimeRate"), LgGetTimeRate)
.Func(_SC("GetHour"), LgGetHour) .Func(_SC("GetHour"), LgGetHour)
.Func(_SC("GetMinute"), LgGetMinute) .Func(_SC("GetMinute"), LgGetMinute)