这篇教程C++ CvAssertMsg函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CvAssertMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ CvAssertMsg函数的具体用法?C++ CvAssertMsg怎么用?C++ CvAssertMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CvAssertMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CvAssertMsg// ------------------------------------------------------------------------------------------------// Returns true if the relationship of the danger plots owner and the input player and plot owner// would result in a 0 danger. This helps avoid costly path finder calls if the end result will be 0.bool CvDangerPlots::IsDangerByRelationshipZero(PlayerTypes ePlayer, CvPlot* pPlot){ CvAssertMsg(pPlot, "No plot passed in?"); bool bIgnoreInFriendlyTerritory = false; // Full value if a player we're at war with if(GET_TEAM(GET_PLAYER(m_ePlayer).getTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam())) { return false; } // if it's a human player, ignore neutral units if(GET_PLAYER(m_ePlayer).isHuman()) { return true; } bool bResultMultiplierIsZero = false; if(GET_PLAYER(m_ePlayer).isMinorCiv()) // if the evaluator is a minor civ { if(!GET_TEAM(GET_PLAYER(m_ePlayer).getTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam())) // and they're not at war with the other player { bIgnoreInFriendlyTerritory = true; // ignore friendly territory } } else if(!GET_PLAYER(ePlayer).isMinorCiv()) { // should we be using bHideTrueFeelings? switch(GET_PLAYER(m_ePlayer).GetDiplomacyAI()->GetMajorCivApproach(ePlayer, /*bHideTrueFeelings*/ false)) { case MAJOR_CIV_APPROACH_WAR: bResultMultiplierIsZero = m_fMajorWarMod == 0.f; break; case MAJOR_CIV_APPROACH_HOSTILE: bResultMultiplierIsZero = m_fMajorHostileMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MAJOR_CIV_APPROACH_DECEPTIVE: bResultMultiplierIsZero = m_fMajorDeceptiveMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MAJOR_CIV_APPROACH_GUARDED: bResultMultiplierIsZero = m_fMajorGuardedMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MAJOR_CIV_APPROACH_AFRAID: bResultMultiplierIsZero = m_fMajorAfraidMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MAJOR_CIV_APPROACH_FRIENDLY: bResultMultiplierIsZero = m_fMajorFriendlyMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MAJOR_CIV_APPROACH_NEUTRAL: bResultMultiplierIsZero = m_fMajorNeutralMod == 0.f; bIgnoreInFriendlyTerritory = true; break; } } else { switch(GET_PLAYER(m_ePlayer).GetDiplomacyAI()->GetMinorCivApproach(ePlayer)) { case MINOR_CIV_APPROACH_IGNORE: bResultMultiplierIsZero = m_fMinorNeutralrMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MINOR_CIV_APPROACH_FRIENDLY: bResultMultiplierIsZero = m_fMinorFriendlyMod == 0.f; bIgnoreInFriendlyTerritory = true; break; case MINOR_CIV_APPROACH_BULLY: bResultMultiplierIsZero = (m_fMinorBullyMod == 0.f); break; case MINOR_CIV_APPROACH_CONQUEST: bResultMultiplierIsZero = m_fMinorConquestMod == 0.f; break; } } // if the plot is in our own territory and, with the current approach, we should ignore danger values in our own territory // zero out the value if(pPlot && pPlot->getOwner() == m_ePlayer && bIgnoreInFriendlyTerritory) { return true; } return bResultMultiplierIsZero;}
开发者ID:Ninakoru,项目名称:Civ-5-BNW-Smart-AI,代码行数:92,
示例2: CvAssertMsg/// Do we get one of our yields from defeating an enemy?int CvUnitEntry::GetYieldFromKills(YieldTypes eYield) const{ CvAssertMsg((int)eYield < NUM_YIELD_TYPES, "Yield type out of bounds"); CvAssertMsg((int)eYield > -1, "Index out of bounds"); return m_piYieldFromKills[(int)eYield];}
开发者ID:Decker87,项目名称:civ5DllMod,代码行数:7,
示例3: CvAssertMsgCvPlot* CvPlayerAI::FindBestArtistTargetPlot(CvUnit* pGreatArtist, int& iResultScore){ CvAssertMsg(pGreatArtist, "pGreatArtist is null"); if(!pGreatArtist) { return NULL; } iResultScore = 0; CvPlotsVector& m_aiPlots = GetPlots(); CvPlot* pBestPlot = NULL; int iBestScore = 0; // loop through plots and wipe out ones that are invalid const uint nPlots = m_aiPlots.size(); for(uint ui = 0; ui < nPlots; ui++) { if(m_aiPlots[ui] == -1) { continue; } CvPlot* pPlot = GC.getMap().plotByIndex(m_aiPlots[ui]); if(pPlot->isWater()) { continue; } if(!pPlot->IsAdjacentOwnedByOtherTeam(getTeam())) { continue; } // don't build over luxury resources ResourceTypes eResource = pPlot->getResourceType(); if(eResource != NO_RESOURCE) { CvResourceInfo* pkResource = GC.getResourceInfo(eResource); if(pkResource != NULL) { if (pkResource->getResourceUsage() == RESOURCEUSAGE_LUXURY) { continue; } } } // if no improvement can be built on this plot, then don't consider it FeatureTypes eFeature = pPlot->getFeatureType(); if (eFeature != NO_FEATURE && GC.getFeatureInfo(eFeature)->isNoImprovement()) { continue; } // Improvement already here? ImprovementTypes eImprovement = (ImprovementTypes)pPlot->getImprovementType(); if (eImprovement != NO_IMPROVEMENT) { CvImprovementEntry* pkImprovementInfo = GC.getImprovementInfo(eImprovement); if(pkImprovementInfo) { if (pkImprovementInfo->GetCultureBombRadius() > 0) { continue; } } } int iScore = 0; for(int iI = 0; iI < NUM_DIRECTION_TYPES; ++iI) { CvPlot* pAdjacentPlot = plotDirection(pPlot->getX(), pPlot->getY(), ((DirectionTypes)iI)); // if there's no plot, bail if(pAdjacentPlot == NULL) { continue; } // if the plot is ours or no one's, bail if(pAdjacentPlot->getTeam() == NO_TEAM || pAdjacentPlot->getTeam() == getTeam()) { continue; } // don't evaluate city plots since we don't get ownership of them with the bomb if(pAdjacentPlot->getPlotCity()) { continue; } const PlayerTypes eOtherPlayer = pAdjacentPlot->getOwner(); if(GET_PLAYER(eOtherPlayer).isMinorCiv()) { MinorCivApproachTypes eMinorApproach = GetDiplomacyAI()->GetMinorCivApproach(eOtherPlayer); // if we're friendly or protective, don't be a jerk. Bail out. if(eMinorApproach != MINOR_CIV_APPROACH_CONQUEST && eMinorApproach != MINOR_CIV_APPROACH_IGNORE)//.........这里部分代码省略.........
开发者ID:GrantSP,项目名称:Civ5-DLL,代码行数:101,
示例4: MakeDelegate//.........这里部分代码省略......... iBranchWeight *= (100 - m_iPolicyWeightPercentDropNewBranch); iBranchWeight /= 100;#if defined(MOD_AI_SMART_V3) if (MOD_AI_SMART_V3 && !pPlayer->GetPlayerPolicies()->IsEraPrereqBranch(ePolicyBranch)) { iBranchWeight *= 80; iBranchWeight /= 100; }#endif if(eCurrentGrandStrategy == eCultureGrandStrategy) { iBranchWeight /= 3; } } m_AdoptablePolicies.push_back(iBranchLoop, iBranchWeight); } } } } m_AdoptablePolicies.SortItems(); LogPossiblePolicies(); // If there were any Level 3 tenets found, consider going for the one that matches our victory strategy if (aLevel3Tenets.size() > 0) { vector<int>::const_iterator it; for (it = aLevel3Tenets.begin(); it != aLevel3Tenets.end(); it++) { CvPolicyEntry *pEntry; pEntry = m_pCurrentPolicies->GetPolicies()->GetPolicyEntry(*it); if (pEntry) { AIGrandStrategyTypes eGrandStrategy = pPlayer->GetGrandStrategyAI()->GetActiveGrandStrategy(); if (eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_CONQUEST")) { if (pEntry->GetFlavorValue((FlavorTypes)GC.getInfoTypeForString("FLAVOR_OFFENSE")) > 0) { LogPolicyChoice((PolicyTypes)*it); return (*it) + GC.getNumPolicyBranchInfos(); } } else if(eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_SPACESHIP")) { if (pEntry->GetFlavorValue((FlavorTypes)GC.getInfoTypeForString("FLAVOR_SPACESHIP")) > 0) { LogPolicyChoice((PolicyTypes)*it); return (*it) + GC.getNumPolicyBranchInfos(); } } else if(eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_UNITED_NATIONS")) { if (pEntry->GetFlavorValue((FlavorTypes)GC.getInfoTypeForString("FLAVOR_DIPLOMACY")) > 0) { LogPolicyChoice((PolicyTypes)*it); return (*it) + GC.getNumPolicyBranchInfos(); } } else if(eGrandStrategy == GC.getInfoTypeForString("AIGRANDSTRATEGY_CULTURE")) { if (pEntry->GetFlavorValue((FlavorTypes)GC.getInfoTypeForString("FLAVOR_CULTURE")) > 0) { LogPolicyChoice((PolicyTypes)*it); return (*it) + GC.getNumPolicyBranchInfos(); } } } } } CvAssertMsg(m_AdoptablePolicies.GetTotalWeight() >= 0, "Total weights of considered policies should not be negative! Please send Anton your save file and version."); // If total weight is above 0, choose one above a threshold if(m_AdoptablePolicies.GetTotalWeight() > 0) { int iNumChoices = GC.getGame().getHandicapInfo().GetPolicyNumOptions(); iRtnValue = m_AdoptablePolicies.ChooseFromTopChoices(iNumChoices, &fcn, "Choosing policy from Top Choices"); } // Total weight may be 0 if the only branches and policies left are ones that are ineffective in our game, but we gotta pick something else if(m_AdoptablePolicies.GetTotalWeight() == 0 && m_AdoptablePolicies.size() > 0) { iRtnValue = m_AdoptablePolicies.ChooseAtRandom(&fcn, "Choosing policy at random (no good choices)"); } // Log our choice if(iRtnValue != (int)NO_POLICY) { if(iRtnValue >= GC.getNumPolicyBranchInfos()) { LogPolicyChoice((PolicyTypes)(iRtnValue - GC.getNumPolicyBranchInfos())); } else { LogBranchChoice((PolicyBranchTypes)iRtnValue); } } return iRtnValue;}
开发者ID:QuinaryLogician,项目名称:DLL-VMC,代码行数:101,
示例5: PUF_canSiegebool PUF_canSiege(const CvUnit* pUnit, int iData1, int){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return pUnit->canSiege(GET_PLAYER((PlayerTypes)iData1).getTeam());}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例6: PUF_canDefendPotentialEnemybool PUF_canDefendPotentialEnemy(const CvUnit* pUnit, int iData1, int iData2){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return (PUF_canDefend(pUnit, iData1, iData2) && PUF_isPotentialEnemy(pUnit, iData1, iData2));}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例7: PUF_isOtherPlayerbool PUF_isOtherPlayer(const CvUnit* pUnit, int iData1, int){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return (pUnit->getOwner() != iData1);}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例8: PUF_isVisibleDebugbool PUF_isVisibleDebug(const CvUnit* pUnit, int iData1, int){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return !(pUnit->isInvisible(GET_PLAYER((PlayerTypes)iData1).getTeam(), true));}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例9: PUF_isTeambool PUF_isTeam(const CvUnit* pUnit, int iData1, int){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return (pUnit->getTeam() == iData1);}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例10: uninit// --------------------------------------------------------------------------------// FUNCTION: reset()// Initializes data members that are serialized.void CvArea::reset(int iID, bool bWater, bool bConstructorCall){ int iI, iJ; //-------------------------------- // Uninit class uninit(); m_iID = iID; m_iNumTiles = 0; m_iNumOwnedTiles = 0; m_iNumRiverEdges = 0; m_iNumUnits = 0; m_iNumCities = 0; m_iTotalPopulation = 0; m_iNumStartingPlots = 0; m_iNumNaturalWonders = 0; m_iTotalFoundValue = 0; m_Boundaries.m_iNorthEdge = 0; m_Boundaries.m_iSouthEdge = 0; m_Boundaries.m_iEastEdge = 0; m_Boundaries.m_iWestEdge = 0; m_bWater = bWater; m_bMountains = false; for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++) { m_aiUnitsPerPlayer[iI] = 0; m_aiCitiesPerPlayer[iI] = 0; m_aiPopulationPerPlayer[iI] = 0; m_aiFreeSpecialist[iI] = 0; } for(iI = 0; iI < REALLY_MAX_TEAMS; iI++) { m_aiNumRevealedTiles[iI] = 0; } for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++) { m_aTargetCities[iI].reset(); } for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++) { for(iJ = 0; iJ < NUM_YIELD_TYPES; iJ++) { m_aaiYieldRateModifier[iI][iJ] = 0; } } if(!bConstructorCall) { CvAssertMsg((0 < GC.getNumResourceInfos()) && "GC.getNumResourceInfos() is not greater than zero but an array is being allocated in CvArea::reset", "GC.getNumResourceInfos() is not greater than zero but an array is being allocated in CvArea::reset"); int numRIs = GC.getNumResourceInfos(); m_paiNumResources = FNEW(int[numRIs], c_eCiv5GameplayDLL, 0); for(iI = 0; iI < numRIs; iI++) { m_paiNumResources[iI] = 0; } CvAssertMsg((0 < GC.getNumImprovementInfos()) && "GC.getNumImprovementInfos() is not greater than zero but an array is being allocated in CvArea::reset", "GC.getNumImprovementInfos() is not greater than zero but an array is being allocated in CvArea::reset"); int numIIs = GC.getNumImprovementInfos(); m_paiNumImprovements = FNEW(int[numIIs], c_eCiv5GameplayDLL, 0); for(iI = 0; iI < numIIs; iI++) { m_paiNumImprovements[iI] = 0; } }
开发者ID:Be1eriand,项目名称:Civ5-DLL,代码行数:73,
示例11: CvAssertMsg/// What can this unit upgrade into?bool CvUnitEntry::GetUpgradeUnitClass(int i) const{ CvAssertMsg(i < GC.getNumUnitClassInfos(), "Index out of bounds"); CvAssertMsg(i > -1, "Index out of bounds"); return m_pbUpgradeUnitClass ? m_pbUpgradeUnitClass[i] : false;}
开发者ID:Be1eriand,项目名称:Civ5-DLL,代码行数:7,
示例12: PUF_isUnitAITypebool PUF_isUnitAIType(const CvUnit* pUnit, int iData1, int){ CvAssertMsg(iData1 != -1, "Invalid data argument, should be >= 0"); return (pUnit->AI_getUnitAIType() == iData1);}
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:5,
示例13: CvAssertMsgbool QuietDiplomacy::LeaderDiscussion(CvPlayer* human, CvPlayer* computer, const char* text){ CvAssertMsg(human && computer && text, "Quiet Diplomacy: Assertion error!"); CvAssertMsg(human->isHuman(), "Quiet Diplomacy: Not a human!"); // Send a notification. CvNotifications* notifications = human->GetNotifications(); if(notifications) { // Create localized strings. // Hardcode some translation strings so DLL can be used alone without XML texts. std::string language = Localization::GetCurrentLanguage().GetType(); std::string message; std::string summary; if(DoesTextKeyExist("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_SUMMARY") && DoesTextKeyExist("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_MESSAGE")) { // Fetch from the database. Localization::String localeSummary = Localization::Lookup("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_SUMMARY"); localeSummary << Localization::Lookup(computer->getNameKey()); Localization::String localeMessage = Localization::Lookup("TXT_KEY_QUIETDIPLOMACY_LEADERDISCUSSION_MESSAGE"); localeMessage << Localization::Lookup(computer->getNameKey()); localeMessage << text; summary = localeSummary.toUTF8(); message = localeMessage.toUTF8(); } else { if(language == "pl_PL") { // Polish Localization::String localeLeader = Localization::Lookup(computer->getNameKey()); size_t localeLeaderBytes = 0; const char* localeLeaderString = localeLeader.toUTF8(localeLeaderBytes, 2); summary += "Wiadomo/xc5/x9b/xc4/x87 od "; summary.append(localeLeaderString, localeLeaderBytes); message += Localization::Lookup(computer->getNameKey()).toUTF8(); message += ": "; message += text; } else { // English summary += "Message from "; summary += Localization::Lookup(computer->getNameKey()).toUTF8(); message += Localization::Lookup(computer->getNameKey()).toUTF8(); message += ": "; message += text; } } // Get computer's capital. int x = -1; int y = -1; CvCity* computerCapital = computer->getCapitalCity(); if(computerCapital && computerCapital->isRevealed(human->getTeam(), false)) { x = computerCapital->getX(); y = computerCapital->getY(); } // Add a notification. notifications->Add(NOTIFICATION_PEACE_ACTIVE_PLAYER, message.c_str(), summary.c_str(), x, y, computer->GetID()); } // Inform that we took care of it. return true;}
开发者ID:gunstarpl,项目名称:Civilization-5-Mods,代码行数:78,
示例14: CvAssertMsg//------------------------------------------------------------------------------bool CvDllGame::HasTurnTimerExpired(){ CvAssertMsg(0, "Obsolete"); return false;}
开发者ID:Creosteanu,项目名称:nqmod-vs2008,代码行数:6,
示例15: CvAssertMsg/// Array of changes to specialist yieldint* CvCorporationEntry::GetSpecialistYieldChangeArray(int i) const{ CvAssertMsg(i < GC.getNumSpecialistInfos(), "Index out of bounds"); CvAssertMsg(i > -1, "Index out of bounds"); return m_ppaiSpecialistYieldChange[i];}
开发者ID:Skidizzle,项目名称:Community-Patch-DLL,代码行数:7,
注:本文中的CvAssertMsg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CvGV函数代码示例 C++ CvAssert函数代码示例 |