mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
Added propagation of unsafe execution context to waiting command
Thanks Edward-san for pointing this out
This commit is contained in:
parent
059e40e2d5
commit
b008426ed7
1 changed files with 9 additions and 3 deletions
|
@ -65,7 +65,7 @@ class DWaitingCommand : public DThinker
|
||||||
{
|
{
|
||||||
DECLARE_CLASS (DWaitingCommand, DThinker)
|
DECLARE_CLASS (DWaitingCommand, DThinker)
|
||||||
public:
|
public:
|
||||||
DWaitingCommand (const char *cmd, int tics);
|
DWaitingCommand (const char *cmd, int tics, bool unsafe);
|
||||||
~DWaitingCommand ();
|
~DWaitingCommand ();
|
||||||
void Serialize(FSerializer &arc);
|
void Serialize(FSerializer &arc);
|
||||||
void Tick ();
|
void Tick ();
|
||||||
|
@ -75,6 +75,7 @@ private:
|
||||||
|
|
||||||
char *Command;
|
char *Command;
|
||||||
int TicsLeft;
|
int TicsLeft;
|
||||||
|
bool IsUnsafe;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DStoredCommand : public DThinker
|
class DStoredCommand : public DThinker
|
||||||
|
@ -203,12 +204,14 @@ DWaitingCommand::DWaitingCommand ()
|
||||||
{
|
{
|
||||||
Command = NULL;
|
Command = NULL;
|
||||||
TicsLeft = 1;
|
TicsLeft = 1;
|
||||||
|
IsUnsafe = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWaitingCommand::DWaitingCommand (const char *cmd, int tics)
|
DWaitingCommand::DWaitingCommand (const char *cmd, int tics, bool unsafe)
|
||||||
{
|
{
|
||||||
Command = copystring (cmd);
|
Command = copystring (cmd);
|
||||||
TicsLeft = tics+1;
|
TicsLeft = tics+1;
|
||||||
|
IsUnsafe = unsafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWaitingCommand::~DWaitingCommand ()
|
DWaitingCommand::~DWaitingCommand ()
|
||||||
|
@ -223,7 +226,10 @@ void DWaitingCommand::Tick ()
|
||||||
{
|
{
|
||||||
if (--TicsLeft == 0)
|
if (--TicsLeft == 0)
|
||||||
{
|
{
|
||||||
|
const bool wasUnsafe = UnsafeExecutionContext;
|
||||||
|
UnsafeExecutionContext = IsUnsafe;
|
||||||
AddCommandString (Command);
|
AddCommandString (Command);
|
||||||
|
UnsafeExecutionContext = wasUnsafe;
|
||||||
Destroy ();
|
Destroy ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,7 +745,7 @@ void AddCommandString (char *cmd, int keynum)
|
||||||
// Note that deferred commands lose track of which key
|
// Note that deferred commands lose track of which key
|
||||||
// (if any) they were pressed from.
|
// (if any) they were pressed from.
|
||||||
*brkpt = ';';
|
*brkpt = ';';
|
||||||
Create<DWaitingCommand> (brkpt, tics);
|
Create<DWaitingCommand> (brkpt, tics, UnsafeExecutionContext);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue