CvUnit::AreUnitsOfSameType(const CvUnit &, const bool) const
- Defined in
- CvUnit.cpp, line 21187
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_AreUnitsOfSameType
Hooks
static bool BeforeCvUnit_AreUnitsOfSameType(const CvUnit* self, const CvUnit& pUnit2, const bool bPretendEmbarked, bool& result);static void AfterCvUnit_AreUnitsOfSameType(const CvUnit* self, const CvUnit& pUnit2, const bool bPretendEmbarked, bool& result);static bool ReplaceCvUnit_AreUnitsOfSameType(bool (*original)(const CvUnit*, const CvUnit&, const bool), const CvUnit* self, const CvUnit& pUnit2, const bool bPretendEmbarked);CivRegisterBefore<CivHooks::CvUnit_AreUnitsOfSameType>(host, &BeforeCvUnit_AreUnitsOfSameType);CivRegisterAfter<CivHooks::CvUnit_AreUnitsOfSameType>(host, &AfterCvUnit_AreUnitsOfSameType);CivRegisterReplace<CivHooks::CvUnit_AreUnitsOfSameType>(host, &ReplaceCvUnit_AreUnitsOfSameType);
Code
21187bool CvUnit::AreUnitsOfSameType(const CvUnit& pUnit2, const bool bPretendEmbarked) const21188{21189 VALIDATE_OBJECT2119021191 bool bUnit1isEmbarked = isEmbarked();21192 bool bUnit2isEmbarked = pUnit2.isEmbarked() || bPretendEmbarked;2119321194 // 2 embarked units are considered the same type, regardless of circumstances21195 if(bUnit1isEmbarked && bUnit2isEmbarked)21196 {21197 return true;21198 }2119921200 return CvGameQueries::AreUnitsSameType(getUnitType(), pUnit2.getUnitType());21201}
Calls
Called by
- CvDllNetMessageHandler::ResponseSwapUnits(PlayerTypes, int, MissionTypes, int, int, int, bool)
- CvGame::updateMoves()
- CvPlayer::receiveGoody(CvPlot *, GoodyTypes, CvUnit *)
- CvPlot::getNumFriendlyUnitsOfType(const CvUnit *, bool) const
- CvTacticalAI::ExecuteMovesToSafestPlot()
- CvUnit::CanSwapWithUnitHere(CvPlot &) const
- CvUnit::GetCaptureChance(CvUnit *)
- CvUnitCombat::GenerateMeleeCombatInfo(CvUnit &, CvUnit *, CvPlot &, CvCombatInfo *)
- CvUnitMission::ContinueMission(UnitHandle, int, int)