CyPlot.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. #pragma once
  2. #ifndef CyPlot_h
  3. #define CyPlot_h
  4. //#include "CvEnums.h"
  5. //
  6. // Python wrapper class for CvPlot
  7. //
  8. class CyArea;
  9. class CvPlot;
  10. class CyUnit;
  11. class CyCity;
  12. class CyPlot
  13. {
  14. public:
  15. DllExport CyPlot();
  16. DllExport CyPlot(CvPlot*); // Call from C++
  17. CvPlot* getPlot() { return m_pPlot; } // Call from C++
  18. void setPlot(CvPlot* p) { m_pPlot=p; } // Call from C++
  19. bool isNone() { return (m_pPlot==NULL); }
  20. void erase();
  21. DllExport NiPoint3 getPoint();
  22. int getTeam();
  23. void nukeExplosion(int iRange, CyUnit* pNukeUnit);
  24. bool isConnectedTo(CyCity* pCity);
  25. bool isConnectedToCapital(int /*PlayerTypes*/ ePlayer);
  26. int getPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus);
  27. bool isPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus);
  28. bool isAdjacentPlotGroupConnectedBonus(int /*PlayerTypes*/ ePlayer, int /*BonusTypes*/ eBonus);
  29. void updateVisibility();
  30. bool isAdjacentToArea(CyArea* pArea);
  31. bool shareAdjacentArea(CyPlot* pPlot);
  32. bool isAdjacentToLand();
  33. bool isCoastalLand();
  34. bool isWithinTeamCityRadius(int /*TeamTypes*/ eTeam, int /*PlayerTypes*/ eIgnorePlayer);
  35. bool isLake();
  36. bool isFreshWater();
  37. bool isPotentialIrrigation();
  38. bool canHavePotentialIrrigation();
  39. bool isIrrigationAvailable(bool bIgnoreSelf);
  40. bool isRiverSide();
  41. bool isRiver();
  42. bool isRiverConnection(int /*DirectionTypes*/ eDirection);
  43. int getNearestLandArea();
  44. int seeFromLevel(int /*TeamTypes*/ eTeam);
  45. CyPlot* getNearestLandPlot();
  46. int seeThroughLevel();
  47. bool canHaveBonus(int /*BonusTypes*/ eBonus, bool bIgnoreLatitude);
  48. //>>>>Unofficial Bug Fix: Modified by Denev 2010/05/04
  49. // bool canHaveImprovement(int /* ImprovementTypes */ eImprovement, int /*TeamTypes*/ eTeam, bool bPotential);
  50. bool canHaveImprovement(int /* ImprovementTypes */ eImprovement, int /*PlayerTypes*/ ePlayer, bool bPotential);
  51. //<<<<Unofficial Bug Fix: End Modify
  52. bool canBuild(int /*BuildTypes*/ eBuild, int /*PlayerTypes*/ ePlayer, bool bTestVisible);
  53. int getBuildTime(int /*BuildTypes*/ eBuild);
  54. int getBuildTurnsLeft(int /*BuildTypes*/ eBuild, int iNowExtra, int iThenExtra);
  55. int getFeatureProduction(int /*BuildTypes*/ eBuild, int /*TeamTypes*/ eTeam, CyCity* ppCity);
  56. CyUnit* getBestDefender(int /*PlayerTypes*/ eOwner, int /*PlayerTypes*/ eAttackingPlayer, CyUnit* pAttacker, bool bTestAtWar, bool bTestPotentialEnemy, bool bTestCanMove);
  57. CyUnit* getSelectedUnit();
  58. int getUnitPower(int /* PlayerTypes */ eOwner);
  59. int defenseModifier(int /*TeamTypes*/ iDefendTeam, bool bIgnoreBuilding, bool bHelp);
  60. int movementCost(CyUnit* pUnit, CyPlot* pFromPlot);
  61. int getExtraMovePathCost();
  62. void changeExtraMovePathCost(int iChange);
  63. bool isAdjacentOwned();
  64. bool isAdjacentPlayer(int /*PlayerTypes*/ ePlayer, bool bLandOnly);
  65. bool isAdjacentTeam(int /*TeamTypes*/ eTeam, bool bLandOnly);
  66. bool isWithinCultureRange(int /*PlayerTypes*/ ePlayer);
  67. int getNumCultureRangeCities(int /*PlayerTypes*/ ePlayer);
  68. int /*PlayerTypes*/ calculateCulturalOwner();
  69. bool isOwned();
  70. bool isBarbarian();
  71. bool isRevealedBarbarian();
  72. bool isVisible(int /*TeamTypes*/ eTeam, bool bDebug);
  73. bool isActiveVisible(bool bDebug);
  74. bool isVisibleToWatchingHuman();
  75. bool isAdjacentVisible(int /*TeamTypes*/ eTeam, bool bDebug);
  76. bool isAdjacentNonvisible(int /*TeamTypes*/ eTeam);
  77. bool isAdjacentRevealed(int /*TeamTypes*/ eTeam);
  78. bool isAdjacentNonrevealed(int /*TeamTypes*/ eTeam);
  79. void removeGoody();
  80. bool isGoody();
  81. bool isRevealedGoody(int /*TeamTypes*/ eTeam);
  82. // bool isCity(bool bCheckImprovement = false, int /*TeamTypes*/ eForTeam = NO_TEAM);
  83. bool isCity();
  84. bool isFriendlyCity(CyUnit* pUnit, bool bCheckImprovement);
  85. bool isEnemyCity(CyUnit* pUnit);
  86. bool isOccupation();
  87. bool isBeingWorked();
  88. bool isUnit();
  89. bool isInvestigate(int /*TeamTypes*/ eTeam);
  90. bool isVisibleEnemyDefender(CyUnit* pUnit);
  91. int getNumDefenders(int /*PlayerTypes*/ ePlayer);
  92. int getNumVisibleEnemyDefenders(CyUnit* pUnit);
  93. int getNumVisiblePotentialEnemyDefenders(CyUnit* pUnit);
  94. bool isVisibleEnemyUnit(int /*PlayerTypes*/ ePlayer);
  95. bool isVisibleOtherUnit(int /*PlayerTypes*/ ePlayer);
  96. bool isFighting();
  97. bool canHaveFeature(int /*FeatureTypes*/ eFeature);
  98. bool isRoute();
  99. bool isNetworkTerrain(int /*TeamTypes*/ eTeam);
  100. bool isBonusNetwork(int /*TeamTypes*/ eTeam);
  101. bool isTradeNetworkImpassable(int /*TeamTypes*/ eTeam);
  102. bool isTradeNetwork(int /*TeamTypes*/ eTeam);
  103. bool isTradeNetworkConnected(CyPlot* pPlot, int /*TeamTypes*/ eTeam);
  104. bool isValidDomainForLocation(CyUnit* pUnit) const;
  105. bool isValidDomainForAction(CyUnit* pUnit) const;
  106. bool isImpassable();
  107. int getX();
  108. int getY();
  109. bool at(int iX, int iY);
  110. int getLatitude();
  111. CyArea* area();
  112. CyArea* waterArea();
  113. int getArea();
  114. int getFeatureVariety();
  115. int getOwnershipDuration();
  116. bool isOwnershipScore();
  117. void setOwnershipDuration(int iNewValue);
  118. void changeOwnershipDuration(int iChange);
  119. int getImprovementDuration();
  120. void setImprovementDuration(int iNewValue);
  121. void changeImprovementDuration(int iChange);
  122. int getUpgradeProgress();
  123. int getUpgradeTimeLeft(int /*ImprovementTypes*/ eImprovement, int /*PlayerTypes*/ ePlayer);
  124. void setUpgradeProgress(int iNewValue);
  125. void changeUpgradeProgress(int iChange);
  126. int getForceUnownedTimer();
  127. bool isForceUnowned();
  128. void setForceUnownedTimer(int iNewValue);
  129. void changeForceUnownedTimer(int iChange);
  130. int getCityRadiusCount();
  131. int isCityRadius();
  132. bool isStartingPlot();
  133. void setStartingPlot(bool bNewValue);
  134. bool isNOfRiver();
  135. void setNOfRiver(bool bNewValue, CardinalDirectionTypes eRiverDir);
  136. bool isWOfRiver();
  137. void setWOfRiver(bool bNewValue, CardinalDirectionTypes eRiverDir);
  138. CardinalDirectionTypes getRiverWEDirection();
  139. CardinalDirectionTypes getRiverNSDirection();
  140. bool isIrrigated();
  141. bool isPotentialCityWork();
  142. bool isPotentialCityWorkForArea(CyArea* pArea);
  143. bool isFlagDirty();
  144. void setFlagDirty(bool bNewValue);
  145. int /*PlayerTypes*/ getOwner();
  146. void setOwner(int /*PlayerTypes*/ eNewValue);
  147. void setOwnerNoUnitCheck(int /*PlayerTypes*/ eNewValue);
  148. PlotTypes getPlotType();
  149. bool isWater();
  150. bool isFlatlands();
  151. bool isHills();
  152. bool isPeak();
  153. void setPlotType(PlotTypes eNewValue, bool bRecalculate, bool bRebuildGraphics);
  154. int /*TerrainTypes*/ getTerrainType();
  155. void setTerrainType(int /*TerrainTypes*/ eNewValue, bool bRecalculate, bool bRebuildGraphics, bool bTemp = false);
  156. int /*FeatureTypes*/ getFeatureType();
  157. void setFeatureType(int /*FeatureTypes*/ eNewValue, int iVariety);
  158. void setFeatureDummyVisibility(std::string dummyTag, bool show);
  159. void addFeatureDummyModel(std::string dummyTag, std::string modelTag);
  160. void setFeatureDummyTexture(std::string dummyTag, std::string textureTag);
  161. std::string pickFeatureDummyTag(int mouseX, int mouseY);
  162. void resetFeatureModel();
  163. int /* BonusTypes */ getBonusType(int /*TeamTypes*/ eTeam);
  164. int /* BonusTypes */ getNonObsoleteBonusType(int /*TeamTypes*/ eTeam);
  165. void setBonusType(int /* BonusTypes */ eNewValue);
  166. int /* ImprovementTypes */ getImprovementType();
  167. void setImprovementType(int /* ImprovementTypes */ eNewValue);
  168. int /* RouteTypes */ getRouteType();
  169. void setRouteType(int /*RouteTypes*/ eNewValue);
  170. CyCity* getPlotCity();
  171. CyCity* getWorkingCity();
  172. CyCity* getWorkingCityOverride();
  173. int getRiverID() const;
  174. void setRiverID(int iNewValue);
  175. int getMinOriginalStartDist();
  176. int getReconCount();
  177. int getRiverCrossingCount();
  178. int getYield(YieldTypes eIndex);
  179. //>>>>Unofficial Bug Fix: Modified by Denev 2010/05/04
  180. /*
  181. int calculateNatureYield(YieldTypes eIndex, TeamTypes eTeam, bool bIgnoreFeature = false);
  182. int calculateBestNatureYield(YieldTypes eIndex, TeamTypes eTeam);
  183. int calculateTotalBestNatureYield(TeamTypes eTeam);
  184. */
  185. int calculateNatureYield(YieldTypes eIndex, PlayerTypes ePlayer, bool bIgnoreFeature = false);
  186. int calculateBestNatureYield(YieldTypes eIndex, PlayerTypes ePlayer);
  187. int calculateTotalBestNatureYield(PlayerTypes ePlayer);
  188. //<<<<Unofficial Bug Fix: End Modify
  189. int calculateImprovementYieldChange(int /*ImprovementTypes*/ eImprovement, YieldTypes eYield, int /*PlayerTypes*/ ePlayer, bool bOptimal);
  190. int calculateYield(YieldTypes eIndex, bool bDisplay);
  191. bool hasYield();
  192. int getCulture(int /*PlayerTypes*/ eIndex);
  193. int countTotalCulture();
  194. int /*TeamTypes*/ findHighestCultureTeam();
  195. int calculateCulturePercent(int /*PlayerTypes*/ eIndex);
  196. int calculateTeamCulturePercent(int /*TeamTypes*/ eIndex);
  197. void setCulture(int /*PlayerTypes*/ eIndex, int iNewValue, bool bUpdate);
  198. void changeCulture(int /*PlayerTypes*/ eIndex, int iChange, bool bUpdate);
  199. int countNumAirUnits(int /*TeamTypes*/ ePlayer);
  200. int getFoundValue(int /*PlayerTypes*/ eIndex);
  201. bool isBestAdjacentFound(int /*PlayerTypes*/ eIndex);
  202. int getPlayerCityRadiusCount(int /*PlayerTypes*/ eIndex);
  203. bool isPlayerCityRadius(int /*PlayerTypes*/ eIndex);
  204. int getVisibilityCount(int /*TeamTypes*/ eTeam);
  205. void changeVisibilityCount(int /*TeamTypes*/ eTeam, int iChange, int /*InvisibleTypes*/ eSeeInvisible);
  206. int getStolenVisibilityCount(int /*TeamTypes*/ eTeam);
  207. int /*PlayerTypes*/ getRevealedOwner(int /*TeamTypes*/ eTeam, bool bDebug);
  208. int /*TeamTypes*/ getRevealedTeam(int /*TeamTypes*/ eTeam, bool bDebug);
  209. bool isRiverCrossing(DirectionTypes eIndex);
  210. bool isRevealed(int /*TeamTypes*/ eTeam, bool bDebug);
  211. void setRevealed(int /*TeamTypes*/ eTeam, bool bNewValue, bool bTerrainOnly, int /*TeamTypes*/ eFromTeam);
  212. int /* ImprovementTypes */ getRevealedImprovementType(int /*TeamTypes*/ eTeam, bool bDebug);
  213. int /* RouteTypes */ getRevealedRouteType(int /*TeamTypes*/ eTeam, bool bDebug);
  214. int getBuildProgress(int /*BuildTypes*/ eBuild);
  215. bool changeBuildProgress(int /*BuildTypes*/ eBuild, int iChange, int /*TeamTypes*/ eTeam);
  216. int getCultureRangeCities(int /*PlayerTypes*/ eOwnerIndex, int iRangeIndex);
  217. bool isCultureRangeCity(int /*PlayerTypes*/ eOwnerIndex, int iRangeIndex);
  218. int getInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible);
  219. bool isInvisibleVisible(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible);
  220. void changeInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible, int iChange);
  221. int getNumUnits();
  222. CyUnit* getUnit(int iIndex);
  223. std::string getScriptData() const;
  224. void setScriptData(std::string szNewValue);
  225. //FfH: Added by Kael 08/15/2007
  226. void changePlotCounter(int iChange) const;
  227. int getPlotCounter() const;
  228. int getPortalExitX() const;
  229. void setPortalExitX(int iNewValue);
  230. int getPortalExitY() const;
  231. void setPortalExitY(int iNewValue);
  232. bool isMoveDisabledAI() const;
  233. void setMoveDisabledAI(bool bNewValue);
  234. bool isMoveDisabledHuman() const;
  235. void setMoveDisabledHuman(bool bNewValue);
  236. bool isBuildDisabled() const;
  237. void setBuildDisabled(bool bNewValue);
  238. bool isFoundDisabled() const;
  239. void setFoundDisabled(bool bNewValue);
  240. bool isPythonActive() const;
  241. void setPythonActive(bool bNewValue);
  242. bool isAdjacentToWater() const;
  243. int getMinLevel() const;
  244. void setMinLevel(int iNewValue);
  245. int getNumAnimalUnits() const;
  246. bool isVisibleToCivTeam() const;
  247. //FfH: End Add
  248. // Super Forts begin *canal* *choke*
  249. int getCanalValue();
  250. void calculateCanalValue();
  251. int getChokeValue();
  252. void calculateChokeValue();
  253. // Super Forts end
  254. // Temporary Map Items (original code from FFH2 (Kael) and FlavorMod (Jean Elcard) - expanded on for MNAI)
  255. TerrainTypes getRealTerrainType() const;
  256. FeatureTypes getRealFeatureType() const;
  257. int getRealFeatureVariety() const;
  258. BonusTypes getRealBonusType() const;
  259. ImprovementTypes getRealImprovementType() const;
  260. RouteTypes getRealRouteType() const;
  261. void setRealTerrainType(int /*TerrainTypes*/ eTerrain);
  262. void setRealFeatureType(int /*FeatureTypes*/ eFeature);
  263. void setRealFeatureVariety(int iVariety);
  264. void setRealBonusType(int /*BonusTypes*/ eBonus);
  265. void setRealImprovementType(int /*RouteTypes*/ eImprovement);
  266. void setRealRouteType(int /*RouteTypes*/ eRoute);
  267. void setTempTerrainType(int /*TerrainTypes*/ eNewValue, int iTimer);
  268. void setTempFeatureType(int /*FeatureTypes*/ eFeature, int iVariety, int iTimer);
  269. void setTempBonusType(int /*BonusTypes*/ eBonus, int iTimer);
  270. void setTempImprovementType(int /*ImprovementTypes*/ eImprovement, int iTimer);
  271. void setTempRouteType(int /*RouteTypes*/ eRoute, int iTimer);
  272. int getTempTerrainTimer() const;
  273. int getTempFeatureTimer() const;
  274. int getTempBonusTimer() const;
  275. int getTempImprovementTimer() const;
  276. int getTempRouteTimer() const;
  277. void changeTempTerrainTimer(int iChange);
  278. void changeTempFeatureTimer(int iChange);
  279. void changeTempBonusTimer(int iChange);
  280. void changeTempImprovementTimer(int iChange);
  281. void changeTempRouteTimer(int iChange);
  282. bool isHasTempTerrain();
  283. bool isHasTempFeature();
  284. bool isHasTempBonus();
  285. bool isHasTempImprovement();
  286. bool isHasTempRoute();
  287. // End Temporary Map Items
  288. private:
  289. CvPlot* m_pPlot;
  290. };
  291. #endif // CyPlot_h