Fixed #581 for aliens

master
krzys-h 2015-08-25 17:25:53 +02:00
parent 43901aa62a
commit 934d97a801
3 changed files with 5 additions and 4 deletions

View File

@ -1921,6 +1921,7 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
} }
//! Indicates whether an object is selectable //! Indicates whether an object is selectable
// TODO: Refactor this, calling CControllableObject::GetSelectable should always be enough
bool CRobotMain::IsSelectable(CObject* obj) bool CRobotMain::IsSelectable(CObject* obj)
{ {
if (obj->GetType() == OBJECT_TOTO) return true; if (obj->GetType() == OBJECT_TOTO) return true;

View File

@ -373,6 +373,8 @@ public:
void StartDetectEffect(COldObject* object, CObject* target); void StartDetectEffect(COldObject* object, CObject* target);
bool IsSelectable(CObject* pObj);
protected: protected:
bool EventFrame(const Event &event); bool EventFrame(const Event &event);
bool EventObject(const Event &event); bool EventObject(const Event &event);
@ -397,7 +399,6 @@ protected:
void RemoteCamera(float pan, float zoom, float rTime); void RemoteCamera(float pan, float zoom, float rTime);
void KeyCamera(EventType event, InputSlot key); void KeyCamera(EventType event, InputSlot key);
void AbortMovie(); void AbortMovie();
bool IsSelectable(CObject* pObj);
void SelectOneObject(CObject* pObj, bool displayError=true); void SelectOneObject(CObject* pObj, bool displayError=true);
void HelpObject(); void HelpObject();
bool DeselectObject(); bool DeselectObject();

View File

@ -147,9 +147,8 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
if ( !target->GetDetectable() ) continue; if ( !target->GetDetectable() ) continue;
if ( target->GetProxyActivate() ) continue; if ( target->GetProxyActivate() ) continue;
if ( !target->Implements(ObjectInterfaceType::Controllable) ) continue; if ( target->Implements(ObjectInterfaceType::Controllable) && dynamic_cast<CControllableObject*>(target)->GetSelect() ) continue;
if ( dynamic_cast<CControllableObject*>(target)->GetSelect() ) continue; if ( !m_main->IsSelectable(target) ) continue;
if ( !dynamic_cast<CControllableObject*>(target)->GetSelectable() ) continue;
if (!target->Implements(ObjectInterfaceType::Old)) continue; // TODO: To be removed after COldObjectInterface is gone if (!target->Implements(ObjectInterfaceType::Old)) continue; // TODO: To be removed after COldObjectInterface is gone