Hooks
static bool BeforeCvCity_DoRazingTurn(CvCity* self, bool& result);static void AfterCvCity_DoRazingTurn(CvCity* self, bool& result);static bool ReplaceCvCity_DoRazingTurn(bool (*original)(CvCity*), CvCity* self);CivRegisterBefore<CivHooks::CvCity_DoRazingTurn>(host, &BeforeCvCity_DoRazingTurn);CivRegisterAfter<CivHooks::CvCity_DoRazingTurn>(host, &AfterCvCity_DoRazingTurn);CivRegisterReplace<CivHooks::CvCity_DoRazingTurn>(host, &ReplaceCvCity_DoRazingTurn);
Code
9553bool CvCity::DoRazingTurn()9554{9555 VALIDATE_OBJECT95569557 AI_PERF_FORMAT("City-AI-perf.csv", ("CvCity::DoRazingTurn, Turn %03d, %s, %s", GC.getGame().getElapsedGameTurns(), GetPlayer()->getCivilizationShortDescription(), getName().c_str()) );9558 if(IsRazing())9559 {9560 CvPlayer& kPlayer = GET_PLAYER(getOwner());9561 int iPopulationDrop = 1;9562 iPopulationDrop *= (100 + kPlayer.GetPlayerTraits()->GetRazeSpeedModifier());9563 iPopulationDrop /= 100;95649565 ChangeRazingTurns(-1);95669567 // Counter has reached 0, disband the City9568 if(GetRazingTurns() <= 0 || getPopulation() <= 1)9569 {9570 CvPlot* pkPlot = plot();95719572 pkPlot->AddArchaeologicalRecord(CvTypes::getARTIFACT_RAZED_CITY(), getOriginalOwner(), getOwner());95739574 kPlayer.disband(this);9575 GC.getGame().addReplayMessage(REPLAY_MESSAGE_CITY_DESTROYED, getOwner(), "", pkPlot->getX(), pkPlot->getY());9576 return true;9577 }9578 // Counter is positive, reduce population9579 else9580 {9581 changePopulation(-iPopulationDrop, true);9582 }9583 }95849585 return false;9586}