diff --git a/src/level/parser/parserparam.cpp b/src/level/parser/parserparam.cpp index 5c911bc6..cd3d5124 100644 --- a/src/level/parser/parserparam.cpp +++ b/src/level/parser/parserparam.cpp @@ -363,11 +363,6 @@ ObjectType CLevelParserParam::ToObjectType(std::string value) if (value == "KeyC" ) return OBJECT_KEYc; if (value == "KeyD" ) return OBJECT_KEYd; if (value == "TNT" ) return OBJECT_TNT; - if (value == "Scrap1" ) return OBJECT_SCRAP1; - if (value == "Scrap2" ) return OBJECT_SCRAP2; - if (value == "Scrap3" ) return OBJECT_SCRAP3; - if (value == "Scrap4" ) return OBJECT_SCRAP4; - if (value == "Scrap5" ) return OBJECT_SCRAP5; if (value == "Mine" ) return OBJECT_BOMB; if (value == "Firework" ) return OBJECT_WINFIRE; if (value == "Bag" ) return OBJECT_BAG; @@ -518,11 +513,6 @@ const std::string CLevelParserParam::FromObjectType(ObjectType value) if (value == OBJECT_KEYc ) return "KeyC"; if (value == OBJECT_KEYd ) return "KeyD"; if (value == OBJECT_TNT ) return "TNT"; - if (value == OBJECT_SCRAP1 ) return "Scrap1"; - if (value == OBJECT_SCRAP2 ) return "Scrap2"; - if (value == OBJECT_SCRAP3 ) return "Scrap3"; - if (value == OBJECT_SCRAP4 ) return "Scrap4"; - if (value == OBJECT_SCRAP5 ) return "Scrap5"; if (value == OBJECT_BOMB ) return "Mine"; if (value == OBJECT_WINFIRE ) return "Firework"; if (value == OBJECT_BAG ) return "Bag"; diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp index 47e09c8b..2f701171 100644 --- a/src/level/robotmain.cpp +++ b/src/level/robotmain.cpp @@ -1921,121 +1921,12 @@ CObject* CRobotMain::DetectObject(Math::Point pos) if (transporter != nullptr && !transporter->GetActive()) continue; if (obj->GetProxyActivate()) continue; - CObject* target = nullptr; - ObjectType type = obj->GetType(); - if ( type == OBJECT_PORTICO || - type == OBJECT_BASE || - type == OBJECT_DERRICK || - type == OBJECT_FACTORY || - type == OBJECT_REPAIR || - type == OBJECT_DESTROYER || - type == OBJECT_STATION || - type == OBJECT_CONVERT || - type == OBJECT_TOWER || - type == OBJECT_RESEARCH || - type == OBJECT_RADAR || - type == OBJECT_INFO || - type == OBJECT_ENERGY || - type == OBJECT_LABO || - type == OBJECT_NUCLEAR || - type == OBJECT_PARA || - type == OBJECT_SAFE || - type == OBJECT_HUSTON || - type == OBJECT_TARGET1 || - type == OBJECT_TARGET2 || - type == OBJECT_START || - type == OBJECT_END || - type == OBJECT_STONE || - type == OBJECT_URANIUM || - type == OBJECT_BULLET || - type == OBJECT_METAL || - type == OBJECT_BBOX || - type == OBJECT_KEYa || - type == OBJECT_KEYb || - type == OBJECT_KEYc || - type == OBJECT_KEYd || - type == OBJECT_TNT || - type == OBJECT_SCRAP1 || - type == OBJECT_SCRAP2 || - type == OBJECT_SCRAP3 || - type == OBJECT_SCRAP4 || - type == OBJECT_SCRAP5 || - type == OBJECT_BOMB || - type == OBJECT_BAG || - type == OBJECT_WAYPOINT || - type == OBJECT_FLAGb || - type == OBJECT_FLAGr || - type == OBJECT_FLAGg || - type == OBJECT_FLAGy || - type == OBJECT_FLAGv || - type == OBJECT_MARKPOWER || - type == OBJECT_MARKSTONE || - type == OBJECT_MARKURANIUM || - type == OBJECT_MARKKEYa || - type == OBJECT_MARKKEYb || - type == OBJECT_MARKKEYc || - type == OBJECT_MARKKEYd || - type == OBJECT_HUMAN || - type == OBJECT_TECH || - type == OBJECT_TOTO || - type == OBJECT_MOBILEfa || - type == OBJECT_MOBILEta || - type == OBJECT_MOBILEwa || - type == OBJECT_MOBILEia || - type == OBJECT_MOBILEfc || - type == OBJECT_MOBILEtc || - type == OBJECT_MOBILEwc || - type == OBJECT_MOBILEic || - type == OBJECT_MOBILEfi || - type == OBJECT_MOBILEti || - type == OBJECT_MOBILEwi || - type == OBJECT_MOBILEii || - type == OBJECT_MOBILEfs || - type == OBJECT_MOBILEts || - type == OBJECT_MOBILEws || - type == OBJECT_MOBILEis || - type == OBJECT_MOBILErt || - type == OBJECT_MOBILErc || - type == OBJECT_MOBILErr || - type == OBJECT_MOBILErs || - type == OBJECT_MOBILEsa || - type == OBJECT_MOBILEtg || - type == OBJECT_MOBILEft || - type == OBJECT_MOBILEtt || - type == OBJECT_MOBILEwt || - type == OBJECT_MOBILEit || - type == OBJECT_MOBILEdr || - type == OBJECT_MOTHER || - type == OBJECT_ANT || - type == OBJECT_SPIDER || - type == OBJECT_BEE || - type == OBJECT_WORM || - type == OBJECT_EGG || - type == OBJECT_RUINmobilew1 || - type == OBJECT_RUINmobilew2 || - type == OBJECT_RUINmobilet1 || - type == OBJECT_RUINmobilet2 || - type == OBJECT_RUINmobiler1 || - type == OBJECT_RUINmobiler2 || - type == OBJECT_RUINfactory || - type == OBJECT_RUINdoor || - type == OBJECT_RUINsupport || - type == OBJECT_RUINradar || - type == OBJECT_RUINconvert || - type == OBJECT_RUINbase || - type == OBJECT_RUINhead || - type == OBJECT_APOLLO1 || - type == OBJECT_APOLLO2 || - type == OBJECT_APOLLO3 || - type == OBJECT_APOLLO4 || - type == OBJECT_APOLLO5 ) - { - target = obj; - } - else if (type == OBJECT_POWER || type == OBJECT_ATOMIC) + CObject* target = obj; + if (obj->GetType() == OBJECT_POWER || obj->GetType() == OBJECT_ATOMIC) { + assert(obj->Implements(ObjectInterfaceType::Transportable)); target = dynamic_cast(obj)->GetTransporter(); // battery connected - if (!target) target = obj; // standalone battery + if (target == nullptr) target = obj; // standalone battery } for (int j = 0; j < OBJECTMAXPART; j++) @@ -2052,74 +1943,24 @@ CObject* CRobotMain::DetectObject(Math::Point pos) //! Indicates whether an object is selectable bool CRobotMain::IsSelectable(CObject* obj) { + if (obj->GetType() == OBJECT_TOTO) return true; if (!obj->Implements(ObjectInterfaceType::Controllable)) return false; - if (!dynamic_cast(obj)->GetSelectable()) return false; - ObjectType type = obj->GetType(); - if ( type == OBJECT_HUMAN || - type == OBJECT_TOTO || - type == OBJECT_MOBILEfa || - type == OBJECT_MOBILEta || - type == OBJECT_MOBILEwa || - type == OBJECT_MOBILEia || - type == OBJECT_MOBILEfc || - type == OBJECT_MOBILEtc || - type == OBJECT_MOBILEwc || - type == OBJECT_MOBILEic || - type == OBJECT_MOBILEfi || - type == OBJECT_MOBILEti || - type == OBJECT_MOBILEwi || - type == OBJECT_MOBILEii || - type == OBJECT_MOBILEfs || - type == OBJECT_MOBILEts || - type == OBJECT_MOBILEws || - type == OBJECT_MOBILEis || - type == OBJECT_MOBILErt || - type == OBJECT_MOBILErc || - type == OBJECT_MOBILErr || - type == OBJECT_MOBILErs || - type == OBJECT_MOBILEsa || - type == OBJECT_MOBILEft || - type == OBJECT_MOBILEtt || - type == OBJECT_MOBILEwt || - type == OBJECT_MOBILEit || - type == OBJECT_MOBILEdr || - type == OBJECT_APOLLO2 || - type == OBJECT_BASE || - type == OBJECT_DERRICK || - type == OBJECT_FACTORY || - type == OBJECT_REPAIR || - type == OBJECT_DESTROYER|| - type == OBJECT_STATION || - type == OBJECT_CONVERT || - type == OBJECT_TOWER || - type == OBJECT_RESEARCH || - type == OBJECT_RADAR || - type == OBJECT_INFO || - type == OBJECT_ENERGY || - type == OBJECT_LABO || - type == OBJECT_NUCLEAR || - type == OBJECT_PARA || - type == OBJECT_SAFE || - type == OBJECT_HUSTON ) + if (!m_selectInsect) { - return true; - } - - if (m_selectInsect) - { - if ( type == OBJECT_MOTHER || - type == OBJECT_ANT || - type == OBJECT_SPIDER || - type == OBJECT_BEE || - type == OBJECT_WORM || - type == OBJECT_MOBILEtg ) + // TODO: Some function in CControllableObject + if ( obj->GetType() == OBJECT_MOTHER || + obj->GetType() == OBJECT_ANT || + obj->GetType() == OBJECT_SPIDER || + obj->GetType() == OBJECT_BEE || + obj->GetType() == OBJECT_WORM || + obj->GetType() == OBJECT_MOBILEtg ) { - return true; + return false; } } - return false; + return dynamic_cast(obj)->GetSelectable(); } diff --git a/src/level/scene_conditions.cpp b/src/level/scene_conditions.cpp index 6353046d..e774a1f1 100644 --- a/src/level/scene_conditions.cpp +++ b/src/level/scene_conditions.cpp @@ -66,15 +66,7 @@ int CSceneCondition::CountObjects() if (IsObjectBeingTransported(obj)) continue; } - // TODO: I really hate those fragments that hardcode subcategories into one in random places in code, we should refactor that at some point ObjectType type = obj->GetType(); - if (type == OBJECT_SCRAP2 || - type == OBJECT_SCRAP3 || - type == OBJECT_SCRAP4 || - type == OBJECT_SCRAP5) // wastes? - { - type = OBJECT_SCRAP1; - } ToolType tool = GetToolFromObject(type); DriveType drive = GetDriveFromObject(type); diff --git a/src/object/auto/autopowerplant.cpp b/src/object/auto/autopowerplant.cpp index 9091a159..d1e8b567 100644 --- a/src/object/auto/autopowerplant.cpp +++ b/src/object/auto/autopowerplant.cpp @@ -389,10 +389,7 @@ CObject* CAutoPowerPlant::SearchMetal() if ( obj == nullptr ) return nullptr; ObjectType type = obj->GetType(); - if ( type == OBJECT_METAL || - type == OBJECT_SCRAP1 || - type == OBJECT_SCRAP2 || - type == OBJECT_SCRAP3 ) return obj; + if ( type == OBJECT_METAL ) return obj; return nullptr; } @@ -511,10 +508,7 @@ Error CAutoPowerPlant::GetError() if (obj == nullptr) return ERR_ENERGY_EMPTY; ObjectType type = obj->GetType(); if ( type == OBJECT_POWER ) return ERR_OK; - if ( type != OBJECT_METAL && - type != OBJECT_SCRAP1 && - type != OBJECT_SCRAP2 && - type != OBJECT_SCRAP3 ) return ERR_ENERGY_BAD; + if ( type != OBJECT_METAL ) return ERR_ENERGY_BAD; return ERR_OK; } diff --git a/src/object/object_factory.cpp b/src/object/object_factory.cpp index ff349cfa..59f2520b 100644 --- a/src/object/object_factory.cpp +++ b/src/object/object_factory.cpp @@ -147,11 +147,6 @@ CObjectUPtr CObjectFactory::CreateObject(const ObjectCreateParams& params) case OBJECT_KEYc: case OBJECT_KEYd: case OBJECT_TNT: - case OBJECT_SCRAP1: - case OBJECT_SCRAP2: - case OBJECT_SCRAP3: - case OBJECT_SCRAP4: - case OBJECT_SCRAP5: case OBJECT_BOMB: case OBJECT_WAYPOINT: case OBJECT_SHOW: @@ -1088,11 +1083,6 @@ CObjectUPtr CObjectFactory::CreateResource(const ObjectCreateParams& params) if ( type == OBJECT_KEYc ) name = "keyc.mod"; if ( type == OBJECT_KEYd ) name = "keyd.mod"; if ( type == OBJECT_TNT ) name = "tnt.mod"; - if ( type == OBJECT_SCRAP1 ) name = "scrap1.mod"; - if ( type == OBJECT_SCRAP2 ) name = "scrap2.mod"; - if ( type == OBJECT_SCRAP3 ) name = "scrap3.mod"; - if ( type == OBJECT_SCRAP4 ) name = "scrap4.mod"; - if ( type == OBJECT_SCRAP5 ) name = "scrap5.mod"; if ( type == OBJECT_BOMB ) name = "bomb.mod"; if ( type == OBJECT_WAYPOINT ) name = "waypoint.mod"; if ( type == OBJECT_SHOW ) name = "show.mod"; diff --git a/src/object/object_manager.cpp b/src/object/object_manager.cpp index 23e13bf5..5e2bf962 100644 --- a/src/object/object_manager.cpp +++ b/src/object/object_manager.cpp @@ -305,14 +305,6 @@ CObject* CObjectManager::Radar(CObject* pThis, Math::Vector thisPosition, float oType = OBJECT_RUINmobilew1; // any ruin } - if ( oType == OBJECT_SCRAP2 || - oType == OBJECT_SCRAP3 || - oType == OBJECT_SCRAP4 || - oType == OBJECT_SCRAP5 ) // wastes? - { - oType = OBJECT_SCRAP1; // any waste - } - if ( oType == OBJECT_BARRIER2 || oType == OBJECT_BARRIER3 ) // barriers? { diff --git a/src/object/old_object.cpp b/src/object/old_object.cpp index b5aac319..2ae8697d 100644 --- a/src/object/old_object.cpp +++ b/src/object/old_object.cpp @@ -556,12 +556,7 @@ void COldObject::DestroyObject(DestructionType type) m_type == OBJECT_ATOMIC || m_type == OBJECT_BULLET || m_type == OBJECT_BBOX || - m_type == OBJECT_TNT || - m_type == OBJECT_SCRAP1 || - m_type == OBJECT_SCRAP2 || - m_type == OBJECT_SCRAP3 || - m_type == OBJECT_SCRAP4 || - m_type == OBJECT_SCRAP5 ) // (*) + m_type == OBJECT_TNT ) // (*) { CScriptFunctions::DestroyObjectVar(m_botVar, false); } @@ -696,22 +691,43 @@ void COldObject::SetType(ObjectType type) } // TODO: Another temporary hack - if ( m_type == OBJECT_MOTHER || - m_type == OBJECT_ANT || - m_type == OBJECT_SPIDER || - m_type == OBJECT_BEE || - m_type == OBJECT_WORM || - m_type == OBJECT_APOLLO2 || - m_type == OBJECT_MOBILEdr || - m_type == OBJECT_CONTROLLER || - m_type == OBJECT_HUMAN || - m_type == OBJECT_TECH ) + if (m_type == OBJECT_MOBILEfa || + m_type == OBJECT_MOBILEta || + m_type == OBJECT_MOBILEwa || + m_type == OBJECT_MOBILEia || + m_type == OBJECT_MOBILEfc || + m_type == OBJECT_MOBILEtc || + m_type == OBJECT_MOBILEwc || + m_type == OBJECT_MOBILEic || + m_type == OBJECT_MOBILEfi || + m_type == OBJECT_MOBILEti || + m_type == OBJECT_MOBILEwi || + m_type == OBJECT_MOBILEii || + m_type == OBJECT_MOBILEfs || + m_type == OBJECT_MOBILEts || + m_type == OBJECT_MOBILEws || + m_type == OBJECT_MOBILEis || + m_type == OBJECT_MOBILErt || + m_type == OBJECT_MOBILErc || + m_type == OBJECT_MOBILErr || + m_type == OBJECT_MOBILErs || + m_type == OBJECT_MOBILEsa || + m_type == OBJECT_MOBILEtg || + m_type == OBJECT_MOBILEft || + m_type == OBJECT_MOBILEtt || + m_type == OBJECT_MOBILEwt || + m_type == OBJECT_MOBILEit || + m_type == OBJECT_TOWER || + m_type == OBJECT_RESEARCH || + m_type == OBJECT_ENERGY || + m_type == OBJECT_LABO || + m_type == OBJECT_NUCLEAR ) { - m_implementedInterfaces[static_cast(ObjectInterfaceType::Powered)] = false; + m_implementedInterfaces[static_cast(ObjectInterfaceType::Powered)] = true; } else { - m_implementedInterfaces[static_cast(ObjectInterfaceType::Powered)] = true; + m_implementedInterfaces[static_cast(ObjectInterfaceType::Powered)] = false; } // TODO: Hacking some more @@ -720,11 +736,6 @@ void COldObject::SetType(ObjectType type) m_type == OBJECT_POWER || m_type == OBJECT_ATOMIC || m_type == OBJECT_TNT || - m_type == OBJECT_SCRAP1 || - m_type == OBJECT_SCRAP2 || - m_type == OBJECT_SCRAP3 || - m_type == OBJECT_SCRAP4 || - m_type == OBJECT_SCRAP5 || m_type == OBJECT_BULLET || m_type == OBJECT_EGG || m_type == OBJECT_BOMB || @@ -803,6 +814,83 @@ void COldObject::SetType(ObjectType type) // TODO: #TooMuchHacking m_implementedInterfaces[static_cast(ObjectInterfaceType::ShieldedAutoRegen)] = (m_type == OBJECT_HUMAN); + // TODO: Hacking in progress... + if ( m_type == OBJECT_FRET || + m_type == OBJECT_STONE || + m_type == OBJECT_URANIUM || + m_type == OBJECT_BULLET || + m_type == OBJECT_METAL || + m_type == OBJECT_POWER || + m_type == OBJECT_ATOMIC || + m_type == OBJECT_BBOX || + m_type == OBJECT_KEYa || + m_type == OBJECT_KEYb || + m_type == OBJECT_KEYc || + m_type == OBJECT_KEYd || + m_type == OBJECT_TNT ) + { + m_implementedInterfaces[static_cast(ObjectInterfaceType::Transportable)] = true; + } + else + { + m_implementedInterfaces[static_cast(ObjectInterfaceType::Transportable)] = false; + } + + // TODO: You have been hacked! + if (m_type == OBJECT_HUMAN || + m_type == OBJECT_TOTO || + m_type == OBJECT_MOBILEfa || + m_type == OBJECT_MOBILEta || + m_type == OBJECT_MOBILEwa || + m_type == OBJECT_MOBILEia || + m_type == OBJECT_MOBILEfc || + m_type == OBJECT_MOBILEtc || + m_type == OBJECT_MOBILEwc || + m_type == OBJECT_MOBILEic || + m_type == OBJECT_MOBILEfi || + m_type == OBJECT_MOBILEti || + m_type == OBJECT_MOBILEwi || + m_type == OBJECT_MOBILEii || + m_type == OBJECT_MOBILEfs || + m_type == OBJECT_MOBILEts || + m_type == OBJECT_MOBILEws || + m_type == OBJECT_MOBILEis || + m_type == OBJECT_MOBILErt || + m_type == OBJECT_MOBILErc || + m_type == OBJECT_MOBILErr || + m_type == OBJECT_MOBILErs || + m_type == OBJECT_MOBILEsa || + m_type == OBJECT_MOBILEft || + m_type == OBJECT_MOBILEtt || + m_type == OBJECT_MOBILEwt || + m_type == OBJECT_MOBILEit || + m_type == OBJECT_MOBILEdr || + m_type == OBJECT_APOLLO2 || + m_type == OBJECT_BASE || + m_type == OBJECT_DERRICK || + m_type == OBJECT_FACTORY || + m_type == OBJECT_REPAIR || + m_type == OBJECT_DESTROYER|| + m_type == OBJECT_STATION || + m_type == OBJECT_CONVERT || + m_type == OBJECT_TOWER || + m_type == OBJECT_RESEARCH || + m_type == OBJECT_RADAR || + m_type == OBJECT_INFO || + m_type == OBJECT_ENERGY || + m_type == OBJECT_LABO || + m_type == OBJECT_NUCLEAR || + m_type == OBJECT_PARA || + m_type == OBJECT_SAFE || + m_type == OBJECT_HUSTON ) + { + m_implementedInterfaces[static_cast(ObjectInterfaceType::Controllable)] = true; + } + else + { + m_implementedInterfaces[static_cast(ObjectInterfaceType::Controllable)] = false; + } + if ( m_type == OBJECT_MOBILEwc || m_type == OBJECT_MOBILEtc || @@ -2312,11 +2400,6 @@ float COldObject::GetShield() m_type == OBJECT_KEYc || m_type == OBJECT_KEYd || m_type == OBJECT_TNT || - m_type == OBJECT_SCRAP1 || - m_type == OBJECT_SCRAP2 || - m_type == OBJECT_SCRAP3 || - m_type == OBJECT_SCRAP4 || - m_type == OBJECT_SCRAP5 || m_type == OBJECT_BOMB || m_type == OBJECT_WAYPOINT || m_type == OBJECT_FLAGb || diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp index cc35833c..3e8514e2 100644 --- a/src/object/task/taskmanip.cpp +++ b/src/object/task/taskmanip.cpp @@ -725,7 +725,6 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit) { CObject *pBest; Math::Vector iPos, oPos; - ObjectType type; float min, distance; iPos = m_object->GetPosition(); @@ -734,21 +733,7 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit) pBest = 0; for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) { - type = pObj->GetType(); - - if ( type != OBJECT_FRET && - type != OBJECT_STONE && - type != OBJECT_URANIUM && - type != OBJECT_BULLET && - type != OBJECT_METAL && - type != OBJECT_POWER && - type != OBJECT_ATOMIC && - type != OBJECT_BBOX && - type != OBJECT_KEYa && - type != OBJECT_KEYb && - type != OBJECT_KEYc && - type != OBJECT_KEYd && - type != OBJECT_TNT ) continue; + if ( !pObj->Implements(ObjectInterfaceType::Transportable) ) continue; if (IsObjectBeingTransported(pObj)) continue; if ( pObj->GetLock() ) continue; @@ -777,7 +762,6 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, { CObject *pBest; Math::Vector iPos, oPos; - ObjectType type; float min, iAngle, bAngle, aLimit, dLimit, f; iPos = m_object->GetPosition(); @@ -801,26 +785,7 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, bAngle = 0.0f; for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) { - type = pObj->GetType(); - - if ( type != OBJECT_FRET && - type != OBJECT_STONE && - type != OBJECT_URANIUM && - type != OBJECT_BULLET && - type != OBJECT_METAL && - type != OBJECT_POWER && - type != OBJECT_ATOMIC && - type != OBJECT_BBOX && - type != OBJECT_KEYa && - type != OBJECT_KEYb && - type != OBJECT_KEYc && - type != OBJECT_KEYd && - type != OBJECT_TNT && - type != OBJECT_SCRAP1 && - type != OBJECT_SCRAP2 && - type != OBJECT_SCRAP3 && - type != OBJECT_SCRAP4 && - type != OBJECT_SCRAP5 ) continue; + if ( !pObj->Implements(ObjectInterfaceType::Transportable) ) continue; if (IsObjectBeingTransported(pObj)) continue; if ( pObj->GetLock() ) continue; @@ -865,7 +830,6 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos, { CObject *pBest; Math::Vector iPos, oPos; - ObjectType type; float min, iAngle, bAngle, aLimit, dLimit, f; iPos = m_object->GetPosition(); @@ -888,26 +852,7 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos, bAngle = 0.0f; for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) { - type = pObj->GetType(); - - if ( type != OBJECT_FRET && - type != OBJECT_STONE && - type != OBJECT_URANIUM && - type != OBJECT_BULLET && - type != OBJECT_METAL && - type != OBJECT_POWER && - type != OBJECT_ATOMIC && - type != OBJECT_BBOX && - type != OBJECT_KEYa && - type != OBJECT_KEYb && - type != OBJECT_KEYc && - type != OBJECT_KEYd && - type != OBJECT_TNT && - type != OBJECT_SCRAP1 && - type != OBJECT_SCRAP2 && - type != OBJECT_SCRAP3 && - type != OBJECT_SCRAP4 && - type != OBJECT_SCRAP5 ) continue; + if ( !pObj->Implements(ObjectInterfaceType::Transportable) ) continue; if (IsObjectBeingTransported(pObj)) continue; if ( pObj->GetLock() ) continue; @@ -983,39 +928,8 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos, if ( pObj == m_object ) continue; // yourself? ObjectType type = pObj->GetType(); - if ( type != OBJECT_MOBILEfa && - type != OBJECT_MOBILEta && - type != OBJECT_MOBILEwa && - type != OBJECT_MOBILEia && - type != OBJECT_MOBILEfc && - type != OBJECT_MOBILEtc && - type != OBJECT_MOBILEwc && - type != OBJECT_MOBILEic && - type != OBJECT_MOBILEfi && - type != OBJECT_MOBILEti && - type != OBJECT_MOBILEwi && - type != OBJECT_MOBILEii && - type != OBJECT_MOBILEfs && - type != OBJECT_MOBILEts && - type != OBJECT_MOBILEws && - type != OBJECT_MOBILEis && - type != OBJECT_MOBILErt && - type != OBJECT_MOBILErc && - type != OBJECT_MOBILErr && - type != OBJECT_MOBILErs && - type != OBJECT_MOBILEsa && - type != OBJECT_MOBILEtg && - type != OBJECT_MOBILEft && - type != OBJECT_MOBILEtt && - type != OBJECT_MOBILEwt && - type != OBJECT_MOBILEit && - type != OBJECT_TOWER && - type != OBJECT_RESEARCH && - type != OBJECT_ENERGY && - type != OBJECT_LABO && - type != OBJECT_NUCLEAR ) continue; + if ( !pObj->Implements(ObjectInterfaceType::Powered) ) continue; - assert(pObj->Implements(ObjectInterfaceType::Powered)); CObject* power = dynamic_cast(pObj)->GetPower(); if (power != nullptr) { diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp index 0025b17a..2cf90df6 100644 --- a/src/script/cbottoken.cpp +++ b/src/script/cbottoken.cpp @@ -66,7 +66,6 @@ const char* GetObjectName(ObjectType type) if ( type == OBJECT_KEYc ) return "KeyC"; if ( type == OBJECT_KEYd ) return "KeyD"; if ( type == OBJECT_TNT ) return "TNT"; - if ( type == OBJECT_SCRAP1 ) return "Scrap"; if ( type == OBJECT_BOMB ) return "Mine"; if ( type == OBJECT_BARRIER1 ) return "Barrier"; if ( type == OBJECT_WAYPOINT ) return "WayPoint"; @@ -169,7 +168,6 @@ std::string GetHelpFilename(ObjectType type) if ( type == OBJECT_KEYc ) helpfile = "object/key"; if ( type == OBJECT_KEYd ) helpfile = "object/key"; if ( type == OBJECT_TNT ) helpfile = "object/tnt"; - if ( type == OBJECT_SCRAP1 ) helpfile = "object/scrap"; if ( type == OBJECT_BOMB ) helpfile = "object/mine"; if ( type == OBJECT_BARRIER1 ) helpfile = "object/barrier"; if ( type == OBJECT_WAYPOINT ) helpfile = "object/waypoint";