本文整理汇总了C++中CyArgsList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ CyArgsList::add方法的具体用法?C++ CyArgsList::add怎么用?C++ CyArgsList::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CyArgsList
的用法示例。
在下文中一共展示了CyArgsList::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reportGameStart
void CvDllPythonEvents::reportGameStart()
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("GameStart"); // add key to lookup python handler fxn
postEvent(eventData);
}
}
示例2: reportKbdEvent
bool CvDllPythonEvents::reportKbdEvent(int evt, int key, int iCursorX, int iCursorY)
{
if (preEvent())
{
NiPoint3 pt3Location;
CvPlot* pPlot = gDLL->getEngineIFace()->pickPlot(iCursorX, iCursorY, pt3Location);
CyArgsList eventData;
eventData.add("kbdEvent");
eventData.add(evt);
eventData.add(key);
eventData.add(iCursorX);
eventData.add(iCursorY);
eventData.add(pPlot ? pPlot->getX() : -1);
eventData.add(pPlot ? pPlot->getY() : -1);
return postEvent(eventData);
}
return false;
}
示例3: reportUnitBuilt
void CvDllPythonEvents::reportUnitBuilt(CvCity *pCity, CvUnit* pUnit)
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("unitBuilt"); // add key to lookup python handler fxn
CyCity* pyc = new CyCity(pCity);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyc));
CyUnit* pyu = new CyUnit(pUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyu));
postEvent(eventData);
delete pyc;
delete pyu;
}
}
示例4: reportCombatLogFlanking
void CvDllPythonEvents::reportCombatLogFlanking(CvUnit* pAttacker, CvUnit* pDefender, int iDamage)
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("combatLogFlanking"); // add key to lookup python handler fxn
CyUnit* pCyAttacker = new CyUnit(pAttacker);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pCyAttacker));
CyUnit* pCyDefender = new CyUnit(pDefender);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pCyDefender));
eventData.add(iDamage);
postEvent(eventData);
delete pCyDefender;
delete pCyAttacker;
}
}
示例5: reportGreatPersonBorn
void CvDllPythonEvents::reportGreatPersonBorn( CvUnit *pUnit, PlayerTypes ePlayer, CvCity *pCity )
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("greatPersonBorn"); // add key to lookup python handler fxn
CyUnit* py = new CyUnit(pUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(py));
eventData.add((int)ePlayer);
CyCity* pyu = new CyCity(pCity);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyu));
postEvent(eventData);
delete py;
delete pyu;
}
}
示例6: getRiverValueAtPlot
int CvMapGenerator::getRiverValueAtPlot(CvPlot* pPlot)
{
CvPlot* pAdjacentPlot;
CvRandom riverRand;
int iSum;
int iI;
FAssert(pPlot != NULL);
long result = 0;
CyPlot kPlot = CyPlot(pPlot);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(&kPlot));
if (gDLL->getPythonIFace()->callFunction(gDLL->getPythonIFace()->getMapScriptModule(), "getRiverAltitude", argsList.makeFunctionArgs(), &result))
{
if (!gDLL->getPythonIFace()->pythonUsingDefaultImpl()) // Python override
{
if (result >= 0)
{
return result;
}
else
{
FAssertMsg(false, "python getRiverAltitude() must return >= 0");
}
}
}
iSum = result;
iSum += ((NUM_PLOT_TYPES - pPlot->getPlotType()) * 20);
for (iI = 0; iI < NUM_DIRECTION_TYPES; iI++)
{
pAdjacentPlot = plotDirection(pPlot->getX_INLINE(), pPlot->getY_INLINE(), ((DirectionTypes)iI));
if (pAdjacentPlot != NULL)
{
iSum += (NUM_PLOT_TYPES - pAdjacentPlot->getPlotType());
}
else
{
iSum += (NUM_PLOT_TYPES * 10);
}
}
riverRand.init((pPlot->getX_INLINE() * 43251267) + (pPlot->getY_INLINE() * 8273903));
iSum += (riverRand.get(10, "River Rand"));
return iSum;
}
示例7: reportUnitSetXY
void CvDllPythonEvents::reportUnitSetXY(CvPlot* pPlot, CvUnit* pUnit)
{
if (preEvent())
{
if(GC.getUSE_ON_UNIT_SET_XY_CALLBACK())
{
CyArgsList eventData;
eventData.add("unitSetXY"); // add key to lookup python handler fxn
CyPlot* py = new CyPlot(pPlot);
eventData.add(gDLL->getPythonIFace()->makePythonObject(py));
CyUnit* pyu = new CyUnit(pUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyu));
postEvent(eventData);
delete py;
delete pyu;
}
}
}
示例8: reportGoodyReceived
void CvDllPythonEvents::reportGoodyReceived(PlayerTypes ePlayer, CvPlot *pGoodyPlot, CvUnit *pGoodyUnit, GoodyTypes eGoodyType)
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("goodyReceived"); // add key to lookup python handler fxn
eventData.add((int)ePlayer);
CyPlot* py = new CyPlot(pGoodyPlot);
eventData.add(gDLL->getPythonIFace()->makePythonObject(py));
CyUnit* pyu = new CyUnit(pGoodyUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyu));
eventData.add((int) eGoodyType);
postEvent(eventData);
delete py;
delete pyu;
}
}
示例9: reportUnitMove
void CvDllPythonEvents::reportUnitMove(CvPlot* pPlot, CvUnit* pUnit, CvPlot* pOldPlot)
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("unitMove"); // add key to lookup python handler fxn
CyPlot* py = new CyPlot(pPlot);
eventData.add(gDLL->getPythonIFace()->makePythonObject(py));
CyUnit* pyu = new CyUnit(pUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyu));
CyPlot* pyOld = new CyPlot(pOldPlot);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pyOld));
postEvent(eventData);
delete py;
delete pyu;
delete pyOld;
}
}
示例10: reportSelectionGroupPushMission
void CvDllPythonEvents::reportSelectionGroupPushMission(CvSelectionGroup* pSelectionGroup, MissionTypes eMission)
{
if (NULL == pSelectionGroup)
{
return;
}
if (preEvent())
{
CyArgsList eventData;
eventData.add("selectionGroupPushMission"); // add key to lookup python handler fxn
eventData.add(pSelectionGroup->getOwner());
eventData.add(eMission);
int iNumUnits = pSelectionGroup->getNumUnits();
eventData.add(iNumUnits);
int* aiUnitIds = new int[iNumUnits];
CLLNode<IDInfo>* pUnitNode = pSelectionGroup->headUnitNode();
for (int i = 0; pUnitNode; i++)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pSelectionGroup->nextUnitNode(pUnitNode);
aiUnitIds[i] = pLoopUnit->getID();
FAssert(i < iNumUnits);
}
if (aiUnitIds)
{
eventData.add(aiUnitIds, iNumUnits);
}
postEvent(eventData);
delete aiUnitIds;
}
}
示例11: postEvent
bool CvDllPythonEvents::postEvent(CyArgsList& eventData)
{
eventData.add(GC.getGameINLINE().isDebugMode());
eventData.add(false);
eventData.add(gDLL->altKey());
eventData.add(gDLL->ctrlKey());
eventData.add(gDLL->shiftKey());
eventData.add(gDLL->getChtLvl() > 0);
long lResult = -1;
bool bOK = gDLL->getPythonIFace()->callFunction(PYEventModule, "onEvent", eventData.makeFunctionArgs(), &lResult);
return (bOK && lResult==1);
}
示例12: reportUnitPillage
void CvDllPythonEvents::reportUnitPillage(CvUnit* pUnit, ImprovementTypes eImprovement, RouteTypes eRoute, PlayerTypes ePlayer, int iPillagedGold)
{
if (preEvent())
{
CyArgsList eventData;
eventData.add("unitPillage"); // add key to lookup python handler fxn
CyUnit* pCyUnit = new CyUnit(pUnit);
eventData.add(gDLL->getPythonIFace()->makePythonObject(pCyUnit));
eventData.add((int) eImprovement);
eventData.add((int) eRoute);
eventData.add((int) ePlayer);
eventData.add((int) iPillagedGold);
postEvent(eventData);
delete pCyUnit;
}
}
示例13: addBonuses
void CvMapGenerator::addBonuses()
{
PROFILE("CvMapGenerator::addBonuses");
gDLL->NiTextOut("Adding Bonuses...");
if (gDLL->getPythonIFace()->callFunction(gDLL->getPythonIFace()->getMapScriptModule(), "addBonuses", NULL))
{
if (!gDLL->getPythonIFace()->pythonUsingDefaultImpl())
{
return; // Python override
}
}
for (int iOrder = 0; iOrder < GC.getNumBonusInfos(); iOrder++)
{
for (int iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
gDLL->callUpdater();
if (GC.getBonusInfo((BonusTypes)iI).getPlacementOrder() == iOrder)
{
CyArgsList argsList;
argsList.add(iI);
if (!gDLL->getPythonIFace()->callFunction(gDLL->getPythonIFace()->getMapScriptModule(), "addBonusType", argsList.makeFunctionArgs()) || gDLL->getPythonIFace()->pythonUsingDefaultImpl())
{
if (GC.getBonusInfo((BonusTypes)iI).isOneArea())
{
addUniqueBonusType((BonusTypes)iI);
}
else
{
addNonUniqueBonusType((BonusTypes)iI);
}
}
}
}
}
}
示例14: reportMouseEvent
bool CvDllPythonEvents::reportMouseEvent(int evt, int iCursorX, int iCursorY, bool bInterfaceConsumed)
{
if (preEvent())
{
NiPoint3 pt3Location;
CvPlot* pPlot = gDLL->getEngineIFace()->pickPlot(iCursorX, iCursorY, pt3Location);
CyArgsList eventData;
eventData.add("mouseEvent"); // add key to lookup python handler fxn
eventData.add(evt);
eventData.add(iCursorX);
eventData.add(iCursorY);
eventData.add(pPlot ? pPlot->getX() : -1);
eventData.add(pPlot ? pPlot->getY() : -1);
eventData.add(bInterfaceConsumed);
// add list of active screens
std::vector<int> screens;
gDLL->getInterfaceIFace()->getInterfaceScreenIdsForInput(screens);
eventData.add(screens.size() ? &screens[0] : NULL, screens.size());
return postEvent(eventData);
}
return false;
}
示例15: doRiver
// pStartPlot = the plot at whose SE corner the river is starting
//
void CvMapGenerator::doRiver(CvPlot *pStartPlot, CardinalDirectionTypes eLastCardinalDirection, CardinalDirectionTypes eOriginalCardinalDirection, int iThisRiverID)
{
if (iThisRiverID == -1)
{
iThisRiverID = GC.getMapINLINE().getNextRiverID();
GC.getMapINLINE().incrementNextRiverID();
}
int iOtherRiverID = pStartPlot->getRiverID();
if (iOtherRiverID != -1 && iOtherRiverID != iThisRiverID)
{
return; // Another river already exists here; can't branch off of an existing river!
}
CvPlot *pRiverPlot = NULL;
CvPlot *pAdjacentPlot = NULL;
CardinalDirectionTypes eBestCardinalDirection = NO_CARDINALDIRECTION;
if (eLastCardinalDirection==CARDINALDIRECTION_NORTH)
{
pRiverPlot = pStartPlot;
if (pRiverPlot == NULL)
{
return;
}
pAdjacentPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_EAST);
if ((pAdjacentPlot == NULL) || pRiverPlot->isWOfRiver() || pRiverPlot->isWater() || pAdjacentPlot->isWater())
{
return;
}
pStartPlot->setRiverID(iThisRiverID);
pRiverPlot->setWOfRiver(true, eLastCardinalDirection);
pRiverPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_NORTH);
}
else if (eLastCardinalDirection==CARDINALDIRECTION_EAST)
{
pRiverPlot = plotCardinalDirection(pStartPlot->getX_INLINE(), pStartPlot->getY_INLINE(), CARDINALDIRECTION_EAST);
if (pRiverPlot == NULL)
{
return;
}
pAdjacentPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_SOUTH);
if ((pAdjacentPlot == NULL) || pRiverPlot->isNOfRiver() || pRiverPlot->isWater() || pAdjacentPlot->isWater())
{
return;
}
pStartPlot->setRiverID(iThisRiverID);
pRiverPlot->setNOfRiver(true, eLastCardinalDirection);
}
else if (eLastCardinalDirection==CARDINALDIRECTION_SOUTH)
{
pRiverPlot = plotCardinalDirection(pStartPlot->getX_INLINE(), pStartPlot->getY_INLINE(), CARDINALDIRECTION_SOUTH);
if (pRiverPlot == NULL)
{
return;
}
pAdjacentPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_EAST);
if ((pAdjacentPlot == NULL) || pRiverPlot->isWOfRiver() || pRiverPlot->isWater() || pAdjacentPlot->isWater())
{
return;
}
pStartPlot->setRiverID(iThisRiverID);
pRiverPlot->setWOfRiver(true, eLastCardinalDirection);
}
else if (eLastCardinalDirection==CARDINALDIRECTION_WEST)
{
pRiverPlot = pStartPlot;
if (pRiverPlot == NULL)
{
return;
}
pAdjacentPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_SOUTH);
if ((pAdjacentPlot == NULL) || pRiverPlot->isNOfRiver() || pRiverPlot->isWater() || pAdjacentPlot->isWater())
{
return;
}
pStartPlot->setRiverID(iThisRiverID);
pRiverPlot->setNOfRiver(true, eLastCardinalDirection);
pRiverPlot = plotCardinalDirection(pRiverPlot->getX_INLINE(), pRiverPlot->getY_INLINE(), CARDINALDIRECTION_WEST);
}
else
{
//FAssertMsg(false, "Illegal direction type");
// River is starting here, set the direction in the next step
pRiverPlot = pStartPlot;
long result = 0;
CyPlot kPlot = CyPlot(pRiverPlot);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(&kPlot));
if (gDLL->getPythonIFace()->callFunction(gDLL->getPythonIFace()->getMapScriptModule(), "getRiverStartCardinalDirection", argsList.makeFunctionArgs(), &result))
{
//.........这里部分代码省略.........