本文整理汇总了C++中CvUnit::doCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ CvUnit::doCommand方法的具体用法?C++ CvUnit::doCommand怎么用?C++ CvUnit::doCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvUnit
的用法示例。
在下文中一共展示了CvUnit::doCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResponseDoCommand
//------------------------------------------------------------------------------
void CvDllNetMessageHandler::ResponseDoCommand(PlayerTypes ePlayer, int iUnitID, CommandTypes eCommand, int iData1, int iData2, bool bAlt)
{
CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);
CvUnit* pkUnit = kPlayer.getUnit(iUnitID);
if(pkUnit != NULL)
{
if(bAlt && GC.getCommandInfo(eCommand)->getAll())
{
const UnitTypes eUnitType = pkUnit->getUnitType();
CvUnit* pkLoopUnit = NULL;
int iLoop = 0;
for(pkLoopUnit = kPlayer.firstUnit(&iLoop); pkLoopUnit != NULL; pkLoopUnit = kPlayer.nextUnit(&iLoop))
{
if(pkLoopUnit->getUnitType() == eUnitType)
{
pkLoopUnit->doCommand(eCommand, iData1, iData2);
}
}
}
else
{
pkUnit->doCommand(eCommand, iData1, iData2);
}
}
}
示例2: Execute
void CvNetDoCommand::Execute()
{
if (m_ePlayer != NO_PLAYER)
{
CvUnit* pUnit = GET_PLAYER(m_ePlayer).getUnit(m_iUnitID);
if (pUnit != NULL)
{
if (m_bAlt && GC.getCommandInfo(m_eCommand).getAll())
{
int iLoop;
for (CvUnit* pLoopUnit = GET_PLAYER(m_ePlayer).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER(m_ePlayer).nextUnit(&iLoop))
{
if (pLoopUnit->getUnitType() == pUnit->getUnitType())
{
pLoopUnit->doCommand(m_eCommand, m_iData1, m_iData2);
}
}
}
else
{
pUnit->doCommand(m_eCommand, m_iData1, m_iData2);
}
}
}
}
示例3: Execute
void CvNetDoCommand::Execute()
{
if (m_ePlayer != NO_PLAYER)
{
CvUnit* pUnit = GET_PLAYER(m_ePlayer).getUnit(m_iUnitID);
if (pUnit != NULL)
{
if (m_bAlt && GC.getCommandInfo(m_eCommand).getAll())
{
int iLoop;
/************************************************************************************************/
/* UNOFFICIAL_PATCH 07/08/09 jdog5000 */
/* */
/* Bugfix */
/************************************************************************************************/
/* orginal bts code
for (CvUnit* pLoopUnit = GET_PLAYER(m_ePlayer).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER(m_ePlayer).nextUnit(&iLoop))
{
if (pLoopUnit->getUnitType() == pUnit->getUnitType())
*/
// Have to save type ahead of time, pointer can change
UnitTypes eUpgradeType = pUnit->getUnitType();
for (CvUnit* pLoopUnit = GET_PLAYER(m_ePlayer).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER(m_ePlayer).nextUnit(&iLoop))
{
if (pLoopUnit->getUnitType() == eUpgradeType)
/************************************************************************************************/
/* UNOFFICIAL_PATCH END */
/************************************************************************************************/
{
pLoopUnit->doCommand(m_eCommand, m_iData1, m_iData2);
}
}
}
else
{
pUnit->doCommand(m_eCommand, m_iData1, m_iData2);
}
}
}
}