1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-25 09:44:02 +00:00

Check against nesting recursive main()

This commit is contained in:
fgenesis 2017-08-09 22:07:37 +02:00
parent 02db145a01
commit db4af79389
3 changed files with 10 additions and 1 deletions

View file

@ -3617,6 +3617,14 @@ bool DSQ::isQuitFlag()
return watchQuitFlag;
}
void DSQ::run(float runTime /* = -1 */)
{
if(isDeveloperKeys() && isNested())
errorLog("Warning: Nesting recursive main()");
Core::run(runTime);
}
void DSQ::watch(float t, int canQuit)
{
watchQuitFlag = false;

View file

@ -353,6 +353,7 @@ public:
void rumble(float leftMotor, float rightMotor, float time, int source, InputDevice device);
void vision(std::string folder, int num, bool ignoreMusic = false);
void run(float runTime = -1); // same as Core::run() but with recursion check
void watch(float t, int canQuit = 0);
std::string lastVoiceFile;

View file

@ -7141,7 +7141,7 @@ luaFunc(watch)
luaFunc(wait)
{
core->run(lua_tonumber(L, 1));
dsq->run(lua_tonumber(L, 1)); // run() with recursion checking
luaReturnNil();
}