From 32b551f4e042fc95cfd77fe17acc978ccb205d36 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sat, 14 Mar 2009 23:28:38 +0300 Subject: [PATCH] [7459] Support case when movegen at own Finilize add another movegen. --- src/game/MotionMaster.cpp | 46 +++++++++++++++++++++++++--------------------- src/shared/revision_nr.h | 2 +- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp index b2f99f96..ce20d5cd 100644 --- a/src/game/MotionMaster.cpp +++ b/src/game/MotionMaster.cpp @@ -43,8 +43,8 @@ MotionMaster::Initialize() while(!empty()) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); + curr->Finalize(*i_owner); if( !isStatic( curr ) ) delete curr; } @@ -66,8 +66,8 @@ MotionMaster::~MotionMaster() while(!empty()) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); + curr->Finalize(*i_owner); if( !isStatic( curr ) ) delete curr; } @@ -117,8 +117,8 @@ MotionMaster::DirectClean(bool reset) while( !empty() && size() > 1 ) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); + curr->Finalize(*i_owner); if( !isStatic( curr ) ) delete curr; } @@ -142,8 +142,8 @@ MotionMaster::DelayedClean() while( !empty() && size() > 1 ) { MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); + curr->Finalize(*i_owner); if( !isStatic( curr ) ) m_expList->push_back(curr); } @@ -156,23 +156,26 @@ MotionMaster::DirectExpire(bool reset) return; MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); - if( !isStatic(curr) ) - delete curr; - - assert( !empty() ); + // also drop stored under top() targeted motions while( !empty() && top()->GetMovementGeneratorType() == TARGETED_MOTION_TYPE ) { - // Should check if target is still valid? If not valid it will crash. - curr = top(); - curr->Finalize(*i_owner); + MovementGenerator *temp = top(); pop(); - delete curr; + temp ->Finalize(*i_owner); + delete temp; } + + // it can add another motions instead + curr->Finalize(*i_owner); + + if( !isStatic(curr) ) + delete curr; + if( empty() ) Initialize(); + if (reset) top()->Reset(*i_owner); } @@ -183,23 +186,24 @@ MotionMaster::DelayedExpire() return; MovementGenerator *curr = top(); - curr->Finalize(*i_owner); pop(); if(!m_expList) m_expList = new ExpireList(); - if( !isStatic(curr) ) - m_expList->push_back(curr); - + // also drop stored under top() targeted motions while( !empty() && top()->GetMovementGeneratorType() == TARGETED_MOTION_TYPE ) { - // Should check if target is still valid? If not valid it will crash. - curr = top(); - curr->Finalize(*i_owner); + MovementGenerator *temp = top(); pop(); - m_expList->push_back(curr); + temp ->Finalize(*i_owner); + m_expList->push_back(temp ); } + + curr->Finalize(*i_owner); + + if( !isStatic(curr) ) + m_expList->push_back(curr); } void MotionMaster::MoveIdle() diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e13fce7d..de966162 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7458" + #define REVISION_NR "7459" #endif // __REVISION_NR_H__ -- 2.11.4.GIT