1
0
forked from 0ad/0ad

- Fixed a compile error on VS2003.

- Fixed some crashes that could occur when you end a game with units
mouseover'ed or with the building placer active (it tries to render them
after the game world is gone).

This was SVN commit r4543.
This commit is contained in:
Matei 2006-10-11 13:37:13 +00:00
parent 0daed1ed30
commit d36bc3a949
4 changed files with 10 additions and 3 deletions

View File

@ -94,6 +94,9 @@ CGameView::CGameView(CGame *pGame):
CGameView::~CGameView()
{
g_Selection.clearSelection();
g_Mouseover.clear();
g_BuildingPlacer.deactivate();
UnloadResources();
}

View File

@ -149,6 +149,8 @@ struct CMouseoverEntities : public Singleton<CMouseoverEntities>
bool isBandbox() { return( m_bandbox ); }
void startBandbox( u16 x, u16 y );
void stopBandbox();
void clear() { m_mouseover.clear(); }
};
struct CBuildingPlacer : public Singleton<CBuildingPlacer>

View File

@ -64,6 +64,8 @@ public:
operator bool() const;
bool operator!() const;
operator CEntity*() const;
// Visual C++ 2003 can't handle (bool && HEntity) expressions, so provide another alias for operator bool()
bool isValid() const {return this->operator bool();}
~HEntity();
uint GetSerializedLength() const;

View File

@ -367,7 +367,7 @@ bool CEntity::processContactAction( CEntityOrder* current, size_t UNUSED(timeste
if( !target || !target->m_extant )
{
popOrder();
if( m_orderQueue.empty() && target )
if( m_orderQueue.empty() && target.isValid() )
{
CEventTargetExhausted evt( target, action->m_Id );
DispatchEvent( &evt );
@ -447,7 +447,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
m_actor->SetEntitySelection( "idle" );
m_actor->SetRandomAnimation( "idle" );
popOrder();
if( m_orderQueue.empty() && target )
if( m_orderQueue.empty() && target.isValid() )
{
CEventTargetExhausted evt( target, action->m_Id );
DispatchEvent( &evt );
@ -473,7 +473,7 @@ bool CEntity::processContactActionNoPathing( CEntityOrder* current, size_t times
|| g_Game->GetWorld()->GetLOSManager()->GetUnitStatus( target, m_player ) == UNIT_HIDDEN )
{
popOrder();
if( m_orderQueue.empty() && target )
if( m_orderQueue.empty() && target.isValid() )
{
CEventTargetExhausted evt( target, action->m_Id );
DispatchEvent( &evt );