本文整理汇总了C++中GET_TEAM函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_TEAM函数的具体用法?C++ GET_TEAM怎么用?C++ GET_TEAM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_TEAM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GET_PLAYER
/// Guess as to how much another Player is prioritizing the SS as his means of winning the game
int CvGrandStrategyAI::GetGuessOtherPlayerSpaceshipPriority(PlayerTypes ePlayer, int iWorldNumTechsAverage)
{
VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_SPACE_RACE", true);
// If SS Victory isn't even available then don't bother with anything
if(eVictory == NO_VICTORY)
{
return -100;
}
TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();
// If the player has the Apollo Program we're pretty sure he's going for the SS
ProjectTypes eApolloProgram = (ProjectTypes) GC.getInfoTypeForString("PROJECT_APOLLO_PROGRAM", true);
if(eApolloProgram != NO_PROJECT)
{
if(GET_TEAM(eTeam).getProjectCount(eApolloProgram) > 0)
{
return /*150*/ GC.getAI_GS_SS_HAS_APOLLO_PROGRAM();
}
}
int iNumTechs = GET_TEAM(eTeam).GetTeamTechs()->GetNumTechsKnown();
// Don't divide by zero, okay?
if(iWorldNumTechsAverage == 0)
iWorldNumTechsAverage = 1;
int iSSPriority = (iNumTechs - iWorldNumTechsAverage) * /*300*/ GC.getAI_GS_SS_TECH_PROGRESS_MOD() / iWorldNumTechsAverage;
return iSSPriority;
}
示例2: GET_PLAYER
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseResearch(PlayerTypes ePlayer, TechTypes eTech, int iDiscover, PlayerTypes ePlayerToStealFrom, bool bShift)
{
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
CvTeam& kTeam = GET_TEAM(kPlayer.getTeam());
// Free tech
if(iDiscover > 0)
{
// Make sure we can research this tech for free
if(kPlayer.GetPlayerTechs()->CanResearchForFree(eTech))
{
kTeam.setHasTech(eTech, true, ePlayer, true, true);
if(iDiscover > 1)
{
if(ePlayer == GC.getGame().getActivePlayer())
{
kPlayer.chooseTech(iDiscover - 1);
}
}
kPlayer.SetNumFreeTechs(max(0, iDiscover - 1));
}
}
// Stealing tech
else if(ePlayerToStealFrom != NO_PLAYER)
{
// make sure we can still take a tech
CvAssertMsg(kPlayer.GetEspionage()->m_aiNumTechsToStealList[ePlayerToStealFrom] > 0, "No techs to steal from player");
CvAssertMsg(kPlayer.GetEspionage()->m_aaPlayerStealableTechList[ePlayerToStealFrom].size() > 0, "No techs to be stolen from this player");
CvAssertMsg(kPlayer.GetPlayerTechs()->CanResearch(eTech), "Player can't research this technology");
CvAssertMsg(GET_TEAM(GET_PLAYER(ePlayerToStealFrom).getTeam()).GetTeamTechs()->HasTech(eTech), "ePlayerToStealFrom does not have the requested tech");
if (kPlayer.GetEspionage()->m_aiNumTechsToStealList[ePlayerToStealFrom] > 0)
{
kTeam.setHasTech(eTech, true, ePlayer, true, true);
kPlayer.GetEspionage()->m_aiNumTechsToStealList[ePlayerToStealFrom]--;
}
}
// Normal tech
else
{
CvPlayerTechs* pPlayerTechs = kPlayer.GetPlayerTechs();
CvTeamTechs* pTeamTechs = kTeam.GetTeamTechs();
if(eTech == NO_TECH)
{
kPlayer.clearResearchQueue();
}
else if(pPlayerTechs->CanEverResearch(eTech))
{
if((pTeamTechs->HasTech(eTech) || pPlayerTechs->IsResearchingTech(eTech)) && !bShift)
{
kPlayer.clearResearchQueue();
}
kPlayer.pushResearch(eTech, !bShift);
}
}
}
示例3: atWar
bool 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);
}
示例4: GET_TEAM
// Calculate how much we owe this turn due to taxes
void CvTreasury::CalculateExpensePerTurnFromVassalTaxes()
{
TeamTypes eMaster = GET_TEAM(m_pPlayer->getTeam()).GetMaster();
if(eMaster == NO_TEAM) {
if(GetExpensePerTurnFromVassalTaxes() != 0)
SetExpensePerTurnFromVassalTaxesTimes100(0);
return;
}
int iNet = CalculateGrossGoldTimes100();
int iTax = iNet * GET_TEAM(eMaster).GetVassalTax(m_pPlayer->GetID()) / 100;
SetExpensePerTurnFromVassalTaxesTimes100(iTax);
}
示例5: defined
/// Should this player be ignored when creating the danger plots?
bool CvDangerPlots::ShouldIgnorePlayer(PlayerTypes ePlayer)
{
//if one is major and the other a minor (but no barbarian)
if(GET_PLAYER(m_ePlayer).isMinorCiv() != GET_PLAYER(ePlayer).isMinorCiv() && !GET_PLAYER(ePlayer).isBarbarian() && !GET_PLAYER(m_ePlayer).isBarbarian())
{
CvPlayer* pMinor = NULL;
CvPlayer* pMajor;
if(GET_PLAYER(m_ePlayer).isMinorCiv())
{
pMinor = &GET_PLAYER(m_ePlayer);
pMajor = &GET_PLAYER(ePlayer);
}
else
{
pMinor = &GET_PLAYER(ePlayer);
pMajor = &GET_PLAYER(m_ePlayer);
}
if(pMinor->GetMinorCivAI()->IsFriends(pMajor->GetID()))
{
return true;
}
// if we're a major, we should ignore minors that are not at war with us
if (!GET_PLAYER(m_ePlayer).isMinorCiv())
{
TeamTypes eMajorTeam = pMajor->getTeam();
TeamTypes eMinorTeam = pMinor->getTeam();
if (!GET_TEAM(eMajorTeam).isAtWar(eMinorTeam))
{
return true;
}
}
}
#if defined(MOD_DIPLOMACY_CIV4_FEATURES)
//ignore if one is vassal of the other
if ( GET_TEAM(GET_PLAYER(m_ePlayer).getTeam()).IsVassal(GET_PLAYER(ePlayer).getTeam()) ||
GET_TEAM(GET_PLAYER(ePlayer).getTeam()).IsVassal(GET_PLAYER(m_ePlayer).getTeam()) )
return true;
#endif
#if defined(MOD_BALANCE_CORE_MILITARY)
//ignore if at peace
if ( !GET_TEAM(GET_PLAYER(m_ePlayer).getTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam()) )
return true;
#endif
return false;
}
示例6: AI_launch
void CvPlayerAI::AI_launch(VictoryTypes eVictory)
{
if(GET_TEAM(getTeam()).isHuman())
{
return;
}
if(!GET_TEAM(getTeam()).canLaunch(eVictory))
{
return;
}
launch(eVictory);
}
示例7: AlexanderConquest
//------------------------------------------------------------------------------
void CvAchievementUnlocker::AlexanderConquest(PlayerTypes ePlayer)
{
//Test For Alexander Conquest
CvGame& kGame = GC.getGame();
if (ePlayer == kGame.getActivePlayer())
{
CvString szLeaderName = (CvString)GET_PLAYER(ePlayer).getLeaderTypeKey();
if(szLeaderName == "LEADER_ALEXANDER")
{
if(kGame.getGameTurnYear() <= 350)
{
for(int iPlayerLoop = 0; iPlayerLoop < MAX_PLAYERS; iPlayerLoop++)
{
CvPlayer* pPlayer = &GET_PLAYER((PlayerTypes) iPlayerLoop);
//All known players must be dead and killed by us
if(GET_TEAM(pPlayer->getTeam()).isHasMet(GET_PLAYER(kGame.getActivePlayer()).getTeam()))
{
if(!pPlayer->isBarbarian() && !pPlayer->isMinorCiv())
{
if(pPlayer->isAlive() && pPlayer->GetID() != GET_PLAYER(kGame.getActivePlayer()).GetID())
{
return; // Nope.
}
}
}
}
// Yep.
gDLL->UnlockAchievement(ACHIEVEMENT_SPECIAL_CONQUEST_WORLD);
}
}
}
}
示例8: GET_PLAYER
// What are our gold maintenance costs because of Vassals?
int CvTreasury::GetVassalGoldMaintenance() const
{
int iRtnValue = 0;
// We have a vassal
for(int iI = 0; iI < MAX_MAJOR_CIVS; iI++)
{
if(!GET_PLAYER((PlayerTypes)iI).isMinorCiv()
&& !GET_PLAYER((PlayerTypes)iI).isBarbarian()
&& GET_PLAYER((PlayerTypes)iI).isAlive())
{
int iLoop, iCityPop;
// This player is our vassal
if(GET_TEAM(GET_PLAYER((PlayerTypes)iI).getTeam()).IsVassal(m_pPlayer->getTeam()))
{
// Loop through our vassal's cities
for(CvCity* pLoopCity = GET_PLAYER((PlayerTypes)iI).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iI).nextCity(&iLoop))
{
iCityPop = pLoopCity->getPopulation();
iRtnValue += std::max(0, (int)(pow((double)iCityPop, (double)/*0.6*/ GC.getVASSALAGE_VASSAL_CITY_POP_EXPONENT())));
}
iRtnValue += std::max(0, (GET_PLAYER((PlayerTypes)iI).GetTreasury()->GetExpensePerTurnUnitMaintenance() * /*10*/GC.getVASSALAGE_VASSAL_UNIT_MAINT_COST_PERCENT() / 100));
}
}
}
// Modifier for vassal maintenance?
iRtnValue *= (100 + m_pPlayer->GetVassalGoldMaintenanceMod());
iRtnValue /= 100;
return iRtnValue;
}
示例9: GET_PLAYER
// Find all our enemies (combat units)
void CvTacticalAnalysisMap::BuildEnemyUnitList()
{
m_EnemyUnits.clear();
m_EnemyCities.clear();
TeamTypes ourTeam = GET_PLAYER(m_ePlayer).getTeam();
for(int iPlayer = 0; iPlayer < MAX_PLAYERS; iPlayer++)
{
const PlayerTypes ePlayer = (PlayerTypes)iPlayer;
CvPlayer& kPlayer = GET_PLAYER(ePlayer);
const TeamTypes eTeam = kPlayer.getTeam();
// for each opposing civ
if(kPlayer.isAlive() && GET_TEAM(eTeam).isAtWar(ourTeam))
{
int iLoop;
CvUnit* pLoopUnit = NULL;
CvCity* pLoopCity;
for(pLoopCity = kPlayer.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = kPlayer.nextCity(&iLoop))
if (pLoopCity->plot()->isRevealed(ourTeam))
m_EnemyCities.push_back(pLoopCity->GetIDInfo());
for(pLoopUnit = kPlayer.firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = kPlayer.nextUnit(&iLoop))
if(pLoopUnit->IsCanAttack() && pLoopUnit->plot()->isVisible(ourTeam))
m_EnemyUnits.push_back(pLoopUnit->GetIDInfo());
}
}
}
示例10: GetSpaceshipPriority
/// Returns Priority for Spaceship Grand Strategy
int CvGrandStrategyAI::GetSpaceshipPriority()
{
int iPriority = 0;
// If SS Victory isn't even available then don't bother with anything
VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_SPACE_RACE", true);
if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))
{
return -100;
}
int iFlavorScience = m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_SCIENCE"));
// the later the game the greater the chance
iPriority += m_pPlayer->GetCurrentEra() * iFlavorScience * 150 / 100;
// if I already built the Apollo Program I am very likely to follow through
ProjectTypes eApolloProgram = (ProjectTypes) GC.getInfoTypeForString("PROJECT_APOLLO_PROGRAM", true);
if(eApolloProgram != NO_PROJECT)
{
if(GET_TEAM(m_pPlayer->getTeam()).getProjectCount(eApolloProgram) > 0)
{
iPriority += /*150*/ GC.getAI_GS_SS_HAS_APOLLO_PROGRAM();
}
}
return iPriority;
}
示例11: switch
void CvGameObjectUnit::foreach(GameObjectTypes eType, boost::function<void (CvGameObject*)> func)
{
switch(eType)
{
case GAMEOBJECT_GAME:
func(GC.getGameINLINE().getGameObject());
break;
case GAMEOBJECT_TEAM:
func(GET_TEAM(m_pUnit->getTeam()).getGameObject());
break;
case GAMEOBJECT_PLAYER:
func(GET_PLAYER(m_pUnit->getOwnerINLINE()).getGameObject());
break;
case GAMEOBJECT_CITY:
m_pUnit->plot()->getGameObject()->foreach(eType, func);
break;
case GAMEOBJECT_PLOT:
func(m_pUnit->plot()->getGameObject());
break;
case GAMEOBJECT_UNIT:
func(this);
break;
}
}
示例12: GET_PLAYER
// Find all our enemies (combat units)
void CvTacticalAnalysisMap::BuildEnemyUnitList()
{
CvTacticalAnalysisEnemy enemy;
m_EnemyUnits.clear();
for(int iPlayer = 0; iPlayer < MAX_PLAYERS; iPlayer++)
{
const PlayerTypes ePlayer = (PlayerTypes)iPlayer;
CvPlayer& kPlayer = GET_PLAYER(ePlayer);
const TeamTypes eTeam = kPlayer.getTeam();
// for each opposing civ
if(kPlayer.isAlive() && GET_TEAM(eTeam).isAtWar(m_pPlayer->getTeam()))
{
int iLoop;
CvUnit* pLoopUnit = NULL;
for(pLoopUnit = kPlayer.firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = kPlayer.nextUnit(&iLoop))
{
// Make sure this unit can attack
if(pLoopUnit->IsCanAttack())
{
m_EnemyUnits.push_back(pLoopUnit);
}
}
}
}
}
示例13: FAssert
void CvNetChangeVassal::Execute()
{
if (m_ePlayer != NO_PLAYER)
{
FAssert(GET_PLAYER(m_ePlayer).getTeam() != m_eMasterTeam);
GET_TEAM(GET_PLAYER(m_ePlayer).getTeam()).setVassal(m_eMasterTeam, m_bVassal, m_bCapitulated);
}
}
示例14: GetTeamClosenessScore
// --------------------------------------------------------------------------------
// For each of n teams, let the closeness score for that team be the average distance of an edge between two players on that team.
// This function calculates the closeness score for each team and returns the sum of those n scores.
// The lower the result, the better "clumped" the players' starting locations are.
//
// Note: for the purposes of this function, player i will be assumed to start in the location of player aiStartingLocs[i]
int CvGameQueries::GetTeamClosenessScore(int** aaiDistances, int* aiStartingLocs)
{
int iScore = 0;
for(int iTeam = 0; iTeam < MAX_CIV_TEAMS; iTeam++)
{
if(GET_TEAM((TeamTypes)iTeam).isAlive())
{
int iTeamTotalDist = 0;
int iNumEdges = 0;
for(int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; iPlayer++)
{
if(GET_PLAYER((PlayerTypes)iPlayer).isAlive())
{
if(GET_PLAYER((PlayerTypes)iPlayer).getTeam() == (TeamTypes)iTeam)
{
for(int iOtherPlayer = 0; iOtherPlayer < iPlayer; iOtherPlayer++)
{
if(GET_PLAYER((PlayerTypes)iOtherPlayer).getTeam() == (TeamTypes)iTeam)
{
// Add the edge between these two players that are on the same team
iNumEdges++;
int iPlayerStart = aiStartingLocs[iPlayer];
int iOtherPlayerStart = aiStartingLocs[iOtherPlayer];
if(iPlayerStart < iOtherPlayerStart) // Make sure that iPlayerStart > iOtherPlayerStart
{
int iTemp = iPlayerStart;
iPlayerStart = iOtherPlayerStart;
iOtherPlayerStart = iTemp;
}
else if(iPlayerStart == iOtherPlayerStart)
{
CvAssertMsg(false, "Two players are (hypothetically) assigned to the same starting location!");
}
iTeamTotalDist += aaiDistances[iPlayerStart][iOtherPlayerStart];
}
}
}
}
}
int iTeamScore;
if(iNumEdges == 0)
{
iTeamScore = 0;
}
else
{
iTeamScore = iTeamTotalDist/iNumEdges; // the avg distance between team edges is the team score
}
iScore += iTeamScore;
}
}
return iScore;
}
示例15: CvAssertMsg
CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
if(!pGreatMerchant)
{
return NULL;
}
int iBestTurnsToReach = MAX_INT;
CvPlot* pBestTargetPlot = NULL;
int iPathTurns;
UnitHandle pMerchant = UnitHandle(pGreatMerchant);
CvTeam& kTeam = GET_TEAM(getTeam());
// Loop through each city state
for(int iI = 0; iI < MAX_PLAYERS; iI++)
{
CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
if(kPlayer.isMinorCiv())
{
CvPlot* pCSPlot = kPlayer.getStartingPlot();
if(pCSPlot)
{
if(pCSPlot->isRevealed(getTeam()))
{
// Is this a minor we are friendly with?
if(GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST &&
!kTeam.isAtWar(kPlayer.getTeam()) && GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE)
{
// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
{
CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
if(pAdjacentPlot != NULL)
{
// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam())
&& !pAdjacentPlot->isWater())
{
iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
if(iPathTurns < iBestTurnsToReach)
{
iBestTurnsToReach = iPathTurns;
pBestTargetPlot = pAdjacentPlot;
}
}
}
}
}
}
}
}
}
return pBestTargetPlot;
}