• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GET_PLAYER函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GET_PLAYER函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_PLAYER函数的具体用法?C++ GET_PLAYER怎么用?C++ GET_PLAYER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GET_PLAYER函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:QuinaryLogician,项目名称:DLL-VMC,代码行数:15,代码来源:CvDllNetMessageHandler.cpp


示例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);
	}
}
开发者ID:QuinaryLogician,项目名称:DLL-VMC,代码行数:15,代码来源:CvDllNetMessageHandler.cpp


示例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);
			}
		}
	}
}
开发者ID:Sergeus,项目名称:Civ5-WoTModDLL,代码行数:37,代码来源:CvAchievementUnlocker.cpp


示例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();
			}
		}
	}
}
开发者ID:markourm,项目名称:fall,代码行数:15,代码来源:CvMessageData.cpp


示例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;
}
开发者ID:Nightinggale,项目名称:Medieval_Tech,代码行数:15,代码来源:CyGlobalContext.cpp


示例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();
	}
}
开发者ID:Be1eriand,项目名称:Battle-Royale,代码行数:18,代码来源:CvPlayerManager.cpp


示例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;
}
开发者ID:LoneGazebo,项目名称:Community-Patch-DLL,代码行数:18,代码来源:CvArmyAI.cpp


示例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());
		}
	}
}
开发者ID:XplosiveLun,项目名称:Community-Patch-DLL,代码行数:16,代码来源:CvArmyAI.cpp


示例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);
		}
	}
}
开发者ID:Nutzzz,项目名称:Civ5-BarbEnhanced-DLL,代码行数:48,代码来源:CvDllNetMessageHandler.cpp


示例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;
    }
}
开发者ID:gdambrauskas,项目名称:anewdawn1.74Hspinoff,代码行数:46,代码来源:CvGameObject.cpp


示例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
}
开发者ID:DivineYuri,项目名称:Community-Patch-DLL,代码行数:47,代码来源:CvAchievementUnlocker.cpp


示例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);
	}
}
开发者ID:DivineYuri,项目名称:Community-Patch-DLL,代码行数:18,代码来源:CvDllNetMessageHandler.cpp


示例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;
};
开发者ID:JFDaly,项目名称:Community-Patch-DLL,代码行数:18,代码来源:CvDangerPlots.cpp


示例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;
}
开发者ID:XplosiveLun,项目名称:Community-Patch-DLL,代码行数:20,代码来源:CvArmyAI.cpp


示例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;
}
开发者ID:Be1eriand,项目名称:Battle-Royale,代码行数:38,代码来源:CvDangerPlots.cpp


示例16: kGame

//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseFoundPantheon(PlayerTypes ePlayer, BeliefTypes eBelief)
{
	CvGame& kGame(GC.getGame());
	CvGameReligions* pkGameReligions(kGame.GetGameReligions());
	CvBeliefXMLEntries* pkBeliefs = GC.GetGameBeliefs();
	CvBeliefEntry* pEntry = pkBeliefs->GetEntry((int)eBelief);

	// Pantheon belief, or adding one through Reformation?
	if (pEntry && ePlayer != NO_PLAYER)
	{
		if (pEntry->IsPantheonBelief())
		{
			CvGameReligions::FOUNDING_RESULT eResult = pkGameReligions->CanCreatePantheon(ePlayer, true);
			if(eResult == CvGameReligions::FOUNDING_OK)
			{
#if defined(MOD_TRAITS_ANY_BELIEF)
				if(pkGameReligions->IsPantheonBeliefAvailable(eBelief, ePlayer))
#else
				if(pkGameReligions->IsPantheonBeliefAvailable(eBelief))
#endif
				{
					pkGameReligions->FoundPantheon(ePlayer, eBelief);
				}
				else
				{
					CvGameReligions::NotifyPlayer(ePlayer, CvGameReligions::FOUNDING_BELIEF_IN_USE);
				}
			}
			else
			{
				CvGameReligions::NotifyPlayer(ePlayer, eResult);
			}
		}
		else if (pEntry->IsReformationBelief())
		{
			CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
			if (!pkGameReligions->HasAddedReformationBelief(ePlayer) && kPlayer.GetReligions()->HasCreatedReligion())
			{
				ReligionTypes eReligion = kPlayer.GetReligions()->GetReligionCreatedByPlayer();
				pkGameReligions->AddReformationBelief(ePlayer, eReligion, eBelief);
			}
		}
	}
}
开发者ID:DivineYuri,项目名称:Community-Patch-DLL,代码行数:45,代码来源:CvDllNetMessageHandler.cpp


