void CvArea::changeNumBonuses(BonusTypes eBonus, int iChange) { FAssertMsg(eBonus >= 0, "eBonus expected to be >= 0"); FAssertMsg(eBonus < GC.getNumBonusInfos(), "eBonus expected to be < GC.getNumBonusInfos"); m_paiNumBonuses[eBonus] = (m_paiNumBonuses[eBonus] + iChange); FAssert(getNumBonuses(eBonus) >= 0); }
void CvPlotGroup::changeNumBonuses(BonusTypes eBonus, int iChange) { CLLNode<XYCoords>* pPlotNode; CvCity* pCity; int iOldNumBonuses; FAssertMsg(eBonus >= 0, "eBonus is expected to be non-negative (invalid Index)"); FAssertMsg(eBonus < GC.getNumBonusInfos(), "eBonus is expected to be within maximum bounds (invalid Index)"); if (iChange != 0) { iOldNumBonuses = getNumBonuses(eBonus); m_paiNumBonuses[eBonus] = (m_paiNumBonuses[eBonus] + iChange); //FAssertMsg(m_paiNumBonuses[eBonus] >= 0, "m_paiNumBonuses[eBonus] is expected to be non-negative (invalid Index)"); XXX pPlotNode = headPlotsNode(); while (pPlotNode != NULL) { pCity = GC.getMapINLINE().plotSorenINLINE(pPlotNode->m_data.iX, pPlotNode->m_data.iY)->getPlotCity(); if (pCity != NULL) { if (pCity->getOwnerINLINE() == getOwnerINLINE()) { pCity->changeNumBonuses(eBonus, iChange); } } pPlotNode = nextPlotsNode(pPlotNode); } } }
int CvArea::countNumUniqueBonusTypes() const { int iCount = 0; for (int iI = 0; iI < GC.getNumBonusInfos(); iI++) { if (getNumBonuses((BonusTypes)iI) > 0) { if (GC.getBonusInfo((BonusTypes)iI).isOneArea()) { iCount++; } } } return iCount; }
void CvMap::changeNumBonuses(BonusTypes eIndex, int iChange) { return m_ja_iNumBonus.add(iChange, eIndex); FAssert(getNumBonuses(eIndex) >= 0); }
bool CvPlotGroup::hasBonus(BonusTypes eBonus) { return(getNumBonuses(eBonus) > 0); }