diff --git a/source/simulation/AStarEngine.cpp b/source/simulation/AStarEngine.cpp index 1e9aaf4240..e3ebf6c0c8 100644 --- a/source/simulation/AStarEngine.cpp +++ b/source/simulation/AStarEngine.cpp @@ -71,6 +71,16 @@ bool CAStarEngine::findPath( mGoal->setDestination(dest); mGoal->setRadius(radius); + if( !mGoal->isPassable(src, player) ) + { + return false; + } + + if( radius==0 && !mGoal->isPassable(dest, player) ) + { + return false; + } + AStarNode *start = getFreeASNode(); start->coord = mGoal->getTile(src); start->parent = NULL; @@ -145,7 +155,7 @@ bool CAStarEngine::findPath( if (mSolved && best!=NULL) { - debug_printf("Number of nodes searched: %d\n", iterations); + //debug_printf("Number of nodes searched: %d\n", iterations); constructPath(best); } diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index e9aeaea938..cec73988b7 100644 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -433,7 +433,6 @@ void CEntity::update( size_t timestep ) } break; case CEntityOrder::ORDER_PRODUCE: - debug_printf("calling processProduce once\n"); processProduce( current ); m_orderQueue.pop_front(); break; diff --git a/source/simulation/EntityScriptInterface.cpp b/source/simulation/EntityScriptInterface.cpp index 4bb52edb11..c21597125c 100644 --- a/source/simulation/EntityScriptInterface.cpp +++ b/source/simulation/EntityScriptInterface.cpp @@ -385,12 +385,17 @@ bool CEntity::Kill( JSContext* UNUSED(cx), uintN UNUSED(argc), jsval* UNUSED(arg g_EntityManager.SetDeath(true); - - if( m_actor ) + if( m_actor && m_actor->GetRandomAnimation( "death" ) != m_actor->GetRandomAnimation( "idle" ) ) { m_actor->SetEntitySelection( "death" ); m_actor->SetRandomAnimation( "death", true ); } + else + { + g_UnitMan.RemoveUnit( m_actor ); + delete( m_actor ); + m_actor = NULL; + } return( true ); } diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index 0f8a216600..fa169b1e65 100644 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -489,12 +489,11 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times // The pathfinder will push its result in front of the current order if( !g_Pathfinder.requestAvoidPath( me, current, action->m_MinRange + 2.0f ) ) { - popOrder(); // Nothing we can do.. maybe we'll find a better target - m_actor->SetRandomAnimation( "idle" ); - return false; + m_actor->SetRandomAnimation( "idle" ); // Nothing we can do.. maybe we'll find a better target + popOrder(); } - return true; + return false; } }