这篇教程C++ CvAssert函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CvAssert函数的典型用法代码示例。如果您正苦于以下问题:C++ CvAssert函数的具体用法?C++ CvAssert怎么用?C++ CvAssert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CvAssert函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CvAssert/// Value of this site for a settlerint CvSiteEvaluatorForSettler::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes eYield, bool bCoastOnly){ CvAssert(pPlot); if(!pPlot) return 0; if(!CanFound(pPlot, pPlayer, true)) { return 0; } // Is there any reason this site doesn't work for a settler? // // First must be on coast if settling a new continent bool bIsCoastal = pPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()); CvArea* pArea = pPlot->area(); CvAssert(pArea); if(!pArea) return 0; int iNumAreaCities = pArea->getCitiesPerPlayer(pPlayer->GetID()); if(bCoastOnly && !bIsCoastal && iNumAreaCities == 0) { return 0; } // Seems okay for a settler, use base class to determine exact value else { return CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield); }}
开发者ID:Be1eriand,项目名称:Battle-Royale,代码行数:30,
示例2: log10/// Make some adjustments to flavors based on the map we're onvoid CvFlavorManager::AdjustWeightsForMap(){ int iTotalLandTiles; int iNumPlayers; double iTilesPerPlayer; double fAdjust; int iAdjust; iTotalLandTiles = GC.getMap().getLandPlots(); iNumPlayers = GC.getGame().countMajorCivsAlive(); if(iNumPlayers > 0) { int iNumFlavorTypes = GC.getNumFlavorTypes(); // Find tiles per player iTilesPerPlayer = (double)iTotalLandTiles / (double)iNumPlayers; // Compute +/- addition // // We want this to be logarithmic, since that is the curve between lots of players on a duel map // and a few player on a huge map. "FLAVOR_STANDARD_LOG10_TILES_PER_PLAYER" is the typical log10 of // tiles per player. We go up and down from this point (multiplying by a coefficient) from here fAdjust = log10(iTilesPerPlayer) - GC.getFLAVOR_STANDARD_LOG10_TILES_PER_PLAYER(); fAdjust *= (double)GC.getFLAVOR_EXPANDGROW_COEFFICIENT(); iAdjust = (int)fAdjust; int iFlavorMaxValue = /*20*/ GC.getPERSONALITY_FLAVOR_MAX_VALUE(); int iFlavorMinValue = /*0*/ GC.getPERSONALITY_FLAVOR_MIN_VALUE(); int iExpansionIndex = GC.getInfoTypeForString("FLAVOR_EXPANSION"); int iGrowthIndex = GC.getInfoTypeForString("FLAVOR_GROWTH"); // Boost expansion CvAssert(iExpansionIndex >= 0 && iExpansionIndex < iNumFlavorTypes); if (iExpansionIndex >= 0 && iExpansionIndex < iNumFlavorTypes) { m_piPersonalityFlavor[iExpansionIndex] += iAdjust; if(m_piPersonalityFlavor[iExpansionIndex] > iFlavorMaxValue) { m_piPersonalityFlavor[iExpansionIndex] = iFlavorMaxValue; } } // Reduce growth CvAssert(iGrowthIndex >= 0 && iGrowthIndex < iNumFlavorTypes); if (iGrowthIndex >= 0 && iGrowthIndex < iNumFlavorTypes) { m_piPersonalityFlavor[iGrowthIndex] -= iAdjust; if(m_piPersonalityFlavor[iGrowthIndex] < iFlavorMinValue) { m_piPersonalityFlavor[iGrowthIndex] = iFlavorMinValue; } } // Save these off as our core personality and broadcast updates ResetToBasePersonality(); }}
开发者ID:GravitasShortfall,项目名称:Community-Patch-DLL,代码行数:59,
示例3: atWarbool atWar(TeamTypes eTeamA, TeamTypes eTeamB){ if((eTeamA == NO_TEAM) || (eTeamB == NO_TEAM)) { return false; } CvAssert(GET_TEAM(eTeamA).isAtWar(eTeamB) == GET_TEAM(eTeamB).isAtWar(eTeamA)); CvAssert((eTeamA != eTeamB) || !(GET_TEAM(eTeamA).isAtWar(eTeamB))); return GET_TEAM(eTeamA).isAtWar(eTeamB);}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:12,
示例4: CvAssert void CvLoggerCSV::DeleteCSV(const char* strLogName) { CvAssert(strLogName != NULL); FILogFile *pLog; pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp); CvAssert(pLog != NULL); LOGFILEMGR.DeleteLog(pLog); }
开发者ID:Be1eriand,项目名称:Battle-Royale,代码行数:13,
示例5: isBeforeUnitCyclebool isBeforeUnitCycle(const CvUnit* pFirstUnit, const CvUnit* pSecondUnit){ CvAssert(pFirstUnit != NULL); CvAssert(pSecondUnit != NULL); CvAssert(pFirstUnit != pSecondUnit); if(!pFirstUnit || !pSecondUnit) return false; if(pFirstUnit->getOwner() != pSecondUnit->getOwner()) { return (pFirstUnit->getOwner() < pSecondUnit->getOwner()); } if(pFirstUnit->getDomainType() != pSecondUnit->getDomainType()) { return (pFirstUnit->getDomainType() < pSecondUnit->getDomainType()); } if(pFirstUnit->GetBaseCombatStrength() != pSecondUnit->GetBaseCombatStrength()) { return (pFirstUnit->GetBaseCombatStrength() > pSecondUnit->GetBaseCombatStrength()); } if(pFirstUnit->getUnitType() != pSecondUnit->getUnitType()) { return (pFirstUnit->getUnitType() > pSecondUnit->getUnitType()); } if(pFirstUnit->getLevel() != pSecondUnit->getLevel()) { return (pFirstUnit->getLevel() > pSecondUnit->getLevel()); }#if defined(MOD_UNITS_XP_TIMES_100) if (pFirstUnit->getExperienceTimes100() != pSecondUnit->getExperienceTimes100()) { return (pFirstUnit->getExperienceTimes100() > pSecondUnit->getExperienceTimes100()); }#else if (pFirstUnit->getExperience() != pSecondUnit->getExperience()) { return (pFirstUnit->getExperience() > pSecondUnit->getExperience()); }#endif return (pFirstUnit->GetID() < pSecondUnit->GetID());}
开发者ID:JFDaly,项目名称:Community-Patch-DLL,代码行数:48,
示例6: CvAssert/// Delete the armyvoid CvArmyAI::Kill(){ CvAssert(GetOwner() != NO_PLAYER); CvAssertMsg(GetID() != -1, "GetID() is not expected to be equal with -1"); int iUnitID; iUnitID = GetFirstUnitID(); while(iUnitID != ARMYSLOT_NO_UNIT) { UnitHandle pThisUnit = GET_PLAYER(GetOwner()).getUnit(iUnitID); if(pThisUnit) { pThisUnit->setArmyID(-1);#if defined(MOD_BALANCE_CORE) pThisUnit->AI_setUnitAIType(pThisUnit->getUnitInfo().GetDefaultUnitAIType());#endif } iUnitID = GetNextUnitID(); } m_FormationEntries.clear(); CvAIOperation* pOperation = GET_PLAYER(GetOwner()).getAIOperation(m_iOperationID); if (pOperation) pOperation->DeleteArmyAI(m_iID); GET_PLAYER(GetOwner()).deleteArmyAI(m_iID);}
开发者ID:XplosiveLun,项目名称:Community-Patch-DLL,代码行数:30,
示例7: CvAssert/// Value of plot for providing tradeable resourcesint CvCitySiteEvaluator::ComputeTradeableResourceValue(CvPlot* pPlot, const CvPlayer* pPlayer){ int rtnValue = 0; CvAssert(pPlot); if(!pPlot) return rtnValue; // If we already own this Tile then we already have access to the Strategic Resource if(pPlot->isOwned()) { return rtnValue; } TeamTypes eTeam = NO_TEAM; if(pPlayer != NULL) { eTeam = pPlayer->getTeam(); } ResourceTypes eResource; eResource = pPlot->getResourceType(eTeam); if(eResource != NO_RESOURCE) { ResourceUsageTypes eResourceUsage = GC.getResourceInfo(eResource)->getResourceUsage(); // Multiply number of tradeable resources by flavor value if(eResourceUsage == RESOURCEUSAGE_LUXURY || eResourceUsage == RESOURCEUSAGE_STRATEGIC) { rtnValue += pPlot->getNumResource() * m_iFlavorMultiplier[SITE_EVALUATION_RESOURCES]; if(pPlayer) { // If we don't have this resource yet, increase it's value if(pPlayer->getNumResourceTotal(eResource) == 0) rtnValue *= 3;#if defined(MOD_BALANCE_CORE_RESOURCE_MONOPOLIES) if(MOD_BALANCE_CORE_RESOURCE_MONOPOLIES && (GC.getMap().getNumResources(eResource) > 0)) { //Will this get us closer to a monopoly? if((((pPlot->getNumResource() + pPlayer->getNumResourceTotal(eResource, false) + pPlayer->getResourceExport(eResource)) * 100) / GC.getMap().getNumResources(eResource)) >= 30) { rtnValue *= 2; } else if((((pPlot->getNumResource() + pPlayer->getNumResourceTotal(eResource, false)) * 100) / GC.getMap().getNumResources(eResource)) >= 50) { rtnValue *= 10; } }#endif } } } return rtnValue;}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:57,
示例8: isBeforeUnitCyclebool isBeforeUnitCycle(const CvUnit* pFirstUnit, const CvUnit* pSecondUnit){ CvAssert(pFirstUnit != NULL); CvAssert(pSecondUnit != NULL); CvAssert(pFirstUnit != pSecondUnit); if(!pFirstUnit || !pSecondUnit) return false; if(pFirstUnit->getOwner() != pSecondUnit->getOwner()) { return (pFirstUnit->getOwner() < pSecondUnit->getOwner()); } if(pFirstUnit->getDomainType() != pSecondUnit->getDomainType()) { return (pFirstUnit->getDomainType() < pSecondUnit->getDomainType()); } if(pFirstUnit->GetBaseCombatStrength() != pSecondUnit->GetBaseCombatStrength()) { return (pFirstUnit->GetBaseCombatStrength() > pSecondUnit->GetBaseCombatStrength()); } if(pFirstUnit->getUnitType() != pSecondUnit->getUnitType()) { return (pFirstUnit->getUnitType() > pSecondUnit->getUnitType()); } if(pFirstUnit->getLevel() != pSecondUnit->getLevel()) { return (pFirstUnit->getLevel() > pSecondUnit->getLevel()); } if(pFirstUnit->getExperience() != pSecondUnit->getExperience()) { return (pFirstUnit->getExperience() > pSecondUnit->getExperience()); } return (pFirstUnit->GetID() < pSecondUnit->GetID());}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:41,
示例9: CvAssert/// Log all potential buildsvoid CvProjectProductionAI::LogPossibleBuilds(){ if(GC.getLogging() && GC.getAILogging()) { CvString strOutBuf; CvString strBaseString; CvString strTemp; CvString playerName; CvString cityName; CvString strDesc; CvString strLogName; CvAssert(m_pCity); if(!m_pCity) return; // Find the name of this civ and city playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription(); cityName = m_pCity->getName(); // Open the log file FILogFile* pLog; pLog = LOGFILEMGR.GetLog(m_pCity->GetCityStrategyAI()->GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp); CvAssert(pLog); if(!pLog) return; // Get the leading info for this line strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns()); strBaseString += playerName + ", " + cityName + ", "; // Dump out the weight of each buildable item for(int iI = 0; iI < m_Buildables.size(); iI++) { CvProjectEntry* pProjectEntry = GC.GetGameProjects()->GetEntry(m_Buildables.GetElement(iI)); strDesc = (pProjectEntry != NULL)? pProjectEntry->GetDescription() : "Unknown"; strTemp.Format("Project, %s, %d", strDesc.GetCString(), m_Buildables.GetWeight(iI)); strOutBuf = strBaseString + strTemp; pLog->Msg(strOutBuf); } }}
开发者ID:Be1eriand,项目名称:Civ5-DLL,代码行数:42,
示例10: CvAssert/// Value of this site for a settlerint CvSiteEvaluatorForSettler::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes eYield, bool bCoastOnly){ CvAssert(pPlot); if(!pPlot) return 0; if(!CanFound(pPlot, pPlayer, true)) { return 0; } // Is there any reason this site doesn't work for a settler? // // First must be on coast if settling a new continent bool bIsCoastal = pPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()); CvArea* pArea = pPlot->area(); CvAssert(pArea); if(!pArea) return 0; int iNumAreaCities = pArea->getCitiesPerPlayer(pPlayer->GetID()); if(bCoastOnly && !bIsCoastal && iNumAreaCities == 0) { return 0; } // Seems okay for a settler, use base class to determine exact value else { // if the civ gets a benefit from settling on a new continent (ie: Indonesia) // double the fertility of that plot int iLuxuryModifier = 0; if (pPlayer->GetPlayerTraits()->WillGetUniqueLuxury(pArea)) { iLuxuryModifier = CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield) * 2; return iLuxuryModifier; } else { return CvCitySiteEvaluator::PlotFoundValue(pPlot, pPlayer, eYield); } }}
开发者ID:rmarquis,项目名称:Community-Patch-DLL,代码行数:41,
示例11: CvAssertvoid CvPlayerAI::ProcessGreatPeople(void){ SpecialUnitTypes eSpecialUnitGreatPerson = (SpecialUnitTypes) GC.getInfoTypeForString("SPECIALUNIT_PEOPLE"); CvAssert(isAlive()); if(!isAlive()) return; int iLoop; for(CvUnit* pLoopUnit = firstUnit(&iLoop); pLoopUnit; pLoopUnit = nextUnit(&iLoop)) { if(pLoopUnit->getSpecialUnitType() != eSpecialUnitGreatPerson) { continue; } GreatPeopleDirectiveTypes eDirective = NO_GREAT_PEOPLE_DIRECTIVE_TYPE; switch(pLoopUnit->AI_getUnitAIType()) { case UNITAI_WRITER: eDirective = GetDirectiveWriter(pLoopUnit); break; case UNITAI_ARTIST: eDirective = GetDirectiveArtist(pLoopUnit); break; case UNITAI_MUSICIAN: eDirective = GetDirectiveMusician(pLoopUnit); break; case UNITAI_ENGINEER: eDirective = GetDirectiveEngineer(pLoopUnit); break; case UNITAI_MERCHANT: eDirective = GetDirectiveMerchant(pLoopUnit); break; case UNITAI_SCIENTIST: eDirective = GetDirectiveScientist(pLoopUnit); break; case UNITAI_GENERAL: eDirective = GetDirectiveGeneral(pLoopUnit); break; case UNITAI_PROPHET: eDirective = GetDirectiveProphet(pLoopUnit); break; case UNITAI_ADMIRAL: eDirective = GetDirectiveAdmiral(pLoopUnit); break; } pLoopUnit->SetGreatPeopleDirective(eDirective); }}
开发者ID:GrantSP,项目名称:Civ5-DLL,代码行数:52,
示例12: CvAssert/// Delete the armyvoid CvArmyAI::Kill(){ CvAssert(GetOwner() != NO_PLAYER); CvAssertMsg(GetID() != -1, "GetID() is not expected to be equal with -1"); ReleaseUnits(); CvAIOperation* pOperation = GET_PLAYER(GetOwner()).getAIOperation(m_iOperationID); if (pOperation) pOperation->DeleteArmyAI(m_iID); GET_PLAYER(GetOwner()).deleteArmyAI(m_iID);}
开发者ID:LoneGazebo,项目名称:Community-Patch-DLL,代码行数:14,
示例13: float/// Compute unit supply for the turn (returns component info)int CvTreasury::CalculateUnitSupply(int& iPaidUnits, int& iBaseSupplyCost){ int iSupply; iPaidUnits = std::max(0, (m_pPlayer->getNumOutsideUnits() - /*3*/ GC.getINITIAL_FREE_OUTSIDE_UNITS())); // JON: This is set to 0 right now, which pretty much means it's disabled iBaseSupplyCost = iPaidUnits* /*0*/ GC.getINITIAL_OUTSIDE_UNIT_GOLD_PERCENT(); iBaseSupplyCost /= 100; iSupply = iBaseSupplyCost; CvHandicapInfo& playerHandicap = m_pPlayer->getHandicapInfo(); iSupply *= playerHandicap.getUnitCostPercent(); iSupply /= 100; if(!m_pPlayer->isHuman() && !m_pPlayer->IsAITeammateOfHuman() && !m_pPlayer->isBarbarian()) { //iSupply *= gameHandicap->getAIUnitSupplyPercent(); // This is no longer valid //iSupply /= 100; iSupply *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * m_pPlayer->GetCurrentEra()) + 100)); iSupply /= 100; } // Game progress factor ranges from 0.0 to 1.0 based on how far into the game we are double fGameProgressFactor = float(GC.getGame().getElapsedGameTurns()) / GC.getGame().getEstimateEndTurn(); // Multiplicative increase - helps scale costs as game goes on - the HIGHER this number the more is paid double fMultiplyFactor = 1.0 + (fGameProgressFactor* /*8*/ GC.getUNIT_MAINTENANCE_GAME_MULTIPLIER()); // Exponential increase - this one really punishes those with a HUGE military - the LOWER this number the more is paid double fExponentialFactor = 1.0 + (fGameProgressFactor / /*7*/ GC.getUNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR()); double fTempCost = fMultiplyFactor * iSupply; int iFinalCost = (int) pow(fTempCost, fExponentialFactor); // A mod at the player level? (Policies, etc.) if(m_pPlayer->GetUnitSupplyMod() != 0) { iFinalCost *= (100 + m_pPlayer->GetUnitSupplyMod()); iFinalCost /= 100; } CvAssert(iFinalCost >= 0); return iFinalCost;}
开发者ID:J-d-H,项目名称:Community-Patch-DLL,代码行数:48,
示例14: CvAssert/// Compute inflation for this part of the gameint CvTreasury::CalculateInflationRate(){ CvGame& kGame = GC.getGame(); CvHandicapInfo& playerHandicap = m_pPlayer->getHandicapInfo(); CvHandicapInfo& gameHandicap = kGame.getHandicapInfo(); CvGameSpeedInfo& gameSpeedInfo = kGame.getGameSpeedInfo(); int iTurns = ((kGame.getGameTurn() + kGame.getElapsedGameTurns()) / 2); iTurns += gameSpeedInfo.getInflationOffset(); if(iTurns <= 0) { return 0; } int iInflationPerTurnTimes10000 = gameSpeedInfo.getInflationPercent(); iInflationPerTurnTimes10000 *= playerHandicap.getInflationPercent(); iInflationPerTurnTimes10000 /= 100; int iModifier = 0; if(!m_pPlayer->isHuman() && !m_pPlayer->isBarbarian()) { int iAIModifier = gameHandicap.getAIInflationPercent(); iAIModifier *= std::max(0, ((gameHandicap.getAIPerEraModifier() * m_pPlayer->GetCurrentEra()) + 100)); iAIModifier /= 100; iModifier += iAIModifier - 100; } iInflationPerTurnTimes10000 *= std::max(0, 100 + iModifier); iInflationPerTurnTimes10000 /= 100; // Keep up to second order terms in binomial series int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100; iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000; CvAssert(iRatePercent >= 0); return iRatePercent;}
开发者ID:J-d-H,项目名称:Community-Patch-DLL,代码行数:43,
示例15: CvAssert/// Delete the armyvoid CvArmyAI::Kill(){ CvAssert(GetOwner() != NO_PLAYER); CvAssertMsg(GetID() != FFreeList::INVALID_INDEX, "GetID() is not expected to be equal with FFreeList::INVALID_INDEX"); int iUnitID; iUnitID = GetFirstUnitID(); while(iUnitID != ARMY_NO_UNIT) { UnitHandle pThisUnit = GET_PLAYER(GetOwner()).getUnit(iUnitID); if(pThisUnit) { pThisUnit->setArmyID(FFreeList::INVALID_INDEX); } iUnitID = GetNextUnitID(); } m_FormationEntries.clear();}
开发者ID:GravitasShortfall,项目名称:Community-Patch-DLL,代码行数:21,
示例16: CvAssertbool CvPlayerAI::AI_captureUnit(UnitTypes, CvPlot* pPlot){ CvCity* pNearestCity; CvAssert(!isHuman()); // Barbs always capture if (isBarbarian()) return true; if (pPlot->getTeam() == getTeam()) return true; pNearestCity = GC.getMap().findCity(pPlot->getX(), pPlot->getY(), NO_PLAYER, getTeam()); if (pNearestCity != NULL) { if (plotDistance(pPlot->getX(), pPlot->getY(), pNearestCity->getX(), pNearestCity->getY()) <= 4) return true; } return false;}
开发者ID:shocklateboy92,项目名称:itchy-weasel,代码行数:23,
示例17: CvAssert// ---------------------------------------------------------------------------bool CvUnitMovement::CostsOnlyOne(const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot){ if(!pToPlot->isValidDomainForAction(*pUnit)) { // If we are a land unit that can embark, then do further tests. if(pUnit->getDomainType() != DOMAIN_LAND || pUnit->IsHoveringUnit() || pUnit->canMoveAllTerrain() || !pUnit->CanEverEmbark()) return true; } CvAssert(!pUnit->IsImmobile()); if(pUnit->flatMovementCost() || pUnit->getDomainType() == DOMAIN_AIR) { return true; } // Is the unit from a civ that can disembark for just 1 MP? if(!pToPlot->isWater() && pFromPlot->isWater() && pUnit->isEmbarked() && GET_PLAYER(pUnit->getOwner()).GetPlayerTraits()->IsEmbarkedToLandFlatCost()) { return true; } return false;}
开发者ID:Be1eriand,项目名称:Civ5-DLL,代码行数:25,
示例18: GET_PLAYER//.........这里部分代码省略......... if(eGrowCrazy != NO_ECONOMICAISTRATEGY && kPlayer.GetEconomicAI()->IsUsingStrategy(eGrowCrazy)) { iModifier += 15; } if(eNeedFood != NO_AICITYSTRATEGY && m_pCity->GetCityStrategyAI()->IsUsingCityStrategy(eNeedFood)) { iModifier += 15; } if(eNeedFoodNaval != NO_AICITYSTRATEGY && m_pCity->GetCityStrategyAI()->IsUsingCityStrategy(eNeedFoodNaval)) { iModifier += 10; } } break; } } } for(int iI = 0; iI < GC.getNumLeagueProjectInfos(); iI++) { LeagueProjectTypes eLeagueProject = (LeagueProjectTypes) iI; CvLeagueProjectEntry* pInfo = GC.getLeagueProjectInfo(eLeagueProject); if (pInfo && pInfo->GetProcess() == eProcess) { if (GC.getGame().GetGameLeagues()->CanContributeToLeagueProject(m_pCity->getOwner(), eLeagueProject)) { FStaticVector<LeagueProjectRewardTypes, 4, true, c_eCiv5GameplayDLL> veRewards; veRewards.push_back(pInfo->GetRewardTier3()); veRewards.push_back(pInfo->GetRewardTier2()); veRewards.push_back(pInfo->GetRewardTier1()); for (uint i = 0; i < veRewards.size(); i++) { CvLeagueProjectRewardEntry* pRewardInfo = GC.getLeagueProjectRewardInfo(veRewards[i]); CvAssert(pRewardInfo); if (!pRewardInfo) continue; // Free Building in Capital if (pRewardInfo->GetBuilding() != NO_BUILDING) { CvBuildingEntry* pBuildingInfo = GC.getBuildingInfo(pRewardInfo->GetBuilding()); if(pBuildingInfo) { int iValue = 1000; if(kPlayer.getCapitalCity() != NULL) { iValue = kPlayer.getCapitalCity()->GetCityStrategyAI()->GetBuildingProductionAI()->CheckBuildingBuildSanity(pRewardInfo->GetBuilding(), iValue, 5, 5, 1); iModifier += iValue; } else { iModifier += m_pCity->GetCityStrategyAI()->GetBuildingProductionAI()->GetWeight(pRewardInfo->GetBuilding()); } } } // Happiness if (pRewardInfo->GetHappiness() != 0) { iModifier += pRewardInfo->GetHappiness() * (50 - kPlayer.GetHappiness()); } // Free Social Policy if (pRewardInfo->GetFreeSocialPolicies() > 0) { iModifier += (kPlayer.GetPlayerPolicies()->GetNumPoliciesOwned() * 20); }
开发者ID:JFDaly,项目名称:Community-Patch-DLL,代码行数:67,
示例19: pLoopPlot/// Value of this site for a civ starting locationint CvSiteEvaluatorForStart::PlotFoundValue(CvPlot* pPlot, CvPlayer* pPlayer, YieldTypes, bool){ int rtnValue = 0; int iI; CvPlot* pLoopPlot(NULL); int iCelticForestCount = 0; CvAssert(pPlot); if(!pPlot) return rtnValue; if(!CanFound(pPlot, pPlayer, false)) { return rtnValue; } // Is there any reason this site doesn't work for a start location? // // Not on top of a goody hut if(pPlot->isGoody()) { return 0; } // We have our own special method of scoring, so don't call the base class for that (like settler version does)#if defined(MOD_GLOBAL_CITY_WORKING) int iLimit = (pPlayer != NULL) ? pPlayer->GetNumWorkablePlots() : AVG_CITY_PLOTS; for(iI = 0; iI < iLimit; iI++)#else for(iI = 0; iI < NUM_CITY_PLOTS; iI++)#endif { pLoopPlot = plotCity(pPlot->getX(), pPlot->getY(), iI); // Too close to map edge? if(pLoopPlot == NULL) { return 0; } else { int iDistance = plotDistance(pPlot->getX(), pPlot->getY(), pLoopPlot->getX(), pLoopPlot->getY());#if defined(MOD_GLOBAL_CITY_WORKING) if (pPlayer != NULL) { CvAssert(iDistance <= pPlayer->getWorkPlotDistance()); if(iDistance > pPlayer->getWorkPlotDistance()) continue; } else { CvAssert(iDistance <= AVG_CITY_RADIUS); if(iDistance > AVG_CITY_RADIUS) continue; }#else CvAssert(iDistance <= NUM_CITY_RINGS); if(iDistance > NUM_CITY_RINGS) continue;#endif int iRingModifier = m_iRingModifier[iDistance]; // Skip the city plot itself for now if(iDistance != 0) { rtnValue += iRingModifier * ComputeFoodValue(pLoopPlot, pPlayer) * /*6*/ GC.getSTART_AREA_FOOD_MULTIPLIER(); rtnValue += iRingModifier * ComputeHappinessValue(pLoopPlot, pPlayer) * /*12*/ GC.getSTART_AREA_HAPPINESS_MULTIPLIER(); rtnValue += iRingModifier * ComputeProductionValue(pLoopPlot, pPlayer) * /*8*/ GC.getSTART_AREA_PRODUCTION_MULTIPLIER(); rtnValue += iRingModifier * ComputeGoldValue(pLoopPlot, pPlayer) * /*2*/ GC.getSTART_AREA_GOLD_MULTIPLIER(); rtnValue += iRingModifier * ComputeScienceValue(pLoopPlot, pPlayer) * /*1*/ GC.getSTART_AREA_SCIENCE_MULTIPLIER(); rtnValue += iRingModifier * ComputeFaithValue(pLoopPlot, pPlayer) * /*1*/ GC.getSTART_AREA_FAITH_MULTIPLIER(); rtnValue += iRingModifier * ComputeTradeableResourceValue(pLoopPlot, pPlayer) * /*1*/ GC.getSTART_AREA_RESOURCE_MULTIPLIER(); rtnValue += iRingModifier * ComputeStrategicValue(pLoopPlot, pPlayer, iDistance) * /*1*/ GC.getSTART_AREA_STRATEGIC_MULTIPLIER(); } if (pPlayer) { if (iDistance == 1 && pLoopPlot->getFeatureType() == FEATURE_FOREST) { if (pLoopPlot->getImprovementType() == NO_IMPROVEMENT && pPlayer->GetPlayerTraits()->IsFaithFromUnimprovedForest()) { iCelticForestCount += 1; } } } } } if (iCelticForestCount >= 3) { rtnValue += 2 * 1000 * m_iFlavorMultiplier[YIELD_FAITH]; } else if (iCelticForestCount >= 1) { rtnValue += 1 * 1000 * m_iFlavorMultiplier[YIELD_FAITH]; } if(rtnValue < 0) rtnValue = 0; // Finally, look at the city plot itself and use it as an overall multiplier if(pPlot->getResourceType() != NO_RESOURCE) { rtnValue += rtnValue * GC.getBUILD_ON_RESOURCE_PERCENT() / 100; } if(pPlot->isRiver())//.........这里部分代码省略.........
开发者ID:rmarquis,项目名称:Community-Patch-DLL,代码行数:101,
注:本文中的CvAssert函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CvAssertMsg函数代码示例 C++ Cut函数代码示例 |