CvGame::selectUnit(CvUnit *, bool, bool, bool)
- Defined in
- CvGame.cpp, line 2702
- Class
- CvGame
- Hook name
CivHooks::CvGame_selectUnit
Hooks
static bool BeforeCvGame_selectUnit(CvGame* self, CvUnit* pUnit, bool bClear, bool bToggle, bool bSound);static void AfterCvGame_selectUnit(CvGame* self, CvUnit* pUnit, bool bClear, bool bToggle, bool bSound);static void ReplaceCvGame_selectUnit(void (*original)(CvGame*, CvUnit*, bool, bool, bool), CvGame* self, CvUnit* pUnit, bool bClear, bool bToggle, bool bSound);CivRegisterBefore<CivHooks::CvGame_selectUnit>(host, &BeforeCvGame_selectUnit);CivRegisterAfter<CivHooks::CvGame_selectUnit>(host, &AfterCvGame_selectUnit);CivRegisterReplace<CivHooks::CvGame_selectUnit>(host, &ReplaceCvGame_selectUnit);
Code
2702void CvGame::selectUnit(CvUnit* pUnit, bool bClear, bool bToggle, bool bSound)2703{2704 auto_ptr<ICvUnit1> pOldSelectedUnit(GC.GetEngineUserInterface()->GetHeadSelectedUnit());2705 CvUnit* pkOldSelectedUnit = GC.UnwrapUnitPointer(pOldSelectedUnit.get());27062707 GC.GetEngineUserInterface()->clearSelectedCities();27082709 bool bGroup = true;2710 if(bClear)2711 {2712 GC.GetEngineUserInterface()->ClearSelectionList();2713 bGroup = false;2714 }27152716 pUnit->IncrementFirstTimeSelected();27172718 auto_ptr<ICvUnit1> pDllUnit = GC.WrapUnitPointer(pUnit);2719 GC.GetEngineUserInterface()->InsertIntoSelectionList(pDllUnit.get(), true, bToggle, bGroup, bSound);27202721 gDLL->GameplayMinimapUnitSelect(pUnit->getX(), pUnit->getY());27222723 GC.GetEngineUserInterface()->makeSelectionListDirty();27242725 bool bHighlightTrade = false;2726 int iRouteIndex = -1;2727 if(GC.getGame().getActivePlayer() == pUnit->getOwner())2728 {2729 CvMap& theMap = GC.getMap();2730 theMap.updateDeferredFog();2731 if(pkOldSelectedUnit)2732 {2733 pkOldSelectedUnit->plot()->updateCenterUnit();2734 }2735 pUnit->plot()->updateCenterUnit();27362737 if (pUnit->isTrade())2738 {2739 iRouteIndex = GC.getGame().GetGameTrade()->GetIndexFromUnitID( pUnit->GetID(), pUnit->getOwner() );2740 if (iRouteIndex != -1)2741 bHighlightTrade = true;2742 }2743 }2744 2745 if (bHighlightTrade)2746 gDLL->TradeVisuals_ActivatePopupRoute(iRouteIndex);2747 else2748 gDLL->TradeVisuals_DeactivatePopupRoute();2749}
Calls
- CvGame::getActivePlayer() const
- CvGame::GetGameTrade()
- CvGameTrade::GetIndexFromUnitID(int, PlayerTypes)
- CvGlobals::getDLLIFace()
- CvGlobals::GetEngineUserInterface()
- CvGlobals::getGame()
- CvGlobals::getMap()
- CvGlobals::UnwrapUnitPointer(ICvUnit1 *)
- CvGlobals::WrapUnitPointer(CvUnit *)
- CvMap::updateDeferredFog()
- CvPlot::updateCenterUnit()
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::getX() const
- CvUnit::getY() const
- CvUnit::IncrementFirstTimeSelected()
- CvUnit::isTrade() const
- CvUnit::plot() const
ICvEngineUtility1::GameplayMinimapUnitSelectICvEngineUtility3::TradeVisuals_ActivatePopupRouteICvEngineUtility3::TradeVisuals_DeactivatePopupRouteICvUserInterface1::clearSelectedCitiesICvUserInterface1::ClearSelectionListICvUserInterface1::GetHeadSelectedUnitICvUserInterface1::InsertIntoSelectionListICvUserInterface1::makeSelectionListDirtystd::auto_ptr::auto_ptrstd::auto_ptr::auto_ptrstd::auto_ptr::getstd::auto_ptr::operator auto_ptr_ref