本文整理汇总了C++中GET_PLAYER函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_PLAYER函数的具体用法?C++ GET_PLAYER怎么用?C++ GET_PLAYER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_PLAYER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GET_PLAYER
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponsePushMission(PlayerTypes ePlayer, int iUnitID, MissionTypes eMission, int iData1, int iData2, int iFlags, bool bShift)
{
CvUnit::dispatchingNetMessage(true);
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
CvUnit* pkUnit = kPlayer.getUnit(iUnitID);
if(pkUnit != NULL)
{
pkUnit->PushMission(eMission, iData1, iData2, iFlags, bShift, true);
}
CvUnit::dispatchingNetMessage(false);
}
示例2: CvAssertMsg
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseStageCoup(PlayerTypes eSpyPlayer, int iSpyIndex)
{
CvAssertMsg(eSpyPlayer != NO_PLAYER, "eSpyPlayer invalid");
CvAssertMsg(iSpyIndex >= 0, "iSpyIndex invalid");
CvPlayerAI& kPlayer = GET_PLAYER(eSpyPlayer);
CvPlayerEspionage* pPlayerEspionage = kPlayer.GetEspionage();
CvAssertMsg(pPlayerEspionage, "pPlayerEspionage is null");
if(pPlayerEspionage)
{
bool bCoupSuccess = pPlayerEspionage->AttemptCoup(iSpyIndex);
}
}
示例3: 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()))
{
// ----------------------------------------------------------------
// WoTMod Addition
// ----------------------------------------------------------------
if(!pPlayer->isBarbarian() && !pPlayer->isMinorCiv() && !pPlayer->IsShadowspawn())
{
if(pPlayer->isAlive() && pPlayer->GetID() != GET_PLAYER(kGame.getActivePlayer()).GetID())
{
return; // Nope.
}
}
}
}
// Yep.
gDLL->UnlockAchievement(ACHIEVEMENT_SPECIAL_CONQUEST_WORLD);
}
}
}
}
示例4: GET_PLAYER
void CvNetAutoMission::Execute()
{
if (m_ePlayer != NO_PLAYER)
{
CvUnit* pUnit = GET_PLAYER(m_ePlayer).getUnit(m_iUnitID);
if (pUnit != NULL)
{
CvSelectionGroup* pSelectionGroup = pUnit->getGroup();
if (pSelectionGroup != NULL)
{
pSelectionGroup->autoMission();
}
}
}
}
示例5: getCyPlayer
CyPlayer* CyGlobalContext::getCyPlayer(int idx)
{
static CyPlayer cyPlayers[MAX_PLAYERS];
static bool bInit=false;
if (!bInit)
{
int i;
for(i=0;i<MAX_PLAYERS;i++)
cyPlayers[i]=CyPlayer(&GET_PLAYER((PlayerTypes)i));
bInit=true;
}
FAssert(idx>=0);
FAssert(idx<MAX_PLAYERS);
return idx < MAX_PLAYERS && idx != NO_PLAYER ? &cyPlayers[idx] : NULL;
}
示例6: GET_PLAYER
// -----------------------------------------------------------------------------------------------
// Loop through all the players and do any deferred updates of their danger plots
// static
void CvPlayerManager::RefreshDangerPlots()
{
for (int iPlayerCivLoop = 0; iPlayerCivLoop < MAX_CIV_PLAYERS; iPlayerCivLoop++)
{
PlayerTypes ePlayer = (PlayerTypes) iPlayerCivLoop;
CvPlayer& kPlayer = GET_PLAYER(ePlayer);
// Must be alive
if (!kPlayer.isAlive())
continue;
if (kPlayer.m_pDangerPlots && kPlayer.m_pDangerPlots->IsDirty())
kPlayer.UpdateDangerPlots();
}
}
示例7: GET_PLAYER
// UNIT STRENGTH ACCESSORS
/// Total unit power
int CvArmyAI::GetTotalPower()
{
int iRtnValue = 0;
for (size_t i = 0; i<m_FormationEntries.size(); i++)
{
if (!m_FormationEntries[i].IsUsed())
continue;
CvUnit* pThisUnit = GET_PLAYER(GetOwner()).getUnit(m_FormationEntries[i].GetUnitID());
if (pThisUnit)
iRtnValue += pThisUnit->GetPower();
}
return iRtnValue;
}
示例8: GET_PLAYER
void CvArmyAI::RemoveStuckUnits()
{
CvAIOperation* pOperation = GET_PLAYER(GetOwner()).getAIOperation(GetOperationID());
for(unsigned int iI = 0; iI < m_FormationEntries.size(); iI++)
{
if(m_FormationEntries[iI].GetUnitID() > ARMYSLOT_NO_UNIT && m_FormationEntries[iI].GetTurnAtCheckpoint()==ARMYSLOT_UNKNOWN_TURN_AT_CHECKPOINT)
{
CvString strMsg;
strMsg.Format("Removing unit %d from army %d because no path to checkpoint",m_FormationEntries[iI].GetUnitID(),GetID());
pOperation->LogOperationSpecialMessage(strMsg);
RemoveUnit(m_FormationEntries[iI].GetUnitID());
}
}
}
示例9: GET_PLAYER
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseUpdatePolicies(PlayerTypes ePlayer, bool bNOTPolicyBranch, int iPolicyID, bool bValue)
{
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
// Policy Update
if(bNOTPolicyBranch)
{
const PolicyTypes ePolicy = static_cast<PolicyTypes>(iPolicyID);
if(bValue)
{
kPlayer.doAdoptPolicy(ePolicy);
}
else
{
kPlayer.setHasPolicy(ePolicy, bValue);
#if defined(MOD_BALANCE_CORE_HAPPINESS)
kPlayer.CalculateHappiness();
#else
kPlayer.DoUpdateHappiness();
#endif
kPlayer.DoUpdateHappiness();
}
}
// Policy Branch Update
else
{
const PolicyBranchTypes eBranch = static_cast<PolicyBranchTypes>(iPolicyID);
CvPlayerPolicies* pPlayerPolicies = kPlayer.GetPlayerPolicies();
// If Branch was blocked by another branch, then unblock this one - this may be the only thing this NetMessage does
if(pPlayerPolicies->IsPolicyBranchBlocked(eBranch))
{
// Can't switch to a Branch that's still locked. DoUnlockPolicyBranch below will handle this for us
if(pPlayerPolicies->IsPolicyBranchUnlocked(eBranch))
{
//pPlayerPolicies->ChangePolicyBranchBlockedCount(eBranch, -1);
pPlayerPolicies->DoSwitchToPolicyBranch(eBranch);
}
}
// Unlock the branch if it hasn't been already
if(!pPlayerPolicies->IsPolicyBranchUnlocked(eBranch))
{
pPlayerPolicies->DoUnlockPolicyBranch(eBranch);
}
}
}
示例10: switch
void CvGameObjectTeam::foreach(GameObjectTypes eType, boost::function<void (CvGameObject*)> func)
{
switch(eType)
{
case GAMEOBJECT_GAME:
func(GC.getGameINLINE().getGameObject());
break;
case GAMEOBJECT_PLAYER:
for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; ++iPlayer)
{
CvPlayer& kLoopPlayer = GET_PLAYER((PlayerTypes)iPlayer);
if (kLoopPlayer.isAlive())
{
if (kLoopPlayer.getTeam() == m_pTeam->getID())
{
func((CvGameObject*)&CvGameObjectPlayer(&kLoopPlayer));
}
}
}
break;
case GAMEOBJECT_CITY:
foreach(GAMEOBJECT_PLAYER, boost::bind(callForeach, _1, GAMEOBJECT_CITY, func));
break;
case GAMEOBJECT_UNIT:
foreach(GAMEOBJECT_PLAYER, boost::bind(callForeach, _1, GAMEOBJECT_UNIT, func));
break;
case GAMEOBJECT_PLOT:
for (int iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
{
CvPlot* pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
if (pLoopPlot->getTeam() == m_pTeam->getID())
{
func(pLoopPlot->getGameObject());
}
}
break;
case GAMEOBJECT_TEAM:
func(this);
break;
}
}
示例11: GET_PLAYER
//------------------------------------------------------------------------------
void CvPlayerAchievements::AlliedWithCityState(PlayerTypes eNewCityStateAlly)
{
#if !defined(NO_ACHIEVEMENTS)
if(m_kPlayer.GetID() != GC.getGame().getActivePlayer())
return;
//Cache value if needed
if(m_ePapalPrimacyType == UNDEFINED_TYPE)
{
m_ePapalPrimacyType = (BeliefTypes)GC.getInfoTypeForString("BELIEF_PAPAL_PRIMACY", true);
}
if(m_ePapalPrimacyType != NO_BELIEF)
{
const ReligionTypes eReligion = m_kPlayer.GetReligions()->GetReligionCreatedByPlayer();
if(eReligion != NO_RELIGION)
{
const CvReligion* pReligion = GC.getGame().GetGameReligions()->GetReligion(eReligion, m_kPlayer.GetID());
if(pReligion != NULL)
{
if(pReligion->m_Beliefs.HasBelief(m_ePapalPrimacyType))
{
int iNumAllies = 0;
//We've got the belief! How many city state Allies do we have??
for(int i = 0; i < MAX_CIV_PLAYERS; ++i)
{
const PlayerTypes ePlayer = static_cast<PlayerTypes>(i);
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
if(kPlayer.isAlive() && kPlayer.isMinorCiv())
{
const PlayerTypes eAlly = kPlayer.GetMinorCivAI()->GetAlly();
if(eAlly == m_kPlayer.GetID())
iNumAllies++;
}
}
if(iNumAllies >= 12)
{
gDLL->UnlockAchievement(ACHIEVEMENT_XP1_27);
}
}
}
}
}
#endif
}
示例12: GET_PLAYER
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseChangeWar(PlayerTypes ePlayer, TeamTypes eRivalTeam, bool bWar)
{
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
CvTeam& kTeam = GET_TEAM(kPlayer.getTeam());
const TeamTypes eTeam = kPlayer.getTeam();
FAssert(eTeam != eRivalTeam);
if(bWar)
{
kTeam.declareWar(eRivalTeam);
}
else
{
kTeam.makePeace(eRivalTeam);
}
}
示例13: GET_TEAM
// Get the amount of damage a citadel would deal to a unit
int CvDangerPlotContents::GetDamageFromFeatures(PlayerTypes ePlayer) const
{
if (m_pCitadel && ePlayer != NO_PLAYER)
{
ImprovementTypes eImprovement = m_pCitadel->getImprovementType();
CvTeam& kTeam = GET_TEAM(GET_PLAYER(ePlayer).getTeam());
// Citadel still here and can fire?
if (eImprovement != NO_IMPROVEMENT && !m_pCitadel->IsImprovementPillaged() && m_pCitadel->getOwner() != NO_PLAYER &&
kTeam.isAtWar(m_pCitadel->getTeam()))
{
return GC.getImprovementInfo(eImprovement)->GetNearbyEnemyDamage();
}
}
return 0;
};
示例14: GetFirstUnitID
// UNIT STRENGTH ACCESSORS
/// Total unit power
int CvArmyAI::GetTotalPower()
{
int iRtnValue = 0;
int iUnitID;
iUnitID = GetFirstUnitID();
while(iUnitID != ARMYSLOT_NO_UNIT)
{
UnitHandle pThisUnit = GET_PLAYER(GetOwner()).getUnit(iUnitID);
if(pThisUnit)
{
iRtnValue += pThisUnit->GetPower();
}
iUnitID = GetNextUnitID();
}
return iRtnValue;
}
示例15: ShouldIgnorePlayer
/// Should this player be ignored when creating the danger plots?
bool CvDangerPlots::ShouldIgnorePlayer(PlayerTypes ePlayer)
{
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;
}
}
}
return false;
}