|
From: <imp...@us...> - 2007-03-12 20:28:44
|
Revision: 36
http://civ4ccp.svn.sourceforge.net/civ4ccp/?rev=36&view=rev
Author: impalerwrg
Date: 2007-03-12 13:28:42 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
incremental TR merger, CvGame and CvEnums.h
Modified Paths:
--------------
CvGameCoreDLL/CvEnums.h
CvGameCoreDLL/CvGame.cpp
CvGameCoreDLL/CvGame.h
Modified: CvGameCoreDLL/CvEnums.h
===================================================================
--- CvGameCoreDLL/CvEnums.h 2007-03-12 16:58:38 UTC (rev 35)
+++ CvGameCoreDLL/CvEnums.h 2007-03-12 20:28:42 UTC (rev 36)
@@ -500,7 +500,6 @@
WIDGET_GLOBELAYER_OPTION,
WIDGET_GLOBELAYER_TOGGLE,
-
WIDGET_ZOOM_CITY_CDA, // Custom Domestic Advisor Widget
#ifdef _USRDLL
@@ -635,10 +634,11 @@
COMMERCE_GOLD,
COMMERCE_RESEARCH,
COMMERCE_CULTURE,
- COMMERCE_HAPPY, // Addition MoreCommerceTypes Impaler[WrG]
- COMMERCE_HEALTH, // Addition MoreCommerceTypes Impaler[WrG]
- COMMERCE_EXPERIENCE, // Addition MoreCommerceTypes Impaler[WrG]
+ COMMERCE_HAPPY, // < MoreCommerce Types Impaler[WrG] >
+ COMMERCE_HEALTH, // < MoreCommerce Types Impaler[WrG] >
+ COMMERCE_EXPERIENCE, // < MoreCommerce Types Impaler[WrG] >
+
#ifdef _USRDLL
NUM_COMMERCE_TYPES
#endif
@@ -681,10 +681,9 @@
GAMEOPTION_COMPLETE_KILLS,
GAMEOPTION_NO_VASSAL_STATES,
GAMEOPTION_NO_GOODY_HUTS,
- GAMEOPTION_GREAT_PEOPLE_POINT_POOLING, // GreatPeoplePointPooling by Impaler[WrG]
- GAMEOPTION_SLOW_CULTURAL_BORDERS, // SlowExpandingCulturalBorders by Chalid
- GAMEOPTION_EXPANDED_CITY_WORK_RADIUS, // ExpandedCityWorkRadius by RogerBacon modified by Impaler[WrG]
+ GAMEOPTION_GREAT_PEOPLE_POINT_POOLING, // < GreatPeople Point Pooling by Impaler[WrG] >
+ GAMEOPTION_SLOW_CULTURAL_BORDERS, // < Slow Expanding Cultural Borders by Chalid >
#ifdef _USRDLL
NUM_GAMEOPTION_TYPES
@@ -1107,6 +1106,7 @@
DENIAL_VASSAL,
DENIAL_WAR_NOT_POSSIBLE_US,
DENIAL_WAR_NOT_POSSIBLE_YOU,
+ DENIAL_FAVORITE_RELIGION, // < Author ??? >
#ifdef _USRDLL
@@ -1189,6 +1189,9 @@
UNITAI_DEFENSE_AIR,
UNITAI_CARRIER_AIR,
+ UNITAI_INQUISITOR, // < Inquisition by Lopez >
+ UNITAI_INQUISITOR_SEA, // < Inquisition by Lopez >
+
#ifdef _USRDLL
NUM_UNITAI_TYPES
#endif
@@ -1289,14 +1292,16 @@
MISSION_MULTI_SELECT,
MISSION_MULTI_DESELECT,
- MISSION_PILLAGE_ROUTE, // Route Pillage by Lopez
+ //---------CCCP NEW-------------
- MISSION_THEFT, // Addition New Spy Missions by Impaler[WrG]
- MISSION_ESPIONAGE, // Addition New Spy Missions by Impaler[WrG]
- MISSION_ASSASINATE, // Addition New Spy Missions by Impaler[WrG]
- MISSION_INSURECTION, // Addition New Spy Missions by Impaler[WrG]
+ MISSION_PILLAGE_ROUTE, // < Route Pillage by Lopez >
+ MISSION_THEFT, // < New Spy Missions by Impaler[WrG] >
+ MISSION_ESPIONAGE, // < New Spy Missions by Impaler[WrG] >
+ MISSION_ASSASINATE, // < New Spy Missions by Impaler[WrG] >
+ MISSION_INSURECTION, // < New Spy Missions by Impaler[WrG] >
+ MISSION_REMOVE_RELIGION, // < Inquisition by Lopez >
#ifdef _USRDLL
NUM_MISSION_TYPES
@@ -1329,6 +1334,8 @@
MISSIONAI_CARRIER,
MISSIONAI_PICKUP,
+ MISSIONAI_REMOVE_RELIGION, // < Inquisition by Lopez >
+
#ifdef _USRDLL
NUM_MISSIONAI_TYPES
#endif
@@ -1798,6 +1805,9 @@
MEMORY_TRADED_TECH_TO_US,
MEMORY_RECEIVED_TECH_FROM_ANY,
+ MEMORY_REMOVED_RELIGION_FROM_CITY, // < Inquisition by Lopez >
+ MEMORY_REMOVED_STATE_RELIGION, // < Inquisition by Lopez >
+
#ifdef _USRDLL
NUM_MEMORY_TYPES
#endif
@@ -2513,11 +2523,4 @@
#endif
};
-//---------------------CCCP NEW----------------------------
-
-enum DllExport FlavorUnitTypes // Addition Flavor Units by Impaler[WrG]
-{
- NO_FLAVORUNIT = -1,
-};
-
#endif // CVENUMS_h
Modified: CvGameCoreDLL/CvGame.cpp
===================================================================
--- CvGameCoreDLL/CvGame.cpp 2007-03-12 16:58:38 UTC (rev 35)
+++ CvGameCoreDLL/CvGame.cpp 2007-03-12 20:28:42 UTC (rev 36)
@@ -22,6 +22,7 @@
#include "FProfiler.h"
#include "CvReplayInfo.h"
#include "CyPlot.h"
+#include "CvGameTextMgr.h"
// interface uses
#include "CvDLLInterfaceIFaceBase.h"
@@ -29,6 +30,12 @@
#include "CvDLLEventReporterIFaceBase.h"
#include "CvDLLPythonIFaceBase.h"
+// for testing only
+#ifndef FINAL_RELEASE
+//#define DEBUG_OUT_OF_SYNCS
+#endif
+
+
// Public Functions...
CvGame::CvGame()
@@ -225,7 +232,10 @@
{
if (isVictoryValid((VictoryTypes)iI))
{
- if ((GC.getVictoryInfo((VictoryTypes)iI).isEndScore()) || (GC.getVictoryInfo((VictoryTypes)iI).isTotalVictory())) // Mastery Victory by Sevo
+ // < Mastery Victory by Sevo Start >
+ // ORIGINAL CODE if (GC.getVictoryInfo((VictoryTypes)iI).isEndScore())
+ if ((GC.getVictoryInfo((VictoryTypes)iI).isEndScore()) || (GC.getVictoryInfo((VictoryTypes)iI).isTotalVictory()))
+ // < Mastery Victory End >
{
bValid = true;
break;
@@ -244,7 +254,7 @@
setEstimateEndTurn(getGameTurn() + getMaxTurns());
}
- // Start Mastery Victory by Sevo
+ // < Mastery Victory by Sevo Start >
bValid = false;
for (iI = 0; iI < GC.getNumVictoryInfos(); iI++)
{
@@ -262,9 +272,8 @@
setVictoryValid((VictoryTypes)iI, true);
}
}
- // End Mastery Victory by Sevo
+ // < Mastery Victory End >
-
setStartYear(GC.getDefineINT("START_YEAR"));
for (iI = 0; iI < GC.getNumSpecialUnitInfos(); iI++)
@@ -443,6 +452,12 @@
m_bHotPbemBetweenTurns = false;
m_bPlayerOptionsSent = false;
+ // < Inquisition Mod by Lopez Start >
+ m_bRequireStateReligionForReligionRemoval = true;
+ m_bRequireCityOwnerStateReligionMatchForReligionRemoval = true;
+ m_bRequireOpenBordersForReligionRemoval = true;
+ // < Inquisition Mod End >
+
m_eHandicap = eHandicap;
m_ePausePlayer = NO_PLAYER;
m_eBestLandUnit = NO_UNIT;
@@ -975,7 +990,7 @@
}
}
-
+/*
void CvGame::normalizeAddRiver()
{
CvPlot* pStartingPlot;
@@ -991,12 +1006,24 @@
{
if (!pStartingPlot->isFreshWater())
{
- CvMapGenerator::GetInstance().doRiver(pStartingPlot);
+ // < River Maker by ??? Start >
+ // if we will be able to add a lake, then use old river code
+ if (normalizeFindLakePlot((PlayerTypes)iI) != NULL)
+ {
+ CvMapGenerator::GetInstance().doRiver(pStartingPlot);
+ }
+ // otherwise, use new river code which is much more likely to succeed
+ else
+ {
+ CvMapGenerator::GetInstance().addRiver(pStartingPlot);
+ }
+ // < River Maker End >
}
}
}
}
}
+*/
void CvGame::normalizeRemovePeaks()
@@ -1037,7 +1064,6 @@
}
}
-
void CvGame::normalizeAddLakes()
{
CvPlot* pStartingPlot;
@@ -1049,47 +1075,59 @@
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
- pStartingPlot = GET_PLAYER((PlayerTypes)iI).getStartingPlot();
+ CvPlot* pLakePlot = normalizeFindLakePlot((PlayerTypes)iI);
+ if (pLakePlot != NULL)
+ {
+ pLakePlot->setPlotType(PLOT_OCEAN);
+ }
+ }
+ }
+}
- if (pStartingPlot != NULL)
+CvPlot* CvGame::normalizeFindLakePlot(PlayerTypes ePlayer)
+{
+ if (!GET_PLAYER(ePlayer).isAlive())
+ {
+ return NULL;
+ }
+
+ CvPlot* pStartingPlot = GET_PLAYER(ePlayer).getStartingPlot();
+ if (pStartingPlot != NULL)
+ {
+ if (!(pStartingPlot->isFreshWater()))
+ {
+ for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
- if (!(pStartingPlot->isFreshWater()))
+ CvPlot* pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
+
+ if (pLoopPlot != NULL)
{
- for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
+ if (!(pLoopPlot->isWater()))
{
- pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
-
- if (pLoopPlot != NULL)
+ if (!(pLoopPlot->isCoastalLand()))
{
- if (!(pLoopPlot->isWater()))
+ if (!(pLoopPlot->isRiver()))
{
- if (!(pLoopPlot->isCoastalLand()))
+ if (pLoopPlot->getBonusType() == NO_BONUS)
{
- if (!(pLoopPlot->isRiver()))
+ bool bStartingPlot = false;
+
+ for (int iK = 0; iK < MAX_CIV_PLAYERS; iK++)
{
- if (pLoopPlot->getBonusType() == NO_BONUS)
+ if (GET_PLAYER((PlayerTypes)iK).isAlive())
{
- bStartingPlot = false;
-
- for (iK = 0; iK < MAX_CIV_PLAYERS; iK++)
+ if (GET_PLAYER((PlayerTypes)iK).getStartingPlot() == pLoopPlot)
{
- if (GET_PLAYER((PlayerTypes)iK).isAlive())
- {
- if (GET_PLAYER((PlayerTypes)iK).getStartingPlot() == pLoopPlot)
- {
- bStartingPlot = true;
- break;
- }
- }
- }
-
- if (!bStartingPlot)
- {
- pLoopPlot->setPlotType(PLOT_OCEAN);
+ bStartingPlot = true;
break;
}
}
}
+
+ if (!bStartingPlot)
+ {
+ return pLoopPlot;
+ }
}
}
}
@@ -1098,6 +1136,8 @@
}
}
}
+
+ return NULL;
}
@@ -1132,7 +1172,43 @@
}
}
}
- }
+
+ int iX, iY;
+ int iCityRange = CITY_PLOTS_RADIUS;
+ int iExtraRange = 2;
+ int iMaxRange = iCityRange + iExtraRange;
+
+ for (iX = -iMaxRange; iX <= iMaxRange; iX++)
+ {
+ for (iY = -iMaxRange; iY <= iMaxRange; iY++)
+ {
+ pLoopPlot = plotXY(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iX, iY);
+ if (pLoopPlot != NULL)
+ {
+ int iDistance = plotDistance(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE());
+ if (iDistance <= iMaxRange)
+ {
+ if (pLoopPlot->getFeatureType() != NO_FEATURE)
+ {
+ if ((GC.getFeatureInfo(pLoopPlot->getFeatureType()).getYieldChange(YIELD_FOOD) <= 0) && (GC.getFeatureInfo(pLoopPlot->getFeatureType()).getYieldChange(YIELD_PRODUCTION) <= 0))
+ {
+ if (pLoopPlot->isWater())
+ {
+ if (pLoopPlot->isAdjacentToLand() || (!(iDistance == iMaxRange) && (getSorenRandNum(2, "Remove Bad Feature") == 0)))
+ pLoopPlot->setFeatureType(NO_FEATURE);
+ }
+ else
+ {
+ if (!(iDistance == iMaxRange) && (getSorenRandNum((2 + (pLoopPlot->getBonusType() == NO_BONUS) ? 0 : 2), "Remove Bad Feature") == 0))
+ pLoopPlot->setFeatureType(NO_FEATURE);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
}
@@ -1141,8 +1217,19 @@
{
CvPlot* pStartingPlot;
CvPlot* pLoopPlot;
- int iI, iJ, iK;
+ int iI, iK;
+ int iX, iY;
+ int iTargetFood;
+ int iTargetTotal;
+ int iPlotFood;
+ int iPlotProduction;
+
+
+ int iCityRange = CITY_PLOTS_RADIUS;
+ int iExtraRange = 1;
+ int iMaxRange = iCityRange + iExtraRange;
+
for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
@@ -1151,32 +1238,57 @@
if (pStartingPlot != NULL)
{
- for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
- {
- pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
+ for (iX = -iMaxRange; iX <= iMaxRange; iX++)
+ {
+ for (iY = -iMaxRange; iY <= iMaxRange; iY++)
+ {
+ pLoopPlot = plotXY(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iX, iY);
+ if (pLoopPlot != NULL)
+ {
+ int iDistance = plotDistance(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE());
+ if (iDistance <= iMaxRange)
+ {
+ if (!(pLoopPlot->isWater()) && ((iDistance <= iCityRange) || (pLoopPlot->isCoastalLand()) || (0 == getSorenRandNum(1 + iDistance - iCityRange, "Map Upgrade Terrain Food"))))
+ {
+ iPlotFood = GC.getTerrainInfo(pLoopPlot->getTerrainType()).getYield(YIELD_FOOD);
+ iPlotProduction = GC.getTerrainInfo(pLoopPlot->getTerrainType()).getYield(YIELD_PRODUCTION);
+ if ((iPlotFood + iPlotProduction) <= 1)
+ {
+ iTargetFood = 1;
+ iTargetTotal = 1;
+ if (pLoopPlot->getBonusType(GET_PLAYER((PlayerTypes)iI).getTeam()) != NO_BONUS)
+ {
+ iTargetFood = 1;
+ iTargetTotal = 2;
+ }
+ else if ((iPlotFood == 1) || (iDistance <= iCityRange))
+ {
+ iTargetFood = 1 + getSorenRandNum(2, "Map Upgrade Terrain Food");
+ iTargetTotal = 2;
+ }
+ else
+ {
+ iTargetFood = pLoopPlot->isCoastalLand() ? 2 : 1;
+ iTargetTotal = 2;
+ }
- if (pLoopPlot != NULL)
- {
- if (!(pLoopPlot->isWater()))
- {
- if ((GC.getTerrainInfo(pLoopPlot->getTerrainType()).getYield(YIELD_FOOD) + GC.getTerrainInfo(pLoopPlot->getTerrainType()).getYield(YIELD_PRODUCTION)) <= 1)
- {
- for (iK = 0; iK < GC.getNumTerrainInfos(); iK++)
- {
- if (!(GC.getTerrainInfo((TerrainTypes)iK).isWater()))
- {
- if ((GC.getTerrainInfo((TerrainTypes)iK).getYield(YIELD_FOOD) + GC.getTerrainInfo((TerrainTypes)iK).getYield(YIELD_PRODUCTION)) > 1)
- {
- if ((pLoopPlot->getFeatureType() == NO_FEATURE) || GC.getFeatureInfo(pLoopPlot->getFeatureType()).isTerrain(iK))
- {
- pLoopPlot->setTerrainType((TerrainTypes)iK);
- }
- }
- }
- }
- }
- }
- }
+ for (iK = 0; iK < GC.getNumTerrainInfos(); iK++)
+ {
+ if (!(GC.getTerrainInfo((TerrainTypes)iK).isWater()))
+ {
+ if ((GC.getTerrainInfo((TerrainTypes)iK).getYield(YIELD_FOOD) >= iTargetFood) &&
+ (GC.getTerrainInfo((TerrainTypes)iK).getYield(YIELD_FOOD) + GC.getTerrainInfo((TerrainTypes)iK).getYield(YIELD_PRODUCTION)) == iTargetTotal)
+ {
+ if ((pLoopPlot->getFeatureType() == NO_FEATURE) || GC.getFeatureInfo(pLoopPlot->getFeatureType()).isTerrain(iK))
+ pLoopPlot->setTerrainType((TerrainTypes)iK);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -1191,6 +1303,7 @@
BonusTypes eBonus;
bool bIgnoreLatitude;
int iFoodBonus;
+ int iGoodNatureTileCount;
int iI, iJ, iK;
bIgnoreLatitude = false;
@@ -1205,6 +1318,7 @@
if (pStartingPlot != NULL)
{
iFoodBonus = 0;
+ iGoodNatureTileCount = 0;
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
@@ -1216,27 +1330,41 @@
if (eBonus != NO_BONUS)
{
+ if (pLoopPlot->calculateBestNatureYield(YIELD_FOOD, GET_PLAYER((PlayerTypes)iI).getTeam()) >= 2)
+ {
+ iGoodNatureTileCount++;
+ }
if (GC.getBonusInfo(eBonus).getYieldChange(YIELD_FOOD) > 0)
{
if ((GC.getBonusInfo(eBonus).getTechCityTrade() == NO_TECH) || (GC.getTechInfo((TechTypes)(GC.getBonusInfo(eBonus).getTechCityTrade())).getEra() <= getStartEra()))
{
if (pLoopPlot->isWater())
{
- iFoodBonus++;
+ iFoodBonus += 2;
}
else
{
- iFoodBonus += 2;
+ iFoodBonus += 3;
}
}
}
}
+ else
+ {
+ if (pLoopPlot->calculateBestNatureYield(YIELD_FOOD, GET_PLAYER((PlayerTypes)iI).getTeam()) >= 3)
+ {
+ iGoodNatureTileCount++;
+ }
+ }
}
}
+ int iTargetFoodBonusCount = 3;
+ iTargetFoodBonusCount += (iGoodNatureTileCount == 0) ? 2 : 0;
+
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
- if (iFoodBonus >= 2)
+ if (iFoodBonus >= iTargetFoodBonusCount)
{
break;
}
@@ -1264,11 +1392,11 @@
pLoopPlot->setBonusType((BonusTypes)iK);
if (pLoopPlot->isWater())
{
- iFoodBonus++;
+ iFoodBonus += 2;
}
else
{
- iFoodBonus += 2;
+ iFoodBonus += 3;
}
break;
}
@@ -1398,16 +1526,26 @@
CvPlot* pLoopPlot;
bool bIgnoreLatitude;
int iValue;
- int iMaxValue;
+ int iTotalValue;
+ int iBestValue;
+ int iWorstValue;
int iTargetValue;
int iCount;
int iPass;
+ int iPlayerCount;
int iI, iJ, iK;
+ int iOceanFoodCount;
+ int iCoastFoodCount;
+ bool bLandBias;
+
bIgnoreLatitude = false;
gDLL->getPythonIFace()->pythonIsBonusIgnoreLatitudes(&bIgnoreLatitude);
- iMaxValue = 0;
+ iTotalValue = 0;
+ iPlayerCount = 0;
+ iBestValue = 0;
+ iWorstValue = MAX_INT;
for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
@@ -1418,14 +1556,19 @@
if (pStartingPlot != NULL)
{
iValue = GET_PLAYER((PlayerTypes)iI).AI_foundValue(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), -1, true);
+ iTotalValue += iValue;
+ iPlayerCount++;
- iMaxValue = max(iMaxValue, iValue);
+ iBestValue = max(iValue, iBestValue);
+ iWorstValue = min(iValue, iWorstValue);
+
}
}
}
- iTargetValue = ((iMaxValue * 4) / 5);
+ iTargetValue = (iBestValue * 4) / 5;
+
for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
@@ -1435,7 +1578,8 @@
if (pStartingPlot != NULL)
{
- iCount = 0;
+ iCount = 0;
+ int iFeatureCount = 0;
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
@@ -1469,28 +1613,68 @@
}
}
}
+
+ iFeatureCount += (pLoopPlot->getFeatureType() != NO_FEATURE) ? 1 : 0;
}
}
}
}
}
- iCount = 0;
-
+ iCoastFoodCount = 0;
+ iOceanFoodCount = 0;
+ int iWaterCount = 0;
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
- if (GET_PLAYER((PlayerTypes)iI).AI_foundValue(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), -1, true) >= iTargetValue)
+ pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
+ if (pLoopPlot != NULL)
{
- break;
+ if (pLoopPlot != pStartingPlot)
+ {
+ iWaterCount++;
+ if (pLoopPlot->isWater())
+ {
+ if (pLoopPlot->getBonusType() != NO_BONUS)
+ {
+ if (pLoopPlot->isAdjacentToLand())
+ {
+ iCoastFoodCount++;
+ }
+ else
+ {
+ iOceanFoodCount++;
+ }
+ }
+ }
+ }
}
+ }
- if (getSorenRandNum(((iCount * 4) + 1), "Placing Bonuses") == 0)
- {
- pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
+ if (iWaterCount > NUM_CITY_PLOTS / 2)
+ {
+ bLandBias = true;
+ }
- if (pLoopPlot != NULL)
- {
- if (pLoopPlot != pStartingPlot)
+ iCount = 0;
+
+ for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
+ {
+ pLoopPlot = plotCity(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), iJ);
+
+ if ((pLoopPlot != NULL) && (pLoopPlot != pStartingPlot))
+ {
+ if (getSorenRandNum((((iCount * 3) + 1) * ((bLandBias && pLoopPlot->isWater()) ? 2 : 1)), "Placing Bonuses") == 0)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).AI_foundValue(pStartingPlot->getX_INLINE(), pStartingPlot->getY_INLINE(), -1, true) >= iTargetValue)
+ {
+ break;
+ }
+
+ bool bCoast = (pLoopPlot->isWater() && pLoopPlot->isAdjacentToLand());
+ bool bOcean = (pLoopPlot->isWater() && !bCoast);
+ if ((pLoopPlot != pStartingPlot)
+ && !(bCoast && (iCoastFoodCount > 2))
+ && !(bOcean && (iOceanFoodCount > 2)))
{
for (iPass = 0; iPass < 2; iPass++)
{
@@ -1511,6 +1695,8 @@
{
pLoopPlot->setBonusType((BonusTypes)iK);
iCount++;
+ iCoastFoodCount += bCoast ? 1 : 0;
+ iOceanFoodCount += bOcean ? 1 : 0;
break;
}
}
@@ -1518,6 +1704,40 @@
}
}
}
+
+ if (bLandBias && !(pLoopPlot->isWater()) && pLoopPlot->getBonusType() != NO_BONUS)
+ {
+ if (((iFeatureCount > 4) && (pLoopPlot->getFeatureType() != NO_FEATURE))
+ && ((iCoastFoodCount + iOceanFoodCount) > 2))
+ {
+ pLoopPlot->setFeatureType(NO_FEATURE);
+ if (getSorenRandNum(2, "Clear feature do add bonus") == 0)
+ {
+ for (iK = 0; iK < GC.getNumBonusInfos(); iK++)
+ {
+ if (GC.getBonusInfo((BonusTypes)iK).isNormalize())
+ {
+ //???no bonuses with negative yields?
+ if ((GC.getBonusInfo((BonusTypes)iK).getYieldChange(YIELD_FOOD) >= 0) &&
+ (GC.getBonusInfo((BonusTypes)iK).getYieldChange(YIELD_PRODUCTION) >= 0))
+ {
+ if ((GC.getBonusInfo((BonusTypes)iK).getTechCityTrade() == NO_TECH) || (GC.getTechInfo((TechTypes)(GC.getBonusInfo((BonusTypes)iK).getTechCityTrade())).getEra() <= getStartEra()))
+ {
+ if ((iPass == 0) ? CvMapGenerator::GetInstance().canPlaceBonusAt(((BonusTypes)iK), pLoopPlot->getX(), pLoopPlot->getY(), bIgnoreLatitude) : pLoopPlot->canHaveBonus(((BonusTypes)iK), bIgnoreLatitude))
+ {
+ pLoopPlot->setBonusType((BonusTypes)iK);
+ iCount++;
+ iCoastFoodCount += bCoast ? 1 : 0;
+ iOceanFoodCount += bOcean ? 1 : 0;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -1876,6 +2096,138 @@
}
else if (pHeadSelectedUnit != NULL)
{
+#ifdef ITS_FULL_OF_STARS
+ // testing
+ static bool bDrawVisibility = true;
+ if (bDrawVisibility)
+ {
+ TeamTypes eTeam = pHeadSelectedUnit->getTeam();
+ int iRange = pHeadSelectedUnit->visibilityRange();
+
+ CvPlotDataRegion visiblePlotDataRegion;
+ pHeadSelectedUnit->getGroup()->buildVisibilityRegion(visiblePlotDataRegion);
+ for(CvPlotDataRegionIterator it = visiblePlotDataRegion.begin(); it != visiblePlotDataRegion.end(); it++)
+ {
+ XYCoords xy(getXYCoords(it));
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(xy.iX, xy.iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ CvPlotRegion visiblePlotRegion;
+ pHeadSelectedUnit->getGroup()->buildVisibilityRegion(visiblePlotRegion);
+ for(CvPlotRegionIterator it = visiblePlotRegion.begin(); it != visiblePlotRegion.end(); it++)
+ {
+ XYCoords xy(getXYCoords(it));
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(xy.iX, xy.iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_UNIT_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ /*CvPlotDataRegion visiblePlotRegion;
+ pHeadSelectedUnit->getGroup()->buildVisibilityRegion(visiblePlotRegion);
+ for(CvPlotDataRegionIterator it = visiblePlotRegion.begin(); it != visiblePlotRegion.end(); it++)
+ {
+ XYCoords xy(getXYCoords(it));
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(xy.iX, xy.iY);
+ FAssert(pLoopPlot != NULL);
+ CvUnitAI* pUnit = static_cast<CvUnitAI*>(pHeadSelectedUnit);
+ if (pUnit->AI_fogbustPlotValue(pLoopPlot, getRegionValue(it)) > 0)
+ {
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_UNIT_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+ }*/
+
+ /*CvPlotDataRegion visibilityValues;
+ pHeadSelectedUnit->plot()->addVisiblePlots(visibilityValues, iRange, 1, eTeam);
+
+ if (pHeadSelectedUnit->getDomainType() == DOMAIN_LAND)
+ {
+ CvPlotDataRegion adjacentPlots;
+ bool bIncludeOriginal = (pHeadSelectedUnit->getDomainType() == DOMAIN_AIR);
+ int iRange = (pHeadSelectedUnit->getDomainType() == DOMAIN_LAND) ? 2 : 1;
+ findAdjacentPlots(visibilityValues, adjacentPlots, bIncludeOriginal, iRange);
+ for(CvPlotDataRegionIterator it = adjacentPlots.begin(); it != adjacentPlots.end(); it++)
+ {
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(it->first.iX, it->first.iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_POSITIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ CvPlotDataRegion furtherAdjacentPlots;
+ bIncludeOriginal = false;
+ iRange = 1;
+ findAdjacentPlots(adjacentPlots, furtherAdjacentPlots, bIncludeOriginal, iRange);
+ for(CvPlotDataRegionIterator it = furtherAdjacentPlots.begin(); it != furtherAdjacentPlots.end(); it++)
+ {
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(it->first.iX, it->first.iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+ }
+ else
+ {
+ CvPlotRegion adjacentPlots;
+ bool bIncludeOriginal = (pHeadSelectedUnit->getDomainType() == DOMAIN_AIR);
+ int iRange = (pHeadSelectedUnit->getDomainType() == DOMAIN_LAND) ? 2 : 1;
+ findAdjacentPlots(visiblePlotRegion, adjacentPlots, bIncludeOriginal, iRange);
+ for(CvPlotRegionIterator it = adjacentPlots.begin(); it != adjacentPlots.end(); it++)
+ {
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(it->iX, it->iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_POSITIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ CvPlotRegion furtherAdjacentPlots;
+ bIncludeOriginal = false;
+ iRange = 1;
+ findAdjacentPlots(adjacentPlots, furtherAdjacentPlots, bIncludeOriginal, iRange);
+ for(CvPlotRegionIterator it = furtherAdjacentPlots.begin(); it != furtherAdjacentPlots.end(); it++)
+ {
+ CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(it->iX, it->iY);
+ FAssert(pLoopPlot != NULL);
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ }*/
+
+ //CLinkList<CvPlot*> visiblePlotList;
+ //pHeadSelectedUnit->plot()->getVisiblePlotsList(visiblePlotList, eTeam, iRange);
+ /*for (CLLNode<CvPlot*>* pNode = visiblePlotList.head(); (pNode != NULL); pNode = visiblePlotList.next(pNode))
+ {
+ CvPlot* pLoopPlot = pNode->m_data;
+ CvPlotDataRegionIterator itValue = visibilityValues.find(XYCoords(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE()));
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(itValue != visibilityValues.end() ? "COLOR_UNIT_TEXT" : "COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }*/
+
+ //// check size
+ //FAssert(visiblePlotList.getLength() == visiblePlotRegion.size());
+
+ //// compare
+ //for (CLLNode<CvPlot*>* pNode = visiblePlotList.head(); (pNode != NULL); pNode = visiblePlotList.next(pNode))
+ //{
+ // CvPlotRegionIterator itPlot = visiblePlotRegion.find(XYCoords(pNode->m_data->getX_INLINE(), pNode->m_data->getY_INLINE()));
+ // FAssert(itPlot != visiblePlotRegion.end());
+ //}
+
+ /*CLinkList<CvPlot*> furtherPlotList;
+ pHeadSelectedUnit->plot()->getVisiblePlotsList(furtherPlotList, eTeam, iRange + 2, &visiblePlotList);
+ for (CLLNode<CvPlot*>* pNode = furtherPlotList.head(); (pNode != NULL); pNode = furtherPlotList.next(pNode))
+ {
+ CvPlot* pLoopPlot = pNode->m_data;
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+ pHeadSelectedUnit->plot()->getVisiblePlotsList(furtherPlotList, eTeam, iRange + 1, &visiblePlotList);
+ for (CLLNode<CvPlot*>* pNode = furtherPlotList.head(); (pNode != NULL); pNode = furtherPlotList.next(pNode))
+ {
+ CvPlot* pLoopPlot = pNode->m_data;
+ gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_POSITIVE_TEXT")).getColor(), PLOT_STYLE_BOX_OUTLINE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }*/
+
+ }
+#endif
+
if (gDLL->getGraphicOption(GRAPHICOPTION_CITY_RADIUS))
{
if (gDLL->getInterfaceIFace()->canSelectionListFound())
@@ -1940,6 +2292,8 @@
if (!(GET_PLAYER(getActivePlayer()).isOption(PLAYEROPTION_NO_UNIT_RECOMMENDATIONS)))
{
+ bool bFoundRecommendation = false;
+
if ((pHeadSelectedUnit->AI_getUnitAIType() == UNITAI_WORKER) || (pHeadSelectedUnit->AI_getUnitAIType() == UNITAI_WORKER_SEA))
{
if (pHeadSelectedUnit->plot()->getOwnerINLINE() == pHeadSelectedUnit->getOwnerINLINE())
@@ -1950,6 +2304,8 @@
{
if (pHeadSelectedUnit->AI_bestCityBuild(pCity, &pBestPlot))
{
+ bFoundRecommendation = true;
+
FAssert(pBestPlot != NULL);
gDLL->getEngineIFace()->addColoredPlot(pBestPlot->getX_INLINE(), pBestPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
@@ -1983,6 +2339,7 @@
{
if (pLoopPlot->isBestAdjacentFound(pHeadSelectedUnit->getOwnerINLINE()))
{
+ bFoundRecommendation = true;
gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
}
}
@@ -1991,6 +2348,7 @@
{
if (pLoopPlot->isRevealedGoody(pHeadSelectedUnit->getTeam()))
{
+ bFoundRecommendation = true;
gDLL->getEngineIFace()->addColoredPlot(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
}
}
@@ -2000,6 +2358,33 @@
}
}
}
+
+#ifdef GIVE_EXPLORER_SUGGESTIONS
+ if (!bFoundRecommendation && (pHeadSelectedUnit->isNoBadGoodies() || pHeadSelectedUnit->getDomainType() == DOMAIN_SEA))
+ {
+ CvPlot* pBestExplorePlotThisTurn = NULL;
+ CvPlot* pBestExplorePlot = pHeadSelectedUnit->AI_getBestExplorePlot((pHeadSelectedUnit->getDomainType() == DOMAIN_SEA) ? 4 : 3, &pBestExplorePlotThisTurn, /*bNoRandom*/ true);
+ if (pBestExplorePlotThisTurn != NULL)
+ {
+ if (pBestExplorePlotThisTurn != pHeadSelectedUnit->plot())
+ {
+ gDLL->getEngineIFace()->addColoredPlot(pBestExplorePlotThisTurn->getX_INLINE(), pBestExplorePlotThisTurn->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+ else if (pBestExplorePlot != NULL && pBestExplorePlotThisTurn != pBestExplorePlot)
+ {
+ gDLL->getEngineIFace()->addColoredPlot(pBestExplorePlot->getX_INLINE(), pBestExplorePlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+
+#ifdef FASSERT_ENABLE
+ if (pBestExplorePlot != NULL && pBestExplorePlotThisTurn != pBestExplorePlot)
+ {
+ gDLL->getEngineIFace()->addColoredPlot(pBestExplorePlot->getX_INLINE(), pBestExplorePlot->getY_INLINE(), GC.getColorInfo((ColorTypes)GC.getInfoTypeForString("COLOR_NEGATIVE_TEXT")).getColor(), PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS);
+ }
+#endif
+ }
+ }
+#endif
+
}
}
}
@@ -3637,6 +4022,40 @@
FAssertMsg(eOtherWho != NO_PLAYER, "OtherWho is not assigned a valid value");
FAssertMsg(eWho != eOtherWho, "eWho is not expected to be equal with eOtherWho");
+ // if debug mode (ctrl-z under chipotle), then notify the human that a deal was made
+ if (GC.getGameINLINE().isDebugMode())
+ {
+ FAssertMsg(((pOurList->getLength() > 0) || (pTheirList->getLength() > 0)), "Empty trade implemented?!");
+
+ PlayerTypes iActivePlayer = GC.getGameINLINE().getActivePlayer();
+
+ if (iActivePlayer != eWho && iActivePlayer != eOtherWho)
+ {
+ bool bReportTrade = true;
+
+ // special check for the triple open borders issue
+ CLLNode<TradeData>* pNode = pOurList->head();
+ if (pNode != NULL)
+ {
+ if (pNode->m_data.m_eItemType == TRADE_OPEN_BORDERS && pNode->m_data.m_iData != 0)
+ {
+ bReportTrade = false;
+ }
+ }
+
+ if (bReportTrade)
+ {
+ CvWString szString;
+ CvWString szDealString;
+
+ szDealString.clear();
+ // TODO Fix GAMETEXT.getDealString(szDealString, eWho, eOtherWho, pOurList, pTheirList, iActivePlayer);
+ szString.Format(L"%s", szDealString.GetCString());
+ gDLL->getInterfaceIFace()->addMessage(iActivePlayer, true, GC.getDefineINT("EVENT_MESSAGE_TIME"), szString);
+ }
+ }
+ }
+
pDeal = addDeal();
pDeal->init(pDeal->getID(), eWho, eOtherWho);
pDeal->addTrades(pOurList, pTheirList, !bForce);
@@ -3832,10 +4251,10 @@
{
if (getPlayerVote(((PlayerTypes)iI), eVote) == iChoice)
{
- // StartChange TraitVotes by Impaler[WrG]
+ // < TraitVotes by Impaler[WrG] Start >
// ORIGINAL CODE iCount += (GET_PLAYER((PlayerTypes)iI).getTotalPopulation() * GET_PLAYER((PlayerTypes)iI).getVoteModifier() /100);
iCount += ((GET_PLAYER((PlayerTypes)iI).getTotalPopulation() * GET_PLAYER((PlayerTypes)iI).getVoteModifier()) /100);
- // End Change
+ // < TraitVotes End >
}
}
}
@@ -3855,10 +4274,10 @@
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
- // Start Change TraitVotes by Impaler[WrG]
+ // < TraitVotes by Impaler[WrG] Start >
// ORIGINAL CODE iCount += GET_PLAYER((PlayerTypes)iI).getTotalPopulation();
iCount += ((GET_PLAYER((PlayerTypes)iI).getTotalPopulation() * GET_PLAYER((PlayerTypes)iI).getVoteModifier()) /100);
- // End Change
+ // < TraitVotes End >
}
}
@@ -4938,7 +5357,7 @@
{
m_iAIAutoPlay = max(0, iNewValue);
-// ---------------- AI_AUTO_PLAY_MOD start (2006-07-04)-------------------
+ // < AI Autoplay by jdog5000 Start >
/* ORIGINAL
if ((iOldValue == 0) && (getAIAutoPlay() > 0))
{
@@ -4947,7 +5366,7 @@
}
ORIGINAL */
GET_PLAYER(getActivePlayer()).setDisableHuman((getAIAutoPlay() != 0));
-// ---------------- AI_AUTO_PLAY_MOD end ---------------------------------
+ // < AI Autoplay End >
}
}
@@ -4956,9 +5375,9 @@
{
setAIAutoPlay(getAIAutoPlay() + iChange);
-// ---------------- AI_AUTO_PLAY_MOD start (2006-07-04)-------------------
+ // < AI Autoplay by jdog5000 Start >
GET_PLAYER(getActivePlayer()).setDisableHuman((getAIAutoPlay() != 0));
-// ---------------- AI_AUTO_PLAY_MOD end ---------------------------------
+ // < AI Autoplay End >
}
@@ -7030,9 +7449,9 @@
int iLoop;
int iI, iJ, iK;
- bool bSkip; // Mastery Victory by Sevo
- int iL, iM, winningTeam, topScore, score; // Mastery Victory by Sevo
- CvWString szBuffer; // Mastery Victory by Sevo
+ bool bSkip; // < Mastery Victory by Sevo >
+ int iL, iM, winningTeam, topScore, score; // < Mastery Victory by Sevo >
+ CvWString szBuffer; // < Mastery Victory by Sevo >
if (getVictory() != NO_VICTORY)
{
@@ -7055,9 +7474,8 @@
bEndScore = false;
- // Start Mastery Victory by Sevo
+ // < Mastery Victory by Sevo Start >
// I'm doing a separate loop here because this victory condition is so different from the rest.
-
bSkip = false;
topScore = 0;
winningTeam = -1;
@@ -7157,7 +7575,7 @@
// This creates a conditional for the main loop; we skip it if we're in total victory mode
if (bSkip == false)
{
- // End Mastery Victory by Sevo
+ // < Mastery Victory End >
for (iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
@@ -7674,6 +8092,143 @@
}
}
+#ifdef DEBUG_OUT_OF_SYNCS
+ if (GC.getLogging())
+ {
+ TCHAR szOut[1024];
+ sprintf(szOut, "SyncChecksum = %d on %d\n", iValue, GC.getGameINLINE().getTurnSlice());
+ gDLL->messageControlLog(szOut);
+
+ sprintf(szOut, "m=%d, s=%d, c=%d, p=%d, d=%d, o=%d, a=%d\n",
+ getMapRand().getSeed(),
+ getSorenRand().getSeed(),
+ getNumCities(),
+ getTotalPopulation(),
+ getNumDeals(),
+ GC.getMapINLINE().getOwnedPlots(),
+ GC.getMapINLINE().getNumAreas());
+ gDLL->messageControlLog(szOut);
+
+ sprintf(szOut, "m=%d, s=%d, c=%d, p=%d, d=%d, o=%d, a=%d\n",
+ getMapRand().getSeed(),
+ getSorenRand().getSeed(),
+ getNumCities(),
+ getTotalPopulation(),
+ getNumDeals(),
+ GC.getMapINLINE().getOwnedPlots(),
+ GC.getMapINLINE().getNumAreas());
+ gDLL->messageControlLog(szOut);
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isEverAlive())
+ {
+ sprintf(szOut, "%S: s=%d, p=%d, L=%d, g=%d, a=%d, pw=%d, c=%d, u=%d, sg=%d\n",
+ GET_PLAYER((PlayerTypes)iI).getName(),
+ getPlayerScore((PlayerTypes)iI),
+ GET_PLAYER((PlayerTypes)iI).getTotalPopulation(),
+ GET_PLAYER((PlayerTypes)iI).getTotalLand(),
+ GET_PLAYER((PlayerTypes)iI).getGold(),
+ GET_PLAYER((PlayerTypes)iI).getAssets(),
+ GET_PLAYER((PlayerTypes)iI).getPower(),
+ GET_PLAYER((PlayerTypes)iI).getNumCities(),
+ GET_PLAYER((PlayerTypes)iI).getNumUnits(),
+ GET_PLAYER((PlayerTypes)iI).getNumSelectionGroups());
+ gDLL->messageControlLog(szOut);
+
+ sprintf(szOut, " yield: f=%d, p=%d, c=%d; commerce: g=%d, r=%d, c=%d\n",
+ GET_PLAYER((PlayerTypes)iI).calculateTotalYield(YIELD_FOOD),
+ GET_PLAYER((PlayerTypes)iI).calculateTotalYield(YIELD_PRODUCTION),
+ GET_PLAYER((PlayerTypes)iI).calculateTotalYield(YIELD_COMMERCE),
+ GET_PLAYER((PlayerTypes)iI).getCommerceRate(COMMERCE_GOLD),
+ GET_PLAYER((PlayerTypes)iI).getCommerceRate(COMMERCE_RESEARCH),
+ GET_PLAYER((PlayerTypes)iI).getCommerceRate(COMMERCE_CULTURE));
+ gDLL->messageControlLog(szOut);
+
+ sprintf(szOut, " bonuses: ");
+ gDLL->messageControlLog(szOut);
+ for (iJ = 0; iJ < GC.getNumBonusInfos(); iJ++)
+ {
+ int iAvailableBonuses = GET_PLAYER((PlayerTypes)iI).getNumAvailableBonuses((BonusTypes)iJ);
+ int iBonusImport = GET_PLAYER((PlayerTypes)iI).getBonusImport((BonusTypes)iJ);
+ int iBonusExport = GET_PLAYER((PlayerTypes)iI).getBonusExport((BonusTypes)iJ);
+
+ if (iAvailableBonuses != 0 || iBonusImport != 0 || iBonusExport != 0)
+ {
+ sprintf(szOut, "%S: f=%d, p=%d, c=%d; ", GC.getBonusInfo((BonusTypes)iJ).getDescription(), iAvailableBonuses, iBonusImport, iBonusExport);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ sprintf(szOut, "\n imrovements: ");
+ gDLL->messageControlLog(szOut);
+ for (iJ = 0; iJ < GC.getNumImprovementInfos(); iJ++)
+ {
+ int iImprovementCount = GET_PLAYER((PlayerTypes)iI).getImprovementCount((ImprovementTypes)iJ);
+ if (iImprovementCount != 0)
+ {
+ sprintf(szOut, "%S=%d, ", GC.getImprovementInfo((ImprovementTypes)iJ).getDescription(), iImprovementCount);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ sprintf(szOut, "\n buildings: ");
+ gDLL->messageControlLog(szOut);
+ for (iJ = 0; iJ < GC.getNumBuildingClassInfos(); iJ++)
+ {
+ int iBuildingCount = GET_PLAYER((PlayerTypes)iI).getBuildingClassCountPlusMaking((BuildingClassTypes)iJ);
+ if (iBuildingCount != 0)
+ {
+ sprintf(szOut, "%S=%d, ", GC.getBuildingClassInfo((BuildingClassTypes)iJ).getDescription(), iBuildingCount);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ sprintf(szOut, "\n unitclasses: ");
+ gDLL->messageControlLog(szOut);
+ for (iJ = 0; iJ < GC.getNumUnitClassInfos(); iJ++)
+ {
+ int iUnitCount = GET_PLAYER((PlayerTypes)iI).getUnitClassCountPlusMaking((UnitClassTypes)iJ);
+ if (iUnitCount != 0)
+ {
+ sprintf(szOut, "%S=%d, ", GC.getUnitClassInfo((UnitClassTypes)iJ).getDescription(), iUnitCount);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ sprintf(szOut, "\n unitais: ");
+ gDLL->messageControlLog(szOut);
+ for (iJ = 0; iJ < NUM_UNITAI_TYPES; iJ++)
+ {
+ int iUnitAICount = GET_PLAYER((PlayerTypes)iI).AI_totalUnitAIs((UnitAITypes)iJ);
+ if (iUnitAICount != 0)
+ {
+ sprintf(szOut, "%S=%d, ", GC.getUnitAIInfo((UnitAITypes)iJ).getDescription(), iUnitAICount);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ sprintf(szOut, "\n units: ");
+ gDLL->messageControlLog(szOut);
+ for (pLoopUnit = GET_PLAYER((PlayerTypes)iI).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER((PlayerTypes)iI).nextUnit(&iLoop))
+ {
+ sprintf(szOut, "%S(%d,%d), d=%d, %dexp, l=%d; ",
+ pLoopUnit->getName().GetCString(),
+ pLoopUnit->getX_INLINE(),
+ pLoopUnit->getY_INLINE(),
+ pLoopUnit->getDamage(),
+ pLoopUnit->getExperience(),
+ pLoopUnit->getLevel());
+ gDLL->messageControlLog(szOut);
+ }
+
+ sprintf(szOut, "\n\n");
+ gDLL->messageControlLog(szOut);
+ }
+ }
+ }
+#endif
+
return iValue;
}
@@ -7996,6 +8551,12 @@
pStream->Read(MAX_PLAYERS, starshipLaunched); // Mastery Victory by Sevo
pStream->Read(MAX_PLAYERS, diplomaticVictoryAchieved); // Mastery Victory by Sevo
+
+ // < Inquisition Mod by Lopez Start >
+ pStream->Read(&m_bRequireStateReligionForReligionRemoval);
+ pStream->Read(&m_bRequireCityOwnerStateReligionMatchForReligionRemoval);
+ pStream->Read(&m_bRequireOpenBordersForReligionRemoval);
+ // < Inquisition Mod End >
}
@@ -8122,6 +8683,12 @@
pStream->Write(MAX_PLAYERS, starshipLaunched); // Mastery Victory by Sevo
pStream->Write(MAX_PLAYERS, diplomaticVictoryAchieved); // Mastery Victory by Sevo
+
+ // < Inquisition Mod by Lopez Start >
+ pStream->Write(m_bRequireStateReligionForReligionRemoval);
+ pStream->Write(m_bRequireCityOwnerStateReligionMatchForReligionRemoval);
+ pStream->Write(m_bRequireOpenBordersForReligionRemoval);
+ // < Inquisition Mod End >
}
void CvGame::writeReplay(FDataStreamBase& stream, PlayerTypes ePlayer)
@@ -8254,7 +8821,7 @@
//--------------------------CCCP NEW--------------------------
-// ---------------- REVOLUTION_MOD start ---------------------
+// < Revolution Mod by jdog5000 Start >
#include "CvDLLFlagEntityIFaceBase.h"
// Return success of creating new player at index playerIdx (must be dead or empty player)
@@ -8664,14 +9231,182 @@
break;
}
}
-// ---------------- REVOLUTION_MOD end -----------------------
+// < Revolution Mod End >
-bool CvGame::getStarshipLaunched(int ID) // Mastery Victory by Sevo
+bool CvGame::getStarshipLaunched(int ID) // < Mastery Victory by Sevo >
{
return starshipLaunched[ID];
}
-bool CvGame::getDiplomaticVictoryAchieved(int ID) // Mastery Victory by Sevo
+bool CvGame::getDiplomaticVictoryAchieved(int ID) // < Mastery Victory by Sevo >
{
return diplomaticVictoryAchieved[ID];
-}
\ No newline at end of file
+}
+
+// < Shrine Functions by ??? Start >
+int CvGame::getShrineBuildingCount(ReligionTypes eReligion)
+{
+ int iShrineBuildingCount = 0;
+
+ if (eReligion == NO_RELIGION)
+ iShrineBuildingCount = m_iShrineBuildingCount;
+ else for (int iI = 0; iI < m_iShrineBuildingCount; iI++)
+ if (m_aiShrineReligion[iI] == eReligion)
+ iShrineBuildingCount++;
+
+ return iShrineBuildingCount;
+}
+
+BuildingTypes CvGame::getShrineBuilding(int eIndex, ReligionTypes eReligion)
+{
+ FAssertMsg(eIndex >= 0 && eIndex < m_iShrineBuildingCount, "invalid index to CvGame::getShrineBuilding");
+
+ BuildingTypes eBuilding = NO_BUILDING;
+
+ if (eIndex >= 0 && eIndex < m_iShrineBuildingCount)
+ {
+ if (eReligion == NO_RELIGION)
+ eBuilding = (BuildingTypes) m_aiShrineBuilding[eIndex];
+ else for (int iI = 0, iReligiousBuilding = 0; iI < m_iShrineBuildingCount; iI++)
+ if (m_aiShrineReligion[iI] == (int) eReligion)
+ {
+ if (iReligiousBuilding == eIndex)
+ {
+ // found it
+ eBuilding = (BuildingTypes) m_aiShrineBuilding[iI];
+ break;
+ }
+
+ iReligiousBuilding++;
+ }
+ }
+
+ return eBuilding;
+}
+
+void CvGame::changeShrineBuilding(BuildingTypes eBuilding, ReligionTypes eReligion, bool bRemove)
+{
+ FAssertMsg(eBuilding >= 0 && eBuilding < GC.getNumBuildingInfos(), "invalid index to CvGame::changeShrineBuilding");
+ FAssertMsg(bRemove || m_iShrineBuildingCount < GC.getNumBuildingInfos(), "trying to add too many buildings to CvGame::changeShrineBuilding");
+
+ if (bRemove)
+ {
+ bool bFound = false;
+
+ for (int iI = 0; iI < m_iShrineBuildingCount; iI++)
+ {
+ if (!bFound)
+ {
+ // note, eReligion is not important if we removing, since each building is always one religion
+ if (m_aiShrineBuilding[iI] == (int) eBuilding)
+ bFound = true;
+ }
+
+ if (bFound)
+ {
+ int iToMove = iI + 1;
+ if (iToMove < m_iShrineBuildingCount)
+ {
+ m_aiShrineBuilding[iI] = m_aiShrineBuilding[iToMove];
+ m_aiShrineReligion[iI] = m_aiShrineReligion[iToMove];
+ }
+ else
+ {
+ m_aiShrineBuilding[iI] = (int) NO_BUILDING;
+ m_aiShrineReligion[iI] = (int) NO_RELIGION;
+ }
+ }
+
+ if (bFound)
+ m_iShrineBuildingCount--;
+
+ }
+ }
+ else if (m_iShrineBuildingCount < GC.getNumBuildingInfos())
+ {
+ // add this item to the end
+ m_aiShrineBuilding[m_iShrineBuildingCount] = eBuilding;
+ m_aiShrineReligion[m_iShrineBuildingCount] = eReligion;
+ m_iShrineBuildingCount++;
+ }
+
+}
+
+bool CvGame::culturalVictoryValid()
+{
+ if (m_iNumCultureVictoryCities > 0)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+int CvGame::culturalVictoryNumCultureCities()
+{
+ return m_iNumCultureVictoryCities;
+}
+
+CultureLevelTypes CvGame::culturalVictoryCultureLevel()
+{
+ if (m_iNumCultureVictoryCities > 0)
+ {
+ return (CultureLevelTypes) m_eCultureVictoryCultureLevel;
+ }
+
+ return NO_CULTURELEVEL;
+}
+
+// < Inquisition Mod by Lopez Start >
+bool CvGame::isRequireStateReligionForReligionRemoval() const
+{
+ return m_bRequireStateReligionForReligionRemoval;
+}
+
+void CvGame::setRequireStateReligionForReligionRemoval(bool bNewValue)
+{
+ m_bRequireStateReligionForReligionRemoval = bNewValue;
+}
+
+bool CvGame::isRequireCityOwnerStateReligionMatchForReligionRemoval() const
+{
+ return m_bRequireCityOwnerStateReligionMatchForReligionRemoval;
+}
+
+void CvGame::setRequireCityOwnerStateReligionMatchForReligionRemoval(bool bNewValue)
+{
+ m_bRequireCityOwnerStateReligionMatchForReligionRemoval = bNewValue;
+}
+
+bool CvGame::isRequireOpenBordersForReligionRemoval() const
+{
+ return m_bRequireOpenBordersForReligionRemoval;
+}
+
+void CvGame::setRequireOpenBordersForReligionRemoval(bool bNewValue)
+{
+ m_bRequireOpenBordersForReligionRemoval = bNewValue;
+}
+// < Inquisition Mod End >
+
+
+bool CvGame::circumnavigationAvailable() const // < Circumnavigation by ??? >
+{
+ if (isCircumnavigated())
+ return false;
+
+ if (GC.getDefineINT("CIRCUMNAVIGATE_FREE_MOVES") == 0)
+ return false;
+
+ CvMap& kMap = GC.getMapINLINE();
+
+ if (!(kMap.isWrapXINLINE()) && !(kMap.isWrapYINLINE()))
+ return false;
+
+ if (kMap.getLandPlots() > ((kMap.numPlotsINLINE() * 2) / 3))
+ return false;
+
+ return true;
+}
+ //return diplomaticVictoryAchieved[ID];
+
Modified: CvGameCoreDLL/CvGame.h
===================================================================
--- CvGameCoreDLL/CvGame.h 2007-03-12 16:58:38 UTC (rev 35)
+++ CvGameCoreDLL/CvGame.h 2007-03-12 20:28:42 UTC (rev 36)
@@ -422,15 +422,40 @@
bool hasSkippedSaveChecksum() const;
- // ---------------- REVOLUTION_MOD start ---------------------
+ //----------------------------CCCP NEW-----------------------------
+
+ // < Revolution Mod by jdog5000 Start >
DllExport bool createNewPlayer( int playerIdx, int newCivType, int newLeader, int teamIdx, bool doGive, int ix, int iy );
DllExport bool changePlayer( int playerIdx, int newCivType, int newLeader, int teamIdx, bool bIsHuman, bool bChangeGraphics );
void convertUnits( int playerIdx );
- // ---------------- REVOLUTION_MOD end -----------------------
+ // < Revolution Mod End >
DllExport bool getStarshipLaunched(int ID); // Mastery Victory by Sevo
DllExport bool getDiplomaticVictoryAchieved(int ID); // Mastery Victory by Sevo
+ // < Inquisition Mod Start >
+ DllExport bool isRequireStateReligionForReligionRemoval() const;
+ DllExport void setRequireStateReligionForReligionRemoval(bool bNewValue); // Exposed to Python
+
+ DllExport bool isRequireCityOwnerStateReligionMatchForReligionRemoval() const;
+ DllExport void setRequireCityOwnerStateReligionMatchForReligionRemoval(bool bNewValue); // Exposed to Python
+
+ DllExport bool isRequireOpenBordersForReligionRemoval() const;
+ DllExport void setRequireOpenBordersForReligionRemoval(bool bNewValue); // Exposed to Python
+ // < Inquisition Mod End >
+
+ CvPlot* normalizeFindLakePlot(PlayerTypes ePlayer);
+
+ int getShrineBuildingCount(ReligionTypes eReligion = NO_RELIGION);
+ BuildingTypes getShrineBuilding(int eIndex, ReligionTypes eReligion = NO_RELIGION);
+ void changeShrineBuilding(BuildingTypes eBuilding, ReligionTypes eReligion, bool bRemove = false);
+
+ bool culturalVictoryValid();
+ int culturalVictoryNumCultureCities();
+ CultureLevelTypes culturalVictoryCultureLevel();
+
+ bool circumnavigationAvailable() const;
+
protected:
int m_iEndTurnMessagesSent;
@@ -555,6 +580,19 @@
bool starshipLaunched[MAX_PLAYERS]; // Mastery Victory by Sevo
bool diplomaticVictoryAchieved[MAX_PLAYERS]; // Mastery Victory by Sevo
+
+ // < Inquisition Mod by Lopez Start >
+ bool m_bRequireStateReligionForReligionRemoval;
+ bool m_bRequireCityOwnerStateReligionMatchForReligionRemoval;
+ bool m_bRequireOpenBordersForReligionRemoval;
+ // < Inquisition Mod End >
+
+ int m_iShrineBuildingCount;
+ int* m_aiShrineBuilding;
+ int* m_aiShrineReligion;
+
+ int m_iNumCultureVictoryCities;
+ int m_eCultureVictoryCultureLevel;
};
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|