diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 0c59b1e213..e1e443abf9 100644 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -271,7 +271,7 @@ public: // Removes entity from the gameworld and deallocates it, but not necessarily immediately. // The keepActor parameter specifies whether to remove the unit's actor immediately (for - // units we want removed immediately, e.g. in Atkas) or to keep it and play the death + // units we want removed immediately, e.g. in Alkas) or to keep it and play the death // animation (for units that die of "natural causes"). void Kill(bool keepActor = false); diff --git a/source/simulation/EntityScriptInterface.cpp b/source/simulation/EntityScriptInterface.cpp index 9a4afdbb02..f798d71025 100644 --- a/source/simulation/EntityScriptInterface.cpp +++ b/source/simulation/EntityScriptInterface.cpp @@ -95,7 +95,7 @@ void CEntity::ScriptingInit() AddClassProperty( L"actions.move.speed", &CEntity::m_speed ); AddClassProperty( L"actions.move.run.speed", &CEntity::m_runSpeed ); - AddClassProperty( L"actions.move.run.rangemin", &CEntity::m_runMinRange ); + AddClassProperty( L"actions.move.run.rangeMin", &CEntity::m_runMinRange ); AddClassProperty( L"actions.move.run.range", &CEntity::m_runMaxRange ); AddClassProperty( L"actions.move.run.regenRate", &CEntity::m_runRegenRate ); AddClassProperty( L"actions.move.run.decayRate", &CEntity::m_runDecayRate ); diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index 5e71d4f169..4ae496c197 100644 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -335,7 +335,6 @@ bool CEntity::ProcessGotoNoPathing( CEntityOrder* current, size_t timestep_milli avoidance.m_target_location = avoidancePosition; if( current->m_type == CEntityOrder::ORDER_GOTO_COLLISION ) - m_orderQueue.pop_front(); m_orderQueue.push_front( avoidance ); return( false ); @@ -602,15 +601,14 @@ bool CEntity::ProcessGenericNoPathing( CEntityOrder* current, size_t timestep_mi bool CEntity::ProcessGoto( CEntityOrder* current, size_t UNUSED(timestep_millis) ) { - // float timestep=timestep_millis/1000.0f; - // janwas: currently unused - - CVector2D pos( m_position.X, m_position.Z ); CVector2D path_to = current->m_target_location; - m_orderQueue.pop_front(); float Distance = ( path_to - pos ).Length(); + CEntityOrder::EOrderSource source = current->m_source; + m_orderQueue.pop_front(); + // pop_front may delete 'current', so we mustn't use it after this point + // Let's just check we're going somewhere... if( Distance < 0.1f ) { @@ -623,7 +621,7 @@ bool CEntity::ProcessGoto( CEntityOrder* current, size_t UNUSED(timestep_millis) // The pathfinder will push its result back into this unit's queue. - g_Pathfinder.RequestPath( me, path_to, current->m_source ); + g_Pathfinder.RequestPath( me, path_to, source ); return( true ); } @@ -632,9 +630,13 @@ bool CEntity::ProcessGotoWaypoint( CEntityOrder* current, size_t UNUSED(timestep { CVector2D pos( m_position.X, m_position.Z ); CVector2D path_to = current->m_target_location; - m_orderQueue.pop_front(); float Distance = ( path_to - pos ).Length(); + CEntityOrder::EOrderSource source = current->m_source; + float pathfinder_radius = current->m_pathfinder_radius; + m_orderQueue.pop_front(); + // pop_front may delete 'current', so we mustn't use it after this point + // Let's just check we're going somewhere... if( Distance < 0.1f ) { @@ -645,16 +647,13 @@ bool CEntity::ProcessGotoWaypoint( CEntityOrder* current, size_t UNUSED(timestep ChooseMovementSpeed( Distance ); - g_Pathfinder.RequestLowLevelPath( me, path_to, contact, current->m_pathfinder_radius, current->m_source ); + g_Pathfinder.RequestLowLevelPath( me, path_to, contact, pathfinder_radius, source ); return( true ); } bool CEntity::ProcessPatrol( CEntityOrder* current, size_t UNUSED(timestep_millis) ) { - // float timestep=timestep_millis/1000.0f; - // janwas: currently unused - CEntityOrder this_segment; CEntityOrder repeat_patrol;