mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Allow routines to have configurable error reporting that is individual from global setting.
Potential fix for error handling that was being used in a way that had the opposite intended effect.
This commit is contained in:
parent
19a245f3b1
commit
a7f8584661
@ -18,6 +18,7 @@ Routine::Time Routine::s_Last = 0;
|
||||
Routine::Time Routine::s_Prev = 0;
|
||||
Routine::Interval Routine::s_Intervals[SQMOD_MAX_ROUTINES];
|
||||
Routine::Instance Routine::s_Instances[SQMOD_MAX_ROUTINES];
|
||||
bool Routine::s_Silenced = false;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Routine::Process()
|
||||
@ -57,6 +58,7 @@ void Routine::Process()
|
||||
void Routine::Initialize()
|
||||
{
|
||||
std::memset(s_Intervals, 0, sizeof(s_Intervals));
|
||||
SetSilenced(!ErrorHandling::IsEnabled());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@ -349,6 +351,8 @@ void Register_Routine(HSQUIRRELVM vm)
|
||||
.Func(_SC("GetArgument"), &Routine::GetArgument)
|
||||
.Func(_SC("DropEnv"), &Routine::DropEnv)
|
||||
.StaticFunc(_SC("UsedCount"), &Routine::GetUsed)
|
||||
.StaticFunc(_SC("AreSilenced"), &Routine::GetSilenced)
|
||||
.StaticFunc(_SC("SetSilenced"), &Routine::SetSilenced)
|
||||
);
|
||||
// Global functions
|
||||
RootTable(vm).SquirrelFunc(_SC("SqRoutine"), &Routine::Create);
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
, mIterations(0)
|
||||
, mInterval(0)
|
||||
, mSuspended(false)
|
||||
, mQuiet(ErrorHandling::IsEnabled())
|
||||
, mQuiet(GetSilenced())
|
||||
, mEndure(false)
|
||||
, mArgc(0)
|
||||
, mArgv()
|
||||
@ -213,6 +213,7 @@ private:
|
||||
static Time s_Prev; // Previous time point.
|
||||
static Interval s_Intervals[SQMOD_MAX_ROUTINES]; // List of intervals to be processed.
|
||||
static Instance s_Instances[SQMOD_MAX_ROUTINES]; // List of routines to be executed.
|
||||
static bool s_Silenced; // Error reporting independent from global setting.
|
||||
|
||||
private:
|
||||
|
||||
@ -639,6 +640,22 @@ public:
|
||||
{
|
||||
GetValid().mEnv.Release();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* See if error reporting is enabled for all newlly created routines.
|
||||
*/
|
||||
static bool GetSilenced()
|
||||
{
|
||||
return s_Silenced;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set if error reporting should be enabled for all newlly created routines.
|
||||
*/
|
||||
static void SetSilenced(bool toggle)
|
||||
{
|
||||
s_Silenced = toggle;
|
||||
}
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
Loading…
Reference in New Issue
Block a user