Simplify NoDelay implementation

- All NoDelay needs to do is call the current state's function. Calling
  SetState() is excessive.
This commit is contained in:
Randy Heit 2015-02-24 20:37:58 -06:00
parent 5d65b10aec
commit 5aba252b87
2 changed files with 3 additions and 11 deletions

View file

@ -3673,17 +3673,9 @@ void AActor::Tick ()
if (state->GetNoDelay()) if (state->GetNoDelay())
{ {
// For immediately spawned objects with the NoDelay flag set for their // For immediately spawned objects with the NoDelay flag set for their
// Spawn state, explicitly set the current state so that it calls its // Spawn state, explicitly call the current state's function.
// action and chains 0-tic states. if (state->CallAction(this, this) && (ObjectFlags & OF_EuthanizeMe))
int starttics = tics;
if (!SetState(state))
return; // freed itself return; // freed itself
// If the initial state had a duration of 0 tics, let the next state run
// normally. Otherwise, increment tics by 1 so that we don't double up ticks.
else if (starttics > 0 && tics >= 0)
{
tics++;
}
} }
} }
// cycle through states, calling action functions at transitions // cycle through states, calling action functions at transitions

View file

@ -2375,7 +2375,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log)
if (text[0] == '$') text = GStrings(text+1); if (text[0] == '$') text = GStrings(text+1);
FString formatted = strbin1(text); FString formatted = strbin1(text);
Printf("%s\n", formatted.GetChars()); Printf("%4d: %s\n", gametic, formatted.GetChars());
ACTION_SET_RESULT(false); // Prints should never set the result for inventory state chains! ACTION_SET_RESULT(false); // Prints should never set the result for inventory state chains!
} }