mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +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)
|
||||
public:
|
||||
DWaitingCommand (const char *cmd, int tics);
|
||||
DWaitingCommand (const char *cmd, int tics, bool unsafe);
|
||||
~DWaitingCommand ();
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
@ -75,6 +75,7 @@ private:
|
|||
|
||||
char *Command;
|
||||
int TicsLeft;
|
||||
bool IsUnsafe;
|
||||
};
|
||||
|
||||
class DStoredCommand : public DThinker
|
||||
|
@ -203,12 +204,14 @@ DWaitingCommand::DWaitingCommand ()
|
|||
{
|
||||
Command = NULL;
|
||||
TicsLeft = 1;
|
||||
IsUnsafe = false;
|
||||
}
|
||||
|
||||
DWaitingCommand::DWaitingCommand (const char *cmd, int tics)
|
||||
DWaitingCommand::DWaitingCommand (const char *cmd, int tics, bool unsafe)
|
||||
{
|
||||
Command = copystring (cmd);
|
||||
TicsLeft = tics+1;
|
||||
IsUnsafe = unsafe;
|
||||
}
|
||||
|
||||
DWaitingCommand::~DWaitingCommand ()
|
||||
|
@ -223,7 +226,10 @@ void DWaitingCommand::Tick ()
|
|||
{
|
||||
if (--TicsLeft == 0)
|
||||
{
|
||||
const bool wasUnsafe = UnsafeExecutionContext;
|
||||
UnsafeExecutionContext = IsUnsafe;
|
||||
AddCommandString (Command);
|
||||
UnsafeExecutionContext = wasUnsafe;
|
||||
Destroy ();
|
||||
}
|
||||
}
|
||||
|
@ -739,7 +745,7 @@ void AddCommandString (char *cmd, int keynum)
|
|||
// Note that deferred commands lose track of which key
|
||||
// (if any) they were pressed from.
|
||||
*brkpt = ';';
|
||||
Create<DWaitingCommand> (brkpt, tics);
|
||||
Create<DWaitingCommand> (brkpt, tics, UnsafeExecutionContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue