CySelectionGroup.cpp 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. //
  2. // Python wrapper class for CySelectionGroup
  3. //
  4. //
  5. #include "CvGameCoreDLL.h"
  6. #include "CySelectionGroup.h"
  7. #include "CvSelectionGroup.h"
  8. #include "CvPlot.h"
  9. #include "CyPlot.h"
  10. #include "CvArea.h"
  11. #include "CyArea.h"
  12. #include "CyUnit.h"
  13. //#include "CvStructs.h"
  14. CySelectionGroup::CySelectionGroup() : m_pSelectionGroup(NULL)
  15. {
  16. }
  17. CySelectionGroup::CySelectionGroup(CvSelectionGroup* pSelectionGroup) : m_pSelectionGroup(pSelectionGroup)
  18. {
  19. }
  20. void CySelectionGroup::pushMission(MissionTypes eMission, int iData1, int iData2, int iFlags, bool bAppend, bool bManual, MissionAITypes eMissionAI, CyPlot* pMissionAIPlot, CyUnit* pMissionAIUnit)
  21. {
  22. if (m_pSelectionGroup)
  23. return m_pSelectionGroup->pushMission(eMission, iData1, iData2, iFlags, bAppend, bManual, eMissionAI, pMissionAIPlot->getPlot(), pMissionAIUnit->getUnit());
  24. }
  25. void CySelectionGroup::pushMoveToMission(int iX, int iY)
  26. {
  27. if (m_pSelectionGroup)
  28. return m_pSelectionGroup->pushMission(MISSION_MOVE_TO, iX, iY);
  29. }
  30. void CySelectionGroup::popMission()
  31. {
  32. if (m_pSelectionGroup)
  33. return m_pSelectionGroup->popMission();
  34. }
  35. CyPlot* CySelectionGroup::lastMissionPlot()
  36. {
  37. return m_pSelectionGroup ? new CyPlot(m_pSelectionGroup->lastMissionPlot()) : NULL;
  38. }
  39. bool CySelectionGroup::canStartMission(int iMission, int iData1, int iData2, CyPlot* pPlot, bool bTestVisible)
  40. {
  41. return m_pSelectionGroup ? m_pSelectionGroup->canStartMission(iMission, iData1, iData2, pPlot->getPlot(), bTestVisible) : false;
  42. }
  43. bool CySelectionGroup::canDoInterfaceMode(InterfaceModeTypes eInterfaceMode)
  44. {
  45. return m_pSelectionGroup ? m_pSelectionGroup->canDoInterfaceMode(eInterfaceMode) : false;
  46. }
  47. bool CySelectionGroup::canDoInterfaceModeAt(InterfaceModeTypes eInterfaceMode, CyPlot* pPlot)
  48. {
  49. return m_pSelectionGroup ? m_pSelectionGroup->canDoInterfaceModeAt(eInterfaceMode, pPlot->getPlot()) : false;
  50. }
  51. bool CySelectionGroup::canDoCommand(CommandTypes eCommand, int iData1, int iData2, bool bTestVisible)
  52. {
  53. return m_pSelectionGroup ? m_pSelectionGroup->canDoCommand(eCommand, iData1, iData2, bTestVisible) : false;
  54. }
  55. bool CySelectionGroup::isHuman()
  56. {
  57. return m_pSelectionGroup ? m_pSelectionGroup->isHuman() : false;
  58. }
  59. int CySelectionGroup::baseMoves()
  60. {
  61. return m_pSelectionGroup ? m_pSelectionGroup->baseMoves() : -1;
  62. }
  63. bool CySelectionGroup::canAllMove()
  64. {
  65. return m_pSelectionGroup ? m_pSelectionGroup->canAllMove() : false;
  66. }
  67. bool CySelectionGroup::isWaiting()
  68. {
  69. return m_pSelectionGroup ? m_pSelectionGroup->isWaiting() : false;
  70. }
  71. bool CySelectionGroup::isFull()
  72. {
  73. return m_pSelectionGroup ? m_pSelectionGroup->isFull() : false;
  74. }
  75. bool CySelectionGroup::hasCargo()
  76. {
  77. return m_pSelectionGroup ? m_pSelectionGroup->hasCargo() : false;
  78. }
  79. bool CySelectionGroup::canAnyMove()
  80. {
  81. return m_pSelectionGroup ? m_pSelectionGroup->canAnyMove() : false;
  82. }
  83. bool CySelectionGroup::hasMoved()
  84. {
  85. return m_pSelectionGroup ? m_pSelectionGroup->hasMoved() : false;
  86. }
  87. bool CySelectionGroup::canEnterTerritory(int /*TeamTypes*/ eTeam, bool bIgnoreRightOfPassage)
  88. {
  89. return m_pSelectionGroup ? m_pSelectionGroup->canEnterTerritory((TeamTypes) eTeam, bIgnoreRightOfPassage) : false;
  90. }
  91. bool CySelectionGroup::canEnterArea(int /*TeamTypes*/ eTeam, CyArea* pArea, bool bIgnoreRightOfPassage)
  92. {
  93. return m_pSelectionGroup ? m_pSelectionGroup->canEnterArea((TeamTypes) eTeam, pArea->getArea(), bIgnoreRightOfPassage) : false;
  94. }
  95. bool CySelectionGroup::canMoveInto(CyPlot* pPlot, bool bAttack)
  96. {
  97. return m_pSelectionGroup ? m_pSelectionGroup->canMoveInto(pPlot->getPlot(), bAttack) : false;
  98. }
  99. bool CySelectionGroup::canMoveOrAttackInto(CyPlot* pPlot, bool bDeclareWar)
  100. {
  101. return m_pSelectionGroup ? m_pSelectionGroup->canMoveOrAttackInto(pPlot->getPlot(), bDeclareWar) : false;
  102. }
  103. bool CySelectionGroup::canMoveThrough(CyPlot* pPlot)
  104. {
  105. return m_pSelectionGroup ? m_pSelectionGroup->canMoveThrough(pPlot->getPlot()) : false;
  106. }
  107. bool CySelectionGroup::canFight()
  108. {
  109. return m_pSelectionGroup ? m_pSelectionGroup->canFight() : false;
  110. }
  111. bool CySelectionGroup::canDefend()
  112. {
  113. return m_pSelectionGroup ? m_pSelectionGroup->canDefend() : false;
  114. }
  115. bool CySelectionGroup::alwaysInvisible()
  116. {
  117. return m_pSelectionGroup ? m_pSelectionGroup->alwaysInvisible() : false;
  118. }
  119. bool CySelectionGroup::isInvisible(int /*TeamTypes*/ eTeam)
  120. {
  121. return m_pSelectionGroup ? m_pSelectionGroup->isInvisible((TeamTypes) eTeam) : false;
  122. }
  123. int CySelectionGroup::countNumUnitAIType(UnitAITypes eUnitAI)
  124. {
  125. return m_pSelectionGroup ? m_pSelectionGroup->countNumUnitAIType(eUnitAI) : -1;
  126. }
  127. bool CySelectionGroup::hasWorker()
  128. {
  129. return m_pSelectionGroup ? m_pSelectionGroup->hasWorker() : false;
  130. }
  131. /************************************************************************************************/
  132. /* BETTER_BTS_AI_MOD 11/30/08 jdog5000 */
  133. /* */
  134. /* General AI */
  135. /************************************************************************************************/
  136. bool CySelectionGroup::isStranded()
  137. {
  138. return m_pSelectionGroup ? m_pSelectionGroup->isStranded() : false;
  139. }
  140. /************************************************************************************************/
  141. /* BETTER_BTS_AI_MOD END */
  142. /************************************************************************************************/
  143. bool CySelectionGroup::at(int iX, int iY)
  144. {
  145. return m_pSelectionGroup ? m_pSelectionGroup->at(iX, iY) : false;
  146. }
  147. bool CySelectionGroup::atPlot(CyPlot* pPlot)
  148. {
  149. return m_pSelectionGroup ? m_pSelectionGroup->atPlot(pPlot->getPlot()) : false;
  150. }
  151. CyPlot* CySelectionGroup::plot()
  152. {
  153. return m_pSelectionGroup ? new CyPlot( m_pSelectionGroup->plot() ) : NULL;
  154. }
  155. CyArea* CySelectionGroup::area()
  156. {
  157. return m_pSelectionGroup ? new CyArea( m_pSelectionGroup->area() ) : NULL;
  158. }
  159. int /*RouteTypes*/ CySelectionGroup::getBestBuildRoute(CyPlot* pPlot, BuildTypes* peBestBuild)
  160. {
  161. return m_pSelectionGroup ? m_pSelectionGroup->getBestBuildRoute(pPlot->getPlot(), peBestBuild) : -1;
  162. }
  163. bool CySelectionGroup::isAmphibPlot(CyPlot* pPlot)
  164. {
  165. return m_pSelectionGroup ? m_pSelectionGroup->isAmphibPlot(pPlot->getPlot()) : false;
  166. }
  167. bool CySelectionGroup::readyToSelect(bool bAny)
  168. {
  169. return m_pSelectionGroup ? m_pSelectionGroup->readyToSelect(bAny) : false;
  170. }
  171. bool CySelectionGroup::readyToMove(bool bAny)
  172. {
  173. return m_pSelectionGroup ? m_pSelectionGroup->readyToMove(bAny) : false;
  174. }
  175. bool CySelectionGroup::readyToAuto()
  176. {
  177. return m_pSelectionGroup ? m_pSelectionGroup->readyToAuto() : false;
  178. }
  179. int CySelectionGroup::getID()
  180. {
  181. return m_pSelectionGroup ? m_pSelectionGroup->getID() : -1;
  182. }
  183. int /*PlayerTypes*/ CySelectionGroup::getOwner()
  184. {
  185. return m_pSelectionGroup ? m_pSelectionGroup->getOwnerINLINE() : -1;
  186. }
  187. int /*TeamTypes*/ CySelectionGroup::getTeam()
  188. {
  189. return m_pSelectionGroup ? (TeamTypes) m_pSelectionGroup->getTeam() : -1;
  190. }
  191. int /*ActivityTypes*/ CySelectionGroup::getActivityType()
  192. {
  193. return m_pSelectionGroup ? (ActivityTypes) m_pSelectionGroup->getActivityType() : -1;
  194. }
  195. void CySelectionGroup::setActivityType(int /*ActivityTypes*/ eNewValue)
  196. {
  197. if (m_pSelectionGroup)
  198. m_pSelectionGroup->setActivityType((ActivityTypes) eNewValue);
  199. }
  200. int /*AutomateTypes*/ CySelectionGroup::getAutomateType()
  201. {
  202. return m_pSelectionGroup ? (AutomateTypes) m_pSelectionGroup->getAutomateType() : -1;
  203. }
  204. bool CySelectionGroup::isAutomated()
  205. {
  206. return m_pSelectionGroup ? m_pSelectionGroup->isAutomated() : false;
  207. }
  208. void CySelectionGroup::setAutomateType(int /*AutomateTypes*/ eNewValue)
  209. {
  210. if (m_pSelectionGroup)
  211. m_pSelectionGroup->setAutomateType((AutomateTypes) eNewValue);
  212. }
  213. CyPlot* CySelectionGroup::getPathFirstPlot()
  214. {
  215. return m_pSelectionGroup ? new CyPlot(m_pSelectionGroup->getPathFirstPlot()) : NULL;
  216. }
  217. CyPlot* CySelectionGroup::getPathEndTurnPlot()
  218. {
  219. return m_pSelectionGroup ? new CyPlot(m_pSelectionGroup->getPathEndTurnPlot()) : NULL;
  220. }
  221. bool CySelectionGroup::generatePath(CyPlot* pFromPlot, CyPlot* pToPlot, int iFlags, bool bReuse, int* piPathTurns)
  222. {
  223. return m_pSelectionGroup ? m_pSelectionGroup->generatePath(pFromPlot->getPlot(), pToPlot->getPlot(), iFlags, bReuse, piPathTurns) : false;
  224. }
  225. void CySelectionGroup::resetPath()
  226. {
  227. if (m_pSelectionGroup)
  228. m_pSelectionGroup->resetPath();
  229. }
  230. int CySelectionGroup::getNumUnits()
  231. {
  232. return m_pSelectionGroup ? m_pSelectionGroup->getNumUnits() : -1;
  233. }
  234. void CySelectionGroup::clearMissionQueue()
  235. {
  236. if (m_pSelectionGroup)
  237. m_pSelectionGroup->clearMissionQueue();
  238. }
  239. int CySelectionGroup::getLengthMissionQueue()
  240. {
  241. return m_pSelectionGroup ? m_pSelectionGroup->getLengthMissionQueue() : -1;
  242. }
  243. MissionData* CySelectionGroup::getMissionFromQueue(int iIndex)
  244. {
  245. return m_pSelectionGroup ? m_pSelectionGroup->getMissionFromQueue(iIndex) : NULL;
  246. }
  247. CyUnit* CySelectionGroup::getHeadUnit()
  248. {
  249. return m_pSelectionGroup ? new CyUnit(m_pSelectionGroup->getHeadUnit()) : NULL;
  250. }
  251. CyUnit* CySelectionGroup::getUnitAt(int index)
  252. {
  253. return m_pSelectionGroup ? new CyUnit(m_pSelectionGroup->getUnitAt(index)) : NULL;
  254. }
  255. int CySelectionGroup::getMissionType( int iNode )
  256. {
  257. return m_pSelectionGroup ? m_pSelectionGroup->getMissionType(iNode) : -1;
  258. }
  259. int CySelectionGroup::getMissionData1( int iNode )
  260. {
  261. return m_pSelectionGroup ? m_pSelectionGroup->getMissionData1( iNode ) : -1;
  262. }
  263. int CySelectionGroup::getMissionData2( int iNode )
  264. {
  265. return m_pSelectionGroup ? m_pSelectionGroup->getMissionData2( iNode ) : -1;
  266. }