Bazaar developer reference

CvGame::selectionListIgnoreBuildingDefense()

Defined in
CvGame.cpp, line 2892
Class
CvGame
Hook name
CivHooks::CvGame_selectionListIgnoreBuildingDefense

Hooks

static bool BeforeCvGame_selectionListIgnoreBuildingDefense(CvGame* self, bool& result);static void AfterCvGame_selectionListIgnoreBuildingDefense(CvGame* self, bool& result);static bool ReplaceCvGame_selectionListIgnoreBuildingDefense(bool (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_selectionListIgnoreBuildingDefense>(host, &BeforeCvGame_selectionListIgnoreBuildingDefense);CivRegisterAfter<CivHooks::CvGame_selectionListIgnoreBuildingDefense>(host, &AfterCvGame_selectionListIgnoreBuildingDefense);CivRegisterReplace<CivHooks::CvGame_selectionListIgnoreBuildingDefense>(host, &ReplaceCvGame_selectionListIgnoreBuildingDefense);

Code

2892bool CvGame::selectionListIgnoreBuildingDefense()2893{2894	bool bIgnoreBuilding = false;2895	bool bAttackLandUnit = false;2896	auto_ptr<ICvUnit1> pSelectedUnit(GC.GetEngineUserInterface()->GetHeadSelectedUnit());2897	CvUnit* pkSelectedUnit = GC.UnwrapUnitPointer(pSelectedUnit.get());28982899	if(pkSelectedUnit != NULL)2900	{2901		if(pkSelectedUnit->ignoreBuildingDefense())2902		{2903			bIgnoreBuilding = true;2904		}29052906		if((pkSelectedUnit->getDomainType() == DOMAIN_LAND) && pkSelectedUnit->IsCanAttack())2907		{2908			bAttackLandUnit = true;2909		}2910	}29112912	if(!bIgnoreBuilding && !bAttackLandUnit)2913	{2914		const UnitTypes eBestLandUnit = getBestLandUnit();2915		if(eBestLandUnit != NO_UNIT)2916		{2917			CvUnitEntry* pkUnitInfo = GC.getUnitInfo(eBestLandUnit);2918			if(pkUnitInfo)2919			{2920				bIgnoreBuilding = pkUnitInfo->IsIgnoreBuildingDefense();2921			}2922		}2923	}29242925	return bIgnoreBuilding;2926}

Calls

Called by