示例17: GET_PLAYER

bool CvSelectionGroupAI::AI_separateImpassable()
{
	CvPlayerAI& kPlayer = GET_PLAYER(getOwner());
	bool bSeparated = false;

	CLLNode<IDInfo>* pEntityNode = headUnitNode();

	while (pEntityNode != NULL)
	{
		CvUnit* pLoopUnit = ::getUnit(pEntityNode->m_data);
		pEntityNode = nextUnitNode(pEntityNode);
		if (kPlayer.AI_unitImpassableCount(pLoopUnit->getUnitType()) > 0)
		{
			pLoopUnit->joinGroup(NULL);
			bSeparated = true;
		}
	}
	return bSeparated;
}
开发者ID:Ungomma,项目名称:Civ4-K-Mod,代码行数:19,代码来源:CvSelectionGroupAI.cpp


示例18: GET_PLAYER

/// Is this part of an operation that allows units to be poached by tactical AI?
bool CvArmyAI::CanTacticalAIInterruptUnit(int /* iUnitId */) const
{
	// If the operation is still assembling, by all means interrupt it
	if(m_eAIState == ARMYAISTATE_WAITING_FOR_UNITS_TO_REINFORCE ||
	        m_eAIState == ARMYAISTATE_WAITING_FOR_UNITS_TO_CATCH_UP)
	{
		return true;
	}

	if(m_eOwner >=0 && m_eOwner < MAX_PLAYERS)
	{
		CvAIOperation* op = GET_PLAYER(m_eOwner).getAIOperation(m_iOperationID);
		if(op)
		{
			return op->CanTacticalAIInterruptOperation();
		}
	}
	return false;
}
开发者ID:GravitasShortfall,项目名称:Community-Patch-DLL,代码行数:20,代码来源:CvArmyAI.cpp


示例19: GET_PLAYER

/// Recalculate when each unit will arrive on target
void CvArmyAI::UpdateCheckpointTurns()
{
	for(unsigned int iI = 0; iI < m_FormationEntries.size(); iI++)
	{
		// No reestimate for units being built
		if(m_FormationEntries[iI].GetUnitID() != ARMY_NO_UNIT)
		{
			CvUnit* pUnit = GET_PLAYER(m_eOwner).getUnit(m_FormationEntries[iI].GetUnitID());
			CvPlot* pMusterPlot = GC.getMap().plot(GetX(), GetY());
			if(pUnit && pMusterPlot)
			{
				int iTurnsToReachCheckpoint = pUnit->TurnsToReachTarget(pMusterPlot, false, true, true);
				if(iTurnsToReachCheckpoint < MAX_INT)
					SetEstimatedTurn(iI, iTurnsToReachCheckpoint);
				else
					SetEstimatedTurn(iI, ARMYSLOT_UNKNOWN_TURN_AT_CHECKPOINT);
			}
		}
	}
}
开发者ID:steemroller,项目名称:Community-Patch-DLL,代码行数:21,代码来源:CvArmyAI.cpp


示例20: CvAssert

/// Delete the army
void 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,代码来源:CvArmyAI.cpp



注:本文中的GET_PLAYER函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GET_POS函数代码示例发布时间:2022-05-30
下一篇:
C++ GET_PKT_LEN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap