feat(Core/SmartScripts): SMART_EVENT_EVENT_PHASE_CHANGE (#10054)

* cherry-pick commit (619a5534c5)
This commit is contained in:
IntelligentQuantum
2022-04-17 04:25:52 +04:30
committed by GitHub
parent 02ba514f0a
commit e38a17d2da
4 changed files with 92 additions and 24 deletions

View File

@@ -258,26 +258,10 @@ public:
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
private:
void IncPhase(uint32 p)
{
// Xinef: protect phase from overflowing
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
}
void DecPhase(uint32 p)
{
if (p >= mEventPhase)
mEventPhase = 0;
else
mEventPhase -= p;
}
bool IsInPhase(uint32 p) const
{
if (mEventPhase == 0)
return false;
return (1 << (mEventPhase - 1)) & p;
}
void SetPhase(uint32 p = 0) { mEventPhase = p; }
void IncPhase(uint32 p);
void DecPhase(uint32 p);
void SetPhase(uint32 p);
bool IsInPhase(uint32 p) const;
SmartAIEventList mEvents;
SmartAIEventList mInstallEvents;