CvUnit::DoRushBuilding()
- Defined in
- CvUnit.cpp, line 9155
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_DoRushBuilding
Hooks
static bool BeforeCvUnit_DoRushBuilding(CvUnit* self, bool& result);static void AfterCvUnit_DoRushBuilding(CvUnit* self, bool& result);static bool ReplaceCvUnit_DoRushBuilding(bool (*original)(CvUnit*), CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_DoRushBuilding>(host, &BeforeCvUnit_DoRushBuilding);CivRegisterAfter<CivHooks::CvUnit_DoRushBuilding>(host, &AfterCvUnit_DoRushBuilding);CivRegisterReplace<CivHooks::CvUnit_DoRushBuilding>(host, &ReplaceCvUnit_DoRushBuilding);
Code
9154/// Tells this Unit to rush a Building here (in a City)9155bool CvUnit::DoRushBuilding()9156{9157 VALIDATE_OBJECT9158 CvCity* pCity = plot()->getPlotCity();91599160 if(pCity == NULL)9161 {9162 return false;9163 }91649165 if(!IsCanRushBuilding(pCity, false))9166 {9167 return false;9168 }91699170 pCity->setProduction(pCity->getProductionNeeded());91719172 if(plot()->isActiveVisible(false))9173 {9174 auto_ptr<ICvUnit1> pDllUnit(new CvDllUnit(this));9175 gDLL->GameplayUnitActivate(pDllUnit.get());9176 }91779178 kill(true);91799180 return true;9181}
Calls
- CvCity::getProductionNeeded() const
- CvCity::setProduction(int)
- CvDllUnit::CvDllUnit(CvUnit *)
- CvGlobals::getDLLIFace()
- CvPlot::getPlotCity() const
- CvPlot::isActiveVisible(bool) const
- CvUnit::IsCanRushBuilding(CvCity *, bool) const
- CvUnit::kill(bool, PlayerTypes)
- CvUnit::plot() const
ICvEngineUtility1::GameplayUnitActivatestd::auto_ptr::auto_ptrstd::auto_ptr::get