[sanguoforciv4] r339 committed - add source code for 3.17 Chinese version

69 views
Skip to first unread message

codesite...@google.com

unread,
Sep 19, 2009, 9:40:15 AM9/19/09
to sanguom...@googlegroups.com
Revision: 339
Author: TongShen.Martin
Date: Sat Sep 19 06:38:49 2009
Log: add source code for 3.17 Chinese version
http://code.google.com/p/sanguoforciv4/source/detail?r=339

Added:
/trunk/317DLL
/trunk/317DLL/CvGameCoreDLL
/trunk/317DLL/CvGameCoreDLL/AI_Defines.h
/trunk/317DLL/CvGameCoreDLL/CvArea.cpp
/trunk/317DLL/CvGameCoreDLL/CvArea.h
/trunk/317DLL/CvGameCoreDLL/CvArtFileMgr.cpp
/trunk/317DLL/CvGameCoreDLL/CvArtFileMgr.h
/trunk/317DLL/CvGameCoreDLL/CvCity.cpp
/trunk/317DLL/CvGameCoreDLL/CvCity.h
/trunk/317DLL/CvGameCoreDLL/CvCityAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvCityAI.h
/trunk/317DLL/CvGameCoreDLL/CvDLLButtonPopup.cpp
/trunk/317DLL/CvGameCoreDLL/CvDLLButtonPopup.h
/trunk/317DLL/CvGameCoreDLL/CvDLLDataStreamIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLEngineIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLEntity.cpp
/trunk/317DLL/CvGameCoreDLL/CvDLLEntity.h
/trunk/317DLL/CvGameCoreDLL/CvDLLEntityIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLEventReporterIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLFAStarIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLFlagEntityIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLIniParserIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLInterfaceIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLPlotBuilderIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLPython.cpp
/trunk/317DLL/CvGameCoreDLL/CvDLLPythonIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLSymbolIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLUtilityIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDLLWidgetData.cpp
/trunk/317DLL/CvGameCoreDLL/CvDLLWidgetData.h
/trunk/317DLL/CvGameCoreDLL/CvDLLXMLIFaceBase.h
/trunk/317DLL/CvGameCoreDLL/CvDeal.cpp
/trunk/317DLL/CvGameCoreDLL/CvDeal.h
/trunk/317DLL/CvGameCoreDLL/CvDefines.h
/trunk/317DLL/CvGameCoreDLL/CvDiploParameters.cpp
/trunk/317DLL/CvGameCoreDLL/CvDiploParameters.h
/trunk/317DLL/CvGameCoreDLL/CvDllPythonEvents.cpp
/trunk/317DLL/CvGameCoreDLL/CvDllPythonEvents.h
/trunk/317DLL/CvGameCoreDLL/CvDllTranslator.cpp
/trunk/317DLL/CvGameCoreDLL/CvDllTranslator.h
/trunk/317DLL/CvGameCoreDLL/CvEnums.h
/trunk/317DLL/CvGameCoreDLL/CvEventReporter.cpp
/trunk/317DLL/CvGameCoreDLL/CvEventReporter.h
/trunk/317DLL/CvGameCoreDLL/CvFractal.cpp
/trunk/317DLL/CvGameCoreDLL/CvFractal.h
/trunk/317DLL/CvGameCoreDLL/CvGame.cpp
/trunk/317DLL/CvGameCoreDLL/CvGame.h
/trunk/317DLL/CvGameCoreDLL/CvGameAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvGameAI.h
/trunk/317DLL/CvGameCoreDLL/CvGameCoreDLL.cpp
/trunk/317DLL/CvGameCoreDLL/CvGameCoreDLL.h
/trunk/317DLL/CvGameCoreDLL/CvGameCoreDLL.sln
/trunk/317DLL/CvGameCoreDLL/CvGameCoreDLLDefNew.h
/trunk/317DLL/CvGameCoreDLL/CvGameCoreDLLUndefNew.h
/trunk/317DLL/CvGameCoreDLL/CvGameCoreUtils.cpp
/trunk/317DLL/CvGameCoreDLL/CvGameCoreUtils.h
/trunk/317DLL/CvGameCoreDLL/CvGameInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CvGameTextMgr.cpp
/trunk/317DLL/CvGameCoreDLL/CvGameTextMgr.h
/trunk/317DLL/CvGameCoreDLL/CvGlobals.cpp
/trunk/317DLL/CvGameCoreDLL/CvGlobals.h
/trunk/317DLL/CvGameCoreDLL/CvHallOfFameInfo.cpp
/trunk/317DLL/CvGameCoreDLL/CvHallOfFameInfo.h
/trunk/317DLL/CvGameCoreDLL/CvInfoWater.cpp
/trunk/317DLL/CvGameCoreDLL/CvInfoWater.h
/trunk/317DLL/CvGameCoreDLL/CvInfos.cpp
/trunk/317DLL/CvGameCoreDLL/CvInfos.h
/trunk/317DLL/CvGameCoreDLL/CvInitCore.cpp
/trunk/317DLL/CvGameCoreDLL/CvInitCore.h
/trunk/317DLL/CvGameCoreDLL/CvMap.cpp
/trunk/317DLL/CvGameCoreDLL/CvMap.h
/trunk/317DLL/CvGameCoreDLL/CvMapGenerator.cpp
/trunk/317DLL/CvGameCoreDLL/CvMapGenerator.h
/trunk/317DLL/CvGameCoreDLL/CvMessageControl.cpp
/trunk/317DLL/CvGameCoreDLL/CvMessageControl.h
/trunk/317DLL/CvGameCoreDLL/CvMessageData.cpp
/trunk/317DLL/CvGameCoreDLL/CvMessageData.h
/trunk/317DLL/CvGameCoreDLL/CvPlayer.cpp
/trunk/317DLL/CvGameCoreDLL/CvPlayer.h
/trunk/317DLL/CvGameCoreDLL/CvPlayerAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvPlayerAI.h
/trunk/317DLL/CvGameCoreDLL/CvPlot.cpp
/trunk/317DLL/CvGameCoreDLL/CvPlot.h
/trunk/317DLL/CvGameCoreDLL/CvPlotGroup.cpp
/trunk/317DLL/CvGameCoreDLL/CvPlotGroup.h
/trunk/317DLL/CvGameCoreDLL/CvPopupInfo.cpp
/trunk/317DLL/CvGameCoreDLL/CvPopupInfo.h
/trunk/317DLL/CvGameCoreDLL/CvPopupReturn.cpp
/trunk/317DLL/CvGameCoreDLL/CvPopupReturn.h
/trunk/317DLL/CvGameCoreDLL/CvRandom.cpp
/trunk/317DLL/CvGameCoreDLL/CvRandom.h
/trunk/317DLL/CvGameCoreDLL/CvReplayInfo.cpp
/trunk/317DLL/CvGameCoreDLL/CvReplayInfo.h
/trunk/317DLL/CvGameCoreDLL/CvReplayMessage.cpp
/trunk/317DLL/CvGameCoreDLL/CvReplayMessage.h
/trunk/317DLL/CvGameCoreDLL/CvSelectionGroup.cpp
/trunk/317DLL/CvGameCoreDLL/CvSelectionGroup.h
/trunk/317DLL/CvGameCoreDLL/CvSelectionGroupAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvSelectionGroupAI.h
/trunk/317DLL/CvGameCoreDLL/CvStatistics.cpp
/trunk/317DLL/CvGameCoreDLL/CvStatistics.h
/trunk/317DLL/CvGameCoreDLL/CvString.h
/trunk/317DLL/CvGameCoreDLL/CvStructs.cpp
/trunk/317DLL/CvGameCoreDLL/CvStructs.h
/trunk/317DLL/CvGameCoreDLL/CvTalkingHeadMessage.cpp
/trunk/317DLL/CvGameCoreDLL/CvTalkingHeadMessage.h
/trunk/317DLL/CvGameCoreDLL/CvTeam.cpp
/trunk/317DLL/CvGameCoreDLL/CvTeam.h
/trunk/317DLL/CvGameCoreDLL/CvTeamAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvTeamAI.h
/trunk/317DLL/CvGameCoreDLL/CvTextScreens.cpp
/trunk/317DLL/CvGameCoreDLL/CvUnit.cpp
/trunk/317DLL/CvGameCoreDLL/CvUnit.h
/trunk/317DLL/CvGameCoreDLL/CvUnitAI.cpp
/trunk/317DLL/CvGameCoreDLL/CvUnitAI.h
/trunk/317DLL/CvGameCoreDLL/CvXMLLoadUtility.cpp
/trunk/317DLL/CvGameCoreDLL/CvXMLLoadUtility.h
/trunk/317DLL/CvGameCoreDLL/CvXMLLoadUtilityGet.cpp
/trunk/317DLL/CvGameCoreDLL/CvXMLLoadUtilityInit.cpp
/trunk/317DLL/CvGameCoreDLL/CvXMLLoadUtilitySet.cpp
/trunk/317DLL/CvGameCoreDLL/CyArea.cpp
/trunk/317DLL/CvGameCoreDLL/CyArea.h
/trunk/317DLL/CvGameCoreDLL/CyAreaInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyArgsList.cpp
/trunk/317DLL/CvGameCoreDLL/CyArgsList.h
/trunk/317DLL/CvGameCoreDLL/CyArtFileMgr.cpp
/trunk/317DLL/CvGameCoreDLL/CyArtFileMgr.h
/trunk/317DLL/CvGameCoreDLL/CyArtFileMgrInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyCity.cpp
/trunk/317DLL/CvGameCoreDLL/CyCity.h
/trunk/317DLL/CvGameCoreDLL/CyCityInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyDeal.cpp
/trunk/317DLL/CvGameCoreDLL/CyDeal.h
/trunk/317DLL/CvGameCoreDLL/CyEnumsInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyGame.cpp
/trunk/317DLL/CvGameCoreDLL/CyGame.h
/trunk/317DLL/CvGameCoreDLL/CyGameCoreUtils.cpp
/trunk/317DLL/CvGameCoreDLL/CyGameCoreUtils.h
/trunk/317DLL/CvGameCoreDLL/CyGameCoreUtilsInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyGameInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyGameTextMgr.cpp
/trunk/317DLL/CvGameCoreDLL/CyGameTextMgr.h
/trunk/317DLL/CvGameCoreDLL/CyGameTextMgrInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyGlobalContext.cpp
/trunk/317DLL/CvGameCoreDLL/CyGlobalContext.h
/trunk/317DLL/CvGameCoreDLL/CyGlobalContextInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyGlobalContextInterface2.cpp
/trunk/317DLL/CvGameCoreDLL/CyGlobalContextInterface3.cpp
/trunk/317DLL/CvGameCoreDLL/CyGlobalContextInterface4.cpp
/trunk/317DLL/CvGameCoreDLL/CyHallOfFameInfo.cpp
/trunk/317DLL/CvGameCoreDLL/CyHallOfFameInfo.h
/trunk/317DLL/CvGameCoreDLL/CyHallOfFameInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyInfoInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyInfoInterface2.cpp
/trunk/317DLL/CvGameCoreDLL/CyInfoInterface3.cpp
/trunk/317DLL/CvGameCoreDLL/CyMap.cpp
/trunk/317DLL/CvGameCoreDLL/CyMap.h
/trunk/317DLL/CvGameCoreDLL/CyMapGenerator.cpp
/trunk/317DLL/CvGameCoreDLL/CyMapGenerator.h
/trunk/317DLL/CvGameCoreDLL/CyMapGeneratorInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyMapInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyMessageControl.cpp
/trunk/317DLL/CvGameCoreDLL/CyMessageControl.h
/trunk/317DLL/CvGameCoreDLL/CyMessageControlInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyPlayer.cpp
/trunk/317DLL/CvGameCoreDLL/CyPlayer.h
/trunk/317DLL/CvGameCoreDLL/CyPlayerInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyPlayerInterface2.cpp
/trunk/317DLL/CvGameCoreDLL/CyPlot.cpp
/trunk/317DLL/CvGameCoreDLL/CyPlot.h
/trunk/317DLL/CvGameCoreDLL/CyPlotInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyRandomInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyReplayInfo.cpp
/trunk/317DLL/CvGameCoreDLL/CyReplayInfo.h
/trunk/317DLL/CvGameCoreDLL/CySelectionGroup.cpp
/trunk/317DLL/CvGameCoreDLL/CySelectionGroup.h
/trunk/317DLL/CvGameCoreDLL/CySelectionGroupInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyStructsInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/CyTeam.cpp
/trunk/317DLL/CvGameCoreDLL/CyTeam.h
/trunk/317DLL/CvGameCoreDLL/CyTeamInterface.cpp
/trunk/317DLL/CvGameCoreDLL/CyUnit.cpp
/trunk/317DLL/CvGameCoreDLL/CyUnit.h
/trunk/317DLL/CvGameCoreDLL/CyUnitInterface1.cpp
/trunk/317DLL/CvGameCoreDLL/FAStarNode.h
/trunk/317DLL/CvGameCoreDLL/FAssert.cpp
/trunk/317DLL/CvGameCoreDLL/FAssert.h
/trunk/317DLL/CvGameCoreDLL/FDataStreamBase.h
/trunk/317DLL/CvGameCoreDLL/FDialogTemplate.cpp
/trunk/317DLL/CvGameCoreDLL/FDialogTemplate.h
/trunk/317DLL/CvGameCoreDLL/FFreeListArray.h
/trunk/317DLL/CvGameCoreDLL/FFreeListArrayBase.h
/trunk/317DLL/CvGameCoreDLL/FFreeListTrashArray.h
/trunk/317DLL/CvGameCoreDLL/FInputDevice.h
/trunk/317DLL/CvGameCoreDLL/FProfiler.h
/trunk/317DLL/CvGameCoreDLL/FVariableSystem.h
/trunk/317DLL/CvGameCoreDLL/FVariableSystem.inl
/trunk/317DLL/CvGameCoreDLL/LinkedList.h
/trunk/317DLL/CvGameCoreDLL/Makefile
/trunk/317DLL/CvGameCoreDLL/_precompile.cpp
/trunk/317DLL/CvGameCoreDLL/interfaceDirtyBits.inl
/trunk/317DLL/CvGameCoreDLL/resource.h

=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/AI_Defines.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,76 @@
+#pragma once
+
+#ifndef AI_DEFINES_H
+#define AI_DEFINES_H
+
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 6/25/09 jdog5000 */
+/** */
+/** */
+/********************************************************************************/
+// Could increase this value now that player closness is fixed
+#define DEFAULT_PLAYER_CLOSENESS 6
+
+#define AI_DAGGER_THRESHOLD 100 //higher is a lower chance
+
+#define AI_DEFAULT_STRATEGY (1 << 0)
+#define AI_STRATEGY_DAGGER (1 << 1)
+#define AI_STRATEGY_SLEDGEHAMMER (1 << 2)
+#define AI_STRATEGY_TURTLE (1 << 3) // Defensive shell
+#define AI_STRATEGY_FASTMOVERS (1 << 4)
+#define AI_STRATEGY_SLOWMOVERS (1 << 5)
+#define AI_STRATEGY_CULTURE1 (1 << 6) //religions and wonders
+#define AI_STRATEGY_CULTURE2 (1 << 7) //mass culture buildings
+#define AI_STRATEGY_CULTURE3 (1 << 8) //culture slider
+#define AI_STRATEGY_CULTURE4 (1 << 9)
+#define AI_STRATEGY_MISSIONARY (1 << 10)
+#define AI_STRATEGY_CRUSH (1 << 11) //convert units to City Attack
+#define AI_STRATEGY_PRODUCTION (1 << 12)
+#define AI_STRATEGY_PEACE (1 << 13) //lucky... neglect defenses.
+#define AI_STRATEGY_GET_BETTER_UNITS (1 << 14)
+#define AI_STRATEGY_LAND_BLITZ (1 << 15)
+#define AI_STRATEGY_AIR_BLITZ (1 << 16)
+#define AI_STRATEGY_LAST_STAND (1 << 17)
+#define AI_STRATEGY_FINAL_WAR (1 << 18)
+#define AI_STRATEGY_OWABWNW (1 << 19)
+#define AI_STRATEGY_BIG_ESPIONAGE (1 << 20)
+
+// AI victory stages
+#define AI_DEFAULT_VICTORY_STRATEGY (1 << 0)
+#define AI_VICTORY_SPACE1 (1 << 1)
+#define AI_VICTORY_SPACE2 (1 << 2)
+#define AI_VICTORY_SPACE3 (1 << 3)
+#define AI_VICTORY_SPACE4 (1 << 4)
+#define AI_VICTORY_CONQUEST1 (1 << 5)
+#define AI_VICTORY_CONQUEST2 (1 << 6)
+#define AI_VICTORY_CONQUEST3 (1 << 7)
+#define AI_VICTORY_CONQUEST4 (1 << 8)
+#define AI_VICTORY_CULTURE1 (1 << 9) //religions and wonders
+#define AI_VICTORY_CULTURE2 (1 << 10) //mass culture buildings
+#define AI_VICTORY_CULTURE3 (1 << 11) //culture slider
+#define AI_VICTORY_CULTURE4 (1 << 12)
+#define AI_VICTORY_DOMINATION1 (1 << 13)
+#define AI_VICTORY_DOMINATION2 (1 << 14)
+#define AI_VICTORY_DOMINATION3 (1 << 15)
+#define AI_VICTORY_DOMINATION4 (1 << 16)
+#define AI_VICTORY_DIPLOMACY1 (1 << 17)
+#define AI_VICTORY_DIPLOMACY2 (1 << 18)
+#define AI_VICTORY_DIPLOMACY3 (1 << 19)
+#define AI_VICTORY_DIPLOMACY4 (1 << 20)
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD END */
+/********************************************************************************/
+
+#define AI_CITY_ROLE_VALID (1 << 1) //zero is bad
+#define AI_CITY_ROLE_BIG_CULTURE (1 << 2) //culture victory,
probably
+#define AI_CITY_ROLE_BIG_PRODUCTION (1 << 3) //don't build girly
NW's
+#define AI_CITY_ROLE_BIG_MILITARY (1 << 4) //stick with military
stuff
+#define AI_CITY_ROLE_SCIENCE (1 << 5) //
+#define AI_CITY_ROLE_GOLD (1 << 6) //
+#define AI_CITY_ROLE_PRODUCTION (1 << 7) //
+#define AI_CITY_ROLE_SPECIALIST (1 << 8) //
+#define AI_CITY_ROLE_FISHING (1 << 9) //
+#define AI_CITY_ROLE_STAGING (1 << 10) //send troops here
+#define AI_CITY_ROLE_LICHPIN (1 << 11) //this city must not
fall
+
+#endif // AI_DEFINES_H
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvArea.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,1067 @@
+// area.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvArea.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvGlobals.h"
+#include "CvGameAI.h"
+#include "CvPlayerAI.h"
+#include "CvTeamAI.h"
+#include "CvGameCoreUtils.h"
+#include "CvInfos.h"
+
+#include "CvDLLInterfaceIFaceBase.h"
+
+// Public Functions...
+
+CvArea::CvArea()
+{
+ m_aiUnitsPerPlayer = new int[MAX_PLAYERS];
+ m_aiAnimalsPerPlayer = new int[MAX_PLAYERS];
+ m_aiCitiesPerPlayer = new int[MAX_PLAYERS];
+ m_aiPopulationPerPlayer = new int[MAX_PLAYERS];
+ m_aiBuildingGoodHealth = new int[MAX_PLAYERS];
+ m_aiBuildingBadHealth = new int[MAX_PLAYERS];
+ m_aiBuildingHappiness = new int[MAX_PLAYERS];
+ m_aiFreeSpecialist = new int[MAX_PLAYERS];
+ m_aiPower = new int[MAX_PLAYERS];
+ m_aiBestFoundValue = new int[MAX_PLAYERS];
+ m_aiNumRevealedTiles = new int[MAX_TEAMS];
+ m_aiCleanPowerCount = new int[MAX_TEAMS];
+ m_aiBorderObstacleCount = new int[MAX_TEAMS];
+
+ m_aeAreaAIType = new AreaAITypes[MAX_TEAMS];
+
+ m_aTargetCities = new IDInfo[MAX_PLAYERS];
+
+ m_aaiYieldRateModifier = new int*[MAX_PLAYERS];
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ m_aaiYieldRateModifier[i] = new int[NUM_YIELD_TYPES];
+ }
+ m_aaiNumTrainAIUnits = new int*[MAX_PLAYERS];
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ m_aaiNumTrainAIUnits[i] = new int[NUM_UNITAI_TYPES];
+ }
+ m_aaiNumAIUnits = new int*[MAX_PLAYERS];
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ m_aaiNumAIUnits[i] = new int[NUM_UNITAI_TYPES];
+ }
+
+ m_paiNumBonuses = NULL;
+ m_paiNumImprovements = NULL;
+
+
+ reset(0, false, true);
+}
+
+
+CvArea::~CvArea()
+{
+ uninit();
+
+ SAFE_DELETE_ARRAY(m_aiUnitsPerPlayer);
+ SAFE_DELETE_ARRAY(m_aiAnimalsPerPlayer);
+ SAFE_DELETE_ARRAY(m_aiCitiesPerPlayer);
+ SAFE_DELETE_ARRAY(m_aiPopulationPerPlayer);
+ SAFE_DELETE_ARRAY(m_aiBuildingGoodHealth);
+ SAFE_DELETE_ARRAY(m_aiBuildingBadHealth);
+ SAFE_DELETE_ARRAY(m_aiBuildingHappiness);
+ SAFE_DELETE_ARRAY(m_aiFreeSpecialist);
+ SAFE_DELETE_ARRAY(m_aiPower);
+ SAFE_DELETE_ARRAY(m_aiBestFoundValue);
+ SAFE_DELETE_ARRAY(m_aiNumRevealedTiles);
+ SAFE_DELETE_ARRAY(m_aiCleanPowerCount);
+ SAFE_DELETE_ARRAY(m_aiBorderObstacleCount);
+ SAFE_DELETE_ARRAY(m_aeAreaAIType);
+ SAFE_DELETE_ARRAY(m_aTargetCities);
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ SAFE_DELETE_ARRAY(m_aaiYieldRateModifier[i]);
+ }
+ SAFE_DELETE_ARRAY(m_aaiYieldRateModifier);
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ SAFE_DELETE_ARRAY(m_aaiNumTrainAIUnits[i]);
+ }
+ SAFE_DELETE_ARRAY(m_aaiNumTrainAIUnits);
+ for (int i = 0; i < MAX_PLAYERS; i++)
+ {
+ SAFE_DELETE_ARRAY(m_aaiNumAIUnits[i]);
+ }
+ SAFE_DELETE_ARRAY(m_aaiNumAIUnits);
+}
+
+
+void CvArea::init(int iID, bool bWater)
+{
+ //--------------------------------
+ // Init saved data
+ reset(iID, bWater);
+
+ //--------------------------------
+ // Init non-saved data
+
+ //--------------------------------
+ // Init other game data
+}
+
+
+void CvArea::uninit()
+{
+ SAFE_DELETE_ARRAY(m_paiNumBonuses);
+ SAFE_DELETE_ARRAY(m_paiNumImprovements);
+}
+
+
+// FUNCTION: reset()
+// Initializes data members that are serialized.
+void CvArea::reset(int iID, bool bWater, bool bConstructorCall)
+{
+ int iI, iJ;
+
+ //--------------------------------
+ // Uninit class
+ uninit();
+
+ m_iID = iID;
+ m_iNumTiles = 0;
+ m_iNumOwnedTiles = 0;
+ m_iNumRiverEdges = 0;
+ m_iNumUnits = 0;
+ m_iNumCities = 0;
+ m_iTotalPopulation = 0;
+ m_iNumStartingPlots = 0;
+
+ m_bWater = bWater;
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_aiUnitsPerPlayer[iI] = 0;
+ m_aiAnimalsPerPlayer[iI] = 0;
+ m_aiCitiesPerPlayer[iI] = 0;
+ m_aiPopulationPerPlayer[iI] = 0;
+ m_aiBuildingGoodHealth[iI] = 0;
+ m_aiBuildingBadHealth[iI] = 0;
+ m_aiBuildingHappiness[iI] = 0;
+ m_aiFreeSpecialist[iI] = 0;
+ m_aiPower[iI] = 0;
+ m_aiBestFoundValue[iI] = 0;
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ m_aiNumRevealedTiles[iI] = 0;
+ m_aiCleanPowerCount[iI] = 0;
+ m_aiBorderObstacleCount[iI] = 0;
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ m_aeAreaAIType[iI] = NO_AREAAI;
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_aTargetCities[iI].reset();
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ for (iJ = 0; iJ < NUM_YIELD_TYPES; iJ++)
+ {
+ m_aaiYieldRateModifier[iI][iJ] = 0;
+ }
+
+ for (iJ = 0; iJ < NUM_UNITAI_TYPES; iJ++)
+ {
+ m_aaiNumTrainAIUnits[iI][iJ] = 0;
+ m_aaiNumAIUnits[iI][iJ] = 0;
+ }
+ }
+
+ if (!bConstructorCall)
+ {
+ FAssertMsg((0 < GC.getNumBonusInfos()) && "GC.getNumBonusInfos() is not
greater than zero but an array is being allocated in
CvArea::reset", "GC.getNumBonusInfos() is not greater than zero but an
array is being allocated in CvArea::reset");
+ m_paiNumBonuses = new int[GC.getNumBonusInfos()];
+ for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
+ {
+ m_paiNumBonuses[iI] = 0;
+ }
+
+ FAssertMsg((0 < GC.getNumImprovementInfos())
&& "GC.getNumImprovementInfos() is not greater than zero but an array is
being allocated in CvArea::reset", "GC.getNumImprovementInfos() is not
greater than zero but an array is being allocated in CvArea::reset");
+ m_paiNumImprovements = new int[GC.getNumImprovementInfos()];
+ for (iI = 0; iI < GC.getNumImprovementInfos(); iI++)
+ {
+ m_paiNumImprovements[iI] = 0;
+ }
+ }
+}
+
+
+int CvArea::getID() const
+{
+ return m_iID;
+}
+
+
+void CvArea::setID(int iID)
+{
+ m_iID = iID;
+}
+
+
+int CvArea::calculateTotalBestNatureYield() const
+{
+ CvPlot* pLoopPlot;
+ int iCount;
+ int iI;
+
+ iCount = 0;
+
+ for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
+ {
+ pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
+
+ if (pLoopPlot->getArea() == getID())
+ {
+ iCount += pLoopPlot->calculateTotalBestNatureYield(NO_TEAM);
+ }
+ }
+
+ return iCount;
+}
+
+
+int CvArea::countCoastalLand() const
+{
+ CvPlot* pLoopPlot;
+ int iCount;
+ int iI;
+
+ if (isWater())
+ {
+ return 0;
+ }
+
+ iCount = 0;
+
+ for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
+ {
+ pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
+
+ if (pLoopPlot->getArea() == getID())
+ {
+ if (pLoopPlot->isCoastalLand())
+ {
+ iCount++;
+ }
+ }
+ }
+
+ return iCount;
+}
+
+
+int CvArea::countNumUniqueBonusTypes() const
+{
+ int iCount;
+ int iI;
+
+ iCount = 0;
+
+ for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
+ {
+ if (getNumBonuses((BonusTypes)iI) > 0)
+ {
+ if (GC.getBonusInfo((BonusTypes)iI).isOneArea())
+ {
+ iCount++;
+ }
+ }
+ }
+
+ return iCount;
+}
+
+
+int CvArea::countHasReligion(ReligionTypes eReligion, PlayerTypes eOwner)
const
+{
+ CvCity* pLoopCity;
+ int iCount;
+ int iLoop;
+ int iI;
+
+ iCount = 0;
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if ((eOwner == NO_PLAYER) || (iI == eOwner))
+ {
+ for (pLoopCity = GET_PLAYER((PlayerTypes)iI).firstCity(&iLoop);
pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iI).nextCity(&iLoop))
+ {
+ if (pLoopCity->area()->getID() == getID())
+ {
+ if (pLoopCity->isHasReligion(eReligion))
+ {
+ iCount++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return iCount;
+}
+
+int CvArea::countHasCorporation(CorporationTypes eCorporation, PlayerTypes
eOwner) const
+{
+ int iCount = 0;
+
+ for (int iI = 0; iI < MAX_PLAYERS; ++iI)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if ((eOwner == NO_PLAYER) || (iI == eOwner))
+ {
+ int iLoop;
+ for (CvCity* pLoopCity =
GET_PLAYER((PlayerTypes)iI).firstCity(&iLoop); NULL != pLoopCity; pLoopCity
= GET_PLAYER((PlayerTypes)iI).nextCity(&iLoop))
+ {
+ if (pLoopCity->area()->getID() == getID())
+ {
+ if (pLoopCity->isHasCorporation(eCorporation))
+ {
+ ++iCount;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return iCount;
+}
+
+
+int CvArea::getNumTiles() const
+{
+ return m_iNumTiles;
+}
+
+
+bool CvArea::isLake() const
+{
+ return (isWater() && (getNumTiles() <= GC.getLAKE_MAX_AREA_SIZE()));
+}
+
+
+void CvArea::changeNumTiles(int iChange)
+{
+ bool bOldLake;
+
+ if (iChange != 0)
+ {
+ bOldLake = isLake();
+
+ m_iNumTiles = (m_iNumTiles + iChange);
+ FAssert(getNumTiles() >= 0);
+
+ if (bOldLake != isLake())
+ {
+ GC.getMapINLINE().updateIrrigated();
+ GC.getMapINLINE().updateYield();
+ }
+ }
+}
+
+
+int CvArea::getNumOwnedTiles() const
+{
+ return m_iNumOwnedTiles;
+}
+
+
+int CvArea::getNumUnownedTiles() const
+{
+ return (getNumTiles() - getNumOwnedTiles());
+}
+
+
+void CvArea::changeNumOwnedTiles(int iChange)
+{
+ m_iNumOwnedTiles = (m_iNumOwnedTiles + iChange);
+ FAssert(getNumOwnedTiles() >= 0);
+ FAssert(getNumUnownedTiles() >= 0);
+}
+
+
+int CvArea::getNumRiverEdges() const
+{
+ return m_iNumRiverEdges;
+}
+
+
+void CvArea::changeNumRiverEdges(int iChange)
+{
+ m_iNumRiverEdges = (m_iNumRiverEdges + iChange);
+ FAssert(getNumRiverEdges() >= 0);
+}
+
+
+int CvArea::getNumUnits() const
+{
+ return m_iNumUnits;
+}
+
+
+int CvArea::getNumCities() const
+{
+ return m_iNumCities;
+}
+
+
+int CvArea::getTotalPopulation() const
+{
+ return m_iTotalPopulation;
+}
+
+
+int CvArea::getNumStartingPlots() const
+{
+ return m_iNumStartingPlots;
+}
+
+
+void CvArea::changeNumStartingPlots(int iChange)
+{
+ m_iNumStartingPlots = m_iNumStartingPlots + iChange;
+ FAssert(getNumStartingPlots() >= 0);
+}
+
+
+bool CvArea::isWater() const
+{
+ return m_bWater;
+}
+
+
+int CvArea::getUnitsPerPlayer(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiUnitsPerPlayer[eIndex];
+}
+
+
+void CvArea::changeUnitsPerPlayer(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_iNumUnits = (m_iNumUnits + iChange);
+ FAssert(getNumUnits() >= 0);
+ m_aiUnitsPerPlayer[eIndex] = (m_aiUnitsPerPlayer[eIndex] + iChange);
+ FAssert(getUnitsPerPlayer(eIndex) >= 0);
+}
+
+
+int CvArea::getAnimalsPerPlayer(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiAnimalsPerPlayer[eIndex];
+}
+
+
+void CvArea::changeAnimalsPerPlayer(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_aiAnimalsPerPlayer[eIndex] = (m_aiAnimalsPerPlayer[eIndex] + iChange);
+ FAssert(getAnimalsPerPlayer(eIndex) >= 0);
+}
+
+
+int CvArea::getCitiesPerPlayer(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiCitiesPerPlayer[eIndex];
+}
+
+
+void CvArea::changeCitiesPerPlayer(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_iNumCities = (m_iNumCities + iChange);
+ FAssert(getNumCities() >= 0);
+ m_aiCitiesPerPlayer[eIndex] = (m_aiCitiesPerPlayer[eIndex] + iChange);
+ FAssert(getCitiesPerPlayer(eIndex) >= 0);
+}
+
+
+int CvArea::getPopulationPerPlayer(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiPopulationPerPlayer[eIndex];
+}
+
+
+void CvArea::changePopulationPerPlayer(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_iTotalPopulation = (m_iTotalPopulation + iChange);
+ FAssert(getTotalPopulation() >= 0);
+ m_aiPopulationPerPlayer[eIndex] = (m_aiPopulationPerPlayer[eIndex] +
iChange);
+ FAssert(getPopulationPerPlayer(eIndex) >= 0);
+}
+
+
+int CvArea::getBuildingGoodHealth(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiBuildingGoodHealth[eIndex];
+}
+
+
+void CvArea::changeBuildingGoodHealth(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+
+ if (iChange != 0)
+ {
+ m_aiBuildingGoodHealth[eIndex] = (m_aiBuildingGoodHealth[eIndex] +
iChange);
+ FAssert(getBuildingGoodHealth(eIndex) >= 0);
+
+ GET_PLAYER(eIndex).AI_makeAssignWorkDirty();
+ }
+}
+
+
+int CvArea::getBuildingBadHealth(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiBuildingBadHealth[eIndex];
+}
+
+
+void CvArea::changeBuildingBadHealth(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+
+ if (iChange != 0)
+ {
+ m_aiBuildingBadHealth[eIndex] = (m_aiBuildingBadHealth[eIndex] +
iChange);
+ FAssert(getBuildingBadHealth(eIndex) >= 0);
+
+ GET_PLAYER(eIndex).AI_makeAssignWorkDirty();
+ }
+}
+
+
+int CvArea::getBuildingHappiness(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiBuildingHappiness[eIndex];
+}
+
+
+void CvArea::changeBuildingHappiness(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+
+ if (iChange != 0)
+ {
+ m_aiBuildingHappiness[eIndex] = (m_aiBuildingHappiness[eIndex] +
iChange);
+
+ GET_PLAYER(eIndex).AI_makeAssignWorkDirty();
+ }
+}
+
+
+int CvArea::getFreeSpecialist(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiFreeSpecialist[eIndex];
+}
+
+
+void CvArea::changeFreeSpecialist(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+
+ if (iChange != 0)
+ {
+ m_aiFreeSpecialist[eIndex] = (m_aiFreeSpecialist[eIndex] + iChange);
+ FAssert(getFreeSpecialist(eIndex) >= 0);
+
+ GET_PLAYER(eIndex).AI_makeAssignWorkDirty();
+ }
+}
+
+
+int CvArea::getPower(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiPower[eIndex];
+}
+
+
+void CvArea::changePower(PlayerTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_aiPower[eIndex] = (m_aiPower[eIndex] + iChange);
+ FAssert(getPower(eIndex) >= 0);
+}
+
+
+int CvArea::getBestFoundValue(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiBestFoundValue[eIndex];
+}
+
+
+void CvArea::setBestFoundValue(PlayerTypes eIndex, int iNewValue)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_aiBestFoundValue[eIndex] = iNewValue;
+ FAssert(getBestFoundValue(eIndex) >= 0);
+}
+
+
+int CvArea::getNumRevealedTiles(TeamTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return m_aiNumRevealedTiles[eIndex];
+}
+
+
+int CvArea::getNumUnrevealedTiles(TeamTypes eIndex) const
+{
+ return (getNumTiles() - getNumRevealedTiles(eIndex));
+}
+
+
+void CvArea::changeNumRevealedTiles(TeamTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ m_aiNumRevealedTiles[eIndex] = (m_aiNumRevealedTiles[eIndex] + iChange);
+ FAssert(getNumRevealedTiles(eIndex) >= 0);
+}
+
+
+int CvArea::getCleanPowerCount(TeamTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+ return m_aiCleanPowerCount[eIndex];
+}
+
+
+bool CvArea::isCleanPower(TeamTypes eIndex) const
+{
+ return (getCleanPowerCount(eIndex) > 0);
+}
+
+
+void CvArea::changeCleanPowerCount(TeamTypes eIndex, int iChange)
+{
+ bool bOldCleanPower;
+
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+
+ if (iChange != 0)
+ {
+ bOldCleanPower = isCleanPower(eIndex);
+
+ m_aiCleanPowerCount[eIndex] = (m_aiCleanPowerCount[eIndex] + iChange);
+
+ if (bOldCleanPower != isCleanPower(eIndex))
+ {
+ GET_TEAM(eIndex).updateCommerce();
+ GET_TEAM(eIndex).updatePowerHealth();
+
+ if (eIndex == GC.getGameINLINE().getActiveTeam())
+ {
+ gDLL->getInterfaceIFace()->setDirty(CityInfo_DIRTY_BIT, true);
+ }
+ }
+ }
+}
+
+
+int CvArea::getBorderObstacleCount(TeamTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+ return m_aiBorderObstacleCount[eIndex];
+}
+
+bool CvArea::isBorderObstacle(TeamTypes eIndex) const
+{
+ return (getBorderObstacleCount(eIndex) > 0);
+}
+
+
+void CvArea::changeBorderObstacleCount(TeamTypes eIndex, int iChange)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+
+ m_aiBorderObstacleCount[eIndex] += iChange;
+
+ if (iChange > 0 && m_aiBorderObstacleCount[eIndex] == iChange)
+ {
+ GC.getMapINLINE().verifyUnitValidPlot();
+ }
+}
+
+
+
+AreaAITypes CvArea::getAreaAIType(TeamTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+ return m_aeAreaAIType[eIndex];
+}
+
+
+void CvArea::setAreaAIType(TeamTypes eIndex, AreaAITypes eNewValue)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be < MAX_TEAMS");
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.13.09
+ if (!GET_TEAM(eIndex).isHuman() && eNewValue != m_aeAreaAIType[eIndex])
+ {
+ // dismiss all legions
+ for (int iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ if (GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI) >= 0 &&
GC.getGameINLINE().getHeroCapturePlayer((HeroTypes)iI) == NO_PLAYER)
+ {
+ if
(GET_PLAYER((PlayerTypes)GC.getGameINLINE().getHeroDebutStatus((HeroTypes)iI)).getTeam()
== eIndex)
+ {
+ CvUnit* pHero =
GC.getGameINLINE().getHeroUnit((HeroTypes)iI);
+ FAssert (pHero != NULL);
+
+ if (pHero != NULL && pHero->getLegionHero() != NO_HERO)
+ {
+ if (pHero->area()->getID() == getID())
+ {
+ if (eNewValue == AREAAI_OFFENSIVE && pHero->AI_getUnitAIType() ==
UNITAI_COUNTER)
+ {
+ pHero->AI_setUnitAIType(UNITAI_ATTACK);
+ }
+ else if(eNewValue == AREAAI_DEFENSIVE && pHero->AI_getUnitAIType()
== UNITAI_ATTACK)
+ {
+ pHero->AI_setUnitAIType(UNITAI_COUNTER);
+ }
+ else
+ {
+ pHero->dismissLegion();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // Sanguo Mod Hero, end
+
+ m_aeAreaAIType[eIndex] = eNewValue;
+}
+
+
+CvCity* CvArea::getTargetCity(PlayerTypes eIndex) const
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+ return getCity(m_aTargetCities[eIndex]);
+}
+
+
+void CvArea::setTargetCity(PlayerTypes eIndex, CvCity* pNewValue)
+{
+ FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
+ FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be <
MAX_PLAYERS");
+
+ if (pNewValue != NULL)
+ {
+ m_aTargetCities[eIndex] = pNewValue->getIDInfo();
+ }
+ else
+ {
+ m_aTargetCities[eIndex].reset();
+ }
+}
+
+
+int CvArea::getYieldRateModifier(PlayerTypes eIndex1, YieldTypes eIndex2)
const
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_YIELD_TYPES, "eIndex2 is expected to be <
NUM_YIELD_TYPES");
+ return m_aaiYieldRateModifier[eIndex1][eIndex2];
+}
+
+
+void CvArea::changeYieldRateModifier(PlayerTypes eIndex1, YieldTypes
eIndex2, int iChange)
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_YIELD_TYPES, "eIndex2 is expected to be <
NUM_YIELD_TYPES");
+
+ if (iChange != 0)
+ {
+ m_aaiYieldRateModifier[eIndex1][eIndex2] =
(m_aaiYieldRateModifier[eIndex1][eIndex2] + iChange);
+
+ GET_PLAYER(eIndex1).invalidateYieldRankCache(eIndex2);
+
+ if (eIndex2 == YIELD_COMMERCE)
+ {
+ GET_PLAYER(eIndex1).updateCommerce();
+ }
+
+ GET_PLAYER(eIndex1).AI_makeAssignWorkDirty();
+
+ if (GET_PLAYER(eIndex1).getTeam() == GC.getGameINLINE().getActiveTeam())
+ {
+ gDLL->getInterfaceIFace()->setDirty(CityInfo_DIRTY_BIT, true);
+ }
+ }
+}
+
+
+int CvArea::getNumTrainAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2)
const
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_UNITAI_TYPES, "eIndex2 is expected to be <
NUM_UNITAI_TYPES");
+ return m_aaiNumTrainAIUnits[eIndex1][eIndex2];
+}
+
+
+void CvArea::changeNumTrainAIUnits(PlayerTypes eIndex1, UnitAITypes
eIndex2, int iChange)
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_UNITAI_TYPES, "eIndex2 is expected to be <
NUM_UNITAI_TYPES");
+ m_aaiNumTrainAIUnits[eIndex1][eIndex2] =
(m_aaiNumTrainAIUnits[eIndex1][eIndex2] + iChange);
+ FAssert(getNumTrainAIUnits(eIndex1, eIndex2) >= 0);
+}
+
+
+int CvArea::getNumAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2) const
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_UNITAI_TYPES, "eIndex2 is expected to be <
NUM_UNITAI_TYPES");
+ return m_aaiNumAIUnits[eIndex1][eIndex2];
+}
+
+
+void CvArea::changeNumAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2,
int iChange)
+{
+ FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be >= 0");
+ FAssertMsg(eIndex1 < MAX_PLAYERS, "eIndex1 is expected to be <
MAX_PLAYERS");
+ FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be >= 0");
+ FAssertMsg(eIndex2 < NUM_UNITAI_TYPES, "eIndex2 is expected to be <
NUM_UNITAI_TYPES");
+ m_aaiNumAIUnits[eIndex1][eIndex2] = (m_aaiNumAIUnits[eIndex1][eIndex2] +
iChange);
+ FAssert(getNumAIUnits(eIndex1, eIndex2) >= 0);
+}
+
+
+int CvArea::getNumBonuses(BonusTypes eBonus) const
+{
+ FAssertMsg(eBonus >= 0, "eBonus expected to be >= 0");
+ FAssertMsg(eBonus < GC.getNumBonusInfos(), "eBonus expected to be <
GC.getNumBonusInfos");
+ return m_paiNumBonuses[eBonus];
+}
+
+
+int CvArea::getNumTotalBonuses() const
+{
+ int iTotal = 0;
+
+ for (int iI = 0; iI < GC.getNumBonusInfos(); iI++)
+ {
+ iTotal += m_paiNumBonuses[iI];
+ }
+
+ return iTotal;
+}
+
+
+void CvArea::changeNumBonuses(BonusTypes eBonus, int iChange)
+{
+ FAssertMsg(eBonus >= 0, "eBonus expected to be >= 0");
+ FAssertMsg(eBonus < GC.getNumBonusInfos(), "eBonus expected to be <
GC.getNumBonusInfos");
+ m_paiNumBonuses[eBonus] = (m_paiNumBonuses[eBonus] + iChange);
+ FAssert(getNumBonuses(eBonus) >= 0);
+}
+
+
+int CvArea::getNumImprovements(ImprovementTypes eImprovement) const
+{
+ FAssertMsg(eImprovement >= 0, "eImprovement expected to be >= 0");
+ FAssertMsg(eImprovement < GC.getNumImprovementInfos(), "eImprovement
expected to be < GC.getNumImprovementInfos");
+ return m_paiNumImprovements[eImprovement];
+}
+
+
+void CvArea::changeNumImprovements(ImprovementTypes eImprovement, int
iChange)
+{
+ FAssertMsg(eImprovement >= 0, "eImprovement expected to be >= 0");
+ FAssertMsg(eImprovement < GC.getNumImprovementInfos(), "eImprovement
expected to be < GC.getNumImprovementInfos");
+ m_paiNumImprovements[eImprovement] = (m_paiNumImprovements[eImprovement]
+ iChange);
+ FAssert(getNumImprovements(eImprovement) >= 0);
+}
+
+
+void CvArea::read(FDataStreamBase* pStream)
+{
+ int iI;
+
+ // Init saved data
+ reset();
+
+ uint uiFlag=0;
+ pStream->Read(&uiFlag); // flags for expansion
+
+ pStream->Read(&m_iID);
+ pStream->Read(&m_iNumTiles);
+ pStream->Read(&m_iNumOwnedTiles);
+ pStream->Read(&m_iNumRiverEdges);
+ pStream->Read(&m_iNumUnits);
+ pStream->Read(&m_iNumCities);
+ pStream->Read(&m_iTotalPopulation);
+ pStream->Read(&m_iNumStartingPlots);
+
+ pStream->Read(&m_bWater);
+
+ pStream->Read(MAX_PLAYERS, m_aiUnitsPerPlayer);
+ pStream->Read(MAX_PLAYERS, m_aiAnimalsPerPlayer);
+ pStream->Read(MAX_PLAYERS, m_aiCitiesPerPlayer);
+ pStream->Read(MAX_PLAYERS, m_aiPopulationPerPlayer);
+ pStream->Read(MAX_PLAYERS, m_aiBuildingGoodHealth);
+ pStream->Read(MAX_PLAYERS, m_aiBuildingBadHealth);
+ pStream->Read(MAX_PLAYERS, m_aiBuildingHappiness);
+ pStream->Read(MAX_PLAYERS, m_aiFreeSpecialist);
+ pStream->Read(MAX_PLAYERS, m_aiPower);
+ pStream->Read(MAX_PLAYERS, m_aiBestFoundValue);
+ pStream->Read(MAX_TEAMS, m_aiNumRevealedTiles);
+ pStream->Read(MAX_TEAMS, m_aiCleanPowerCount);
+ pStream->Read(MAX_TEAMS, m_aiBorderObstacleCount);
+
+ pStream->Read(MAX_TEAMS, (int*)m_aeAreaAIType);
+
+ for (iI=0;iI<MAX_PLAYERS;iI++)
+ {
+ pStream->Read((int*)&m_aTargetCities[iI].eOwner);
+ pStream->Read(&m_aTargetCities[iI].iID);
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ pStream->Read(NUM_YIELD_TYPES, m_aaiYieldRateModifier[iI]);
+ }
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvArea.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,167 @@
+#pragma once
+
+// area.h
+
+#ifndef CIV4_AREA_H
+#define CIV4_AREA_H
+
+//#include "CvStructs.h"
+
+class CvCity;
+class CvPlot;
+
+class CvArea
+{
+
+public:
+
+ CvArea();
+ virtual ~CvArea();
+
+ void init(int iID, bool bWater);
+ void uninit();
+ void reset(int iID = 0, bool bWater = false, bool bConstructorCall =
false);
+
+ int calculateTotalBestNatureYield() const; // Exposed to
Python
+
+ int countCoastalLand() const; // Exposed to Python
+ int countNumUniqueBonusTypes() const; // Exposed to
Python
+ int countHasReligion(ReligionTypes eReligion, PlayerTypes eOwner =
NO_PLAYER) const; // Exposed to Python
+ int countHasCorporation(CorporationTypes eCorporation, PlayerTypes eOwner
= NO_PLAYER) const; // Exposed to Python
+
+ DllExport int getID() const; // Exposed to Python
+ void setID(int iID);
+
+ int getNumTiles() const; // Exposed to Python
+ bool isLake() const; // Exposed to Python
+ void changeNumTiles(int iChange);
+
+ int getNumOwnedTiles() const; // Exposed to Python
+ int getNumUnownedTiles() const; // Exposed to Python
+ void changeNumOwnedTiles(int iChange);
+
+ int getNumRiverEdges() const; // Exposed to Python
+ void changeNumRiverEdges(int iChange);
+
+ int getNumCities() const; // Exposed to Python
+
+ int getNumUnits() const; // Exposed to Python
+
+ int getTotalPopulation() const; // Exposed to Python
+
+ int getNumStartingPlots() const; // Exposed to Python
+ void changeNumStartingPlots(int iChange);
+
+ bool isWater() const; // Exposed to Python
+
+ int getUnitsPerPlayer(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeUnitsPerPlayer(PlayerTypes eIndex, int iChange);
+
+ int getAnimalsPerPlayer(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeAnimalsPerPlayer(PlayerTypes eIndex, int iChange);
+
+ int getCitiesPerPlayer(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeCitiesPerPlayer(PlayerTypes eIndex, int iChange);
+
+ int getPopulationPerPlayer(PlayerTypes eIndex) const; //
Exposed to Python
+ void changePopulationPerPlayer(PlayerTypes eIndex, int iChange);
+
+ int getBuildingGoodHealth(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeBuildingGoodHealth(PlayerTypes eIndex, int iChange);
+
+ int getBuildingBadHealth(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeBuildingBadHealth(PlayerTypes eIndex, int iChange);
+
+ int getBuildingHappiness(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeBuildingHappiness(PlayerTypes eIndex, int iChange);
+
+ int getFreeSpecialist(PlayerTypes eIndex) const; // Exposed
to Python
+ void changeFreeSpecialist(PlayerTypes eIndex, int iChange);
+
+ int getPower(PlayerTypes eIndex) const; // Exposed to
Python
+ void changePower(PlayerTypes eIndex, int iChange);
+
+ int getBestFoundValue(PlayerTypes eIndex) const; // Exposed
to Python
+ void setBestFoundValue(PlayerTypes eIndex, int iNewValue);
+
+ int getNumRevealedTiles(TeamTypes eIndex) const; // Exposed
to Python
+ int getNumUnrevealedTiles(TeamTypes eIndex) const; // Exposed
to Python
+ void changeNumRevealedTiles(TeamTypes eIndex, int iChange);
+
+ int getCleanPowerCount(TeamTypes eIndex) const;
+ bool isCleanPower(TeamTypes eIndex) const; // Exposed to
Python
+ void changeCleanPowerCount(TeamTypes eIndex, int iChange);
+
+ int getBorderObstacleCount(TeamTypes eIndex) const;
+ DllExport bool isBorderObstacle(TeamTypes eIndex) const;
// Exposed to Python
+ void changeBorderObstacleCount(TeamTypes eIndex, int iChange);
+
+ AreaAITypes getAreaAIType(TeamTypes eIndex) const; // Exposed
to Python
+ void setAreaAIType(TeamTypes eIndex, AreaAITypes eNewValue);
+
+ CvCity* getTargetCity(PlayerTypes eIndex) const; // Exposed
to Python
+ void setTargetCity(PlayerTypes eIndex, CvCity* pNewValue);
+
+ int getYieldRateModifier(PlayerTypes eIndex1, YieldTypes eIndex2) const;
// Exposed to Python
+ void changeYieldRateModifier(PlayerTypes eIndex1, YieldTypes eIndex2, int
iChange);
+
+ int getNumTrainAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2) const;
// Exposed to Python
+ void changeNumTrainAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2, int
iChange);
+
+ int getNumAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2) const; //
Exposed to Python
+ void changeNumAIUnits(PlayerTypes eIndex1, UnitAITypes eIndex2, int
iChange);
+
+ int getNumBonuses(BonusTypes eBonus) const; // Exposed to
Python
+ int getNumTotalBonuses() const; // Exposed to Python
+ void changeNumBonuses(BonusTypes eBonus, int iChange);
+
+ int getNumImprovements(ImprovementTypes eImprovement) const; //
Exposed to Python
+ void changeNumImprovements(ImprovementTypes eImprovement, int iChange);
+
+protected:
+
+ int m_iID;
+ int m_iNumTiles;
+ int m_iNumOwnedTiles;
+ int m_iNumRiverEdges;
+ int m_iNumUnits;
+ int m_iNumCities;
+ int m_iTotalPopulation;
+ int m_iNumStartingPlots;
+
+ bool m_bWater;
+
+ int* m_aiUnitsPerPlayer;
+ int* m_aiAnimalsPerPlayer;
+ int* m_aiCitiesPerPlayer;
+ int* m_aiPopulationPerPlayer;
+ int* m_aiBuildingGoodHealth;
+ int* m_aiBuildingBadHealth;
+ int* m_aiBuildingHappiness;
+ int* m_aiFreeSpecialist;
+ int* m_aiPower;
+ int* m_aiBestFoundValue;
+ int* m_aiNumRevealedTiles;
+ int* m_aiCleanPowerCount;
+ int* m_aiBorderObstacleCount;
+
+ AreaAITypes* m_aeAreaAIType;
+
+ IDInfo* m_aTargetCities;
+
+ int** m_aaiYieldRateModifier;
+ int** m_aaiNumTrainAIUnits;
+ int** m_aaiNumAIUnits;
+
+ int* m_paiNumBonuses;
+ int* m_paiNumImprovements;
+
+public:
+
+ // for serialization
+ virtual void read(FDataStreamBase* pStream);
+ virtual void write(FDataStreamBase* pStream);
+
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvArtFileMgr.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,183 @@
+//---------------------------------------------------------------------------------------
+//
+// ***************** Civilization IV ********************
+//
+// FILE: CvArtFileMgr.cpp
+//
+// AUTHOR: Jesse Smith / Mustafa Thamer 9/2004
+//
+// PURPOSE: Interfaces with Civ4ArtDefines.xml to manage the paths of art
files
+//
+//---------------------------------------------------------------------------------------
+// Copyright (c) 2004 Firaxis Games, Inc. All rights reserved.
+//---------------------------------------------------------------------------------------
+#include "CvGameCoreDLL.h"
+#include "CvArtFileMgr.h"
+#include "CvXMLLoadUtility.h"
+#include "CvGlobals.h"
+#include "CvInfos.h"
+#include "CvDLLUtilityIFaceBase.h"
+
+// Macro for Building Art Info Maps
+#if 0 // DEBUGGING
+#define BUILD_INFO_MAP(map, infoArray, numInfos) \
+{ \
+ int iI; \
+ for (iI = 0; iI < numInfos; iI++) \
+ { \
+ char temp[256]; \
+ sprintf(temp, "type = %s\n", infoArray(iI).getType()); \
+ OutputDebugString(temp); \
+ sprintf(temp, "description = %S\n", infoArray(iI).getDescription()); \
+ OutputDebugString(temp); \
+ (map)[infoArray(iI).getTag()] = &infoArray(iI); \
+ } \
+}
+#else
+#define BUILD_INFO_MAP(map, infoArray, numInfos) \
+{ \
+ int iI; \
+ for (iI = 0; iI < numInfos; iI++) \
+ { \
+ (map)[infoArray(iI).getTag()] = &infoArray(iI); \
+ } \
+}
+#endif
+
+//
+// creates a derived artItem class which automatically registers itself
with the ARTFILEMGR upon contruction.
+// creates a static var of that artItem type which constructs (and
registers) at startup.
+// creates a getFooArtInfo() function that searches the map based on the
id provided and returns the artInfo struct or null.
+//
+#define ART_INFO_DEFN(name) \
+\
+class Cv##name##ArtInfoItem : public CvArtFileMgr::ArtInfoItem \
+{ \
+ void init() { ARTFILEMGR.m_map##name##ArtInfos = new
CvArtFileMgr::ArtInfo##name##MapType; } \
+ void deInit(); \
+ void buildMap() { BUILD_INFO_MAP(*ARTFILEMGR.m_map##name##ArtInfos,
ARTFILEMGR.get##name##ArtInfo, ARTFILEMGR.getNum##name##ArtInfos()); } \
+}; \
+\
+static Cv##name##ArtInfoItem g##name##ArtInfoItem; \
+\
+CvArtInfo##name##* CvArtFileMgr::get##name##ArtInfo( const char
*szArtDefineTag ) const \
+{ \
+ FAssertMsg(szArtDefineTag, "NULL string on art info lookup?"); \
+ ArtInfo##name##MapType::const_iterator it = m_map##name##ArtInfos->find(
szArtDefineTag );\
+ if ( it == m_map##name##ArtInfos->end() ) \
+ {\
+ char szErrorMsg[256]; \
+ sprintf(szErrorMsg, "get##name##ArtInfo: %s was not found",
szArtDefineTag); \
+ FAssertMsg(false, szErrorMsg ); \
+ if ( 0 == strcmp(szArtDefineTag, "ERROR") ) \
+ { \
+ return NULL; \
+ } \
+ else \
+ { \
+ return get##name##ArtInfo( "ERROR" ); \
+ } \
+ } \
+ return it->second; \
+} \
+void Cv##name##ArtInfoItem::deInit() \
+{ \
+ SAFE_DELETE(ARTFILEMGR.m_map##name##ArtInfos); \
+ for (uint i = 0; i < ARTFILEMGR.m_pa##name##ArtInfo.size(); ++i) \
+ { \
+ SAFE_DELETE(ARTFILEMGR.m_pa##name##ArtInfo[i]); \
+ } \
+ ARTFILEMGR.m_pa##name##ArtInfo.clear(); \
+} \
+CvArtInfo##name##& CvArtFileMgr::get##name##ArtInfo(int i) { return
*(m_pa##name##ArtInfo[i]); }
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: GetInstance()
+//
+// PURPOSE: Get the instance of this class.
+//
+//----------------------------------------------------------------------------
+CvArtFileMgr& CvArtFileMgr::GetInstance()
+{
+ static CvArtFileMgr gs_ArtFileMgr;
+ return gs_ArtFileMgr;
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: Init()
+//
+// PURPOSE: Initializes the Maps
+//
+//----------------------------------------------------------------------------
+void CvArtFileMgr::Init()
+{
+ int i;
+ for(i=0;i<(int)m_artInfoItems.size();i++)
+ {
+ m_artInfoItems[i]->init();
+ }
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: DeInit()
+//
+// PURPOSE: Deletes the Maps
+//
+//----------------------------------------------------------------------------
+void CvArtFileMgr::DeInit()
+{
+ int i;
+ for(i=0;i<(int)m_artInfoItems.size();i++)
+ {
+ m_artInfoItems[i]->deInit();
+ }
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: Reset()
+//
+// PURPOSE: Reloads the XML & Rebuilds the Maps
+//
+//----------------------------------------------------------------------------
+void CvArtFileMgr::Reset()
+{
+ DeInit(); // Cleans Art Defines
+ CvXMLLoadUtility XMLLoadUtility;
+ XMLLoadUtility.SetGlobalArtDefines(); // Reloads/allocs Art Defines
+ Init(); // reallocs maps
+ buildArtFileInfoMaps();
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: buildArtFileInfoMaps()
+//
+// PURPOSE: Builds the Art File Maps
+//
+//----------------------------------------------------------------------------
+void CvArtFileMgr::buildArtFileInfoMaps()
+{
+ int i;
+ for(i=0;i<(int)m_artInfoItems.size();i++)
+ {
+ m_artInfoItems[i]->buildMap();
+ }
+}
+
+// Macros the creation of the art file info maps
+ART_INFO_DEFN(Asset);
+ART_INFO_DEFN(Misc);
+ART_INFO_DEFN(Unit);
+ART_INFO_DEFN(Building);
+ART_INFO_DEFN(Civilization);
+ART_INFO_DEFN(Leaderhead);
+ART_INFO_DEFN(Bonus);
+ART_INFO_DEFN(Improvement);
+ART_INFO_DEFN(Terrain);
+ART_INFO_DEFN(Feature);
+ART_INFO_DEFN(Movie);
+ART_INFO_DEFN(Interface);
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvArtFileMgr.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,113 @@
+#pragma once
+
+//---------------------------------------------------------------------------------------
+//
+// ***************** Civilization IV ********************
+//
+// FILE: CvArtFileMgr.h
+//
+// AUTHOR: Jesse Smith / Mustafa Thamer 9/2004
+//
+// PURPOSE: Interfaces with Civ4ArtDefines.xml to manage the paths of art
files
+//
+//---------------------------------------------------------------------------------------
+// Copyright (c) 2004 Firaxis Games, Inc. All rights reserved.
+//---------------------------------------------------------------------------------------
+#ifndef CIV4_ARTFILEMGR_H
+#define CIV4_ARTFILEMGR_H
+
+// Class: CvArtFileMgr
+// Purpose: To Manage the Locations of Art Assets
+//
+// Adding a New Entry:
+// * Create a new ArtInfo<new> in 'CvInfos.h' & add to CyInfosInterface
+// * Add a new ART_INFO_DECL to 'CvArtFileMgr.h'
+// * Add a new ART_INFO_DEFN to 'CvArtFileMgr.cpp'
+// * Update Python 'CyGlobalContext & CyArtFileMgr' files
+// * Add INIT_GLOBAL_XML_LOAD item to SetGlobalArtDefines
in 'CvXMLLoadUtilitySet'
+// * Add <new> to 'XML\Art\CIV4ArtDefines.xml' and update
the 'CIV4ArtDefinesSchema'
+
+class CvArtInfoAsset;
+class CvArtInfoMisc;
+class CvArtInfoUnit;
+class CvArtInfoBuilding;
+class CvArtInfoCivilization;
+class CvArtInfoLeaderhead;
+class CvArtInfoBonus;
+class CvArtInfoImprovement;
+class CvArtInfoTerrain;
+class CvArtInfoFeature;
+class CvArtInfoMovie;
+class CvArtInfoInterface;
+
+// Example usage: ART_INFO_DECL(Unit)
+#define ART_INFO_DECL(name) \
+public: \
+ friend class Cv##name##ArtInfoItem; \
+ DllExport CvArtInfo##name##* get##name##ArtInfo(const char
*szArtDefineTag) const; \
+ DllExport int getNum##name##ArtInfos() { return
(int)m_pa##name##ArtInfo.size(); } \
+ DllExport std::vector<CvArtInfo##name##*>& get##name##ArtInfo() { return
m_pa##name##ArtInfo; } \
+ DllExport CvArtInfo##name##& get##name##ArtInfo(int i); \
+private: \
+ typedef std::map<const char* /* index */,CvArtInfo##name##* /*value */,
ltstr> ArtInfo##name##MapType; \
+ ArtInfo##name##MapType* m_map##name##ArtInfos; \
+ std::vector<CvArtInfo##name##*> m_pa##name##ArtInfo; \
+
+class CvArtFileMgr
+{
+private:
+ class ArtInfoItem
+ {
+ public:
+ ArtInfoItem() { CvArtFileMgr::GetInstance().addArtInfoItem(this); }
+ virtual void init() = 0;
+ virtual void deInit() = 0;
+ virtual void buildMap() = 0;
+ };
+public:
+ // singleton accessor
+ DllExport static CvArtFileMgr& GetInstance();
+
+ DllExport CvArtFileMgr() {};
+ DllExport virtual ~CvArtFileMgr() {};
+
+ DllExport void Init();
+ DllExport void DeInit();
+
+ // Deletes Maps, Reloads Infos from XML, Rebuilds Maps
+ DllExport void Reset(); // Exposed to Python
+
+ // Builds Maps
+ DllExport void buildArtFileInfoMaps(); // Exposed
to Python
+
+ // Adds an Art File List
+ void addArtInfoItem(CvArtFileMgr::ArtInfoItem* item) {
m_artInfoItems.push_back(item); }
+private:
+ struct ltstr
+ {
+ bool operator()(const char* s1, const char* s2) const
+ {
+ return strcmp(s1, s2) < 0;
+ }
+ };
+
+ ART_INFO_DECL(Asset);
+ ART_INFO_DECL(Misc);
+ ART_INFO_DECL(Unit);
+ ART_INFO_DECL(Building);
+ ART_INFO_DECL(Civilization);
+ ART_INFO_DECL(Leaderhead);
+ ART_INFO_DECL(Bonus);
+ ART_INFO_DECL(Improvement);
+ ART_INFO_DECL(Terrain);
+ ART_INFO_DECL(Feature);
+ ART_INFO_DECL(Movie);
+ ART_INFO_DECL(Interface);
+
+ std::vector<ArtInfoItem*> m_artInfoItems;
+};
+
+// Singleton Accessor
+#define ARTFILEMGR CvArtFileMgr::GetInstance()
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvCity.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,14248 @@
+// city.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvGlobals.h"
+#include "CvCity.h"
+#include "CvArea.h"
+#include "CvGameAI.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvTeamAI.h"
+#include "CvGameCoreUtils.h"
+#include "CvPlayerAI.h"
+#include "CvUnit.h"
+#include "CvInfos.h"
+#include "CvRandom.h"
+#include "CvArtFileMgr.h"
+#include "CvPopupInfo.h"
+#include "CyCity.h"
+#include "CyArgsList.h"
+#include "FProfiler.h"
+#include "CvGameTextMgr.h"
+
+// interfaces used
+#include "CvDLLEngineIFaceBase.h"
+#include "CvDLLPythonIFaceBase.h"
+#include "CvDLLEntityIFaceBase.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLEventReporterIFaceBase.h"
+
+// Public Functions...
+
+CvCity::CvCity()
+{
+ m_aiSeaPlotYield = new int[NUM_YIELD_TYPES];
+ m_aiRiverPlotYield = new int[NUM_YIELD_TYPES];
+ m_aiBaseYieldRate = new int[NUM_YIELD_TYPES];
+ m_aiYieldRateModifier = new int[NUM_YIELD_TYPES];
+ m_aiPowerYieldRateModifier = new int[NUM_YIELD_TYPES];
+ m_aiBonusYieldRateModifier = new int[NUM_YIELD_TYPES];
+ m_aiTradeYield = new int[NUM_YIELD_TYPES];
+ m_aiCorporationYield = new int[NUM_YIELD_TYPES];
+ m_aiExtraSpecialistYield = new int[NUM_YIELD_TYPES];
+ m_aiCommerceRate = new int[NUM_COMMERCE_TYPES];
+ m_aiProductionToCommerceModifier = new int[NUM_COMMERCE_TYPES];
+ m_aiBuildingCommerce = new int[NUM_COMMERCE_TYPES];
+ m_aiSpecialistCommerce = new int[NUM_COMMERCE_TYPES];
+ m_aiReligionCommerce = new int[NUM_COMMERCE_TYPES];
+ m_aiCorporationCommerce = new int[NUM_COMMERCE_TYPES];
+ m_aiCommerceRateModifier = new int[NUM_COMMERCE_TYPES];
+ m_aiCommerceHappinessPer = new int[NUM_COMMERCE_TYPES];
+ m_aiDomainFreeExperience = new int[NUM_DOMAIN_TYPES];
+ m_aiDomainProductionModifier = new int[NUM_DOMAIN_TYPES];
+
+ m_aiCulture = new int[MAX_PLAYERS];
+ m_aiNumRevolts = new int[MAX_PLAYERS];
+ m_abEverOwned = new bool[MAX_PLAYERS];
+ m_abTradeRoute = new bool[MAX_PLAYERS];
+ m_abRevealed = new bool[MAX_TEAMS];
+ m_abEspionageVisibility = new bool[MAX_TEAMS];
+
+ m_paiNoBonus = NULL;
+ m_paiFreeBonus = NULL;
+ m_paiNumBonuses = NULL;
+ m_paiNumCorpProducedBonuses = NULL;
+ m_paiProjectProduction = NULL;
+ m_paiBuildingProduction = NULL;
+ m_paiBuildingProductionTime = NULL;
+ m_paiBuildingOriginalOwner = NULL;
+ m_paiBuildingOriginalTime = NULL;
+ m_paiUnitProduction = NULL;
+ m_paiUnitProductionTime = NULL;
+ m_paiGreatPeopleUnitRate = NULL;
+ m_paiGreatPeopleUnitProgress = NULL;
+ m_paiSpecialistCount = NULL;
+ m_paiMaxSpecialistCount = NULL;
+ m_paiForceSpecialistCount = NULL;
+ m_paiFreeSpecialistCount = NULL;
+ m_paiImprovementFreeSpecialists = NULL;
+ m_paiReligionInfluence = NULL;
+ m_paiStateReligionHappiness = NULL;
+ m_paiUnitCombatFreeExperience = NULL;
+ m_paiFreePromotionCount = NULL;
+ m_paiNumRealBuilding = NULL;
+ m_paiNumFreeBuilding = NULL;
+
+ m_pabWorkingPlot = NULL;
+ m_pabHasReligion = NULL;
+ m_pabHasCorporation = NULL;
+
+ m_paTradeCities = NULL;
+
+ CvDLLEntity::createCityEntity(this); // create and attach entity to city
+
+ m_aiBaseYieldRank = new int[NUM_YIELD_TYPES];
+ m_abBaseYieldRankValid = new bool[NUM_YIELD_TYPES];
+ m_aiYieldRank = new int[NUM_YIELD_TYPES];
+ m_abYieldRankValid = new bool[NUM_YIELD_TYPES];
+ m_aiCommerceRank = new int[NUM_COMMERCE_TYPES];
+ m_abCommerceRankValid = new bool[NUM_COMMERCE_TYPES];
+
+ reset(0, NO_PLAYER, 0, 0, true);
+}
+
+CvCity::~CvCity()
+{
+ CvDLLEntity::removeEntity(); // remove entity from engine
+ CvDLLEntity::destroyEntity(); // delete CvCityEntity and detach from us
+
+ uninit();
+
+ SAFE_DELETE_ARRAY(m_aiBaseYieldRank);
+ SAFE_DELETE_ARRAY(m_abBaseYieldRankValid);
+ SAFE_DELETE_ARRAY(m_aiYieldRank);
+ SAFE_DELETE_ARRAY(m_abYieldRankValid);
+ SAFE_DELETE_ARRAY(m_aiCommerceRank);
+ SAFE_DELETE_ARRAY(m_abCommerceRankValid);
+
+ SAFE_DELETE_ARRAY(m_aiSeaPlotYield);
+ SAFE_DELETE_ARRAY(m_aiRiverPlotYield);
+ SAFE_DELETE_ARRAY(m_aiBaseYieldRate);
+ SAFE_DELETE_ARRAY(m_aiYieldRateModifier);
+ SAFE_DELETE_ARRAY(m_aiPowerYieldRateModifier);
+ SAFE_DELETE_ARRAY(m_aiBonusYieldRateModifier);
+ SAFE_DELETE_ARRAY(m_aiTradeYield);
+ SAFE_DELETE_ARRAY(m_aiCorporationYield);
+ SAFE_DELETE_ARRAY(m_aiExtraSpecialistYield);
+ SAFE_DELETE_ARRAY(m_aiCommerceRate);
+ SAFE_DELETE_ARRAY(m_aiProductionToCommerceModifier);
+ SAFE_DELETE_ARRAY(m_aiBuildingCommerce);
+ SAFE_DELETE_ARRAY(m_aiSpecialistCommerce);
+ SAFE_DELETE_ARRAY(m_aiReligionCommerce);
+ SAFE_DELETE_ARRAY(m_aiCorporationCommerce);
+ SAFE_DELETE_ARRAY(m_aiCommerceRateModifier);
+ SAFE_DELETE_ARRAY(m_aiCommerceHappinessPer);
+ SAFE_DELETE_ARRAY(m_aiDomainFreeExperience);
+ SAFE_DELETE_ARRAY(m_aiDomainProductionModifier);
+ SAFE_DELETE_ARRAY(m_aiCulture);
+ SAFE_DELETE_ARRAY(m_aiNumRevolts);
+ SAFE_DELETE_ARRAY(m_abEverOwned);
+ SAFE_DELETE_ARRAY(m_abTradeRoute);
+ SAFE_DELETE_ARRAY(m_abRevealed);
+ SAFE_DELETE_ARRAY(m_abEspionageVisibility);
+}
+
+
+void CvCity::init(int iID, PlayerTypes eOwner, int iX, int iY, bool
bBumpUnits, bool bUpdatePlotGroups)
+{
+ CvPlot* pAdjacentPlot;
+ CvPlot* pPlot;
+ BuildingTypes eLoopBuilding;
+ int iI;
+
+ pPlot = GC.getMapINLINE().plotINLINE(iX, iY);
+
+ //--------------------------------
+ // Log this event
+ if (GC.getLogging())
+ {
+ if (gDLL->getChtLvl() > 0)
+ {
+ TCHAR szOut[1024];
+ sprintf(szOut, "Player %d City %d built at %d:%d\n", eOwner, iID, iX,
iY);
+ gDLL->messageControlLog(szOut);
+ }
+ }
+
+ //--------------------------------
+ // Init saved data
+ reset(iID, eOwner, pPlot->getX_INLINE(), pPlot->getY_INLINE());
+
+ //--------------------------------
+ // Init non-saved data
+ setupGraphical();
+
+ //--------------------------------
+ // Init other game data
+ setName(GET_PLAYER(getOwnerINLINE()).getNewCityName());
+
+ setEverOwned(getOwnerINLINE(), true);
+
+ updateCultureLevel(false);
+
+ if (pPlot->getCulture(getOwnerINLINE()) <
GC.getDefineINT("FREE_CITY_CULTURE"))
+ {
+ pPlot->setCulture(getOwnerINLINE(),
GC.getDefineINT("FREE_CITY_CULTURE"), bBumpUnits, false);
+ }
+ pPlot->setOwner(getOwnerINLINE(), bBumpUnits, false);
+ pPlot->setPlotCity(this);
+
+ for (iI = 0; iI < NUM_DIRECTION_TYPES; iI++)
+ {
+ pAdjacentPlot = plotDirection(getX_INLINE(), getY_INLINE(),
((DirectionTypes)iI));
+
+ if (pAdjacentPlot != NULL)
+ {
+ if (pAdjacentPlot->getCulture(getOwnerINLINE()) <
GC.getDefineINT("FREE_CITY_ADJACENT_CULTURE"))
+ {
+ pAdjacentPlot->setCulture(getOwnerINLINE(),
GC.getDefineINT("FREE_CITY_ADJACENT_CULTURE"), bBumpUnits, false);
+ }
+ pAdjacentPlot->updateCulture(bBumpUnits, false);
+ }
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ if (GET_TEAM(getTeam()).isVassal((TeamTypes)iI))
+ {
+ pPlot->changeAdjacentSight((TeamTypes)iI,
GC.getDefineINT("PLOT_VISIBILITY_RANGE"), true, NULL, false);
+ }
+ }
+
+ CyArgsList argsList;
+ argsList.add(iX);
+ argsList.add(iY);
+ long lResult=0;
+
gDLL->getPythonIFace()->callFunction(PYGameModule, "citiesDestroyFeatures",
argsList.makeFunctionArgs(), &lResult);
+
+ if (lResult == 1)
+ {
+ if (pPlot->getFeatureType() != NO_FEATURE)
+ {
+ pPlot->setFeatureType(NO_FEATURE);
+ }
+ }
+
+ pPlot->setImprovementType(NO_IMPROVEMENT);
+ pPlot->updateCityRoute(false);
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ if (GET_TEAM((TeamTypes)iI).isAlive())
+ {
+ if (pPlot->isVisible(((TeamTypes)iI), false))
+ {
+ setRevealed(((TeamTypes)iI), true);
+ }
+ }
+ }
+
+ changeMilitaryHappinessUnits(pPlot->plotCount(PUF_isMilitaryHappiness));
+
+ for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
+ {
+ changeCommerceHappinessPer(((CommerceTypes)iI),
GC.getCommerceInfo((CommerceTypes)iI).getInitialHappiness());
+ }
+
+ for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
+ {
+ if (GET_PLAYER(getOwnerINLINE()).isBuildingFree((BuildingTypes)iI))
+ {
+ setNumFreeBuilding(((BuildingTypes)iI), 1);
+ }
+ }
+
+ area()->changeCitiesPerPlayer(getOwnerINLINE(), 1);
+
+ GET_TEAM(getTeam()).changeNumCities(1);
+
+ GC.getGameINLINE().changeNumCities(1);
+
+ setGameTurnFounded(GC.getGameINLINE().getGameTurn());
+ setGameTurnAcquired(GC.getGameINLINE().getGameTurn());
+
+ changePopulation(GC.getDefineINT("INITIAL_CITY_POPULATION") +
GC.getEraInfo(GC.getGameINLINE().getStartEra()).getFreePopulation());
+
+ changeAirUnitCapacity(GC.getDefineINT("CITY_AIR_UNIT_CAPACITY"));
+
+ updateFreshWaterHealth();
+ updateFeatureHealth();
+ updateFeatureHappiness();
+ updatePowerHealth();
+
+ GET_PLAYER(getOwnerINLINE()).updateMaintenance();
+
+ GC.getMapINLINE().updateWorkingCity();
+
+ GC.getGameINLINE().AI_makeAssignWorkDirty();
+
+ GET_PLAYER(getOwnerINLINE()).setFoundedFirstCity(true);
+
+ if (GC.getGameINLINE().isFinalInitialized())
+ {
+ if (GET_PLAYER(getOwnerINLINE()).getNumCities() == 1)
+ {
+ for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
+ {
+ if
(GC.getCivilizationInfo(getCivilizationType()).isCivilizationFreeBuildingClass(iI))
+ {
+ eLoopBuilding =
((BuildingTypes)(GC.getCivilizationInfo(getCivilizationType()).getCivilizationBuildings(iI)));
+
+ if (eLoopBuilding != NO_BUILDING)
+ {
+ setNumRealBuilding(eLoopBuilding, true);
+ }
+ }
+ }
+
+ if (!isHuman())
+ {
+
changeOverflowProduction(GC.getDefineINT("INITIAL_AI_CITY_PRODUCTION"), 0);
+ }
+ }
+ }
+
+ updateEspionageVisibility(false);
+
+ if (bUpdatePlotGroups)
+ {
+ GC.getGameINLINE().updatePlotGroups();
+ }
+
+ AI_init();
+}
+
+
+void CvCity::uninit()
+{
+ SAFE_DELETE_ARRAY(m_paiNoBonus);
+ SAFE_DELETE_ARRAY(m_paiFreeBonus);
+ SAFE_DELETE_ARRAY(m_paiNumBonuses);
+ SAFE_DELETE_ARRAY(m_paiNumCorpProducedBonuses);
+ SAFE_DELETE_ARRAY(m_paiProjectProduction);
+ SAFE_DELETE_ARRAY(m_paiBuildingProduction);
+ SAFE_DELETE_ARRAY(m_paiBuildingProductionTime);
+ SAFE_DELETE_ARRAY(m_paiBuildingOriginalOwner);
+ SAFE_DELETE_ARRAY(m_paiBuildingOriginalTime);
+ SAFE_DELETE_ARRAY(m_paiUnitProduction);
+ SAFE_DELETE_ARRAY(m_paiUnitProductionTime);
+ SAFE_DELETE_ARRAY(m_paiGreatPeopleUnitRate);
+ SAFE_DELETE_ARRAY(m_paiGreatPeopleUnitProgress);
+ SAFE_DELETE_ARRAY(m_paiSpecialistCount);
+ SAFE_DELETE_ARRAY(m_paiMaxSpecialistCount);
+ SAFE_DELETE_ARRAY(m_paiForceSpecialistCount);
+ SAFE_DELETE_ARRAY(m_paiFreeSpecialistCount);
+ SAFE_DELETE_ARRAY(m_paiImprovementFreeSpecialists);
+ SAFE_DELETE_ARRAY(m_paiReligionInfluence);
+ SAFE_DELETE_ARRAY(m_paiStateReligionHappiness);
+ SAFE_DELETE_ARRAY(m_paiUnitCombatFreeExperience);
+ SAFE_DELETE_ARRAY(m_paiFreePromotionCount);
+ SAFE_DELETE_ARRAY(m_paiNumRealBuilding);
+ SAFE_DELETE_ARRAY(m_paiNumFreeBuilding);
+
+ SAFE_DELETE_ARRAY(m_pabWorkingPlot);
+ SAFE_DELETE_ARRAY(m_pabHasReligion);
+ SAFE_DELETE_ARRAY(m_pabHasCorporation);
+
+ SAFE_DELETE_ARRAY(m_paTradeCities);
+
+ m_orderQueue.clear();
+}
+
+// FUNCTION: reset()
+// Initializes data members that are serialized.
+void CvCity::reset(int iID, PlayerTypes eOwner, int iX, int iY, bool
bConstructorCall)
+{
+ int iI;
+
+ //--------------------------------
+ // Uninit class
+ uninit();
+
+ m_iID = iID;
+ m_iX = iX;
+ m_iY = iY;
+ m_iRallyX = INVALID_PLOT_COORD;
+ m_iRallyY = INVALID_PLOT_COORD;
+ m_iGameTurnFounded = 0;
+ m_iGameTurnAcquired = 0;
+ m_iPopulation = 0;
+ m_iHighestPopulation = 0;
+ m_iWorkingPopulation = 0;
+ m_iSpecialistPopulation = 0;
+ m_iNumGreatPeople = 0;
+ m_iBaseGreatPeopleRate = 0;
+ m_iGreatPeopleRateModifier = 0;
+ m_iGreatPeopleProgress = 0;
+ m_iNumWorldWonders = 0;
+ m_iNumTeamWonders = 0;
+ m_iNumNationalWonders = 0;
+ m_iNumBuildings = 0;
+ m_iGovernmentCenterCount = 0;
+ m_iMaintenance = 0;
+ m_iMaintenanceModifier = 0;
+ m_iWarWearinessModifier = 0;
+ m_iHurryAngerModifier = 0;
+ m_iHealRate = 0;
+ m_iEspionageHealthCounter = 0;
+ m_iEspionageHappinessCounter = 0;
+ m_iFreshWaterGoodHealth = 0;
+ m_iFreshWaterBadHealth = 0;
+ m_iFeatureGoodHealth = 0;
+ m_iFeatureBadHealth = 0;
+ m_iBuildingGoodHealth = 0;
+ m_iBuildingBadHealth = 0;
+ m_iPowerGoodHealth = 0;
+ m_iPowerBadHealth = 0;
+ m_iBonusGoodHealth = 0;
+ m_iBonusBadHealth = 0;
+ m_iHurryAngerTimer = 0;
+ m_iConscriptAngerTimer = 0;
+ m_iDefyResolutionAngerTimer = 0;
+ m_iHappinessTimer = 0;
+ m_iMilitaryHappinessUnits = 0;
+ m_iBuildingGoodHappiness = 0;
+ m_iBuildingBadHappiness = 0;
+ m_iExtraBuildingGoodHappiness = 0;
+ m_iExtraBuildingBadHappiness = 0;
+ m_iExtraBuildingGoodHealth = 0;
+ m_iExtraBuildingBadHealth = 0;
+ m_iFeatureGoodHappiness = 0;
+ m_iFeatureBadHappiness = 0;
+ m_iBonusGoodHappiness = 0;
+ m_iBonusBadHappiness = 0;
+ m_iReligionGoodHappiness = 0;
+ m_iReligionBadHappiness = 0;
+ m_iExtraHappiness = 0;
+ m_iExtraHealth = 0;
+ m_iNoUnhappinessCount = 0;
+ m_iNoUnhealthyPopulationCount = 0;
+ m_iBuildingOnlyHealthyCount = 0;
+ m_iFood = 0;
+ m_iFoodKept = 0;
+ m_iMaxFoodKeptPercent = 0;
+ m_iOverflowProduction = 0;
+ m_iFeatureProduction = 0;
+ m_iMilitaryProductionModifier = 0;
+ m_iSpaceProductionModifier = 0;
+ m_iExtraTradeRoutes = 0;
+ m_iTradeRouteModifier = 0;
+ m_iForeignTradeRouteModifier = 0;
+ m_iBuildingDefense = 0;
+ m_iBuildingBombardDefense = 0;
+ m_iFreeExperience = 0;
+ m_iCurrAirlift = 0;
+ m_iMaxAirlift = 0;
+ m_iAirModifier = 0;
+ m_iAirUnitCapacity = 0;
+ m_iNukeModifier = 0;
+ m_iFreeSpecialist = 0;
+ m_iPowerCount = 0;
+ m_iDirtyPowerCount = 0;
+ m_iDefenseDamage = 0;
+ m_iLastDefenseDamage = 0;
+ m_iOccupationTimer = 0;
+ m_iCultureUpdateTimer = 0;
+ m_iCitySizeBoost = 0;
+ m_iSpecialistFreeExperience = 0;
+ m_iEspionageDefenseModifier = 0;
+
+ m_bNeverLost = true;
+ m_bBombarded = false;
+ m_bDrafted = false;
+ m_bAirliftTargeted = false;
+ m_bWeLoveTheKingDay = false;
+ m_bCitizensAutomated = true;
+ m_bProductionAutomated = false;
+ m_bWallOverride = false;
+ m_bInfoDirty = true;
+ m_bLayoutDirty = false;
+ m_bPlundered = false;
+
+ m_eOwner = eOwner;
+ m_ePreviousOwner = NO_PLAYER;
+ m_eOriginalOwner = eOwner;
+ m_eCultureLevel = NO_CULTURELEVEL;
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ m_aiSeaPlotYield[iI] = 0;
+ m_aiRiverPlotYield[iI] = 0;
+ m_aiBaseYieldRate[iI] = 0;
+ m_aiYieldRateModifier[iI] = 0;
+ m_aiPowerYieldRateModifier[iI] = 0;
+ m_aiBonusYieldRateModifier[iI] = 0;
+ m_aiTradeYield[iI] = 0;
+ m_aiCorporationYield[iI] = 0;
+ m_aiExtraSpecialistYield[iI] = 0;
+ }
+
+ for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
+ {
+ m_aiCommerceRate[iI] = 0;
+ m_aiProductionToCommerceModifier[iI] = 0;
+ m_aiBuildingCommerce[iI] = 0;
+ m_aiSpecialistCommerce[iI] = 0;
+ m_aiReligionCommerce[iI] = 0;
+ m_aiCorporationCommerce[iI] = 0;
+ m_aiCommerceRateModifier[iI] = 0;
+ m_aiCommerceHappinessPer[iI] = 0;
+ }
+
+ for (iI = 0; iI < NUM_DOMAIN_TYPES; iI++)
+ {
+ m_aiDomainFreeExperience[iI] = 0;
+ m_aiDomainProductionModifier[iI] = 0;
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_aiCulture[iI] = 0;
+ m_aiNumRevolts[iI] = 0;
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_abEverOwned[iI] = false;
+ m_abTradeRoute[iI] = false;
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ m_abRevealed[iI] = false;
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ m_abEspionageVisibility[iI] = false;
+ }
+
+ clear(m_szName);
+ m_szScriptData = "";
+
+ m_bPopulationRankValid = false;
+ m_iPopulationRank = -1;
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ m_abBaseYieldRankValid[iI] = false;
+ m_abYieldRankValid[iI] = false;
+ m_aiBaseYieldRank[iI] = -1;
+ m_aiYieldRank[iI] = -1;
+ }
+
+ for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
+ {
+ m_abCommerceRankValid[iI] = false;
+ m_aiCommerceRank[iI] = -1;
+ }
+
+ if (!bConstructorCall)
+ {
+ FAssertMsg((0 < GC.getNumBonusInfos()), "GC.getNumBonusInfos() is not
greater than zero but an array is being allocated in CvCity::reset");
+ m_paiNoBonus = new int[GC.getNumBonusInfos()];
+ m_paiFreeBonus = new int[GC.getNumBonusInfos()];
+ m_paiNumBonuses = new int[GC.getNumBonusInfos()];
+ m_paiNumCorpProducedBonuses = new int[GC.getNumBonusInfos()];
+ for (iI = 0; iI < GC.getNumBonusInfos(); iI++)
+ {
+ m_paiNoBonus[iI] = 0;
+ m_paiFreeBonus[iI] = 0;
+ m_paiNumBonuses[iI] = 0;
+ m_paiNumCorpProducedBonuses[iI] = 0;
+ }
+
+ m_paiProjectProduction = new int[GC.getNumProjectInfos()];
+ for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
+ {
+ m_paiProjectProduction[iI] = 0;
+ }
+
+ FAssertMsg((0 < GC.getNumBuildingInfos()), "GC.getNumBuildingInfos() is
not greater than zero but an array is being allocated in CvCity::reset");
+ //m_ppBuildings = new CvBuilding *[GC.getNumBuildingInfos()];
+ m_paiBuildingProduction = new int[GC.getNumBuildingInfos()];
+ m_paiBuildingProductionTime = new int[GC.getNumBuildingInfos()];
+ m_paiBuildingOriginalOwner = new int[GC.getNumBuildingInfos()];
+ m_paiBuildingOriginalTime = new int[GC.getNumBuildingInfos()];
+ m_paiNumRealBuilding = new int[GC.getNumBuildingInfos()];
+ m_paiNumFreeBuilding = new int[GC.getNumBuildingInfos()];
+ for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
+ {
+ //m_ppBuildings[iI] = NULL;
+ m_paiBuildingProduction[iI] = 0;
+ m_paiBuildingProductionTime[iI] = 0;
+ m_paiBuildingOriginalOwner[iI] = -1;
+ m_paiBuildingOriginalTime[iI] = MIN_INT;
+ m_paiNumRealBuilding[iI] = 0;
+ m_paiNumFreeBuilding[iI] = 0;
+ }
+
+ FAssertMsg((0 < GC.getNumUnitInfos()), "GC.getNumUnitInfos() is not
greater than zero but an array is being allocated in CvCity::reset");
+ m_paiUnitProduction = new int[GC.getNumUnitInfos()];
+ m_paiUnitProductionTime = new int[GC.getNumUnitInfos()];
+ m_paiGreatPeopleUnitRate = new int[GC.getNumUnitInfos()];
+ m_paiGreatPeopleUnitProgress = new int[GC.getNumUnitInfos()];
+ for (iI = 0;iI < GC.getNumUnitInfos();iI++)
+ {
+ m_paiUnitProduction[iI] = 0;
+ m_paiUnitProductionTime[iI] = 0;
+ m_paiGreatPeopleUnitRate[iI] = 0;
+ m_paiGreatPeopleUnitProgress[iI] = 0;
+ }
+
+ FAssertMsg((0 <
GC.getNumSpecialistInfos()), "GC.getNumSpecialistInfos() is not greater
than zero but an array is being allocated in CvCity::reset");
+ m_paiSpecialistCount = new int[GC.getNumSpecialistInfos()];
+ m_paiMaxSpecialistCount = new int[GC.getNumSpecialistInfos()];
+ m_paiForceSpecialistCount = new int[GC.getNumSpecialistInfos()];
+ m_paiFreeSpecialistCount = new int[GC.getNumSpecialistInfos()];
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ m_paiSpecialistCount[iI] = 0;
+ m_paiMaxSpecialistCount[iI] = 0;
+ m_paiForceSpecialistCount[iI] = 0;
+ m_paiFreeSpecialistCount[iI] = 0;
+ }
+
+ FAssertMsg((0 <
GC.getNumImprovementInfos()), "GC.getNumImprovementInfos() is not greater
than zero but an array is being allocated in CvCity::reset");
+ m_paiImprovementFreeSpecialists = new int[GC.getNumImprovementInfos()];
+ for (iI = 0; iI < GC.getNumImprovementInfos(); iI++)
+ {
+ m_paiImprovementFreeSpecialists[iI] = 0;
+ }
+
+ m_paiReligionInfluence = new int[GC.getNumReligionInfos()];
+ m_paiStateReligionHappiness = new int[GC.getNumReligionInfos()];
+ m_pabHasReligion = new bool[GC.getNumReligionInfos()];
+ for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
+ {
+ m_paiReligionInfluence[iI] = 0;
+ m_paiStateReligionHappiness[iI] = 0;
+ m_pabHasReligion[iI] = false;
+ }
+
+ m_pabHasCorporation = new bool[GC.getNumCorporationInfos()];
+ for (iI = 0; iI < GC.getNumCorporationInfos(); iI++)
+ {
+ m_pabHasCorporation[iI] = false;
+ }
+
+ FAssertMsg((0 <
GC.getNumUnitCombatInfos()), "GC.getNumUnitCombatInfos() is not greater
than zero but an array is being allocated in CvCity::reset");
+ m_paiUnitCombatFreeExperience = new int[GC.getNumUnitCombatInfos()];
+ for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
+ {
+ m_paiUnitCombatFreeExperience[iI] = 0;
+ }
+
+ FAssertMsg((0 < GC.getNumPromotionInfos()), "GC.getNumPromotionInfos()
is not greater than zero but an array is being allocated in CvCity::reset");
+ m_paiFreePromotionCount = new int[GC.getNumPromotionInfos()];
+ for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
+ {
+ m_paiFreePromotionCount[iI] = 0;
+ }
+
+ FAssertMsg((0 < NUM_CITY_PLOTS), "NUM_CITY_PLOTS is not greater than
zero but an array is being allocated in CvCity::reset");
+ m_pabWorkingPlot = new bool[NUM_CITY_PLOTS];
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ m_pabWorkingPlot[iI] = false;
+ }
+
+ FAssertMsg((0 <
GC.getDefineINT("MAX_TRADE_ROUTES")), "GC.getMAX_TRADE_ROUTES() is not
greater than zero but an array is being allocated in CvCity::reset");
+ m_paTradeCities = new IDInfo[GC.getDefineINT("MAX_TRADE_ROUTES")];
+ for (iI = 0; iI < GC.getDefineINT("MAX_TRADE_ROUTES"); iI++)
+ {
+ m_paTradeCities[iI].reset();
+ }
+
+ m_aEventsOccured.clear();
+ m_aBuildingYieldChange.clear();
+ m_aBuildingCommerceChange.clear();
+ m_aBuildingHappyChange.clear();
+ m_aBuildingHealthChange.clear();
+ // Sanguo Mod City Perk, start, added by poyuzhe 07.8.09
+ m_aHasCityPerks.clear();
+ // Sanguo Mod City Perk, end
+ }
+
+ if (!bConstructorCall)
+ {
+ AI_reset();
+ }
+}
+
+
+//////////////////////////////////////
+// graphical only setup
+//////////////////////////////////////
+void CvCity::setupGraphical()
+{
+ if (!GC.IsGraphicsInitialized())
+ {
+ return;
+ }
+
+ CvDLLEntity::setup();
+
+ setInfoDirty(true);
+ setLayoutDirty(true);
+}
+
+void CvCity::kill(bool bUpdatePlotGroups)
+{
+ CvPlot* pPlot;
+ CvPlot* pAdjacentPlot;
+ CvPlot* pLoopPlot;
+ PlayerTypes eOwner;
+ bool bCapital;
+ int iI;
+
+ if (isCitySelected())
+ {
+ gDLL->getInterfaceIFace()->clearSelectedCities();
+ }
+
+ pPlot = plot();
+
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ pLoopPlot = getCityIndexPlot(iI);
+
+ if (pLoopPlot != NULL)
+ {
+ if (pLoopPlot->getWorkingCityOverride() == this)
+ {
+ pLoopPlot->setWorkingCityOverride(NULL);
+ }
+ }
+ }
+
+ setCultureLevel(NO_CULTURELEVEL, false);
+
+ for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
+ {
+ setNumRealBuilding(((BuildingTypes)iI), 0);
+ setNumFreeBuilding(((BuildingTypes)iI), 0);
+ }
+
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ setFreeSpecialistCount(((SpecialistTypes)iI), 0);
+ }
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ setTradeYield(((YieldTypes)iI), 0);
+ setCorporationYield(((YieldTypes) iI), 0);
+ }
+
+ for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
+ {
+ setHasReligion(((ReligionTypes)iI), false, false, true);
+
+ if (isHolyCity((ReligionTypes)iI))
+ {
+ GC.getGameINLINE().setHolyCity(((ReligionTypes)iI), NULL, false);
+ }
+ }
+
+ for (iI = 0; iI < GC.getNumCorporationInfos(); iI++)
+ {
+ setHasCorporation(((CorporationTypes)iI), false, false);
+
+ if (isHeadquarters((CorporationTypes)iI))
+ {
+ GC.getGameINLINE().setHeadquarters(((CorporationTypes)iI), NULL, false);
+ }
+ }
+
+ setPopulation(0);
+
+ AI_assignWorkingPlots();
+
+ clearOrderQueue();
+
+ // remember the visibility before we take away the city from the plot
below
+ std::vector<bool> abEspionageVisibility;
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ abEspionageVisibility.push_back(getEspionageVisibility((TeamTypes)iI));
+ }
+
+/*************************************************************************************************/
+/** UNOFFICIAL_PATCH
08/04/09 jdog5000 */
+/**
*/
+/**
Bugfix
*/
+/*************************************************************************************************/
+ // Need to clear trade routes of dead city, else they'll be claimed for
the owner forever
+ clearTradeRoutes();
+/*************************************************************************************************/
+/** UNOFFICIAL_PATCH
END */
+/*************************************************************************************************/
+
+ pPlot->setPlotCity(NULL);
+
+ area()->changeCitiesPerPlayer(getOwnerINLINE(), -1);
+
+ GET_TEAM(getTeam()).changeNumCities(-1);
+
+ GC.getGameINLINE().changeNumCities(-1);
+
+ FAssertMsg(getWorkingPopulation() == 0, "getWorkingPopulation is expected
to be 0");
+ FAssertMsg(!isWorkingPlot(CITY_HOME_PLOT), "isWorkingPlot(CITY_HOME_PLOT)
is expected to be false");
+ FAssertMsg(getSpecialistPopulation() == 0, "getSpecialistPopulation is
expected to be 0");
+ FAssertMsg(getNumGreatPeople() == 0, "getNumGreatPeople is expected to be
0");
+ FAssertMsg(getBaseYieldRate(YIELD_FOOD) ==
0, "getBaseYieldRate(YIELD_FOOD) is expected to be 0");
+ FAssertMsg(getBaseYieldRate(YIELD_PRODUCTION) ==
0, "getBaseYieldRate(YIELD_PRODUCTION) is expected to be 0");
+ FAssertMsg(getBaseYieldRate(YIELD_COMMERCE) ==
0, "getBaseYieldRate(YIELD_COMMERCE) is expected to be 0");
+ FAssertMsg(!isProduction(), "isProduction is expected to be false");
+
+ eOwner = getOwnerINLINE();
+
+ bCapital = isCapital();
+
+
pPlot->setImprovementType((ImprovementTypes)(GC.getDefineINT("RUINS_IMPROVEMENT")));
+
+ gDLL->getEventReporterIFace()->cityLost(this);
+
+ GET_PLAYER(getOwnerINLINE()).deleteCity(getID());
+
+ pPlot->updateCulture(true, false);
+
+ for (iI = 0; iI < NUM_DIRECTION_TYPES; iI++)
+ {
+ pAdjacentPlot = plotDirection(pPlot->getX_INLINE(),
pPlot->getY_INLINE(), ((DirectionTypes)iI));
+
+ if (pAdjacentPlot != NULL)
+ {
+ pAdjacentPlot->updateCulture(true, false);
+ }
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ if (GET_TEAM(GET_PLAYER(eOwner).getTeam()).isVassal((TeamTypes)iI))
+ {
+ pPlot->changeAdjacentSight((TeamTypes)iI,
GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
+ }
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ if (abEspionageVisibility[iI])
+ {
+ pPlot->changeAdjacentSight((TeamTypes)iI,
GC.getDefineINT("PLOT_VISIBILITY_RANGE"), false, NULL, false);
+ }
+ }
+
+ GET_PLAYER(eOwner).updateMaintenance();
+
+ GC.getMapINLINE().updateWorkingCity();
+
+ GC.getGameINLINE().AI_makeAssignWorkDirty();
+
+ if (bCapital)
+ {
+ GET_PLAYER(eOwner).findNewCapital();
+
+ GET_TEAM(GET_PLAYER(eOwner).getTeam()).resetVictoryProgress();
+ }
+
+ if (bUpdatePlotGroups)
+ {
+ GC.getGameINLINE().updatePlotGroups();
+ }
+
+ if (eOwner == GC.getGameINLINE().getActivePlayer())
+ {
+ gDLL->getInterfaceIFace()->setDirty(SelectionButtons_DIRTY_BIT, true);
+ }
+}
+
+
+void CvCity::doTurn()
+{
+ PROFILE("CvCity::doTurn()");
+
+ CvPlot* pLoopPlot;
+ int iI;
+
+ if (!isBombarded())
+ {
+ changeDefenseDamage(-(GC.getDefineINT("CITY_DEFENSE_DAMAGE_HEAL_RATE")));
+ }
+
+ setLastDefenseDamage(getDefenseDamage());
+ setBombarded(false);
+ setPlundered(false);
+ setDrafted(false);
+ setAirliftTargeted(false);
+ setCurrAirlift(0);
+
+ AI_doTurn();
+
+ bool bAllowNoProduction = !doCheckProduction();
+
+ doGrowth();
+
+ doCulture();
+
+ doPlotCulture(false, getOwnerINLINE(), getCommerceRate(COMMERCE_CULTURE));
+
+ doProduction(bAllowNoProduction);
+
+ doDecay();
+
+ doReligion();
+
+ doGreatPeople();
+
+ doMeltdown();
+
+ updateEspionageVisibility(true);
+
+ if (!isDisorder())
+ {
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ pLoopPlot = getCityIndexPlot(iI);
+
+ if (pLoopPlot != NULL)
+ {
+ if (pLoopPlot->getWorkingCity() == this)
+ {
+ if (pLoopPlot->isBeingWorked())
+ {
+ pLoopPlot->doImprovement();
+ }
+ }
+ }
+ }
+ }
+
+ if (getCultureUpdateTimer() > 0)
+ {
+ changeCultureUpdateTimer(-1);
+ }
+
+ if (getOccupationTimer() > 0)
+ {
+ changeOccupationTimer(-1);
+ }
+
+ if (getHurryAngerTimer() > 0)
+ {
+ changeHurryAngerTimer(-1);
+ }
+
+ if (getConscriptAngerTimer() > 0)
+ {
+ changeConscriptAngerTimer(-1);
+ }
+
+ if (getDefyResolutionAngerTimer() > 0)
+ {
+ changeDefyResolutionAngerTimer(-1);
+ }
+
+ if (getHappinessTimer() > 0)
+ {
+ changeHappinessTimer(-1);
+ }
+
+ if (getEspionageHealthCounter() > 0)
+ {
+ changeEspionageHealthCounter(-1);
+ }
+
+ if (getEspionageHappinessCounter() > 0)
+ {
+ changeEspionageHappinessCounter(-1);
+ }
+
+ // Sanguo Mod Civilization Trait, start, by poyuzhe 11.28.08
+ // Zhang Lu, TRAIT_RICE_TAOIST
+ if (GET_PLAYER(getOwnerINLINE()).getBaseImmigrationChance() > 0)
+ {
+ if (foodDifference(true) > 0)
+ {
+ if (!isOccupation() && healthRate() == 0)
+ {
+ int iRealHappy = happyLevel() - unhappyLevel(0);
+ if (iRealHappy > 0)
+ {
+ int iChance =
(GET_PLAYER(getOwnerINLINE()).getBaseImmigrationChance()) * (iRealHappy *
GC.getDefineINT("RICE_TAOIST_IMMIGRATION_HAPPINESS_MODIFIER") + 100) / 100;
+ if
(GC.getGameINLINE().getSorenRandNum(1000, "Population Immigration") <
iChance)
+ {
+ changePopulation(1);
+ CvWString szBuffer;
+ szBuffer =
gDLL->getText("TXT_KEY_CITY_IMMIGRATION", getNameKey());
+ gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(),
false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_WELOVEKING",
MESSAGE_TYPE_MINOR_EVENT,
ARTFILEMGR.getInterfaceArtInfo("INTERFACE_HAPPY_PERSON")->getPath(),
(ColorTypes)GC.getInfoTypeForString("COLOR_WHITE"), getX_INLINE(),
getY_INLINE(), true, true);
+ }
+ }
+ }
+ }
+ }
+ // Sanguo Mod Civilization Trait, end
+
+ if (isOccupation() || (angryPopulation() > 0) || (healthRate() < 0))
+ {
+ setWeLoveTheKingDay(false);
+ }
+ else if ((getPopulation() >=
GC.getDefineINT("WE_LOVE_THE_KING_POPULATION_MIN_POPULATION")) &&
(GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("WE_LOVE_THE_KING_RAND"), "Do
We Love The King?") < getPopulation()))
+ {
+ setWeLoveTheKingDay(true);
+ }
+ else
+ {
+ setWeLoveTheKingDay(false);
+ }
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvCity.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,1186 @@
+#pragma once
+
+// city.h
+
+#ifndef CIV4_CITY_H
+#define CIV4_CITY_H
+
+#include "CvDLLEntity.h"
+#include "LinkedList.h"
+
+class CvPlot;
+class CvPlotGroup;
+class CvArea;
+class CvGenericBuilding;
+
+class CvCity : public CvDLLEntity
+{
+
+public:
+ CvCity();
+ virtual ~CvCity();
+
+ void init(int iID, PlayerTypes eOwner, int iX, int iY, bool bBumpUnits,
bool bUpdatePlotGroups);
+ void uninit();
+ void reset(int iID = 0, PlayerTypes eOwner = NO_PLAYER, int iX = 0, int
iY = 0, bool bConstructorCall = false);
+ void setupGraphical();
+
+ DllExport void kill(bool bUpdatePlotGroups); //
Exposed to Python
+
+ void doTurn();
+
+ bool isCitySelected();
+ DllExport bool canBeSelected() const;
+ DllExport void updateSelectedCity();
+
+ void updateYield();
+
+ void updateVisibility();
+
+ // Sanguo Mod Hero, start, added by poyuzhe 07.19.09
+ //void createGreatPeople(UnitTypes eGreatPersonUnit, bool
bIncrementThreshold, bool bIncrementExperience); // Exposed to Python
+ CvUnit* createGreatPeople(UnitTypes eGreatPersonUnit, bool
bIncrementThreshold, bool bIncrementExperience); // Exposed to Python
+ // Sanguo Mod Hero, end
+
+ DllExport void doTask(TaskTypes eTask, int iData1 = -1, int iData2 = -1,
bool bOption = false, bool bAlt = false, bool bShift = false, bool bCtrl =
false); // Exposed to Python
+
+ DllExport void chooseProduction(UnitTypes eTrainUnit = NO_UNIT,
BuildingTypes eConstructBuilding = NO_BUILDING, ProjectTypes eCreateProject
= NO_PROJECT, bool bFinish = false, bool bFront = false); // Exposed to
Python
+
+ DllExport int getCityPlotIndex(const CvPlot* pPlot) const; // Exposed
to Python
+ CvPlot* getCityIndexPlot(int iIndex) const; // Exposed to
Python
+
+ bool canWork(CvPlot* pPlot) const; // Exposed to Python
+ void verifyWorkingPlot(int iIndex);
+ void verifyWorkingPlots();
+ void clearWorkingOverride(int iIndex); // Exposed to Python
+ int countNumImprovedPlots(ImprovementTypes eImprovement = NO_IMPROVEMENT,
bool bPotential = false) const; // Exposed to Python
+ int countNumWaterPlots() const; // Exposed to Python
+ int countNumRiverPlots() const; // Exposed to Python
+
+ int findPopulationRank() const; // Exposed to Python
+ int findBaseYieldRateRank(YieldTypes eYield) const; // Exposed
to Python
+ DllExport int findYieldRateRank(YieldTypes eYield) const; //
Exposed to Python
+ DllExport int findCommerceRateRank(CommerceTypes eCommerce) const; //
Exposed to Python
+
+ UnitTypes allUpgradesAvailable(UnitTypes eUnit, int iUpgradeCount = 0)
const; // Exposed to Python
+ DllExport bool isWorldWondersMaxed() const; //
Exposed to Python
+ DllExport bool isTeamWondersMaxed() const; //
Exposed to Python
+ DllExport bool isNationalWondersMaxed() const; //
Exposed to Python
+ DllExport bool isBuildingsMaxed() const; //
Exposed to Python
+
+ DllExport bool canTrain(UnitTypes eUnit, bool bContinue = false, bool
bTestVisible = false, bool bIgnoreCost = false, bool bIgnoreUpgrades =
false) const; // Exposed to Python
+ DllExport bool canTrain(UnitCombatTypes eUnitCombat) const;
+ DllExport bool canConstruct(BuildingTypes eBuilding, bool bContinue =
false, bool bTestVisible = false, bool bIgnoreCost = false) const; //
Exposed to Python
+ DllExport bool canCreate(ProjectTypes eProject, bool bContinue = false,
bool bTestVisible = false) const; // Exposed to Python
+ DllExport bool canMaintain(ProcessTypes eProcess, bool bContinue = false)
const; // Exposed to Python
+ bool canJoin() const; // Exposed to Python
+
+ DllExport int getFoodTurnsLeft() const; // Exposed to
Python
+ DllExport bool isProduction() const; // Exposed to
Python
+ bool isProductionLimited() const; // Exposed to
Python
+ bool isProductionUnit() const; // Exposed to Python
+ bool isProductionBuilding() const; // Exposed to
Python
+ bool isProductionProject() const; // Exposed to
Python
+ DllExport bool isProductionProcess() const; // Exposed
to Python
+
+ bool canContinueProduction(OrderData order); // Exposed to
Python
+ int getProductionExperience(UnitTypes eUnit = NO_UNIT); //
Exposed to Python
+ void addProductionExperience(CvUnit* pUnit, bool bConscript = false); //
Exposed to Python
+
+ DllExport UnitTypes getProductionUnit() const; // Exposed
to Python
+ UnitAITypes getProductionUnitAI() const; // Exposed to
Python
+ DllExport BuildingTypes getProductionBuilding() const; //
Exposed to Python
+ DllExport ProjectTypes getProductionProject() const; //
Exposed to Python
+ DllExport ProcessTypes getProductionProcess() const; //
Exposed to Python
+ DllExport const wchar* getProductionName() const; //
Exposed to Python
+ DllExport const wchar* getProductionNameKey() const; //
Exposed to Python
+ DllExport int getGeneralProductionTurnsLeft() const; // Exposed
to Python
+
+ bool isFoodProduction() const; // Exposed to Python
+ bool isFoodProduction(UnitTypes eUnit) const; // Exposed
to Python
+ int getFirstUnitOrder(UnitTypes eUnit) const; // Exposed
to Python
+ int getFirstBuildingOrder(BuildingTypes eBuilding) const; //
Exposed to Python
+ int getFirstProjectOrder(ProjectTypes eProject) const; //
Exposed to Python
+ int getNumTrainUnitAI(UnitAITypes eUnitAI) const; //
Exposed to Python
+
+ DllExport int getProduction() const; // Exposed to
Python
+ DllExport int getProductionNeeded() const; //
Exposed to Python
+ DllExport int getProductionNeeded(UnitTypes eUnit) const;
+ DllExport int getProductionNeeded(BuildingTypes eBuilding) const;
+ DllExport int getProductionNeeded(ProjectTypes eProject) const;
+ DllExport int getProductionTurnsLeft() const; // Exposed
to Python
+ DllExport int getProductionTurnsLeft(UnitTypes eUnit, int iNum) const;
// Exposed to Python
+ DllExport int getProductionTurnsLeft(BuildingTypes eBuilding, int iNum)
const; // Exposed to Python
+ DllExport int getProductionTurnsLeft(ProjectTypes eProject, int iNum)
const; // Exposed to Python
+ int getProductionTurnsLeft(int iProductionNeeded, int iProduction, int
iFirstProductionDifference, int iProductionDifference) const;
+ void setProduction(int iNewValue); // Exposed to Python
+ void changeProduction(int iChange); // Exposed to Python
+
+ int getProductionModifier() const; // Exposed to
Python
+ int getProductionModifier(UnitTypes eUnit) const; //
Exposed to Python
+ int getProductionModifier(BuildingTypes eBuilding) const; //
Exposed to Python
+ int getProductionModifier(ProjectTypes eProject) const; //
Exposed to Python
+
+ int getOverflowProductionDifference(int iProductionNeeded, int
iProduction, int iProductionModifier, int iDiff, int iModifiedProduction)
const;
+ int getProductionDifference(int iProductionNeeded, int iProduction, int
iProductionModifier, bool bFoodProduction, bool bOverflow) const;
+ DllExport int getCurrentProductionDifference(bool bIgnoreFood, bool
bOverflow) const; // Exposed to Python
+ int getExtraProductionDifference(int iExtra) const;
// Exposed to Python
+
+ DllExport bool canHurry(HurryTypes eHurry, bool bTestVisible = false)
const; // Exposed to Python
+ void hurry(HurryTypes eHurry); // Exposed to Python
+
+ DllExport UnitTypes getConscriptUnit() const; // Exposed
to Python
+ CvUnit* initConscriptedUnit();
+ DllExport int getConscriptPopulation() const; // Exposed
to Python
+ int conscriptMinCityPopulation() const; // Exposed to
Python
+ int flatConscriptAngerLength() const; // Exposed to
Python
+ DllExport bool canConscript() const; // Exposed to
Python
+ void conscript(); // Exposed to Python
+
+ int getBonusHealth(BonusTypes eBonus) const; // Exposed to
Python - getBonusHealth
+ int getBonusHappiness(BonusTypes eBonus) const; // Exposed
to Python - getBonusHappiness
+ int getBonusPower(BonusTypes eBonus, bool bDirty) const; //
Exposed to Python
+ int getBonusYieldRateModifier(YieldTypes eIndex, BonusTypes eBonus)
const; // Exposed to Python
+
+ void processBonus(BonusTypes eBonus, int iChange);
+ void processBuilding(BuildingTypes eBuilding, int iChange, bool bObsolete
= false);
+ void processProcess(ProcessTypes eProcess, int iChange);
+ void processSpecialist(SpecialistTypes eSpecialist, int iChange);
+
+ DllExport HandicapTypes getHandicapType() const; // Exposed to
Python
+ DllExport CivilizationTypes getCivilizationType() const; //
Exposed to Python
+ LeaderHeadTypes getPersonalityType() const; // Exposed to
Python
+ DllExport ArtStyleTypes getArtStyleType() const; // Exposed
to Python
+ DllExport CitySizeTypes getCitySizeType() const; // Exposed to
Python
+
+ bool hasTrait(TraitTypes eTrait) const; // Exposed to
Python
+ bool isBarbarian() const; // Exposed to Python
+ bool isHuman() const; // Exposed to Python
+ DllExport bool isVisible(TeamTypes eTeam, bool bDebug) const; //
Exposed to Python
+
+ DllExport bool isCapital() const; // Exposed to Python
+ bool isCoastal(int iMinWaterSize) const; //
Exposed to Python
+ DllExport bool isDisorder() const; // Exposed to Python
+ DllExport bool isHolyCity(ReligionTypes eIndex) const; // Exposed
to Python
+ DllExport bool isHolyCity() const; // Exposed to Python
+ DllExport bool isHeadquarters(CorporationTypes eIndex) const; //
Exposed to Python
+ DllExport bool isHeadquarters() const; // Exposed to
Python
+ void setHeadquarters(CorporationTypes eIndex);
+
+ int getOvercrowdingPercentAnger(int iExtra = 0) const; // Exposed
to Python
+ int getNoMilitaryPercentAnger() const; // Exposed to
Python
+ int getCulturePercentAnger() const; // Exposed to Python
+ int getReligionPercentAnger() const; // Exposed to Python
+ int getHurryPercentAnger(int iExtra = 0) const; //
Exposed to Python
+ int getConscriptPercentAnger(int iExtra = 0) const; //
Exposed to Python
+ int getDefyResolutionPercentAnger(int iExtra = 0) const;
+ int getWarWearinessPercentAnger() const; // Exposed to
Python
+ int getLargestCityHappiness() const; // Exposed to Python
+ int getVassalHappiness() const; // Exposed to Python
+ int getVassalUnhappiness() const; // Exposed to Python
+ int unhappyLevel(int iExtra = 0) const; // Exposed to
Python
+ DllExport int happyLevel() const; // Exposed to Python
+ DllExport int angryPopulation(int iExtra = 0) const; // Exposed
to Python
+
+ int visiblePopulation() const;
+ DllExport int totalFreeSpecialists() const; // Exposed to
Python
+ int extraPopulation() const; // Exposed to Python
+ int extraSpecialists() const; // Exposed to Python
+ int extraFreeSpecialists() const; // Exposed to Python
+
+ DllExport int unhealthyPopulation(bool bNoAngry = false, int iExtra = 0)
const; // Exposed to Python
+ int totalGoodBuildingHealth() const; // Exposed to Python
+ DllExport int totalBadBuildingHealth() const; // Exposed to
Python
+ DllExport int goodHealth() const; // Exposed to Python
+ DllExport int badHealth(bool bNoAngry = false, int iExtra = 0) const; //
Exposed to Python
+ DllExport int healthRate(bool bNoAngry = false, int iExtra = 0) const; //
Exposed to Python
+ int foodConsumption(bool bNoAngry = false, int iExtra = 0) const; //
Exposed to Python
+ DllExport int foodDifference(bool bBottom = true) const; //
Exposed to Python
+ DllExport int growthThreshold() const; // Exposed to
Python
+
+ int productionLeft() const; // Exposed to Python
+ int hurryCost(bool bExtra) const; // Exposed to Python
+ int getHurryCostModifier(bool bIgnoreNew = false) const;
+ DllExport int hurryGold(HurryTypes eHurry) const; // Exposed
to Python
+ DllExport int hurryPopulation(HurryTypes eHurry) const; //
Exposed to Python
+ int hurryProduction(HurryTypes eHurry) const; // Exposed to
Python
+ int flatHurryAngerLength() const; // Exposed to Python
+ int hurryAngerLength(HurryTypes eHurry) const; // Exposed to
Python
+ int maxHurryPopulation() const; // Exposed to Python
+
+ int cultureDistance(int iDX, int iDY) const; // Exposed to
Python
+ DllExport int cultureStrength(PlayerTypes ePlayer) const; //
Exposed to Python
+ DllExport int cultureGarrison(PlayerTypes ePlayer) const; //
Exposed to Python
+
+ DllExport int getNumBuilding(BuildingTypes eIndex) const; //
Exposed to Python
+ DllExport int getNumActiveBuilding(BuildingTypes eIndex) const; //
Exposed to Python
+ bool hasActiveWorldWonder() const; // Exposed to Python
+
+ int getReligionCount() const; // Exposed to Python
+ int getCorporationCount() const; // Exposed to Python
+
+ DllExport int getID() const; // Exposed to Python
+ DllExport int getIndex() const;
+ DllExport IDInfo getIDInfo() const;
+ void setID(int iID);
+
+ DllExport int getX() const; // Exposed to Python
+#ifdef _USRDLL
+ inline int getX_INLINE() const
+ {
+ return m_iX;
+ }
+#endif
+ DllExport int getY() const; // Exposed to Python
+#ifdef _USRDLL
+ inline int getY_INLINE() const
+ {
+ return m_iY;
+ }
+#endif
+ bool at(int iX, int iY) const; // Exposed to Python
+ bool at(CvPlot* pPlot) const; // Exposed to Python -
atPlot
+ DllExport CvPlot* plot() const; // Exposed to Python
+ CvPlotGroup* plotGroup(PlayerTypes ePlayer) const;
+ bool isConnectedTo(CvCity* pCity) const; // Exposed to
Python
+ DllExport bool isConnectedToCapital(PlayerTypes ePlayer = NO_PLAYER)
const; // Exposed to Python
+ int getArea() const;
+ DllExport CvArea* area() const; // Exposed to Python
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
01/02/09 jdog5000 */
+/**
*/
+/**
*/
+/*************************************************************************************************/
+ CvArea* waterArea(bool bNoImpassable = false) const; //
Exposed to Python
+ CvArea* secondWaterArea() const;
+ CvArea* sharedWaterArea(CvCity* pCity) const;
+ bool isBlockaded() const;
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+ DllExport CvPlot* getRallyPlot() const; // Exposed to
Python
+ void setRallyPlot(CvPlot* pPlot);
+
+ int getGameTurnFounded() const; // Exposed to Python
+ void setGameTurnFounded(int iNewValue);
+
+ int getGameTurnAcquired() const; // Exposed to Python
+ void setGameTurnAcquired(int iNewValue);
+
+ DllExport int getPopulation() const; // Exposed to Python
+ DllExport void setPopulation(int iNewValue); // Exposed to Python
+ DllExport void changePopulation(int iChange); // Exposed to
Python
+
+ long getRealPopulation() const; // Exposed to Python
+
+ int getHighestPopulation() const; // Exposed to Python
+ void setHighestPopulation(int iNewValue);
+
+ int getWorkingPopulation() const; // Exposed to Python
+ void changeWorkingPopulation(int iChange);
+
+ int getSpecialistPopulation() const; // Exposed to Python
+ void changeSpecialistPopulation(int iChange);
+
+ int getNumGreatPeople() const; // Exposed to Python
+ void changeNumGreatPeople(int iChange);
+
+ int getBaseGreatPeopleRate() const; // Exposed to Python
+ int getGreatPeopleRate() const; // Exposed to Python
+ int getTotalGreatPeopleRateModifier() const; // Exposed to
Python
+ void changeBaseGreatPeopleRate(int iChange); // Exposed to Python
+
+ int getGreatPeopleRateModifier() const; // Exposed to
Python
+ void changeGreatPeopleRateModifier(int iChange);
+
+ DllExport int getGreatPeopleProgress() const; // Exposed to
Python
+ void changeGreatPeopleProgress(int iChange); // Exposed to Python
+
+ int getNumWorldWonders() const; // Exposed to Python
+ void changeNumWorldWonders(int iChange);
+
+ int getNumTeamWonders() const; // Exposed to Python
+ void changeNumTeamWonders(int iChange);
+
+ int getNumNationalWonders() const; // Exposed to Python
+ void changeNumNationalWonders(int iChange);
+
+ int getNumBuildings() const; // Exposed to Python
+ void changeNumBuildings(int iChange);
+
+ int getGovernmentCenterCount() const;
+ DllExport bool isGovernmentCenter() const; // Exposed to
Python
+ void changeGovernmentCenterCount(int iChange);
+
+ DllExport int getMaintenance() const; // Exposed to Python
+ int getMaintenanceTimes100() const; // Exposed to Python
+ void updateMaintenance();
+ DllExport int calculateDistanceMaintenance() const; // Exposed
to Python
+ DllExport int calculateNumCitiesMaintenance() const; // Exposed
to Python
+ DllExport int calculateColonyMaintenance() const; // Exposed to
Python
+ DllExport int calculateCorporationMaintenance() const; // Exposed
to Python
+ int calculateDistanceMaintenanceTimes100() const; // Exposed to
Python
+ int calculateNumCitiesMaintenanceTimes100() const; // Exposed to
Python
+ int calculateColonyMaintenanceTimes100() const; // Exposed to
Python
+ int calculateCorporationMaintenanceTimes100(CorporationTypes
eCorporation) const; // Exposed to Python
+ int calculateCorporationMaintenanceTimes100() const; // Exposed
to Python
+ int calculateBaseMaintenanceTimes100() const;
+ DllExport int getMaintenanceModifier() const; // Exposed to
Python
+ void changeMaintenanceModifier(int iChange);
+
+ int getWarWearinessModifier() const; // Exposed to Python
+ void changeWarWearinessModifier(int iChange);
+
+ int getHurryAngerModifier() const; // Exposed to Python
+ void changeHurryAngerModifier(int iChange);
+
+ int getHealRate() const; // Exposed to Python
+ void changeHealRate(int iChange);
+
+ DllExport int getEspionageHealthCounter() const; // Exposed
to Python
+ void changeEspionageHealthCounter(int iChange); // Exposed to
Python
+
+ DllExport int getEspionageHappinessCounter() const; //
Exposed to Python
+ void changeEspionageHappinessCounter(int iChange); // Exposed
to Python
+
+ int getFreshWaterGoodHealth() const; // Exposed to Python
+ DllExport int getFreshWaterBadHealth() const; // Exposed to
Python
+ void updateFreshWaterHealth();
+
+ int getFeatureGoodHealth() const; // Exposed to Python
+ DllExport int getFeatureBadHealth() const; // Exposed to
Python
+ void updateFeatureHealth();
+
+ int getBuildingGoodHealth() const; // Exposed to Python
+ int getBuildingBadHealth() const; // Exposed to Python
+ int getBuildingHealth(BuildingTypes eBuilding) const; // Exposed
to Python
+ int getBuildingGoodHealth(BuildingTypes eBuilding) const;
+ int getBuildingBadHealth(BuildingTypes eBuilding) const;
+ void changeBuildingGoodHealth(int iChange);
+ void changeBuildingBadHealth(int iChange);
+
+ int getPowerGoodHealth() const; // Exposed to Python
+ DllExport int getPowerBadHealth() const; // Exposed to
Python
+ void updatePowerHealth();
+
+ int getBonusGoodHealth() const; // Exposed to Python
+ DllExport int getBonusBadHealth() const; // Exposed to
Python
+ void changeBonusGoodHealth(int iChange);
+ void changeBonusBadHealth(int iChange);
+
+ int getMilitaryHappiness() const; // Exposed to Python
+ int getMilitaryHappinessUnits() const; // Exposed to Python
+ void changeMilitaryHappinessUnits(int iChange);
+
+ int getBuildingGoodHappiness() const; // Exposed to Python
+ int getBuildingBadHappiness() const; // Exposed to Python
+ int getBuildingHappiness(BuildingTypes eBuilding) const; // Exposed
to Python
+ void changeBuildingGoodHappiness(int iChange);
+ void changeBuildingBadHappiness(int iChange);
+
+ int getExtraBuildingGoodHappiness() const; // Exposed to
Python
+ int getExtraBuildingBadHappiness() const; // Exposed to
Python
+ void updateExtraBuildingHappiness();
+
+ int getExtraBuildingGoodHealth() const; // Exposed to Python
+ int getExtraBuildingBadHealth() const; // Exposed to Python
+ void updateExtraBuildingHealth();
+
+ int getFeatureGoodHappiness() const; // Exposed to Python
+ int getFeatureBadHappiness() const; // Exposed to Python
+ void updateFeatureHappiness();
+
+ int getBonusGoodHappiness() const; // Exposed to Python
+ int getBonusBadHappiness() const; // Exposed to Python
+ void changeBonusGoodHappiness(int iChange);
+ void changeBonusBadHappiness(int iChange);
+
+ int getReligionGoodHappiness() const; // Exposed to Python
+ int getReligionBadHappiness() const; // Exposed to Python
+ int getReligionHappiness(ReligionTypes eReligion) const; // Exposed
to Python
+ void updateReligionHappiness();
+
+ int getExtraHappiness() const; // Exposed to Python
+ void changeExtraHappiness(int iChange); // Exposed to Python
+
+ int getExtraHealth() const; // Exposed to Python
+ void changeExtraHealth(int iChange); // Exposed to Python
+
+ int getHurryAngerTimer() const; // Exposed to Python
+ void changeHurryAngerTimer(int iChange); // Exposed to Python
+
+ int getConscriptAngerTimer() const; // Exposed to Python
+ void changeConscriptAngerTimer(int iChange); // Exposed to Python
+
+ int getDefyResolutionAngerTimer() const; // Exposed to
Python
+ void changeDefyResolutionAngerTimer(int iChange); // Exposed to
Python
+ int flatDefyResolutionAngerLength() const; // Exposed
to Python
+
+ int getHappinessTimer() const; // Exposed to Python
+ void changeHappinessTimer(int iChange); // Exposed to Python
+
+ int getNoUnhappinessCount() const;
+ bool isNoUnhappiness() const; // Exposed to Python
+ void changeNoUnhappinessCount(int iChange);
+
+ int getNoUnhealthyPopulationCount() const;
+ bool isNoUnhealthyPopulation() const; // Exposed to Python
+ void changeNoUnhealthyPopulationCount(int iChange);
+
+ int getBuildingOnlyHealthyCount() const;
+ bool isBuildingOnlyHealthy() const; // Exposed to Python
+ void changeBuildingOnlyHealthyCount(int iChange);
+
+ DllExport int getFood() const; // Exposed to Python
+ void setFood(int iNewValue); // Exposed to Python
+ void changeFood(int iChange); // Exposed to Python
+
+ int getFoodKept() const; // Exposed to Python
+ void setFoodKept(int iNewValue);
+ void changeFoodKept(int iChange);
+
+ int getMaxFoodKeptPercent() const; // Exposed to Python
+ void changeMaxFoodKeptPercent(int iChange);
+
+ int getOverflowProduction() const; // Exposed to Python
+ void setOverflowProduction(int iNewValue); // Exposed to Python
+ void changeOverflowProduction(int iChange, int iProductionModifier);
+
+ int getFeatureProduction()const; // Exposed to Python
+ void setFeatureProduction(int iNewValue); // Exposed to Python
+ void changeFeatureProduction(int iChange);
+
+ int getMilitaryProductionModifier() const; // Exposed to
Python
+ void changeMilitaryProductionModifier(int iChange);
+
+ int getSpaceProductionModifier() const; // Exposed to
Python
+ void changeSpaceProductionModifier(int iChange);
+
+ int getExtraTradeRoutes() const; // Exposed to Python
+ void changeExtraTradeRoutes(int iChange); // Exposed to
Python
+
+ int getTradeRouteModifier() const; // Exposed to Python
+ void changeTradeRouteModifier(int iChange);
+
+ int getForeignTradeRouteModifier() const; // Exposed to
Python
+ void changeForeignTradeRouteModifier(int iChange);
+
+ int getBuildingDefense() const; // Exposed to Python
+ void changeBuildingDefense(int iChange);
+
+ int getBuildingBombardDefense() const; // Exposed to
Python
+ void changeBuildingBombardDefense(int iChange);
+
+ int getFreeExperience() const; // Exposed to Python
+ void changeFreeExperience(int iChange);
+
+ int getCurrAirlift() const; // Exposed to Python
+ void setCurrAirlift(int iNewValue);
+ void changeCurrAirlift(int iChange);
+
+ int getMaxAirlift() const; // Exposed to Python
+ void changeMaxAirlift(int iChange);
+
+ int getAirModifier() const; // Exposed to Python
+ void changeAirModifier(int iChange);
+
+ DllExport int getAirUnitCapacity(TeamTypes eTeam) const; //
Exposed to Python
+ void changeAirUnitCapacity(int iChange); // Exposed to Python
+
+ int getNukeModifier() const; // Exposed to Python
+ void changeNukeModifier(int iChange);
+
+ int getFreeSpecialist() const; // Exposed to Python
+ void changeFreeSpecialist(int iChange);
+
+ int getPowerCount() const;
+ bool isPower() const; // Exposed to Python
+ bool isAreaCleanPower() const; // Exposed to Python
+ int getDirtyPowerCount() const;
+ bool isDirtyPower() const; // Exposed to Python
+ void changePowerCount(int iChange, bool bDirty);
+
+ bool isAreaBorderObstacle() const; // Exposed to Python
+
+ int getDefenseDamage() const; // Exposed to Python
+ void changeDefenseDamage(int iChange); // Exposed to Python
+ void changeDefenseModifier(int iChange); // Exposed to Python
+
+ int getLastDefenseDamage() const; // Exposed to Python
+ void setLastDefenseDamage(int iNewValue);
+
+ bool isBombardable(const CvUnit* pUnit) const; // Exposed to
Python
+ int getNaturalDefense() const; // Exposed to Python
+ int getTotalDefense(bool bIgnoreBuilding) const; // Exposed to
Python
+ int getDefenseModifier(bool bIgnoreBuilding) const; // Exposed
to Python
+
+ int getOccupationTimer() const; // Exposed to Python
+ bool isOccupation() const; // Exposed to Python
+ void setOccupationTimer(int iNewValue); // Exposed to Python
+ void changeOccupationTimer(int iChange); // Exposed to Python
+
+ int getCultureUpdateTimer() const; // Exposed to Python
+ void setCultureUpdateTimer(int iNewValue);
+ void changeCultureUpdateTimer(int iChange); // Exposed to
Python
+
+ int getCitySizeBoost() const;
+ void setCitySizeBoost(int iBoost);
+
+ bool isNeverLost() const; // Exposed to Python
+ void setNeverLost(bool bNewValue); // Exposed to Python
+
+ bool isBombarded() const; // Exposed to Python
+ void setBombarded(bool bNewValue); // Exposed to Python
+
+ bool isDrafted() const; // Exposed to Python
+ void setDrafted(bool bNewValue); // Exposed to Python
+
+ bool isAirliftTargeted() const; // Exposed to Python
+ void setAirliftTargeted(bool bNewValue); // Exposed to Python
+
+ DllExport bool isWeLoveTheKingDay() const; // Exposed to
Python
+ void setWeLoveTheKingDay(bool bNewValue);
+
+ DllExport bool isCitizensAutomated() const; // Exposed to
Python
+ void setCitizensAutomated(bool bNewValue); // Exposed to Python
+
+ DllExport bool isProductionAutomated() const; // Exposed to
Python
+ void setProductionAutomated(bool bNewValue, bool bClear); //
Exposed to Python
+
+ /* allows you to programatically specify a cities walls rather than
having them be generated automagically */
+ DllExport bool isWallOverride() const;
+ DllExport void setWallOverride(bool bOverride);
+
+ DllExport bool isInfoDirty() const;
+ DllExport void setInfoDirty(bool bNewValue);
+
+ DllExport bool isLayoutDirty() const;
+ DllExport void setLayoutDirty(bool bNewValue);
+
+ bool isPlundered() const; // Exposed to Python
+ void setPlundered(bool bNewValue); // Exposed to Python
+
+ DllExport PlayerTypes getOwner() const; // Exposed to
Python
+#ifdef _USRDLL
+ inline PlayerTypes getOwnerINLINE() const
+ {
+ return m_eOwner;
+ }
+#endif
+ DllExport TeamTypes getTeam() const; // Exposed to Python
+
+ PlayerTypes getPreviousOwner() const; // Exposed to Python
+ void setPreviousOwner(PlayerTypes eNewValue);
+
+ PlayerTypes getOriginalOwner() const; // Exposed to Python
+ void setOriginalOwner(PlayerTypes eNewValue);
+
+ CultureLevelTypes getCultureLevel() const; // Exposed to
Python
+ DllExport int getCultureThreshold() const; // Exposed to
Python
+ static int getCultureThreshold(CultureLevelTypes eLevel);
+ void setCultureLevel(CultureLevelTypes eNewValue, bool bUpdatePlotGroups);
+ void updateCultureLevel(bool bUpdatePlotGroups);
+
+ int getSeaPlotYield(YieldTypes eIndex) const; // Exposed
to Python
+ void changeSeaPlotYield(YieldTypes eIndex, int iChange);
+
+ int getRiverPlotYield(YieldTypes eIndex) const; // Exposed
to Python
+ void changeRiverPlotYield(YieldTypes eIndex, int iChange);
+
+ int getBaseYieldRate(YieldTypes eIndex) const; // Exposed
to Python
+ int getBaseYieldRateModifier(YieldTypes eIndex, int iExtra = 0) const;
// Exposed to Python
+ DllExport int getYieldRate(YieldTypes eIndex) const; //
Exposed to Python
+ void setBaseYieldRate(YieldTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeBaseYieldRate(YieldTypes eIndex, int iChange); //
Exposed to Python
+
+ int getYieldRateModifier(YieldTypes eIndex) const; // Exposed
to Python
+ void changeYieldRateModifier(YieldTypes eIndex, int iChange);
+
+ int getPowerYieldRateModifier(YieldTypes eIndex) const; //
Exposed to Python
+ void changePowerYieldRateModifier(YieldTypes eIndex, int iChange);
+
+ int getBonusYieldRateModifier(YieldTypes eIndex) const; //
Exposed to Python
+ void changeBonusYieldRateModifier(YieldTypes eIndex, int iChange);
+
+ int getTradeYield(YieldTypes eIndex) const; // Exposed to
Python
+ int totalTradeModifier(CvCity* pOtherCity = NULL) const;
// Exposed to Python
+ int getPopulationTradeModifier() const;
+ int getPeaceTradeModifier(TeamTypes eTeam) const;
+ int getBaseTradeProfit(CvCity* pCity) const;
+ int calculateTradeProfit(CvCity* pCity) const; // Exposed
to Python
+ int calculateTradeYield(YieldTypes eIndex, int iTradeProfit) const;
// Exposed to Python
+ void setTradeYield(YieldTypes eIndex, int iNewValue);
+
+ int getExtraSpecialistYield(YieldTypes eIndex) const;
// Exposed to Python
+ int getExtraSpecialistYield(YieldTypes eIndex, SpecialistTypes
eSpecialist) const; // Exposed to Python
+ void updateExtraSpecialistYield(YieldTypes eYield);
+ void updateExtraSpecialistYield();
+
+ DllExport int getCommerceRate(CommerceTypes eIndex) const; //
Exposed to Python
+ int getCommerceRateTimes100(CommerceTypes eIndex) const; //
Exposed to Python
+ int getCommerceFromPercent(CommerceTypes eIndex, int iYieldRate) const;
// Exposed to Python
+ int getBaseCommerceRate(CommerceTypes eIndex) const; //
Exposed to Python
+ int getBaseCommerceRateTimes100(CommerceTypes eIndex) const;
// Exposed to Python
+ int getTotalCommerceRateModifier(CommerceTypes eIndex) const; //
Exposed to Python
+ void updateCommerce(CommerceTypes eIndex);
+ void updateCommerce();
+
+ int getProductionToCommerceModifier(CommerceTypes eIndex) const; //
Exposed to Python
+ void changeProductionToCommerceModifier(CommerceTypes eIndex, int
iChange);
+
+ int getBuildingCommerce(CommerceTypes eIndex) const;
// Exposed to Python
+ int getBuildingCommerceByBuilding(CommerceTypes eIndex, BuildingTypes
eBuilding) const; // Exposed to Python
+ void updateBuildingCommerce();
+
+ int getSpecialistCommerce(CommerceTypes eIndex) const; //
Exposed to Python
+ void changeSpecialistCommerce(CommerceTypes eIndex, int iChange); //
Exposed to Python
+
+ int getReligionCommerce(CommerceTypes eIndex) const;
// Exposed to Python
+ int getReligionCommerceByReligion(CommerceTypes eIndex, ReligionTypes
eReligion) const; // Exposed to Python
+ void updateReligionCommerce(CommerceTypes eIndex);
+ void updateReligionCommerce();
+
+ void setCorporationYield(YieldTypes eIndex, int iNewValue);
+ int getCorporationCommerce(CommerceTypes eIndex) const;
// Exposed to Python
+ int getCorporationCommerceByCorporation(CommerceTypes eIndex,
CorporationTypes eCorporation) const; // Exposed to Python
+ int getCorporationYield(YieldTypes eIndex) const; //
Exposed to Python
+ int getCorporationYieldByCorporation(YieldTypes eIndex, CorporationTypes
eCorporation) const; // Exposed to Python
+ void updateCorporation();
+ void updateCorporationCommerce(CommerceTypes eIndex);
+ void updateCorporationYield(YieldTypes eIndex);
+ void updateCorporationBonus();
+
+ int getCommerceRateModifier(CommerceTypes eIndex) const; //
Exposed to Python
+ void changeCommerceRateModifier(CommerceTypes eIndex, int iChange);
+
+ int getCommerceHappinessPer(CommerceTypes eIndex) const; //
Exposed to Python
+ int getCommerceHappinessByType(CommerceTypes eIndex) const; //
Exposed to Python
+ int getCommerceHappiness() const; // Exposed to
Python
+ void changeCommerceHappinessPer(CommerceTypes eIndex, int iChange);
+
+ int getDomainFreeExperience(DomainTypes eIndex) const; //
Exposed to Python
+ void changeDomainFreeExperience(DomainTypes eIndex, int iChange);
+
+ int getDomainProductionModifier(DomainTypes eIndex) const; //
Exposed to Python
+ void changeDomainProductionModifier(DomainTypes eIndex, int iChange);
+
+ DllExport int getCulture(PlayerTypes eIndex) const; //
Exposed to Python
+ int getCultureTimes100(PlayerTypes eIndex) const; // Exposed
to Python
+ int countTotalCultureTimes100() const; // Exposed
to Python
+ PlayerTypes findHighestCulture() const; // Exposed to
Python
+ int calculateCulturePercent(PlayerTypes eIndex) const; //
Exposed to Python
+ int calculateTeamCulturePercent(TeamTypes eIndex) const; //
Exposed to Python
+ void setCulture(PlayerTypes eIndex, int iNewValue, bool bPlots, bool
bUpdatePlotGroups); // Exposed to Python
+ void setCultureTimes100(PlayerTypes eIndex, int iNewValue, bool bPlots,
bool bUpdatePlotGroups); // Exposed to Python
+ DllExport void changeCulture(PlayerTypes eIndex, int iChange, bool
bPlots, bool bUpdatePlotGroups); // Exposed to Python
+ void changeCultureTimes100(PlayerTypes eIndex, int iChange, bool bPlots,
bool bUpdatePlotGroups); // Exposed to Python
+
+ int getNumRevolts(PlayerTypes eIndex) const;
+ void changeNumRevolts(PlayerTypes eIndex, int iChange);
+ int getRevoltTestProbability() const;
+
+ bool isTradeRoute(PlayerTypes eIndex) const; // Exposed
to Python
+ void setTradeRoute(PlayerTypes eIndex, bool bNewValue);
+
+ bool isEverOwned(PlayerTypes eIndex) const; // Exposed
to Python
+ void setEverOwned(PlayerTypes eIndex, bool bNewValue);
+
+ DllExport bool isRevealed(TeamTypes eIndex, bool bDebug) const; //
Exposed to Python
+ DllExport void setRevealed(TeamTypes eIndex, bool bNewValue);
// Exposed to Python
+
+ DllExport bool getEspionageVisibility(TeamTypes eTeam) const; //
Exposed to Python
+ void setEspionageVisibility(TeamTypes eTeam, bool bVisible, bool
bUpdatePlotGroups);
+ void updateEspionageVisibility(bool bUpdatePlotGroups);
+
+ DllExport const CvWString getName(uint uiForm = 0) const; //
Exposed to Python
+ DllExport const wchar* getNameKey() const; // Exposed to
Python
+ DllExport void setName(const wchar* szNewValue, bool bFound = false); //
Exposed to Python
+ void doFoundMessage();
+
+ // Script data needs to be a narrow string for pickling in Python
+ std::string getScriptData() const; // Exposed to
Python
+ void setScriptData(std::string szNewValue); // Exposed to
Python
+
+ int getFreeBonus(BonusTypes eIndex) const; // Exposed to
Python
+ void changeFreeBonus(BonusTypes eIndex, int iChange); //
Exposed to Python
+
+ int getNumBonuses(BonusTypes eIndex) const; // Exposed
to Python
+ DllExport bool hasBonus(BonusTypes eIndex) const; //
Exposed to Python
+ void changeNumBonuses(BonusTypes eIndex, int iChange);
+
+ int getNumCorpProducedBonuses(BonusTypes eIndex) const;
+ bool isCorporationBonus(BonusTypes eBonus) const;
+ bool isActiveCorporation(CorporationTypes eCorporation) const;
+
+ DllExport int getBuildingProduction(BuildingTypes eIndex) const; //
Exposed to Python
+ void setBuildingProduction(BuildingTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeBuildingProduction(BuildingTypes eIndex, int iChange); //
Exposed to Python
+
+ int getBuildingProductionTime(BuildingTypes eIndex) const; //
Exposed to Python
+ void setBuildingProductionTime(BuildingTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeBuildingProductionTime(BuildingTypes eIndex, int iChange); //
Exposed to Python
+
+ DllExport int getProjectProduction(ProjectTypes eIndex) const; //
Exposed to Python
+ void setProjectProduction(ProjectTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeProjectProduction(ProjectTypes eIndex, int iChange); //
Exposed to Python
+
+ int getBuildingOriginalOwner(BuildingTypes eIndex) const; //
Exposed to Python
+ int getBuildingOriginalTime(BuildingTypes eIndex) const; //
Exposed to Python
+
+ DllExport int getUnitProduction(UnitTypes eIndex) const; //
Exposed to Python
+ void setUnitProduction(UnitTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeUnitProduction(UnitTypes eIndex, int iChange); //
Exposed to Python
+
+ int getUnitProductionTime(UnitTypes eIndex) const; //
Exposed to Python
+ void setUnitProductionTime(UnitTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeUnitProductionTime(UnitTypes eIndex, int iChange); //
Exposed to Python
+
+ int getGreatPeopleUnitRate(UnitTypes eIndex) const; //
Exposed to Python
+ void setGreatPeopleUnitRate(UnitTypes eIndex, int iNewValue);
+ void changeGreatPeopleUnitRate(UnitTypes eIndex, int iChange);
+
+ DllExport int getGreatPeopleUnitProgress(UnitTypes eIndex) const;
// Exposed to Python
+ void setGreatPeopleUnitProgress(UnitTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeGreatPeopleUnitProgress(UnitTypes eIndex, int iChange); //
Exposed to Python
+
+ DllExport int getSpecialistCount(SpecialistTypes eIndex) const; //
Exposed to Python
+ void setSpecialistCount(SpecialistTypes eIndex, int iNewValue);
+ void changeSpecialistCount(SpecialistTypes eIndex, int iChange);
+ void alterSpecialistCount(SpecialistTypes eIndex, int iChange); //
Exposed to Python
+
+ DllExport int getMaxSpecialistCount(SpecialistTypes eIndex) const;
// Exposed to Python
+ bool isSpecialistValid(SpecialistTypes eIndex, int iExtra = 0) const;
// Exposed to Python
+ void changeMaxSpecialistCount(SpecialistTypes eIndex, int iChange);
+
+ DllExport int getForceSpecialistCount(SpecialistTypes eIndex) const;
// Exposed to Python
+ bool isSpecialistForced() const; // Exposed to
Python
+ void setForceSpecialistCount(SpecialistTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeForceSpecialistCount(SpecialistTypes eIndex, int iChange); //
Exposed to Python
+
+ int getFreeSpecialistCount(SpecialistTypes eIndex) const; // Exposed
to Python
+ void setFreeSpecialistCount(SpecialistTypes eIndex, int iNewValue); //
Exposed to Python
+ void changeFreeSpecialistCount(SpecialistTypes eIndex, int iChange); //
Exposed to Python
+ int getAddedFreeSpecialistCount(SpecialistTypes eIndex) const; //
Exposed to Python
+
+ int getImprovementFreeSpecialists(ImprovementTypes eIndex) const; //
Exposed to Python
+ void changeImprovementFreeSpecialists(ImprovementTypes eIndex, int
iChange); // Exposed to Python
+
+ int getReligionInfluence(ReligionTypes eIndex) const; //
Exposed to Python
+ void changeReligionInfluence(ReligionTypes eIndex, int iChange); //
Exposed to Python
+
+ int getCurrentStateReligionHappiness() const; // Exposed
to Python
+ int getStateReligionHappiness(ReligionTypes eIndex) const; //
Exposed to Python
+ void changeStateReligionHappiness(ReligionTypes eIndex, int iChange); //
Exposed to Python
+
+ int getUnitCombatFreeExperience(UnitCombatTypes eIndex) const; //
Exposed to Python
+ void changeUnitCombatFreeExperience(UnitCombatTypes eIndex, int iChange);
+
+ int getFreePromotionCount(PromotionTypes eIndex) const; //
Exposed to Python
+ bool isFreePromotion(PromotionTypes eIndex) const; //
Exposed to Python
+ void changeFreePromotionCount(PromotionTypes eIndex, int iChange);
+
+ int getSpecialistFreeExperience() const; // Exposed to Python
+ void changeSpecialistFreeExperience(int iChange);
+
+ int getEspionageDefenseModifier() const; // Exposed to Python
+ void changeEspionageDefenseModifier(int iChange);
+
+ DllExport bool isWorkingPlot(int iIndex) const; // Exposed to
Python
+ bool isWorkingPlot(const CvPlot* pPlot) const; // Exposed to
Python
+ void setWorkingPlot(int iIndex, bool bNewValue);
+ void setWorkingPlot(CvPlot* pPlot, bool bNewValue);
+ void alterWorkingPlot(int iIndex); // Exposed to Python
+
+ int getNumRealBuilding(BuildingTypes eIndex) const; //
Exposed to Python
+ DllExport void setNumRealBuilding(BuildingTypes eIndex, int iNewValue);
// Exposed to Python
+ void setNumRealBuildingTimed(BuildingTypes eIndex, int iNewValue, bool
bFirst, PlayerTypes eOriginalOwner, int iOriginalTime);
+
+ bool isValidBuildingLocation(BuildingTypes eIndex) const;
+
+ int getNumFreeBuilding(BuildingTypes eIndex) const; //
Exposed to Python
+ void setNumFreeBuilding(BuildingTypes eIndex, int iNewValue);
+
+ DllExport bool isHasReligion(ReligionTypes eIndex) const;
+ DllExport void setHasReligion(ReligionTypes eIndex, bool bNewValue, bool
bAnnounce, bool bArrows = true);
+
+ DllExport bool isHasCorporation(CorporationTypes eIndex) const;
+ DllExport void setHasCorporation(CorporationTypes eIndex, bool bNewValue,
bool bAnnounce, bool bArrows = true);
+
+ CvCity* getTradeCity(int iIndex) const; // Exposed to
Python
+ int getTradeRoutes() const; // Exposed to Python
+ void clearTradeRoutes();
+ void updateTradeRoutes();
+
+ void clearOrderQueue(); // Exposed to Python
+ DllExport void pushOrder(OrderTypes eOrder, int iData1, int iData2, bool
bSave, bool bPop, bool bAppend, bool bForce = false); // Exposed to Python
+ DllExport void popOrder(int iNum, bool bFinish = false, bool bChoose =
false); // Exposed to Python
+ void startHeadOrder();
+ void stopHeadOrder();
+ DllExport int getOrderQueueLength(); // Exposed to Python
+ DllExport OrderData* getOrderFromQueue(int iIndex); // Exposed
to Python
+ DllExport CLLNode<OrderData>* nextOrderQueueNode(CLLNode<OrderData>*
pNode) const;
+ DllExport CLLNode<OrderData>* headOrderQueueNode() const;
+ CLLNode<OrderData>* tailOrderQueueNode() const;
+
+ // fill the kVisible array with buildings that you want shown in city, as
well as the number of generics
+ // This function is called whenever CvCity::setLayoutDirty() is called
+ DllExport void getVisibleBuildings(std::list<BuildingTypes>& kVisible,
int& iNumGenerics);
+
+ // Fill the kEffectNames array with references to effects in the
CIV4EffectInfos.xml to have a
+ // city play a given set of effects. This is called whenever the
interface updates the city billboard
+ // or when the zoom level changes
+ DllExport void getVisibleEffects(ZoomLevelTypes eCurrentZoom,
std::vector<const TCHAR*>& kEffectNames);
+
+
+ // Billboard appearance controls
+ DllExport void getCityBillboardSizeIconColors(NiColorA& kDotColor,
NiColorA& kTextColor) const;
+ DllExport const TCHAR* getCityBillboardProductionIcon() const;
+
+ // Exposed to Python
+ DllExport void setWallOverridePoints(const std::vector< std::pair<float,
float> >& kPoints); /* points are given in world space ... i.e.
PlotXToPointX, etc */
+ DllExport const std::vector< std::pair<float, float> >&
getWallOverridePoints() const;
+
+ int getTriggerValue(EventTriggerTypes eTrigger) const;
+ bool canApplyEvent(EventTypes eEvent, const EventTriggeredData&
kTriggeredData) const;
+ void applyEvent(EventTypes eEvent, const EventTriggeredData&
kTriggeredData, bool bClear);
+ bool isEventOccured(EventTypes eEvent) const;
+ void setEventOccured(EventTypes eEvent, bool bOccured);
+
+ int getBuildingYieldChange(BuildingClassTypes eBuildingClass, YieldTypes
eYield) const; // Exposed to Python
+ void setBuildingYieldChange(BuildingClassTypes eBuildingClass, YieldTypes
eYield, int iChange); // Exposed to Python
+ void changeBuildingYieldChange(BuildingClassTypes eBuildingClass,
YieldTypes eYield, int iChange);
+ int getBuildingCommerceChange(BuildingClassTypes eBuildingClass,
CommerceTypes eCommerce) const; // Exposed to Python
+ void setBuildingCommerceChange(BuildingClassTypes eBuildingClass,
CommerceTypes eCommerce, int iChange); // Exposed to Python
+ void changeBuildingCommerceChange(BuildingClassTypes eBuildingClass,
CommerceTypes eCommerce, int iChange);
+ int getBuildingHappyChange(BuildingClassTypes eBuildingClass)
const; // Exposed to Python
+ void setBuildingHappyChange(BuildingClassTypes eBuildingClass, int
iChange); // Exposed to Python
+ int getBuildingHealthChange(BuildingClassTypes eBuildingClass)
const; // Exposed to Python
+ void setBuildingHealthChange(BuildingClassTypes eBuildingClass, int
iChange); // Exposed to Python
+
+ DllExport PlayerTypes getLiberationPlayer(bool bConquest) const; //
Exposed to Python
+ void liberate(bool bConquest); // Exposed to Python
+
+ void changeNoBonusCount(BonusTypes eBonus, int iChange); // Exposed to
Python
+ int getNoBonusCount(BonusTypes eBonus) const;
+ bool isNoBonus(BonusTypes eBonus) const; // Exposed to Python
+
+ bool isAutoRaze() const;
+
+ void read(FDataStreamBase* pStream);
+ void write(FDataStreamBase* pStream);
+
+ virtual void AI_init() = 0;
+ virtual void AI_reset() = 0;
+ virtual void AI_doTurn() = 0;
+ virtual void AI_assignWorkingPlots() = 0;
+ virtual void AI_updateAssignWork() = 0;
+ virtual bool AI_avoidGrowth() = 0; // Exposed to Python
+ virtual int AI_specialistValue(SpecialistTypes eSpecialist, bool
bAvoidGrowth, bool bRemove) = 0;
+ virtual void AI_chooseProduction() = 0;
+ virtual UnitTypes AI_bestUnit(bool bAsync = false, AdvisorTypes
eIgnoreAdvisor = NO_ADVISOR, UnitAITypes* peBestUnitAI = NULL) = 0;
+ virtual UnitTypes AI_bestUnitAI(UnitAITypes eUnitAI, bool bAsync = false,
AdvisorTypes eIgnoreAdvisor = NO_ADVISOR) = 0;
+ virtual BuildingTypes AI_bestBuilding(int iFocusFlags = 0, int iMaxTurns
= MAX_INT, bool bAsync = false, AdvisorTypes eIgnoreAdvisor = NO_ADVISOR) =
0;
+ virtual int AI_buildingValue(BuildingTypes eBuilding, int iFocusFlags =
0) = 0;
+ virtual int AI_projectValue(ProjectTypes eProject) = 0;
+ virtual int AI_neededSeaWorkers() = 0;
+ virtual bool AI_isDefended(int iExtra = 0) = 0;
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 9/19/08 jdog5000 */
+/** */
+/** Air AI */
+/********************************************************************************/
+/* original BTS code
+ virtual bool AI_isAirDefended(int iExtra = 0) = 0;
+*/
+ virtual bool AI_isAirDefended(bool bCountLand = 0, int iExtra = 0) = 0;
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD END */
+/********************************************************************************/
+ virtual bool AI_isDanger() = 0;
+ virtual int AI_neededDefenders() = 0;
+ virtual int AI_neededAirDefenders() = 0;
+ virtual int AI_minDefenders() = 0;
+ virtual bool AI_isEmphasizeAvoidGrowth() = 0;
+ virtual bool AI_isAssignWorkDirty() = 0;
+ virtual CvCity* AI_getRouteToCity() const = 0;
+ virtual void AI_setAssignWorkDirty(bool bNewValue) = 0;
+ virtual bool AI_isChooseProductionDirty() = 0;
+ virtual void AI_setChooseProductionDirty(bool bNewValue) = 0;
+ virtual bool AI_isEmphasize(EmphasizeTypes eIndex) = 0; //
Exposed to Python
+ virtual void AI_setEmphasize(EmphasizeTypes eIndex, bool bNewValue) = 0;
+ virtual int AI_getBestBuildValue(int iIndex) = 0;
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
06/25/09 jdog5000 */
+/**
*/
+/**
Debug
*/
+/*************************************************************************************************/
+ virtual int AI_getTargetSize() = 0;
+ virtual int AI_getImprovementValue( CvPlot* pPlot, ImprovementTypes
eImprovement, int iFoodPriority, int iProductionPriority, int
iCommercePriority, int iFoodChange, bool bOriginal = false ) = 0;
+ virtual void AI_getYieldMultipliers( int &iFoodMultiplier, int
&iProductionMultiplier, int &iCommerceMultiplier, int &iDesiredFoodChange )
= 0;
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+ virtual int AI_totalBestBuildValue(CvArea* pArea) = 0;
+ virtual int AI_countBestBuilds(CvArea* pArea) = 0; // Exposed
to Python
+ virtual BuildTypes AI_getBestBuild(int iIndex) = 0;
+ virtual void AI_updateBestBuild() = 0;
+ virtual int AI_cityValue() const = 0;
+ virtual int AI_clearFeatureValue(int iIndex) = 0;
+
+ virtual int AI_calculateCulturePressure(bool bGreatWork = false) = 0;
+ virtual int AI_calculateWaterWorldPercent() = 0;
+ virtual int AI_countNumBonuses(BonusTypes eBonus, bool bIncludeOurs, bool
bIncludeNeutral, int iOtherCultureThreshold, bool bLand = true, bool bWater
= true) = 0;
+ virtual int AI_yieldMultiplier(YieldTypes eYield) = 0;
+ virtual int AI_playerCloseness(PlayerTypes eIndex, int iMaxDistance = 7)
= 0;
+ virtual int AI_cityThreat(bool bDangerPercent = false) = 0;
+ virtual BuildingTypes AI_bestAdvancedStartBuilding(int iPass) = 0;
+
+ virtual int AI_getWorkersHave() = 0;
+ virtual int AI_getWorkersNeeded() = 0;
+ virtual void AI_changeWorkersHave(int iChange) = 0;
+
+ bool hasShrine(ReligionTypes eReligion);
+ void processVoteSourceBonus(VoteSourceTypes eVoteSource, bool bActive);
+
+ void invalidatePopulationRankCache();
+ void invalidateYieldRankCache(YieldTypes eYield = NO_YIELD);
+ void invalidateCommerceRankCache(CommerceTypes eCommerce = NO_COMMERCE);
+
+ int getBestYieldAvailable(YieldTypes eYield) const;
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.25.09
+ bool isHasInBorderBonus(BonusTypes eBonus) const;
+ // City Perk, added by poyuzhe 07.08.09
+ bool isHasCityPerk(CityPerkTypes eCityPerk) const; // Exposed to
Python
+ void setHasCityPerk(CityPerkTypes eCityPerk, bool bNewValue); //
Exposed to Python
+ CityPerkTypes getCityPerkForClass(CityPerkClassTypes eCityPerkClass)
const; // Exposed to Python
+ // Sanguo Mod Hero, end
+
+protected:
+
+ int m_iID;
+ int m_iX;
+ int m_iY;
+ int m_iRallyX;
+ int m_iRallyY;
+ int m_iGameTurnFounded;
+ int m_iGameTurnAcquired;
+ int m_iPopulation;
+ int m_iHighestPopulation;
+ int m_iWorkingPopulation;
+ int m_iSpecialistPopulation;
+ int m_iNumGreatPeople;
+ int m_iBaseGreatPeopleRate;
+ int m_iGreatPeopleRateModifier;
+ int m_iGreatPeopleProgress;
+ int m_iNumWorldWonders;
+ int m_iNumTeamWonders;
+ int m_iNumNationalWonders;
+ int m_iNumBuildings;
+ int m_iGovernmentCenterCount;
+ int m_iMaintenance;
+ int m_iMaintenanceModifier;
+ int m_iWarWearinessModifier;
+ int m_iHurryAngerModifier;
+ int m_iHealRate;
+ int m_iEspionageHealthCounter;
+ int m_iEspionageHappinessCounter;
+ int m_iFreshWaterGoodHealth;
+ int m_iFreshWaterBadHealth;
+ int m_iFeatureGoodHealth;
+ int m_iFeatureBadHealth;
+ int m_iBuildingGoodHealth;
+ int m_iBuildingBadHealth;
+ int m_iPowerGoodHealth;
+ int m_iPowerBadHealth;
+ int m_iBonusGoodHealth;
+ int m_iBonusBadHealth;
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvCityAI.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,11667 @@
+// cityAI.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvGlobals.h"
+#include "CvGameCoreUtils.h"
+#include "CvCityAI.h"
+#include "CvGameAI.h"
+#include "CvPlot.h"
+#include "CvArea.h"
+#include "CvPlayerAI.h"
+#include "CvTeamAI.h"
+#include "CyCity.h"
+#include "CyArgsList.h"
+#include "CvInfos.h"
+#include "FProfiler.h"
+
+#include "CvDLLPythonIFaceBase.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLFAStarIFaceBase.h"
+
+
+#define BUILDINGFOCUS_FOOD (1 << 1)
+#define BUILDINGFOCUS_PRODUCTION (1 << 2)
+#define BUILDINGFOCUS_GOLD (1 << 3)
+#define BUILDINGFOCUS_RESEARCH (1 << 4)
+#define BUILDINGFOCUS_CULTURE (1 << 5)
+#define BUILDINGFOCUS_DEFENSE (1 << 6)
+#define BUILDINGFOCUS_HAPPY (1 << 7)
+#define BUILDINGFOCUS_HEALTHY (1 << 8)
+#define BUILDINGFOCUS_EXPERIENCE (1 << 9)
+#define BUILDINGFOCUS_MAINTENANCE (1 << 10)
+#define BUILDINGFOCUS_SPECIALIST (1 << 11)
+#define BUILDINGFOCUS_ESPIONAGE (1 << 12)
+#define BUILDINGFOCUS_BIGCULTURE (1 << 13)
+#define BUILDINGFOCUS_WORLDWONDER (1 << 14)
+#define BUILDINGFOCUS_DOMAINSEA (1 << 15)
+#define BUILDINGFOCUS_WONDEROK (1 << 16)
+#define BUILDINGFOCUS_CAPITAL (1 << 17)
+
+
+
+// Public Functions...
+
+CvCityAI::CvCityAI()
+{
+ m_aiEmphasizeYieldCount = new int[NUM_YIELD_TYPES];
+ m_aiEmphasizeCommerceCount = new int[NUM_COMMERCE_TYPES];
+ m_bForceEmphasizeCulture = false;
+ m_aiSpecialYieldMultiplier = new int[NUM_YIELD_TYPES];
+ m_aiPlayerCloseness = new int[MAX_PLAYERS];
+
+ m_pbEmphasize = NULL;
+
+ AI_reset();
+}
+
+
+CvCityAI::~CvCityAI()
+{
+ AI_uninit();
+
+ SAFE_DELETE_ARRAY(m_aiEmphasizeYieldCount);
+ SAFE_DELETE_ARRAY(m_aiEmphasizeCommerceCount);
+ SAFE_DELETE_ARRAY(m_aiSpecialYieldMultiplier);
+ SAFE_DELETE_ARRAY(m_aiPlayerCloseness);
+}
+
+
+void CvCityAI::AI_init()
+{
+ AI_reset();
+
+ //--------------------------------
+ // Init other game data
+ AI_assignWorkingPlots();
+
+ AI_updateWorkersNeededHere();
+
+ AI_updateBestBuild();
+}
+
+
+void CvCityAI::AI_uninit()
+{
+ SAFE_DELETE_ARRAY(m_pbEmphasize);
+}
+
+
+// FUNCTION: AI_reset()
+// Initializes data members that are serialized.
+void CvCityAI::AI_reset()
+{
+ int iI;
+
+ AI_uninit();
+
+ m_iEmphasizeAvoidGrowthCount = 0;
+ m_iEmphasizeGreatPeopleCount = 0;
+ m_bForceEmphasizeCulture = false;
+
+ m_bAssignWorkDirty = false;
+ m_bChooseProductionDirty = false;
+
+ m_routeToCity.reset();
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ m_aiEmphasizeYieldCount[iI] = 0;
+ }
+
+ for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
+ {
+ m_aiEmphasizeCommerceCount[iI] = 0;
+ }
+
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ m_aiBestBuildValue[iI] = NO_BUILD;
+ }
+
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ m_aeBestBuild[iI] = NO_BUILD;
+ }
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ m_aiSpecialYieldMultiplier[iI] = 0;
+ }
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_aiPlayerCloseness[iI] = 0;
+ }
+ m_iCachePlayerClosenessTurn = -1;
+ m_iCachePlayerClosenessDistance = -1;
+
+ m_iNeededFloatingDefenders = -1;
+ m_iNeededFloatingDefendersCacheTurn = -1;
+
+ m_iWorkersNeeded = 0;
+ m_iWorkersHave = 0;
+
+ FAssertMsg(m_pbEmphasize == NULL, "m_pbEmphasize not NULL!!!");
+ FAssertMsg(GC.getNumEmphasizeInfos() > 0, "GC.getNumEmphasizeInfos() is
not greater than zero but an array is being allocated in
CvCityAI::AI_reset");
+ m_pbEmphasize = new bool[GC.getNumEmphasizeInfos()];
+ for (iI = 0; iI < GC.getNumEmphasizeInfos(); iI++)
+ {
+ m_pbEmphasize[iI] = false;
+ }
+}
+
+
+void CvCityAI::AI_doTurn()
+{
+ PROFILE_FUNC();
+
+ int iI;
+
+ if (!isHuman())
+ {
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ setForceSpecialistCount(((SpecialistTypes)iI), 0);
+ }
+ }
+
+ if (!isHuman())
+ {
+ AI_stealPlots();
+ }
+
+ AI_updateWorkersNeededHere();
+
+ AI_updateBestBuild();
+
+ AI_updateRouteToCity();
+
+ if (isHuman())
+ {
+ if (isProductionAutomated())
+ {
+ AI_doHurry();
+ }
+ return;
+ }
+
+ AI_doPanic();
+
+ AI_doDraft();
+
+ AI_doHurry();
+
+ AI_doEmphasize();
+}
+
+
+void CvCityAI::AI_assignWorkingPlots()
+{
+ PROFILE_FUNC();
+
+ CvPlot* pHomePlot;
+ int iI;
+
+ if (0 != GC.getDefineINT("AI_SHOULDNT_MANAGE_PLOT_ASSIGNMENT"))
+ {
+ return;
+ }
+
+ // remove all assigned plots if we automated
+ if (!isHuman() || isCitizensAutomated())
+ {
+ for (iI = 0; iI < NUM_CITY_PLOTS; iI++)
+ {
+ setWorkingPlot(iI, false);
+ }
+ }
+
+ //update the special yield multiplier to be current
+ AI_updateSpecialYieldMultiplier();
+
+ // remove any plots we can no longer work for any reason
+ verifyWorkingPlots();
+
+ // if forcing specialists, try to make all future specialists of the same
type
+ bool bIsSpecialistForced = false;
+ int iTotalForcedSpecialists = 0;
+
+ // make sure at least the forced amount of specialists are assigned
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ int iForcedSpecialistCount =
getForceSpecialistCount((SpecialistTypes)iI);
+ if (iForcedSpecialistCount > 0)
+ {
+ bIsSpecialistForced = true;
+ iTotalForcedSpecialists += iForcedSpecialistCount;
+ }
+
+ if (!isHuman() || isCitizensAutomated() ||
(getSpecialistCount((SpecialistTypes)iI) < iForcedSpecialistCount))
+ {
+ setSpecialistCount(((SpecialistTypes)iI), iForcedSpecialistCount);
+ }
+ }
+
+ // if we have more specialists of any type than this city can have,
reduce to the max
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ if (!isSpecialistValid((SpecialistTypes)iI))
+ {
+ if (getSpecialistCount((SpecialistTypes)iI) >
getMaxSpecialistCount((SpecialistTypes)iI))
+ {
+ setSpecialistCount(((SpecialistTypes)iI),
getMaxSpecialistCount((SpecialistTypes)iI));
+ }
+ }
+ }
+
+ // always work the home plot (center)
+ pHomePlot = getCityIndexPlot(CITY_HOME_PLOT);
+ if (pHomePlot != NULL)
+ {
+ setWorkingPlot(CITY_HOME_PLOT, ((getPopulation() > 0) &&
canWork(pHomePlot)));
+ }
+
+ // keep removing the worst citizen until we are not over the limit
+ while (extraPopulation() < 0)
+ {
+ if (!AI_removeWorstCitizen())
+ {
+ FAssert(false);
+ break;
+ }
+ }
+
+ // extraSpecialists() is less than extraPopulation()
+ FAssertMsg(extraSpecialists() >= 0, "extraSpecialists() is expected to be
non-negative (invalid Index)");
+
+ // do we have population unassigned
+ while (extraPopulation() > 0)
+ {
+ PROFILE_BEGIN("CityAssignWorkingPlot::addBestCitizen1");
+ // (AI_addBestCitizen now handles forced specialist logic)
+ if (!AI_addBestCitizen(/*bWorkers*/ true, /*bSpecialists*/ true))
+ {
+ break;
+ }
+ PROFILE_END();
+ }
+
+ // if forcing specialists, assign any other specialists that we must
place based on forced specialists
+ int iInitialExtraSpecialists = extraSpecialists();
+ int iExtraSpecialists = iInitialExtraSpecialists;
+ if (bIsSpecialistForced && iExtraSpecialists > 0)
+ {
+ FAssertMsg(iTotalForcedSpecialists > 0, "zero or negative total forced
specialists");
+ for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++)
+ {
+ if (isSpecialistValid((SpecialistTypes)iI, 1))
+ {
+ int iForcedSpecialistCount =
getForceSpecialistCount((SpecialistTypes)iI);
+ if (iForcedSpecialistCount > 0)
+ {
+ int iSpecialistCount = getSpecialistCount((SpecialistTypes)iI);
+ int iMaxSpecialistCount = getMaxSpecialistCount((SpecialistTypes)iI);
+
+ int iSpecialistsToAdd = ((iInitialExtraSpecialists *
iForcedSpecialistCount) + (iTotalForcedSpecialists/2)) /
iTotalForcedSpecialists;
+ if (iExtraSpecialists < iSpecialistsToAdd)
+ {
+ iSpecialistsToAdd = iExtraSpecialists;
+ }
+
+ iSpecialistCount += iSpecialistsToAdd;
+ iExtraSpecialists -= iSpecialistsToAdd;
+
+ // if we cannot fit that many, then add as many as we can
+ if (iSpecialistCount > iMaxSpecialistCount
&& !GET_PLAYER(getOwnerINLINE()).isSpecialistValid((SpecialistTypes)iI))
+ {
+ iExtraSpecialists += iSpecialistCount - iMaxSpecialistCount;
+ iSpecialistCount = iMaxSpecialistCount;
+ }
+
+ setSpecialistCount((SpecialistTypes)iI, iSpecialistCount);
+ }
+ }
+ }
+ }
+ FAssertMsg(iExtraSpecialists >= 0, "added too many specialists");
+
+ // if we still have population to assign, assign specialists
+ while (extraSpecialists() > 0)
+ {
+ PROFILE_BEGIN("CityAssignWorkingPlot::addBestCitizen2");
+ if (!AI_addBestCitizen(/*bWorkers*/ false, /*bSpecialists*/ true))
+ {
+ break;
+ }
+ PROFILE_END();
+ }
+
+ // if automated, look for better choices than the current ones
+ if (!isHuman() || isCitizensAutomated())
+ {
+ AI_juggleCitizens();
+ }
+
+ // at this point, we should not be over the limit
+ FAssert((getWorkingPopulation() + getSpecialistPopulation()) <=
(totalFreeSpecialists() + getPopulation()));
+
+ AI_setAssignWorkDirty(false);
+
+ if ((getOwnerINLINE() == GC.getGameINLINE().getActivePlayer()) &&
isCitySelected())
+ {
+ gDLL->getInterfaceIFace()->setDirty(CitizenButtons_DIRTY_BIT, true);
+ }
+}
+
+
+void CvCityAI::AI_updateAssignWork()
+{
+ if (AI_isAssignWorkDirty())
+ {
+ AI_assignWorkingPlots();
+ }
+}
+
+
+bool CvCityAI::AI_avoidGrowth()
+{
+ PROFILE_FUNC();
+
+ if (AI_isEmphasizeAvoidGrowth())
+ {
+ return true;
+ }
+
+ if (isFoodProduction())
+ {
+ return true;
+ }
+
+ if (!AI_isEmphasizeYield(YIELD_FOOD) && !AI_isEmphasizeGreatPeople())
+ {
+ int iExtra = (isHuman()) ? 0 : 1;
+ int iHappinessLevel = happyLevel() - unhappyLevel(iExtra);
+
+ // ignore military unhappy, since we assume it will be fixed quickly,
grow anyway
+ if (getMilitaryHappinessUnits() == 0)
+ {
+ iHappinessLevel += ((GC.getDefineINT("NO_MILITARY_PERCENT_ANGER") *
(getPopulation() + 1)) / GC.getPERCENT_ANGER_DIVISOR());
+ }
+
+ // if we can pop rush, we want to grow one over the cap
+ if (GET_PLAYER(getOwnerINLINE()).canPopRush())
+ {
+ iHappinessLevel++;
+ }
+
+
+ // if we have angry citizens
+ if (iHappinessLevel < 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+bool CvCityAI::AI_ignoreGrowth()
+{
+ PROFILE_FUNC();
+
+ if (!AI_isEmphasizeYield(YIELD_FOOD) && !AI_isEmphasizeGreatPeople())
+ {
+ if (!AI_foodAvailable((isHuman()) ? 0 : 1))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+int CvCityAI::AI_specialistValue(SpecialistTypes eSpecialist, bool
bAvoidGrowth, bool bRemove)
+{
+ PROFILE_FUNC();
+
+ short aiYields[NUM_YIELD_TYPES];
+ int iTempValue;
+ int iGreatPeopleRate;
+ int iValue;
+ int iI, iJ;
+ int iNumCities = GET_PLAYER(getOwnerINLINE()).getNumCities();
+
+ for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
+ {
+ aiYields[iI] = GET_PLAYER(getOwnerINLINE()).specialistYield(eSpecialist,
((YieldTypes)iI));
+ }
+
+ short int aiCommerceYields[NUM_COMMERCE_TYPES];
+
+ for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
+ {
+ aiCommerceYields[iI] =
GET_PLAYER(getOwnerINLINE()).specialistCommerce(eSpecialist,
((CommerceTypes)iI));
+ }
+
+ iValue = AI_yieldValue(aiYields, aiCommerceYields, bAvoidGrowth, bRemove);
+
+ iGreatPeopleRate =
GC.getSpecialistInfo(eSpecialist).getGreatPeopleRateChange();
+
+ int iEmphasisCount = 0;
+ if (iGreatPeopleRate != 0)
+ {
+ int iGPPValue = 4;
+ if (AI_isEmphasizeGreatPeople())
+ {
+ iGPPValue = isHuman() ? 30 : 20;
+ }
+ else
+ {
+ if (AI_isEmphasizeYield(YIELD_COMMERCE))
+ {
+ iGPPValue = 2;
+ iEmphasisCount++;
+ }
+ if (AI_isEmphasizeYield(YIELD_PRODUCTION))
+ {
+ iGPPValue = 1;
+ iEmphasisCount++;
+ }
+ if (AI_isEmphasizeYield(YIELD_FOOD))
+ {
+ iGPPValue = 1;
+ iEmphasisCount++;
+ }
+ }
+
+ //iGreatPeopleRate = ((iGreatPeopleRate *
getTotalGreatPeopleRateModifier()) / 100);
+ // UnitTypes iGreatPeopleType =
(UnitTypes)GC.getSpecialistInfo(eSpecialist).getGreatPeopleUnitClass();
+
+ iTempValue = (iGreatPeopleRate * iGPPValue);
+
+// if (isHuman() && (getGreatPeopleUnitRate(iGreatPeopleType) == 0)
+// && (getForceSpecialistCount(eSpecialist) == 0)
&& !AI_isEmphasizeGreatPeople())
+// {
+// iTempValue -= (iGreatPeopleRate * 4);
+// }
+
+ if (!isHuman() || AI_isEmphasizeGreatPeople())
+ {
+ int iProgress = getGreatPeopleProgress();
+ if (iProgress > 0)
+ {
+ int iThreshold = GET_PLAYER(getOwnerINLINE()).greatPeopleThreshold();
+ iTempValue += ((iGreatPeopleRate * (isHuman() ? 1 : 4) * iGPPValue *
iProgress * iProgress) / (iThreshold * iThreshold));
+ }
+ }
+
+ int iCurrentEra = GET_PLAYER(getOwnerINLINE()).getCurrentEra();
+ int iTotalEras = GC.getNumEraInfos();
+
+ if (GET_PLAYER(getOwnerINLINE()).AI_isDoStrategy(AI_STRATEGY_CULTURE2))
+ {
+ int iUnitClass =
GC.getSpecialistInfo(eSpecialist).getGreatPeopleUnitClass();
+ FAssert(iUnitClass != NO_UNITCLASS);
+
+ UnitTypes eGreatPeopleUnit =
(UnitTypes)GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(iUnitClass);
+ if (eGreatPeopleUnit != NO_UNIT)
+ {
+ CvUnitInfo& kUnitInfo = GC.getUnitInfo(eGreatPeopleUnit);
+ if (kUnitInfo.getGreatWorkCulture() > 0)
+ {
+ iTempValue += kUnitInfo.getGreatWorkCulture() /
((GET_PLAYER(getOwnerINLINE()).AI_isDoStrategy(AI_STRATEGY_CULTURE3)) ?
200 : 350);
+ }
+ }
+ }
+
+ if (!isHuman() && (iCurrentEra <= ((iTotalEras * 2) / 3)))
+ {
+ // try to spawn a prophet for any shrines we have yet to build
+ bool bNeedProphet = false;
+ int iBestSpreadValue = 0;
+
+
+ for (iJ = 0; iJ < GC.getNumReligionInfos(); iJ++)
+ {
+ ReligionTypes eReligion = (ReligionTypes) iJ;
+
+ if (isHolyCity(eReligion) && !hasShrine(eReligion)
+ && ((iCurrentEra < iTotalEras / 2) ||
GC.getGameINLINE().countReligionLevels(eReligion) >= 10))
+ {
+ CvCivilizationInfo* pCivilizationInfo =
&GC.getCivilizationInfo(getCivilizationType());
+
+ int iUnitClass =
GC.getSpecialistInfo(eSpecialist).getGreatPeopleUnitClass();
+ FAssert(iUnitClass != NO_UNITCLASS);
+
+ UnitTypes eGreatPeopleUnit = (UnitTypes)
pCivilizationInfo->getCivilizationUnits(iUnitClass);
+ if (eGreatPeopleUnit != NO_UNIT)
+ {
+ // note, for normal XML, this count will be one (there is only 1
shrine building for each religion)
+ int shrineBuildingCount =
GC.getGameINLINE().getShrineBuildingCount(eReligion);
+ for (int iI = 0; iI < shrineBuildingCount; iI++)
+ {
+ int eBuilding = (int) GC.getGameINLINE().getShrineBuilding(iI,
eReligion);
+
+ // if this unit builds or forceBuilds this building
+ if (GC.getUnitInfo(eGreatPeopleUnit).getBuildings(eBuilding) ||
GC.getUnitInfo(eGreatPeopleUnit).getForceBuildings(eBuilding))
+ {
+ bNeedProphet = true;
+ iBestSpreadValue = std::max(iBestSpreadValue,
GC.getGameINLINE().countReligionLevels(eReligion));
+ }
+ }
+
+ }
+ }
+ }
+
+ if (bNeedProphet)
+ {
+ iTempValue += ((iGreatPeopleRate * iBestSpreadValue));
+ }
+ }
+ iTempValue *= 100;
+ iTempValue /=
GET_PLAYER(getOwnerINLINE()).AI_averageGreatPeopleMultiplier();
+
+ iTempValue /= (1 + iEmphasisCount);
+ iValue += iTempValue;
+ }
+ else
+ {
+ SpecialistTypes eGenericCitizen = (SpecialistTypes)
GC.getDefineINT("DEFAULT_SPECIALIST");
+
+ // are we the generic specialist?
+ if (eSpecialist == eGenericCitizen)
+ {
+ iValue *= 60;
+ iValue /= 100;
+ }
+ }
+
+ int iExperience = GC.getSpecialistInfo(eSpecialist).getExperience();
+ if (0 != iExperience)
+ {
+ int iProductionRank = findYieldRateRank(YIELD_PRODUCTION);
+ int iHasMetCount = GET_TEAM(getTeam()).getHasMetCivCount(true);
+
+ iValue += (iExperience * ((iHasMetCount > 0) ? 4 : 2));
+ if (iProductionRank <= iNumCities/2 + 1)
+ {
+ iValue += iExperience * 4;
+ }
+ iValue += ((getMilitaryProductionModifier() * iExperience * 8) / 100);
+ }
+
+ return (iValue * 100);
+}
+
+
+void CvCityAI::AI_chooseProduction()
+{
+ PROFILE_FUNC();
+
+ CvArea* pWaterArea;
+ UnitTypes eProductionUnit;
+ bool bWasFoodProduction;
+ bool bHasMetHuman;
+ bool bLandWar;
+ bool bAssault;
+ bool bDefenseWar;
+ bool bPrimaryArea;
+ bool bFinancialTrouble;
+ bool bDanger;
+ bool bChooseUnit;
+ int iProductionRank;
+ int iCulturePressure;
+
+ bDanger = AI_isDanger();
+
+ CvPlayerAI& kPlayer = GET_PLAYER(getOwnerINLINE());
+
+ if (isProduction())
+ {
+ if (getProduction() > 0)
+ {
+
+ if ((getProductionUnitAI() == UNITAI_SETTLE) &&
kPlayer.AI_isFinancialTrouble())
+ {
+
+ }
+ //if we are killing our growth to train this, then finish it.
+ else if (!bDanger && isFoodProduction())
+ {
+ if ((area()->getAreaAIType(getTeam()) != AREAAI_DEFENSIVE))
+ {
+ return;
+ }
+ }
+ // if less than 3 turns left, keep building current item
+ else if (getProductionTurnsLeft() <= 3)
+ {
+ return;
+ }
+
+
+ // if building a combat unit, and we have no defenders, keep building it
+ eProductionUnit = getProductionUnit();
+ if (eProductionUnit != NO_UNIT)
+ {
+ if (plot()->getNumDefenders(getOwnerINLINE()) == 0)
+ {
+ if (GC.getUnitInfo(eProductionUnit).getCombat() > 0)
+ {
+ return;
+ }
+ }
+ }
+
+ // if we are building a wonder, do not cancel, keep building it (if no
danger)
+ BuildingTypes eProductionBuilding = getProductionBuilding();
+ if (!bDanger && eProductionBuilding != NO_BUILDING &&
+ isLimitedWonderClass((BuildingClassTypes)
GC.getBuildingInfo(eProductionBuilding).getBuildingClassType()))
+ {
+ return;
+ }
+ }
+
+ clearOrderQueue();
+ }
+
+ if (GET_PLAYER(getOwner()).isAnarchy())
+ {
+ return;
+ }
+
+ // only clear the dirty bit if we actually do a check, multiple items
might be queued
+ AI_setChooseProductionDirty(false);
+
+ // allow python to handle it
+ CyCity* pyCity = new CyCity(this);
+ CyArgsList argsList;
+ argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass
in city class
+ long lResult=0;
+ gDLL->getPythonIFace()->callFunction(PYGameModule, "AI_chooseProduction",
argsList.makeFunctionArgs(), &lResult);
+ delete pyCity; // python fxn must not hold on to this pointer
+ if (lResult == 1)
+ {
+ return;
+ }
+
+ if (isHuman() && isProductionAutomated())
+ {
+ AI_buildGovernorChooseProduction();
+ return;
+ }
+
+ CvArea* pArea = area();
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 01/01/09 jdog5000 */
+/** */
+/** City AI */
+/********************************************************************************/
+ /* original BTS code
+ pWaterArea = waterArea();
+ bool bMaybeWaterArea = false;
+
+ if (pWaterArea != NULL)
+ {
+ bMaybeWaterArea = true;
+ if (!GET_TEAM(getTeam()).AI_isWaterAreaRelevant(pWaterArea))
+ {
+ pWaterArea = NULL;
+ }
+ }
+ */
+ pWaterArea = waterArea(true);
+ bool bMaybeWaterArea = false;
+ bool bWaterDanger = false;
+
+ if (pWaterArea != NULL)
+ {
+ bMaybeWaterArea = true;
+ if (!GET_TEAM(getTeam()).AI_isWaterAreaRelevant(pWaterArea))
+ {
+ pWaterArea = NULL;
+ }
+
+ bWaterDanger = kPlayer.AI_getWaterDanger(plot(), 4) > 0;
+ }
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD END */
+/********************************************************************************/
+
+
+ bWasFoodProduction = isFoodProduction();
+ bHasMetHuman = GET_TEAM(getTeam()).hasMetHuman();
+ bLandWar = ((pArea->getAreaAIType(getTeam()) == AREAAI_OFFENSIVE) ||
(pArea->getAreaAIType(getTeam()) == AREAAI_DEFENSIVE) ||
(pArea->getAreaAIType(getTeam()) == AREAAI_MASSING));
+ bDefenseWar = (pArea->getAreaAIType(getTeam()) == AREAAI_DEFENSIVE);
+ bool bAssaultAssist = (pArea->getAreaAIType(getTeam()) ==
AREAAI_ASSAULT_ASSIST);
+ bAssault = bAssaultAssist || (pArea->getAreaAIType(getTeam()) ==
AREAAI_ASSAULT) || (pArea->getAreaAIType(getTeam()) ==
AREAAI_ASSAULT_MASSING);
+ bPrimaryArea = kPlayer.AI_isPrimaryArea(pArea);
+ bFinancialTrouble = kPlayer.AI_isFinancialTrouble();
+ iCulturePressure = AI_calculateCulturePressure();
+ int iNumCitiesInArea = pArea->getCitiesPerPlayer(getOwnerINLINE());
+ bool bImportantCity = false; //be very careful about setting this.
+ bool bBigCultureCity = false;
+ int iCultureRateRank = findCommerceRateRank(COMMERCE_CULTURE);
+ int iCulturalVictoryNumCultureCities =
GC.getGameINLINE().culturalVictoryNumCultureCities();
+
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
04/03/09 jdog5000 */
+/**
*/
+/** War Strategy
AI
*/
+/*************************************************************************************************/
+ int iWarSuccessRatio =
GET_TEAM(getTeam()).AI_getWarSuccessCapitulationRatio();
+ int iWarTroubleThreshold = 0;
+
+ if( bLandWar && iWarSuccessRatio < 30 )
+ {
+ iWarTroubleThreshold = std::max(2,(-iWarSuccessRatio/10));
+ }
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
01/10/09 jdog5000 */
+/**
*/
+/** Vassal
AI
*/
+/*************************************************************************************************/
+ if( !bLandWar && !bAssault && GET_TEAM(getTeam()).isAVassal() )
+ {
+ bLandWar = GET_TEAM(getTeam()).isMasterPlanningLandWar(area());
+
+ if( !bLandWar )
+ {
+ bAssault = GET_TEAM(getTeam()).isMasterPlanningSeaWar(area());
+ }
+ }
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+ bool bGetBetterUnits =
kPlayer.AI_isDoStrategy(AI_STRATEGY_GET_BETTER_UNITS);
+ bool bAggressiveAI =
GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI);
+ bool bAlwaysPeace =
GC.getGameINLINE().isOption(GAMEOPTION_ALWAYS_PEACE);
+
+ int iUnitCostPercentage = (kPlayer.calculateUnitCost() * 100) /
std::max(1, kPlayer.calculatePreInflatedCosts());
+ int iWaterPercent = AI_calculateWaterWorldPercent();
+
+ int iBuildUnitProb = AI_buildUnitProb();
+
+ int iExistingWorkers = kPlayer.AI_totalAreaUnitAIs(pArea,
UNITAI_WORKER);
+ int iNeededWorkers = kPlayer.AI_neededWorkers(pArea);
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
01/01/09 jdog5000 */
+/**
*/
+/** Worker
AI
*/
+/*************************************************************************************************/
+/* original bts code
+ int iNeededSeaWorkers = (pWaterArea == NULL) ? 0 : AI_neededSeaWorkers();
+*/
+ int iNeededSeaWorkers = (bMaybeWaterArea) ? AI_neededSeaWorkers() : 0;
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+ int iTargetCulturePerTurn = AI_calculateTargetCulturePerTurn();
+
+ int iAreaBestFoundValue;
+ int iNumAreaCitySites = kPlayer.AI_getNumAreaCitySites(getArea(),
iAreaBestFoundValue);
+
+ int iWaterAreaBestFoundValue = 0;
+ int iNumWaterAreaCitySites = (pWaterArea == NULL) ? 0 :
kPlayer.AI_getNumAdjacentAreaCitySites(pWaterArea->getID(), getArea(),
iWaterAreaBestFoundValue);
+ int iNumSettlers = kPlayer.AI_totalUnitAIs(UNITAI_SETTLE);
+
+ bool bIsCapitalArea = false;
+ int iNumCapitalAreaCities = 0;
+ if (kPlayer.getCapitalCity() != NULL)
+ {
+ iNumCapitalAreaCities =
kPlayer.getCapitalCity()->area()->getCitiesPerPlayer(getOwnerINLINE());
+ if (getArea() == kPlayer.getCapitalCity()->getArea())
+ {
+ bIsCapitalArea = true;
+ }
+ }
+
+ int iMaxSettlers = 0;
+ if (!bFinancialTrouble)
+ {
+ iMaxSettlers= std::min((kPlayer.getNumCities() + 1) / 2,
iNumAreaCitySites + iNumWaterAreaCitySites);
+ if (bLandWar || bAssault)
+ {
+ iMaxSettlers = (iMaxSettlers + 2) / 3;
+ }
+ }
+
+ bool bChooseWorker = false;
+
+ int iEconomyFlags = 0;
+ iEconomyFlags |= BUILDINGFOCUS_PRODUCTION;
+ iEconomyFlags |= BUILDINGFOCUS_GOLD;
+ iEconomyFlags |= BUILDINGFOCUS_RESEARCH;
+ iEconomyFlags |= BUILDINGFOCUS_MAINTENANCE;
+ iEconomyFlags |= BUILDINGFOCUS_HAPPY;
+ iEconomyFlags |= BUILDINGFOCUS_HEALTHY;
+ if (AI_isEmphasizeGreatPeople())
+ {
+ iEconomyFlags |= BUILDINGFOCUS_SPECIALIST;
+ }
+ if (!GC.getGameINLINE().isOption(GAMEOPTION_NO_ESPIONAGE))
+ {
+ iEconomyFlags |= BUILDINGFOCUS_ESPIONAGE;
+ }
+
+ if (iNumCitiesInArea > 2)
+ {
+ if (kPlayer.AI_isDoStrategy(AI_STRATEGY_CULTURE2))
+ {
+ if (iCultureRateRank <= iCulturalVictoryNumCultureCities + 1)
+ {
+ bBigCultureCity = true;
+
+ // if we do not have enough cities, then the highest culture city will
not get special attention
+ if (iCultureRateRank > 1 || (kPlayer.getNumCities() >
(iCulturalVictoryNumCultureCities + 1)))
+ {
+ if ((((iNumAreaCitySites + iNumWaterAreaCitySites) > 0) &&
(kPlayer.getNumCities() < 6)) && (GC.getGameINLINE().getSorenRandNum(2, "AI
Less Culture More Expand") == 0))
+ {
+ bImportantCity = false;
+ }
+ else
+ {
+ bImportantCity = true;
+ }
+ }
+ }
+ }
+ }
+
+ iProductionRank = findYieldRateRank(YIELD_PRODUCTION);
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
07/12/08 jdog5000 */
+/**
*/
+/** City
AI
*/
+/*************************************************************************************************/
+ // Free experience for various unit domains
+ int iFreeLandExperience = getSpecialistFreeExperience() +
getDomainFreeExperience(DOMAIN_LAND);
+ int iFreeSeaExperience = getSpecialistFreeExperience() +
getDomainFreeExperience(DOMAIN_SEA);
+ int iFreeAirExperience = getSpecialistFreeExperience() +
getDomainFreeExperience(DOMAIN_AIR);
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+ clearOrderQueue();
+
+ if (bWasFoodProduction)
+ {
+ AI_assignWorkingPlots();
+ }
+
+ // -------------------- BBAI Notes -------------------------
+ // Special circumstances
+
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 10/25/08 jdog5000 */
+/** */
+/** Barbarian AI */
+/********************************************************************************/
+ // This has been moved up ~2 blocks to before the occupation logic
+ // Those pieces don't really apply for barbarians or are already handled
here
+
+ // -------------------- BBAI Notes -------------------------
+ // Barbarian city build priorities
+ if (isBarbarian())
+ {
+ if (!AI_isDefended(plot()->plotCount(PUF_isUnitAIType, UNITAI_ATTACK,
-1, getOwnerINLINE()))) // XXX check for other team's units?
+ {
+ if (AI_chooseDefender())
+ {
+ return;
+ }
+
+ if (AI_chooseUnit(UNITAI_ATTACK))
+ {
+ return;
+ }
+ }
+
+ if (!bDanger && (iNeededWorkers > 0) && (AI_getWorkersNeeded() > 0) &&
(AI_getWorkersHave() == 0))
+ {
+ if( getPopulation() > 1 || (GC.getGameINLINE().getGameTurn() -
getGameTurnAcquired() > (15 *
GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getTrainPercent())/100)
)
+ {
+ if (AI_chooseUnit(UNITAI_WORKER))
+ {
+ return;
+ }
+ }
+ }
+
+ if (!bDanger && !bWaterDanger && (iNeededSeaWorkers > 0))
+ {
+ if (AI_chooseUnit(UNITAI_WORKER_SEA))
+ {
+ return;
+ }
+ }
+
+ bChooseUnit = false;
+ if (GC.getGameINLINE().getSorenRandNum(100, "AI Build Unit Production")
> AI_buildUnitProb())
+ {
+
+ int iBarbarianFlags = 0;
+ iBarbarianFlags |= BUILDINGFOCUS_FOOD;
+ iBarbarianFlags |= BUILDINGFOCUS_PRODUCTION;
+ iBarbarianFlags |= BUILDINGFOCUS_EXPERIENCE;
+
+ if (AI_chooseBuilding(iBarbarianFlags))
+ {
+ return;
+ }
+
+ if (AI_chooseBuilding())
+ {
+ return;
+ }
+ }
+
+ if (plot()->plotCount(PUF_isUnitAIType, UNITAI_ASSAULT_SEA, -1,
getOwnerINLINE()) > 0)
+ {
+ if (AI_chooseUnit(UNITAI_ATTACK_CITY))
+ {
+ return;
+ }
+ }
+
+ if ((pWaterArea != NULL) && (iWaterPercent > 30))
+ {
+ if (GC.getGameINLINE().getSorenRandNum(2, "AI Coast Raiders!") == 0)
+ {
+ if (kPlayer.AI_getNumAIUnits(UNITAI_ASSAULT_SEA) <= (1 +
kPlayer.getNumCities() / 2))
+ {
+ if (AI_chooseUnit(UNITAI_ASSAULT_SEA))
+ {
+ return;
+ }
+ }
+ }
+ if (GC.getGameINLINE().getSorenRandNum(110, "AI arrrr!") <
(iWaterPercent + 10))
+ {
+ if (kPlayer.AI_getNumAIUnits(UNITAI_PIRATE_SEA) <=
kPlayer.getNumCities())
+ {
+ if (AI_chooseUnit(UNITAI_PIRATE_SEA))
+ {
+ return;
+ }
+ }
+
+ if (kPlayer.AI_totalAreaUnitAIs(pWaterArea, UNITAI_ATTACK_SEA) <
iNumCitiesInArea)
+ {
+ if (AI_chooseUnit(UNITAI_ATTACK_SEA))
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvCityAI.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,242 @@
+#pragma once
+
+// cityAI.h
+
+#ifndef CIV4_CITY_AI_H
+#define CIV4_CITY_AI_H
+
+#include "CvCity.h"
+
+typedef std::vector<std::pair<UnitAITypes, int> > UnitTypeWeightArray;
+
+class CvCityAI : public CvCity
+{
+
+public:
+
+ DllExport CvCityAI();
+ DllExport virtual ~CvCityAI();
+
+ DllExport void AI_init();
+ DllExport void AI_uninit();
+ DllExport void AI_reset();
+
+ DllExport void AI_doTurn();
+
+ DllExport void AI_assignWorkingPlots();
+ DllExport void AI_updateAssignWork();
+
+ DllExport bool AI_avoidGrowth();
+ DllExport bool AI_ignoreGrowth();
+ DllExport int AI_specialistValue(SpecialistTypes eSpecialist, bool
bAvoidGrowth, bool bRemove);
+
+ DllExport void AI_chooseProduction();
+
+ DllExport UnitTypes AI_bestUnit(bool bAsync = false, AdvisorTypes
eIgnoreAdvisor = NO_ADVISOR, UnitAITypes* peBestUnitAI = NULL);
+ DllExport UnitTypes AI_bestUnitAI(UnitAITypes eUnitAI, bool bAsync =
false, AdvisorTypes eIgnoreAdvisor = NO_ADVISOR);
+
+ DllExport BuildingTypes AI_bestBuilding(int iFocusFlags = 0, int
iMaxTurns = 0, bool bAsync = false, AdvisorTypes eIgnoreAdvisor =
NO_ADVISOR);
+ BuildingTypes AI_bestBuildingThreshold(int iFocusFlags = 0, int iMaxTurns
= 0, int iMinThreshold = 0, bool bAsync = false, AdvisorTypes
eIgnoreAdvisor = NO_ADVISOR);
+
+ DllExport int AI_buildingValue(BuildingTypes eBuilding, int iFocusFlags =
0);
+ int AI_buildingValueThreshold(BuildingTypes eBuilding, int iFocusFlags =
0, int iThreshold = 0);
+
+ DllExport ProjectTypes AI_bestProject();
+ DllExport int AI_projectValue(ProjectTypes eProject);
+
+ DllExport ProcessTypes AI_bestProcess();
+ ProcessTypes AI_bestProcess(CommerceTypes eCommerceType);
+ DllExport int AI_processValue(ProcessTypes eProcess);
+ int AI_processValue(ProcessTypes eProcess, CommerceTypes eCommerceType);
+
+ DllExport int AI_neededSeaWorkers();
+
+ DllExport bool AI_isDefended(int iExtra = 0);
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 9/19/08 jdog5000 */
+/** */
+/** Air AI */
+/********************************************************************************/
+/* original BTS code
+ DllExport bool AI_isAirDefended(int iExtra = 0);
+*/
+ DllExport bool AI_isAirDefended(bool bCountLand = false, int iExtra = 0);
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD END */
+/********************************************************************************/
+ DllExport bool AI_isDanger();
+
+ DllExport int AI_neededDefenders();
+ DllExport int AI_neededAirDefenders();
+ int AI_minDefenders();
+ int AI_neededFloatingDefenders();
+ void AI_updateNeededFloatingDefenders();
+
+ DllExport int AI_getEmphasizeAvoidGrowthCount();
+ DllExport bool AI_isEmphasizeAvoidGrowth();
+
+ DllExport int AI_getEmphasizeGreatPeopleCount();
+ DllExport bool AI_isEmphasizeGreatPeople();
+
+ DllExport bool AI_isAssignWorkDirty();
+ DllExport void AI_setAssignWorkDirty(bool bNewValue);
+
+ DllExport bool AI_isChooseProductionDirty();
+ DllExport void AI_setChooseProductionDirty(bool bNewValue);
+
+ DllExport CvCity* AI_getRouteToCity() const;
+ DllExport void AI_updateRouteToCity();
+
+ DllExport int AI_getEmphasizeYieldCount(YieldTypes eIndex);
+ DllExport bool AI_isEmphasizeYield(YieldTypes eIndex);
+
+ DllExport int AI_getEmphasizeCommerceCount(CommerceTypes eIndex);
+ DllExport bool AI_isEmphasizeCommerce(CommerceTypes eIndex);
+
+ DllExport bool AI_isEmphasize(EmphasizeTypes eIndex);
+ DllExport void AI_setEmphasize(EmphasizeTypes eIndex, bool bNewValue);
+ void AI_forceEmphasizeCulture(bool bNewValue);
+
+ DllExport int AI_getBestBuildValue(int iIndex);
+ DllExport int AI_totalBestBuildValue(CvArea* pArea);
+
+ int AI_clearFeatureValue(int iIndex);
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
07/25/09 jdog5000 */
+/**
*/
+/**
Debug
*/
+/*************************************************************************************************/
+ int AI_getGoodTileCount();
+ int AI_countWorkedPoorTiles();
+ int AI_getTargetSize();
+ void AI_getYieldMultipliers();
+ int AI_getImprovementValue();
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+ DllExport BuildTypes AI_getBestBuild(int iIndex);
+ DllExport int AI_countBestBuilds(CvArea* pArea);
+ DllExport void AI_updateBestBuild();
+
+ virtual int AI_cityValue() const;
+
+ int AI_calculateWaterWorldPercent();
+
+ int AI_getCityImportance(bool bEconomy, bool bMilitary);
+
+ int AI_yieldMultiplier(YieldTypes eYield);
+ void AI_updateSpecialYieldMultiplier();
+ int AI_specialYieldMultiplier(YieldTypes eYield);
+
+ int AI_countNumBonuses(BonusTypes eBonus, bool bIncludeOurs, bool
bIncludeNeutral, int iOtherCultureThreshold, bool bLand = true, bool bWater
= true);
+
+ int AI_playerCloseness(PlayerTypes eIndex, int iMaxDistance);
+ int AI_cityThreat(bool bDangerPercent = false);
+
+ int AI_getWorkersHave();
+ int AI_getWorkersNeeded();
+ void AI_changeWorkersHave(int iChange);
+ BuildingTypes AI_bestAdvancedStartBuilding(int iPass);
+
+ DllExport void read(FDataStreamBase* pStream);
+ DllExport void write(FDataStreamBase* pStream);
+
+protected:
+
+ int m_iEmphasizeAvoidGrowthCount;
+ int m_iEmphasizeGreatPeopleCount;
+
+ bool m_bAssignWorkDirty;
+ bool m_bChooseProductionDirty;
+
+ IDInfo m_routeToCity;
+
+ int* m_aiEmphasizeYieldCount;
+ int* m_aiEmphasizeCommerceCount;
+ bool m_bForceEmphasizeCulture;
+
+ int m_aiBestBuildValue[NUM_CITY_PLOTS];
+
+ BuildTypes m_aeBestBuild[NUM_CITY_PLOTS];
+
+ bool* m_pbEmphasize;
+
+ int* m_aiSpecialYieldMultiplier;
+
+ int m_iCachePlayerClosenessTurn;
+ int m_iCachePlayerClosenessDistance;
+ int* m_aiPlayerCloseness;
+
+ int m_iNeededFloatingDefenders;
+ int m_iNeededFloatingDefendersCacheTurn;
+
+ int m_iWorkersNeeded;
+ int m_iWorkersHave;
+
+
+ void AI_doDraft(bool bForce = false);
+ void AI_doHurry(bool bForce = false);
+ void AI_doEmphasize();
+ int AI_getHappyFromHurry(HurryTypes eHurry);
+ int AI_getHappyFromHurry(HurryTypes eHurry, UnitTypes eUnit, bool
bIgnoreNew);
+ int AI_getHappyFromHurry(HurryTypes eHurry, BuildingTypes eBuilding, bool
bIgnoreNew);
+ int AI_getHappyFromHurry(int iHurryPopulation);
+ bool AI_doPanic();
+ int AI_calculateCulturePressure(bool bGreatWork = false);
+
+
+ bool AI_chooseUnit(UnitAITypes eUnitAI = NO_UNITAI);
+ bool AI_chooseUnit(UnitTypes eUnit, UnitAITypes eUnitAI);
+
+ bool AI_chooseDefender();
+ bool AI_chooseLeastRepresentedUnit(UnitTypeWeightArray &allowedTypes);
+ bool AI_chooseBuilding(int iFocusFlags = 0, int iMaxTurns = MAX_INT, int
iMinThreshold = 0);
+ bool AI_chooseProject();
+ bool AI_chooseProcess(CommerceTypes eCommerceType = NO_COMMERCE);
+
+ bool AI_bestSpreadUnit(bool bMissionary, bool bExecutive, int
iBaseChance, UnitTypes* eBestSpreadUnit, int* iBestSpreadUnitValue);
+ bool AI_addBestCitizen(bool bWorkers, bool bSpecialists, int* piBestPlot
= NULL, SpecialistTypes* peBestSpecialist = NULL);
+ bool AI_removeWorstCitizen(SpecialistTypes eIgnoreSpecialist =
NO_SPECIALIST);
+ void AI_juggleCitizens();
+
+ bool AI_potentialPlot(short* piYields);
+ bool AI_foodAvailable(int iExtra = 0);
+ int AI_yieldValue(short* piYields, short* piCommerceYields, bool
bAvoidGrowth, bool bRemove, bool bIgnoreFood = false, bool bIgnoreGrowth =
false, bool bIgnoreStarvation = false, bool bWorkerOptimization = false);
+ int AI_plotValue(CvPlot* pPlot, bool bAvoidGrowth, bool bRemove, bool
bIgnoreFood = false, bool bIgnoreGrowth = false, bool bIgnoreStarvation =
false);
+
+ int AI_experienceWeight();
+ int AI_buildUnitProb();
+
+ void AI_bestPlotBuild(CvPlot* pPlot, int* piBestValue, BuildTypes*
peBestBuild, int iFoodPriority, int iProductionPriority, int
iCommercePriority, bool bChop, int iHappyAdjust, int iHealthAdjust, int
iFoodChange);
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
06/25/09 jdog5000 */
+/**
*/
+/**
Debug
*/
+/*************************************************************************************************/
+ int AI_getImprovementValue( CvPlot* pPlot, ImprovementTypes eImprovement,
int iFoodPriority, int iProductionPriority, int iCommercePriority, int
iFoodChange, bool bOriginal = false );
+ void AI_getYieldMultipliers( int &iFoodMultiplier, int
&iProductionMultiplier, int &iCommerceMultiplier, int &iDesiredFoodChange );
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+
+ void AI_buildGovernorChooseProduction();
+
+ int AI_getYieldMagicValue(const int* piYieldsTimes100, bool bHealthy);
+ int AI_getPlotMagicValue(CvPlot* pPlot, bool bHealthy, bool
bWorkerOptimization = false);
+ int AI_countGoodTiles(bool bHealthy, bool bUnworkedOnly, int iThreshold =
50, bool bWorkerOptimization = false);
+ int AI_countGoodSpecialists(bool bHealthy);
+ int AI_calculateTargetCulturePerTurn();
+
+ void AI_stealPlots();
+
+ int AI_buildingSpecialYieldChangeValue(BuildingTypes kBuilding,
YieldTypes eYield);
+
+ void AI_cachePlayerCloseness(int iMaxDistance);
+ void AI_updateWorkersNeededHere();
+
+ // added so under cheat mode we can call protected functions for testing
+ friend class CvGameTextMgr;
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLButtonPopup.cpp Sat Sep 19 06:38:49
2009
@@ -0,0 +1,2574 @@
+// buttonPopup.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvDLLButtonPopup.h"
+#include "CvGlobals.h"
+#include "CvPlayerAI.h"
+#include "CvGameAI.h"
+#include "CvTeamAI.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvArtFileMgr.h"
+#include "CyCity.h"
+#include "CyArgsList.h"
+#include "CvPopupReturn.h"
+#include "CvInfos.h"
+#include "CvInitCore.h"
+#include "CvGameTextMgr.h"
+#include "CvDLLPythonIFaceBase.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLEntityIFaceBase.h"
+#include "CvGameCoreUtils.h"
+#include "CvDLLEngineIFaceBase.h"
+#include "CvDLLEventReporterIFaceBase.h"
+
+// Public Functions...
+
+#define PASSWORD_DEFAULT (L"*****")
+
+CvDLLButtonPopup* CvDLLButtonPopup::m_pInst = NULL;
+
+CvDLLButtonPopup& CvDLLButtonPopup::getInstance()
+{
+ if (m_pInst == NULL)
+ {
+ m_pInst = new CvDLLButtonPopup;
+ }
+ return *m_pInst;
+}
+
+void CvDLLButtonPopup::freeInstance()
+{
+ delete m_pInst;
+ m_pInst = NULL;
+}
+
+CvDLLButtonPopup::CvDLLButtonPopup()
+{
+}
+
+
+CvDLLButtonPopup::~CvDLLButtonPopup()
+{
+}
+
+void CvDLLButtonPopup::OnAltExecute(CvPopup& popup, const PopupReturn&
popupReturn, CvPopupInfo &info)
+{
+ CvPopupInfo* pInfo = new CvPopupInfo;
+ if (pInfo)
+ {
+ *pInfo = info;
+ gDLL->getInterfaceIFace()->addPopup(pInfo);
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(&popup);
+ }
+}
+
+
+void CvDLLButtonPopup::OnOkClicked(CvPopup* pPopup, PopupReturn
*pPopupReturn, CvPopupInfo &info)
+{
+ int iExamineCityID;
+ int iI;
+
+ switch (info.getButtonPopupType())
+ {
+ case BUTTONPOPUP_TEXT:
+ break;
+
+ case BUTTONPOPUP_CONFIRM_MENU:
+ if ( pPopupReturn->getButtonClicked() == 0 )
+ {
+ switch (info.getData1())
+ {
+ case 0:
+ gDLL->SetDone(true);
+ break;
+ case 1:
+ gDLL->getInterfaceIFace()->exitingToMainMenu();
+ break;
+ case 2:
+ GC.getGameINLINE().doControl(CONTROL_RETIRE);
+ break;
+ case 3:
+ GC.getGameINLINE().regenerateMap();
+ break;
+ case 4:
+ GC.getGameINLINE().doControl(CONTROL_WORLD_BUILDER);
+ break;
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_MAIN_MENU:
+ if (pPopupReturn->getButtonClicked() == 0)
+ { // exit to desktop
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_CONFIRM_MENU);
+ if (NULL != pInfo)
+ {
+ pInfo->setData1(0);
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), true);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 1)
+ { // exit to main menu
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_CONFIRM_MENU);
+ if (NULL != pInfo)
+ {
+ pInfo->setData1(1);
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), true);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 2)
+ {
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_CONFIRM_MENU);
+ if (NULL != pInfo)
+ {
+ pInfo->setData1(2);
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), true);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 3)
+ {
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_CONFIRM_MENU);
+ if (NULL != pInfo)
+ {
+ pInfo->setData1(3);
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), true);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 4)
+ { // load game
+ GC.getGameINLINE().doControl(CONTROL_LOAD_GAME);
+ }
+ else if (pPopupReturn->getButtonClicked() == 5)
+ { // save game
+ GC.getGameINLINE().doControl(CONTROL_SAVE_NORMAL);
+ }
+ else if (pPopupReturn->getButtonClicked() == 6)
+ { // options
+
gDLL->getPythonIFace()->callFunction("CvScreensInterface", "showOptionsScreen");
+ }
+ else if (pPopupReturn->getButtonClicked() == 7)
+ {
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_CONFIRM_MENU);
+ if (NULL != pInfo)
+ {
+ pInfo->setData1(4);
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), true);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 8)
+ { // Game details
+ GC.getGameINLINE().doControl(CONTROL_ADMIN_DETAILS);
+ }
+ else if (pPopupReturn->getButtonClicked() == 9)
+ { // player details
+ GC.getGameINLINE().doControl(CONTROL_DETAILS);
+ }
+ // 10 - cancel
+ break;
+
+ case BUTTONPOPUP_DECLAREWARMOVE:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ gDLL->sendChangeWar((TeamTypes)info.getData1(), true);
+ }
+ if (((pPopupReturn->getButtonClicked() == 0) || info.getOption2()) &&
info.getFlags() == 0)
+ {
+
GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_PUSH_MISSION,
MISSION_MOVE_TO, info.getData2(), info.getData3(), info.getFlags(), false,
info.getOption1());
+ }
+ break;
+
+ case BUTTONPOPUP_CONFIRMCOMMAND:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ int iAction = info.getData1();
+ GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_DO_COMMAND,
GC.getActionInfo(iAction).getCommandType(),
GC.getActionInfo(iAction).getCommandData(), -1, 0, info.getOption1());
+ }
+ break;
+
+ case BUTTONPOPUP_LOADUNIT:
+ if (pPopupReturn->getButtonClicked() != 0)
+ {
+ CLLNode<IDInfo>* pUnitNode;
+ CvSelectionGroup* pSelectionGroup;
+ CvUnit* pLoopUnit;
+ CvPlot* pPlot;
+ int iCount;
+
+ pSelectionGroup = gDLL->getInterfaceIFace()->getSelectionList();
+
+ if (NULL != pSelectionGroup)
+ {
+ pPlot = pSelectionGroup->plot();
+
+ iCount = pPopupReturn->getButtonClicked();
+
+ pUnitNode = pPlot->headUnitNode();
+
+ while (pUnitNode != NULL)
+ {
+ pLoopUnit = ::getUnit(pUnitNode->m_data);
+ pUnitNode = pPlot->nextUnitNode(pUnitNode);
+
+ if (pSelectionGroup->canDoCommand(COMMAND_LOAD_UNIT,
pLoopUnit->getOwnerINLINE(), pLoopUnit->getID()))
+ {
+ iCount--;
+ if (iCount == 0)
+ {
+
GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_DO_COMMAND,
COMMAND_LOAD_UNIT, pLoopUnit->getOwnerINLINE(), pLoopUnit->getID());
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_LEADUNIT:
+ if (pPopupReturn->getButtonClicked() != 0)
+ {
+ CLLNode<IDInfo>* pUnitNode;
+ CvSelectionGroup* pSelectionGroup;
+ CvUnit* pLoopUnit;
+ CvPlot* pPlot;
+ int iCount;
+
+ pSelectionGroup = gDLL->getInterfaceIFace()->getSelectionList();
+
+ if (NULL != pSelectionGroup)
+ {
+ pPlot = pSelectionGroup->plot();
+
+ iCount = pPopupReturn->getButtonClicked();
+
+ pUnitNode = pPlot->headUnitNode();
+
+ while (pUnitNode != NULL)
+ {
+ pLoopUnit = ::getUnit(pUnitNode->m_data);
+ pUnitNode = pPlot->nextUnitNode(pUnitNode);
+
+ if (pLoopUnit->canPromote((PromotionTypes) info.getData1(),
info.getData2()))
+ {
+ iCount--;
+ if (iCount == 0)
+ {
+
GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_PUSH_MISSION,
MISSION_LEAD, pLoopUnit->getID());
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_DOESPIONAGE:
+ if (pPopupReturn->getButtonClicked() != NO_ESPIONAGEMISSION)
+ {
+
GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_PUSH_MISSION,
MISSION_ESPIONAGE, (EspionageMissionTypes)
pPopupReturn->getButtonClicked());
+ }
+ break;
+
+ case BUTTONPOPUP_DOESPIONAGE_TARGET:
+ if (pPopupReturn->getButtonClicked() != -1)
+ {
+
GC.getGameINLINE().selectionListGameNetMessage(GAMEMESSAGE_PUSH_MISSION,
MISSION_ESPIONAGE, (EspionageMissionTypes)info.getData1(),
pPopupReturn->getButtonClicked());
+ }
+ break;
+
+ case BUTTONPOPUP_CHOOSETECH:
+ if (pPopupReturn->getButtonClicked() == GC.getNumTechInfos())
+ {
+
gDLL->getPythonIFace()->callFunction("CvScreensInterface", "showTechChooser");
+ GET_PLAYER(GC.getGameINLINE().getActivePlayer()).chooseTech(0, "",
true);
+ }
+ break;
+
+ case BUTTONPOPUP_RAZECITY:
+ if (pPopupReturn->getButtonClicked() == 1)
+ {
+ gDLL->sendDoTask(info.getData1(), TASK_RAZE, -1, -1, false, false,
false, false);
+ }
+ else if (pPopupReturn->getButtonClicked() == 2)
+ {
+ CvCity* pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (NULL != pCity)
+ {
+
gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(),
pCity);
+ }
+
+ gDLL->sendDoTask(info.getData1(), TASK_GIFT, info.getData2(), -1,
false, false, false, false);
+ }
+ else if (pPopupReturn->getButtonClicked() == 0)
+ {
+ CvCity* pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (NULL != pCity)
+ {
+ pCity->chooseProduction();
+
gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(),
pCity);
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_DISBANDCITY:
+ if (pPopupReturn->getButtonClicked() == 1)
+ {
+ gDLL->sendDoTask(info.getData1(), TASK_DISBAND, -1, -1, false, false,
false, false);
+ }
+ else if (pPopupReturn->getButtonClicked() == 0)
+ {
+ CvCity* pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (NULL != pCity)
+ {
+ pCity->chooseProduction();
+
gDLL->getEventReporterIFace()->cityAcquiredAndKept(GC.getGameINLINE().getActivePlayer(),
pCity);
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_CHOOSEPRODUCTION:
+ iExamineCityID = 0;
+ iExamineCityID = std::max(iExamineCityID, GC.getNumUnitInfos());
+ iExamineCityID = std::max(iExamineCityID, GC.getNumBuildingInfos());
+ iExamineCityID = std::max(iExamineCityID, GC.getNumProjectInfos());
+ iExamineCityID = std::max(iExamineCityID, GC.getNumProcessInfos());
+
+ if (pPopupReturn->getButtonClicked() == iExamineCityID)
+ {
+ CvCity* pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (pCity != NULL)
+ {
+ gDLL->getInterfaceIFace()->selectCity(pCity, true);
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGECIVIC:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ CivicTypes* paeNewCivics = new CivicTypes[GC.getNumCivicOptionInfos()];
+
+ for (iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
+ {
+ paeNewCivics[iI] =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCivics((CivicOptionTypes)iI);
+ }
+
+ paeNewCivics[info.getData1()] = ((CivicTypes)(info.getData2()));
+
+ gDLL->sendUpdateCivics(paeNewCivics);
+
+ SAFE_DELETE(paeNewCivics);
+ }
+ else if (pPopupReturn->getButtonClicked() == 2)
+ {
+
gDLL->getPythonIFace()->callFunction(PYScreensModule, "showCivicsScreen");
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGERELIGION:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ gDLL->sendConvert((ReligionTypes)(info.getData1()));
+ }
+ break;
+
+ case BUTTONPOPUP_CHOOSEELECTION:
+ {
+ VoteSelectionData* pData =
GC.getGameINLINE().getVoteSelection(info.getData1());
+ if (NULL != pData && pPopupReturn->getButtonClicked() <
(int)pData->aVoteOptions.size())
+ {
+
gDLL->sendChooseElection((VoteTypes)(pPopupReturn->getButtonClicked()),
info.getData1());
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_DIPLOVOTE:
+ gDLL->sendDiploVote(info.getData1(),
(PlayerVoteTypes)pPopupReturn->getButtonClicked());
+ break;
+
+ case BUTTONPOPUP_ALARM:
+ break;
+
+ case BUTTONPOPUP_DEAL_CANCELED:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ gDLL->sendKillDeal(info.getData1(), info.getOption1());
+ }
+ break;
+
+ case BUTTONPOPUP_PYTHON:
+ if (!info.getOnClickedPythonCallback().IsEmpty())
+ {
+ FAssertMsg(!GC.getGameINLINE().isNetworkMultiPlayer(), "Danger: Out of
Sync");
+ CyArgsList argsList;
+ argsList.add(pPopupReturn->getButtonClicked());
+ argsList.add(info.getData1());
+ argsList.add(info.getData2());
+ argsList.add(info.getData3());
+ argsList.add(info.getFlags());
+ argsList.add(info.getText());
+ argsList.add(info.getOption1());
+ argsList.add(info.getOption2());
+
gDLL->getPythonIFace()->callFunction((info.getPythonModule().IsEmpty() ?
PYScreensModule : info.getPythonModule()),
info.getOnClickedPythonCallback(), argsList.makeFunctionArgs());
+ break;
+ }
+ break;
+
+ case BUTTONPOPUP_DETAILS:
+ {
+ // Civ details
+ PlayerTypes eID = GC.getInitCore().getActivePlayer();
+
+ CvWString szLeaderName = GC.getInitCore().getLeaderName(eID);
+ CvWString szCivDescription = GC.getInitCore().getCivDescription(eID);
+ CvWString szCivShortDesc = GC.getInitCore().getCivShortDesc(eID);
+ CvWString szCivAdjective = GC.getInitCore().getCivAdjective(eID);
+ CvWString szCivPassword = PASSWORD_DEFAULT;
+ CvString szEmail = GC.getInitCore().getEmail(eID);
+ CvString szSmtpHost = GC.getInitCore().getSmtpHost(eID);
+
+ if (pPopupReturn->getEditBoxString(0) &&
*(pPopupReturn->getEditBoxString(0)))
+ {
+ szLeaderName = pPopupReturn->getEditBoxString(0);
+ }
+ if (pPopupReturn->getEditBoxString(1) &&
*(pPopupReturn->getEditBoxString(1)))
+ {
+ szCivDescription = pPopupReturn->getEditBoxString(1);
+ }
+ if (pPopupReturn->getEditBoxString(2) &&
*(pPopupReturn->getEditBoxString(2)))
+ {
+ szCivShortDesc = pPopupReturn->getEditBoxString(2);
+ }
+ if (pPopupReturn->getEditBoxString(3) &&
*(pPopupReturn->getEditBoxString(3)))
+ {
+ szCivAdjective = pPopupReturn->getEditBoxString(3);
+ }
+ if (GC.getGameINLINE().isHotSeat() || GC.getGameINLINE().isPbem())
+ {
+ if (pPopupReturn->getEditBoxString(4) &&
*(pPopupReturn->getEditBoxString(4)))
+ {
+ szCivPassword = pPopupReturn->getEditBoxString(4);
+ }
+ }
+ if (GC.getGameINLINE().isPitboss() || GC.getGameINLINE().isPbem())
+ {
+ if (pPopupReturn->getEditBoxString(5) &&
*(pPopupReturn->getEditBoxString(5)))
+ {
+ szEmail = CvString(pPopupReturn->getEditBoxString(5));
+ }
+ }
+ if (GC.getGameINLINE().isPbem())
+ {
+ if (pPopupReturn->getEditBoxString(6) &&
*(pPopupReturn->getEditBoxString(6)))
+ {
+ szSmtpHost = CvString(pPopupReturn->getEditBoxString(6));
+ }
+ }
+
+ GC.getInitCore().setLeaderName(eID, szLeaderName);
+ GC.getInitCore().setCivDescription(eID, szCivDescription);
+ GC.getInitCore().setCivShortDesc(eID, szCivShortDesc);
+ GC.getInitCore().setCivAdjective(eID, szCivAdjective);
+ if (szCivPassword != PASSWORD_DEFAULT)
+ {
+ GC.getInitCore().setCivPassword(eID, szCivPassword);
+ }
+ GC.getInitCore().setEmail(eID, szEmail);
+ GC.getInitCore().setSmtpHost(eID, szSmtpHost);
+ gDLL->sendPlayerInfo(eID);
+
+ if (GC.getGameINLINE().isPbem() && pPopupReturn->getButtonClicked() ==
0)
+ {
+ gDLL->sendPbemTurn(NO_PLAYER);
+ }
+
+ }
+ break;
+
+ case BUTTONPOPUP_ADMIN:
+ {
+ // Game details
+ CvWString szGameName;
+ CvWString szAdminPassword = GC.getInitCore().getAdminPassword();
+ if (pPopupReturn->getEditBoxString(0) &&
*(pPopupReturn->getEditBoxString(0)))
+ {
+ szGameName = pPopupReturn->getEditBoxString(0);
+ }
+ if (pPopupReturn->getEditBoxString(1) &&
CvWString(pPopupReturn->getEditBoxString(1)) != PASSWORD_DEFAULT)
+ {
+ if (*(pPopupReturn->getEditBoxString(1)))
+ {
+ szAdminPassword =
CvWString(gDLL->md5String((char*)CvString(pPopupReturn->getEditBoxString(1)).GetCString()));
+ }
+ else
+ {
+ szAdminPassword = L"";
+ }
+ }
+ if (!GC.getGameINLINE().isGameMultiPlayer())
+ {
+ if (pPopupReturn->getCheckboxBitfield(2) &&
pPopupReturn->getCheckboxBitfield(2) > 0)
+ {
+ gDLL->setChtLvl(1);
+ }
+ else
+ {
+ gDLL->setChtLvl(0);
+ }
+ }
+
+ gDLL->sendGameInfo(szGameName, szAdminPassword);
+
+ }
+ break;
+
+ case BUTTONPOPUP_ADMIN_PASSWORD:
+ {
+ CvWString szAdminPassword;
+ if (pPopupReturn->getEditBoxString(0) &&
CvWString(pPopupReturn->getEditBoxString(0)) != PASSWORD_DEFAULT)
+ {
+ szAdminPassword = pPopupReturn->getEditBoxString(0);
+ }
+ if
(CvWString(gDLL->md5String((char*)CvString(szAdminPassword).GetCString()))
== GC.getInitCore().getAdminPassword())
+ {
+ switch ((ControlTypes)info.getData1())
+ {
+ case CONTROL_WORLD_BUILDER:
+
gDLL->getInterfaceIFace()->setWorldBuilder(!(gDLL->GetWorldBuilderMode()));
+ break;
+ case CONTROL_ADMIN_DETAILS:
+ gDLL->getInterfaceIFace()->showAdminDetails();
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ {
+ CvPopupInfo* pInfo = new CvPopupInfo();
+ if (NULL != pInfo)
+ {
+ pInfo->setText(gDLL->getText("TXT_KEY_BAD_PASSWORD_DESC"));
+ gDLL->getInterfaceIFace()->addPopup(pInfo, NO_PLAYER, true);
+ }
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_EXTENDED_GAME:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ if (GC.getGameINLINE().isNetworkMultiPlayer())
+ {
+ gDLL->sendExtendedGame();
+ }
+ else
+ {
+ GC.getGameINLINE().setGameState(GAMESTATE_EXTENDED);
+ }
+ }
+ else if (pPopupReturn->getButtonClicked() == 1)
+ {
+ // exit to main menu
+ if (GC.getGameINLINE().isNetworkMultiPlayer() &&
GC.getGameINLINE().canDoControl(CONTROL_RETIRE) &&
GC.getGameINLINE().countHumanPlayersAlive() > 1)
+ {
+ GC.getGameINLINE().doControl(CONTROL_RETIRE);
+ }
+ else if (!gDLL->getInterfaceIFace()->isDebugMenuCreated())
+ {
+ gDLL->getInterfaceIFace()->exitingToMainMenu();
+ }
+ else
+ {
+ gDLL->SetDone(true);
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_DIPLOMACY:
+ if (pPopupReturn->getButtonClicked() != MAX_CIV_PLAYERS)
+ {
+
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).contact((PlayerTypes)(pPopupReturn->getButtonClicked()));
+ }
+ break;
+
+ case BUTTONPOPUP_ADDBUDDY:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ gDLL->AcceptBuddy(CvString(info.getText()).GetCString(),
info.getData1());
+ }
+ else
+ {
+ gDLL->RejectBuddy(CvString(info.getText()).GetCString(),
info.getData1());
+ }
+ break;
+
+ case BUTTONPOPUP_FORCED_DISCONNECT:
+ case BUTTONPOPUP_PITBOSS_DISCONNECT:
+ case BUTTONPOPUP_KICKED:
+ gDLL->getInterfaceIFace()->exitingToMainMenu();
+ break;
+
+ case BUTTONPOPUP_VASSAL_DEMAND_TRIBUTE:
+ if (pPopupReturn->getButtonClicked() < GC.getNumBonusInfos())
+ {
+ PlayerTypes eVassal = (PlayerTypes)info.getData1();
+ if (GET_PLAYER(eVassal).isHuman())
+ {
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_VASSAL_GRANT_TRIBUTE,
GC.getGameINLINE().getActivePlayer(), pPopupReturn->getButtonClicked());
+ if (NULL != pInfo)
+ {
+ gDLL->sendPopup(eVassal, pInfo);
+ }
+ }
+ else
+ {
+ TradeData item;
+ setTradeItem(&item, TRADE_RESOURCES, pPopupReturn->getButtonClicked());
+
+ CLinkList<TradeData> ourList;
+ CLinkList<TradeData> theirList;
+ theirList.insertAtEnd(item);
+
+ if
(GET_PLAYER(eVassal).AI_considerOffer(GC.getGameINLINE().getActivePlayer(),
&ourList, &theirList))
+ {
+ gDLL->sendImplementDealMessage(eVassal, &ourList, &theirList);
+
+ CvWString szBuffer =
gDLL->getText("TXT_KEY_VASSAL_GRANT_TRIBUTE_ACCEPTED",
GET_PLAYER(eVassal).getNameKey(),
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getNameKey(),
GC.getBonusInfo((BonusTypes)pPopupReturn->getButtonClicked()).getTextKeyWide());
+
gDLL->getInterfaceIFace()->addMessage(GC.getGameINLINE().getActivePlayer(),
false, GC.getEVENT_MESSAGE_TIME(), szBuffer);
+ }
+ else
+ {
+ gDLL->sendChangeWar(GET_PLAYER(eVassal).getTeam(), true);
+ }
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_VASSAL_GRANT_TRIBUTE:
+ if (pPopupReturn->getButtonClicked() == 0)
+ {
+ TradeData item;
+ setTradeItem(&item, TRADE_RESOURCES, info.getData2());
+
+ CLinkList<TradeData> ourList;
+ CLinkList<TradeData> theirList;
+ ourList.insertAtEnd(item);
+
+ gDLL->sendImplementDealMessage((PlayerTypes)info.getData1(), &ourList,
&theirList);
+
+ CvWString szBuffer =
gDLL->getText("TXT_KEY_VASSAL_GRANT_TRIBUTE_ACCEPTED",
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getNameKey(),
GET_PLAYER((PlayerTypes)info.getData1()).getNameKey(),
GC.getBonusInfo((BonusTypes)info.getData2()).getTextKeyWide());
+ gDLL->getInterfaceIFace()->addMessage((PlayerTypes)info.getData1(),
false, GC.getEVENT_MESSAGE_TIME(), szBuffer);
+ }
+ else
+ {
+ gDLL->sendChangeWar(GET_PLAYER((PlayerTypes)info.getData1()).getTeam(),
true);
+ }
+
+ break;
+
+ case BUTTONPOPUP_EVENT:
+ if (pPopupReturn->getButtonClicked() == GC.getNumEventInfos())
+ {
+ CvPlayer& kActivePlayer =
GET_PLAYER(GC.getGameINLINE().getActivePlayer());
+ EventTriggeredData* pTriggeredData =
kActivePlayer.getEventTriggered(info.getData1());
+ if (NULL != pTriggeredData)
+ {
+ CvCity* pCity = kActivePlayer.getCity(pTriggeredData->m_iCityId);
+ if (NULL != pCity)
+ {
+ gDLL->getInterfaceIFace()->selectCity(pCity, true);
+ }
+ }
+
+ CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_EVENT,
info.getData1());
+ gDLL->getInterfaceIFace()->addPopup(pInfo,
GC.getGameINLINE().getActivePlayer(), false, true);
+ }
+ else if (-1 != pPopupReturn->getButtonClicked())
+ {
+ gDLL->sendEventTriggered(GC.getGameINLINE().getActivePlayer(),
(EventTypes)pPopupReturn->getButtonClicked(), info.getData1());
+ }
+ break;
+
+ case BUTTONPOPUP_FREE_COLONY:
+ if (pPopupReturn->getButtonClicked() > 0)
+ {
+ gDLL->sendEmpireSplit(GC.getGameINLINE().getActivePlayer(),
pPopupReturn->getButtonClicked());
+ }
+ else if (pPopupReturn->getButtonClicked() < 0)
+ {
+ gDLL->sendDoTask(-pPopupReturn->getButtonClicked(), TASK_LIBERATE, 0,
-1, false, false, false, false);
+ }
+ break;
+
+ case BUTTONPOPUP_LAUNCH:
+ if (0 == pPopupReturn->getButtonClicked())
+ {
+ gDLL->sendLaunch(GC.getGameINLINE().getActivePlayer(),
(VictoryTypes)info.getData1());
+ }
+ break;
+
+ case BUTTONPOPUP_FOUND_RELIGION:
+ gDLL->sendFoundReligion(GC.getGameINLINE().getActivePlayer(),
(ReligionTypes)pPopupReturn->getButtonClicked(),
(ReligionTypes)info.getData1());
+ break;
+
+ default:
+ FAssert(false);
+ break;
+ }
+}
+
+void CvDLLButtonPopup::OnFocus(CvPopup* pPopup, CvPopupInfo &info)
+{
+ if (gDLL->getInterfaceIFace()->popupIsDying(pPopup))
+ {
+ return;
+ }
+
+ switch (info.getButtonPopupType())
+ {
+ case BUTTONPOPUP_CHOOSETECH:
+ if (info.getData1() == 0)
+ {
+ if
((GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCurrentResearch() !=
NO_TECH) || (GC.getGameINLINE().getGameState() == GAMESTATE_OVER))
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGERELIGION:
+ if
(!(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canChangeReligion()) ||
(GC.getGameINLINE().getGameState() == GAMESTATE_OVER))
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ }
+ break;
+
+ case BUTTONPOPUP_CHOOSEPRODUCTION:
+ if (GC.getGameINLINE().getGameState() == GAMESTATE_OVER)
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ }
+ else
+ {
+ PlayerTypes ePlayer = GC.getGameINLINE().getActivePlayer();
+ CvCity* pCity = GET_PLAYER(ePlayer).getCity(info.getData1());
+
+ if (NULL == pCity || pCity->getOwnerINLINE() != ePlayer ||
pCity->isProduction())
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ break;
+ }
+
+ gDLL->getInterfaceIFace()->lookAtCityOffset(pCity->getID());
+ }
+ break;
+
+ case BUTTONPOPUP_RAZECITY:
+ case BUTTONPOPUP_DISBANDCITY:
+ {
+ PlayerTypes ePlayer = GC.getGameINLINE().getActivePlayer();
+ CvCity* pCity = GET_PLAYER(ePlayer).getCity(info.getData1());
+
+ if (NULL == pCity || pCity->getOwnerINLINE() != ePlayer)
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ break;
+ }
+
+ gDLL->getInterfaceIFace()->lookAtCityOffset(pCity->getID());
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGECIVIC:
+ if
(!(GET_PLAYER(GC.getGameINLINE().getActivePlayer()).canRevolution(NULL)) ||
(GC.getGameINLINE().getGameState() == GAMESTATE_OVER))
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ }
+ break;
+
+ case BUTTONPOPUP_PYTHON:
+ case BUTTONPOPUP_PYTHON_SCREEN:
+ if (!info.getOnFocusPythonCallback().IsEmpty())
+ {
+ long iResult;
+ CyArgsList argsList;
+ argsList.add(info.getData1());
+ argsList.add(info.getData2());
+ argsList.add(info.getData3());
+ argsList.add(info.getFlags());
+ argsList.add(info.getText());
+ argsList.add(info.getOption1());
+ argsList.add(info.getOption2());
+ gDLL->getPythonIFace()->callFunction(PYScreensModule,
info.getOnFocusPythonCallback(), argsList.makeFunctionArgs(), &iResult);
+ if (0 != iResult)
+ {
+ gDLL->getInterfaceIFace()->popupSetAsCancelled(pPopup);
+ }
+ }
+ break;
+ }
+}
+
+// returns false if popup is not launched
+bool CvDLLButtonPopup::launchButtonPopup(CvPopup* pPopup, CvPopupInfo
&info)
+{
+ bool bLaunched = false;
+
+ switch (info.getButtonPopupType())
+ {
+ case BUTTONPOPUP_TEXT:
+ bLaunched = launchTextPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CHOOSEPRODUCTION:
+ bLaunched = launchProductionPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CHANGERELIGION:
+ bLaunched = launchChangeReligionPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CHOOSEELECTION:
+ bLaunched = launchChooseElectionPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DIPLOVOTE:
+ bLaunched = launchDiploVotePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_RAZECITY:
+ bLaunched = launchRazeCityPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DISBANDCITY:
+ bLaunched = launchDisbandCityPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CHOOSETECH:
+ bLaunched = launchChooseTechPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CHANGECIVIC:
+ bLaunched = launchChangeCivicsPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_ALARM:
+ bLaunched = launchAlarmPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DECLAREWARMOVE:
+ bLaunched = launchDeclareWarMovePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CONFIRMCOMMAND:
+ bLaunched = launchConfirmCommandPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_LOADUNIT:
+ bLaunched = launchLoadUnitPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_LEADUNIT:
+ bLaunched = launchLeadUnitPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DOESPIONAGE:
+ bLaunched = launchDoEspionagePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DOESPIONAGE_TARGET:
+ bLaunched = launchDoEspionageTargetPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_MAIN_MENU:
+ bLaunched = launchMainMenuPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_CONFIRM_MENU:
+ bLaunched = launchConfirmMenu(pPopup, info);
+ break;
+ case BUTTONPOPUP_PYTHON_SCREEN:
+ bLaunched = launchPythonScreen(pPopup, info);
+ break;
+ case BUTTONPOPUP_DEAL_CANCELED:
+ bLaunched = launchCancelDeal(pPopup, info);
+ break;
+ case BUTTONPOPUP_PYTHON:
+ bLaunched = launchPythonPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DETAILS:
+ bLaunched = launchDetailsPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_ADMIN:
+ bLaunched = launchAdminPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_ADMIN_PASSWORD:
+ bLaunched = launchAdminPasswordPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_EXTENDED_GAME:
+ bLaunched = launchExtendedGamePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_DIPLOMACY:
+ bLaunched = launchDiplomacyPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_ADDBUDDY:
+ bLaunched = launchAddBuddyPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_FORCED_DISCONNECT:
+ bLaunched = launchForcedDisconnectPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_PITBOSS_DISCONNECT:
+ bLaunched = launchPitbossDisconnectPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_KICKED:
+ bLaunched = launchKickedPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_VASSAL_DEMAND_TRIBUTE:
+ bLaunched = launchVassalDemandTributePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_VASSAL_GRANT_TRIBUTE:
+ bLaunched = launchVassalGrantTributePopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_EVENT:
+ bLaunched = launchEventPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_FREE_COLONY:
+ bLaunched = launchFreeColonyPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_LAUNCH:
+ bLaunched = launchLaunchPopup(pPopup, info);
+ break;
+ case BUTTONPOPUP_FOUND_RELIGION:
+ bLaunched = launchFoundReligionPopup(pPopup, info);
+ break;
+ default:
+ FAssert(false);
+ break;
+ }
+ return (bLaunched);
+}
+
+
+bool CvDLLButtonPopup::launchTextPopup(CvPopup* pPopup, CvPopupInfo &info)
+{
+ gDLL->getInterfaceIFace()->popupSetBodyString(pPopup, info.getText());
+ gDLL->getInterfaceIFace()->popupLaunch(pPopup, true,
POPUPSTATE_IMMEDIATE);
+ return (true);
+}
+
+
+bool CvDLLButtonPopup::launchProductionPopup(CvPopup* pPopup, CvPopupInfo
&info)
+{
+ CvWString szBuffer;
+ CvString szArtFilename;
+ CvWString szTemp;
+
+ CvCity* pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (NULL == pCity || pCity->isProductionAutomated())
+ {
+ return (false);
+ }
+
+ CyCity* pyCity = new CyCity(pCity);
+ CyArgsList argsList;
+ argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass
in plot class
+ long lResult=0;
+ gDLL->getPythonIFace()->callFunction(PYGameModule, "skipProductionPopup",
argsList.makeFunctionArgs(), &lResult);
+ delete pyCity; // python fxn must not hold on to this pointer
+ if (lResult == 1)
+ {
+ return (false);
+ }
+
+ FAssertMsg(pCity->getOwnerINLINE() ==
GC.getGameINLINE().getActivePlayer(), "City must belong to Active Player");
+
+ UnitTypes eTrainUnit = NO_UNIT;
+ BuildingTypes eConstructBuilding = NO_BUILDING;
+ ProjectTypes eCreateProject = NO_PROJECT;
+ switch (info.getData2())
+ {
+ case (ORDER_TRAIN):
+ eTrainUnit = (UnitTypes)info.getData3();
+ break;
+ case (ORDER_CONSTRUCT):
+ eConstructBuilding = (BuildingTypes)info.getData3();
+ break;
+ case (ORDER_CREATE):
+ eCreateProject = (ProjectTypes)info.getData3();
+ break;
+ default:
+ break;
+ }
+ bool bFinish = info.getOption1();
+
+ if (eTrainUnit != NO_UNIT)
+ {
+ if (bFinish)
+ {
+ szBuffer =
gDLL->getText(((isLimitedUnitClass((UnitClassTypes)(GC.getUnitInfo(eTrainUnit).getUnitClassType()))) ? "TXT_KEY_POPUP_TRAINED_WORK_ON_NEXT_LIMITED" : "TXT_KEY_POPUP_TRAINED_WORK_ON_NEXT"),
GC.getUnitInfo(eTrainUnit).getTextKeyWide(), pCity->getNameKey());
+ }
+ else
+ {
+ szBuffer =
gDLL->getText(((isLimitedUnitClass((UnitClassTypes)(GC.getUnitInfo(eTrainUnit).getUnitClassType()))) ? "TXT_KEY_POPUP_CANNOT_TRAIN_WORK_NEXT_LIMITED" : "TXT_KEY_POPUP_CANNOT_TRAIN_WORK_NEXT"),
GC.getUnitInfo(eTrainUnit).getTextKeyWide(), pCity->getNameKey());
+ }
+ szArtFilename =
GET_PLAYER(pCity->getOwnerINLINE()).getUnitButton(eTrainUnit);
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLButtonPopup.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,71 @@
+#pragma once
+
+// CvDLLButtonPopup.h
+
+#ifndef CIV4_DLL_BUTTON_POPUP_H
+#define CIV4_DLL_BUTTON_POPUP_H
+
+//#include "CvEnums.h"
+#include "CvPopupInfo.h"
+#include "CvPopupReturn.h"
+
+class CvPopup;
+class CvDLLButtonPopup
+{
+
+public:
+ CvDLLButtonPopup();
+ virtual ~CvDLLButtonPopup();
+
+ DllExport static CvDLLButtonPopup& getInstance();
+ DllExport static void freeInstance();
+
+ DllExport virtual void OnOkClicked(CvPopup* pPopup, PopupReturn
*pPopupReturn, CvPopupInfo &info);
+ DllExport virtual void OnAltExecute(CvPopup& popup, const PopupReturn&
popupReturn, CvPopupInfo &info);
+ DllExport virtual void OnFocus(CvPopup* pPopup, CvPopupInfo &info);
+
+ DllExport bool launchButtonPopup(CvPopup* pPopup, CvPopupInfo &info);
+
+private:
+
+ static CvDLLButtonPopup* m_pInst;
+
+ bool launchTextPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchProductionPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchChangeReligionPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchChooseElectionPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDiploVotePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchRazeCityPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDisbandCityPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchChooseTechPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchChangeCivicsPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchAlarmPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDeclareWarMovePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchConfirmCommandPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchLoadUnitPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchLeadUnitPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDoEspionagePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDoEspionageTargetPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchMainMenuPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchConfirmMenu(CvPopup *pPopup, CvPopupInfo &info);
+ bool launchPythonScreen(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchPythonPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDetailsPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchAdminPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchAdminPasswordPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchCancelDeal(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchExtendedGamePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchDiplomacyPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchAddBuddyPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchForcedDisconnectPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchPitbossDisconnectPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchKickedPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchVassalDemandTributePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchVassalGrantTributePopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchEventPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchFreeColonyPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchLaunchPopup(CvPopup* pPopup, CvPopupInfo &info);
+ bool launchFoundReligionPopup(CvPopup* pPopup, CvPopupInfo &info);
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLDataStreamIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,2 @@
+#pragma once
+
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLEngineIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,98 @@
+#pragma once
+
+#ifndef CvDLLEngineIFaceBase_h
+#define CvDLLEngineIFaceBase_h
+
+//#include "CvEnums.h"
+//#include "CvStructs.h"
+
+//
+// abstract interface for CvEngine functions used by DLL
+//
+class CvEngine;
+class CvDLLEngineIFaceBase
+{
+public:
+ virtual void cameraLookAt(NiPoint3 lookingPoint) = 0;
+ virtual bool isCameraLocked() = 0;
+
+ virtual void SetObeyEntityVisibleFlags(bool bObeyHide) = 0;
+ virtual void AutoSave(bool bInitial = false) = 0;
+ virtual void SaveReplay(PlayerTypes ePlayer = NO_PLAYER) = 0;
+ virtual void SaveGame(CvString& szFilename, SaveGameTypes eType =
SAVEGAME_NORMAL) = 0;
+ virtual void DoTurn() = 0;
+ virtual void ClearMinimap() = 0;
+ virtual byte GetLandscapePlotTerrainData(uint uiX, uint uiY, uint
uiPointX, uint uiPointY) = 0;
+ virtual byte GetLandscapePlotHeightData(uint uiX, uint uiY, uint
uiPointX, uint uiPointY) = 0;
+ virtual LoadType getLoadType() = 0;
+ virtual void ClampToWorldCoords(NiPoint3* pPt3, float fOffset = 0.0f) = 0;
+ virtual void SetCameraZoom(float zoom) = 0;
+ virtual float GetUpdateRate() = 0;
+ virtual bool SetUpdateRate( float fUpdateRate ) = 0;
+ virtual void toggleGlobeview() = 0;
+ virtual bool isGlobeviewUp() = 0;
+ virtual void toggleResourceLayer() = 0;
+ virtual void toggleUnitLayer() = 0;
+ virtual void setResourceLayer(bool bOn) = 0;
+
+ virtual void MoveBaseTurnRight(float increment = 45) = 0;
+ virtual void MoveBaseTurnLeft(float increment = 45) = 0;
+ virtual void SetFlying(bool value) = 0;
+ virtual void CycleFlyingMode(int displacement) = 0;
+ virtual void SetMouseFlying(bool value) = 0;
+ virtual void SetSatelliteMode(bool value) = 0;
+ virtual void SetOrthoCamera(bool value) = 0;
+ virtual bool GetFlying() = 0;
+ virtual bool GetMouseFlying() = 0;
+ virtual bool GetSatelliteMode() = 0;
+ virtual bool GetOrthoCamera() = 0;
+
+ // landscape
+ virtual int InitGraphics() = 0;
+ virtual void GetLandscapeDimensions(float &fWidth, float &fHeight) = 0;
+ virtual void GetLandscapeGameDimensions(float &fWidth, float &fHeight) =
0;
+ virtual uint GetGameCellSizeX() = 0;
+ virtual uint GetGameCellSizeY() = 0;
+ virtual float GetPointZSpacing() = 0;
+ virtual float GetPointXYSpacing() = 0;
+ virtual float GetPointXSpacing() = 0;
+ virtual float GetPointYSpacing() = 0;
+ virtual float GetHeightmapZ(const NiPoint3 &pt3, bool bClampAboveWater =
true) = 0;
+ virtual void LightenVisibility(uint) = 0;
+ virtual void DarkenVisibility(uint) = 0;
+ virtual void BlackenVisibility(uint) = 0;
+ virtual void RebuildAllPlots() = 0;
+ virtual void RebuildPlot(int plotX, int plotY, bool bRebuildHeights, bool
bRebuildTextures) = 0;
+ virtual void RebuildRiverPlotTile(int plotX, int plotY, bool
bRebuildHeights, bool bRebuildTextures) = 0;
+ virtual void RebuildTileArt(int plotX, int plotY) = 0;
+ virtual void ForceTreeOffsets(int plotX, int plotY) = 0;
+
+ virtual bool GetGridMode() = 0;
+ virtual void SetGridMode(bool bVal) = 0;
+
+ virtual void addColoredPlot(int plotX, int plotY, const NiColorA &color,
PlotStyles plotStyle, PlotLandscapeLayers layer) = 0;
+ virtual void clearColoredPlots(PlotLandscapeLayers layer) = 0;
+ virtual void fillAreaBorderPlot(int plotX, int plotY, const NiColorA
&color, AreaBorderLayers layer) = 0;
+ virtual void clearAreaBorderPlots(AreaBorderLayers layer) = 0;
+ virtual void updateFoundingBorder() = 0;
+ virtual void addLandmark(CvPlot *plot, const wchar *caption) = 0;
+
+ virtual void TriggerEffect(int iEffect, NiPoint3 pt3Point, float rotation
= 0.0f) = 0;
+ virtual void printProfileText() = 0;
+
+ virtual void clearSigns() = 0;
+
+ // dirty bits
+ virtual void SetDirty(EngineDirtyBits eBit, bool bNewValue) = 0;
+ virtual bool IsDirty(EngineDirtyBits eBit) = 0;
+ virtual void PushFogOfWar(FogOfWarModeTypes eNewMode) = 0;
+ virtual FogOfWarModeTypes PopFogOfWar() = 0;
+ virtual void setFogOfWarFromStack() = 0;
+ virtual void MarkBridgesDirty() = 0;
+ virtual void AddLaunch(PlayerTypes playerType) = 0;
+ virtual void AddGreatWall(CvCity *city) = 0;
+ virtual void RemoveGreatWall(CvCity *city) = 0;
+ virtual void MarkPlotTextureAsDirty(int plotX, int plotY) = 0;
+};
+
+#endif // CvDLLEngineIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLEntity.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,94 @@
+#include "CvGameCoreDLL.h"
+#include "CvDLLEntity.h"
+#include "CvDLLEntityIFaceBase.h"
+#include "CvGlobals.h"
+
+CvDLLEntity::CvDLLEntity() : m_pEntity(NULL)
+{
+
+}
+
+CvDLLEntity::~CvDLLEntity()
+{
+
+}
+
+void CvDLLEntity::removeEntity()
+{
+ gDLL->getEntityIFace()->removeEntity(getEntity());
+}
+
+void CvDLLEntity::setup()
+{
+ gDLL->getEntityIFace()->setup(getEntity());
+}
+
+void CvDLLEntity::setVisible(bool bVis)
+{
+ gDLL->getEntityIFace()->setVisible(getEntity(), bVis);
+}
+
+void CvDLLEntity::createCityEntity(CvCity* pCity)
+{
+ gDLL->getEntityIFace()->createCityEntity(pCity);
+}
+
+void CvDLLEntity::createUnitEntity(CvUnit* pUnit)
+{
+ gDLL->getEntityIFace()->createUnitEntity(pUnit);
+}
+
+void CvDLLEntity::destroyEntity()
+{
+ gDLL->getEntityIFace()->destroyEntity(m_pEntity);
+}
+
+bool CvDLLEntity::IsSelected() const
+{
+ return gDLL->getEntityIFace()->IsSelected(getEntity());
+}
+
+void CvDLLEntity::PlayAnimation(AnimationTypes eAnim, float fSpeed, bool
bQueue, int iLayer, float fStartPct, float fEndPct)
+{
+ gDLL->getEntityIFace()->PlayAnimation(getEntity(), eAnim, fSpeed, bQueue,
iLayer, fStartPct, fEndPct);
+}
+
+void CvDLLEntity::StopAnimation(AnimationTypes eAnim)
+{
+ gDLL->getEntityIFace()->StopAnimation(getEntity(), eAnim);
+}
+
+void CvDLLEntity::MoveTo( const CvPlot * pkPlot )
+{
+ gDLL->getEntityIFace()->MoveTo(getUnitEntity(), pkPlot );
+}
+
+void CvDLLEntity::QueueMove( const CvPlot * pkPlot )
+{
+ gDLL->getEntityIFace()->QueueMove(getUnitEntity(), pkPlot );
+}
+
+void CvDLLEntity::ExecuteMove( float fTimeToExecute, bool bCombat )
+{
+ gDLL->getEntityIFace()->ExecuteMove(getUnitEntity(), fTimeToExecute,
bCombat );
+}
+
+void CvDLLEntity::SetPosition( const CvPlot * pkPlot )
+{
+ gDLL->getEntityIFace()->SetPosition(getUnitEntity(), pkPlot );
+}
+
+void CvDLLEntity::NotifyEntity( MissionTypes eMission )
+{
+ gDLL->getEntityIFace()->NotifyEntity( getUnitEntity(), eMission );
+}
+
+void CvDLLEntity::SetSiegeTower(bool show)
+{
+ gDLL->getEntityIFace()->SetSiegeTower( getUnitEntity(), show );
+}
+
+bool CvDLLEntity::GetSiegeTower()
+{
+ return gDLL->getEntityIFace()->GetSiegeTower(getUnitEntity());
+}
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLEntity.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,63 @@
+#pragma once
+
+#ifndef CvDLLEntity_h
+#define CvDLLEntity_h
+
+//
+// Class which represents an entity object in the DLL.
+// Implements common entity functions by making calls to
CvDLLEntityIFaceBase
+//
+// To expose new entity functions:
+// 1. Add the pure virtual function prototype to CvDLLEntityIFaceBase.h
+// 2. Add the function prototype and implementation to
CvDLLEntityIFace.[cpp,h]
+// 3. Add a wrapper function (for convenience) to this file and implement
it in the corresponding cpp
+//
+
+//#include "CvEnums.h"
+
+class CvCityEntity;
+class CvEntity;
+class CvUnitEntity;
+class CvCity;
+class CvUnit;
+class CvPlot;
+
+class DllExport CvDLLEntity
+{
+public:
+ CvDLLEntity();
+ virtual ~CvDLLEntity();
+
+ CvEntity* getEntity() { return m_pEntity; }
+ const CvEntity* getEntity() const { return m_pEntity; }
+ CvUnitEntity* getUnitEntity() { return (CvUnitEntity*)m_pEntity; }
+ CvCityEntity* getCityEntity() { return (CvCityEntity*)m_pEntity; }
+ const CvUnitEntity* getUnitEntity() const { return
(CvUnitEntity*)m_pEntity; }
+ const CvCityEntity* getCityEntity() const { return
(CvCityEntity*)m_pEntity; }
+
+ void setEntity(CvEntity* pG) { m_pEntity = pG; }
+
+ void removeEntity();
+ virtual void setup();
+ void setVisible(bool);
+ void createCityEntity(CvCity*);
+ void createUnitEntity(CvUnit*);
+ void destroyEntity();
+
+ bool IsSelected() const;
+ void PlayAnimation(AnimationTypes eAnim, float fSpeed = 1.0f, bool bQueue
= false, int iLayer = 0,
+ float fStartPct = 0.0f, float fEndPct = 1.0f);
+ void StopAnimation(AnimationTypes eAnim);
+ void MoveTo( const CvPlot * pkPlot );
+ void QueueMove( const CvPlot * pkPlot );
+ void ExecuteMove( float fTimeToExecute, bool bCombat );
+ void SetPosition( const CvPlot * pkPlot );
+ void NotifyEntity( MissionTypes eMission );
+ void SetSiegeTower(bool show);
+ bool GetSiegeTower();
+
+protected:
+ CvEntity* m_pEntity;
+};
+
+#endif // CvDLLEntity_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLEntityIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,53 @@
+#pragma once
+
+#ifndef CvDLLEntityIFaceBase_h
+#define CvDLLEntityIFaceBase_h
+
+#pragma warning(disable:4100)
+
+//#include "CvEnums.h"
+
+//
+// abstract class containing entity-related functions that the DLL needs
+//
+class CvEntity;
+class CvUnitEntity;
+class CvCity;
+class CvUnit;
+class CvMissionDefinition;
+class CvPlot;
+class CvRiver;
+
+class CvDLLEntityIFaceBase
+{
+public:
+ virtual void removeEntity(CvEntity*) { FAssertMsg(false, "can't get
here"); }
+ virtual void addEntity(CvEntity*, uint uiEntAddFlags) {
FAssertMsg(false, "can't get here"); }
+ virtual void setup(CvEntity*) { FAssertMsg(false, "can't get here"); }
+ virtual void setVisible(CvEntity*, bool) { FAssertMsg(false, "can't get
here"); }
+ virtual void createCityEntity(CvCity*) { FAssertMsg(false, "can't get
here"); }
+ virtual void createUnitEntity(CvUnit*) { FAssertMsg(false, "can't get
here"); }
+ virtual void destroyEntity(CvEntity*&, bool bSafeDelete=true) {
FAssertMsg(false, "can't get here"); }
+ virtual void updatePosition(CvEntity *gameEntity) {
FAssertMsg(false, "can't get here"); }
+ virtual void setupFloodPlains(CvRiver *river) { FAssertMsg(false, "can't
get here"); }
+
+ virtual bool IsSelected(const CvEntity*) const { return false; }
+ virtual void PlayAnimation(CvEntity*, AnimationTypes eAnim, float fSpeed
= 1.0f, bool bQueue = false, int iLayer = 0, float fStartPct = 0.0f, float
fEndPct = 1.0f) { FAssertMsg(false, "can't get here"); }
+ virtual void StopAnimation(CvEntity*, AnimationTypes eAnim) {
FAssertMsg(false, "can't get here"); }
+ virtual void StopAnimation(CvEntity * ) { FAssertMsg(false, "can't get
here");}
+ virtual void NotifyEntity(CvUnitEntity*, MissionTypes eMission) {
FAssertMsg( false, "can't get here"); }
+ virtual void MoveTo(CvUnitEntity*, const CvPlot * pkPlot ) {
FAssertMsg(false, "can't get here"); }
+ virtual void QueueMove(CvUnitEntity*, const CvPlot * pkPlot ) {
FAssertMsg(false, "can't get here"); }
+ virtual void ExecuteMove(CvUnitEntity*, float fTimeToExecute, bool
bCombat ) { FAssertMsg(false, "can't get here"); }
+ virtual void SetPosition(CvUnitEntity* pEntity, const CvPlot * pkPlot )
{ FAssertMsg(false, "can't get here"); }
+ virtual void AddMission(const CvMissionDefinition* pDefinition) {
FAssertMsg(false, "can't get here"); };
+ virtual void RemoveUnitFromBattle(CvUnit* pUnit) {
FAssertMsg(false, "can't get here"); };
+ virtual void showPromotionGlow(CvUnitEntity* pEntity, bool show) {
FAssertMsg(false, "can't get here"); };
+ virtual void updateEnemyGlow(CvUnitEntity* pEntity) {
FAssertMsg(false, "can't get here"); };
+ virtual void updatePromotionLayers(CvUnitEntity* pEntity) {
FAssertMsg(false, "can't get here"); };
+ virtual void updateGraphicEra(CvUnitEntity* pEntity, EraTypes eOldEra =
NO_ERA) { FAssertMsg(false, "can't get here"); };
+ virtual void SetSiegeTower(CvUnitEntity *pEntity, bool show) {
FAssertMsg(false, "can't get here"); };
+ virtual bool GetSiegeTower(CvUnitEntity *pEntity) {
FAssertMsg(false, "can't get here"); return false; };
+};
+
+#endif // CvDLLEntityIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLEventReporterIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,106 @@
+#pragma once
+
+#ifndef CvDLLEventReporterIFaceBase_h
+#define CvDLLEventReporterIFaceBase_h
+
+//
+// abstract class containing event reporting functions that the DLL needs
+// Creator- Mustafa Thamer
+//
+
+class CvUnit;
+class CvCity;
+class CvPlot;
+class CvSelectionGroup;
+
+class CvDLLEventReporterIFaceBase
+{
+public:
+ virtual void genericEvent(const char* szEventName, void* pythonArgs=NULL)
= 0;
+
+ virtual void mouseEvent(int evt, const POINT& ptCursor) = 0;
+ virtual void kbdEvent(int evt, int key) = 0;
+
+ virtual void gameEnd() = 0;
+
+ virtual void beginGameTurn(int iGameTurn) = 0;
+ virtual void endGameTurn(int iGameTurn) = 0;
+
+ virtual void beginPlayerTurn(int iGameTurn, PlayerTypes) = 0;
+ virtual void endPlayerTurn(int iGameTurn, PlayerTypes) = 0;
+
+ virtual void firstContact(TeamTypes eTeamID1, TeamTypes eTeamID2) = 0;
+ virtual void combatResult(CvUnit* pWinner, CvUnit* pLoser) = 0;
+ virtual void improvementBuilt(int iImprovementType, int iX, int iY) = 0;
+ virtual void improvementDestroyed(int iImprovementType, int iPlayer, int
iX, int iY) = 0;
+ virtual void routeBuilt(int RouteType, int iX, int iY) = 0;
+
+ virtual void plotRevealed(CvPlot *pPlot, TeamTypes eTeam) = 0;
+ virtual void plotFeatureRemoved(CvPlot *pPlot, FeatureTypes eFeature,
CvCity* pCity) = 0;
+ virtual void plotPicked(CvPlot *pPlot) = 0;
+ virtual void nukeExplosion(CvPlot *pPlot, CvUnit* pNukeUnit) = 0;
+ virtual void gotoPlotSet(CvPlot *pPlot, PlayerTypes ePlayer) = 0;
+
+ virtual void cityBuilt(CvCity *pCity) = 0;
+ virtual void cityRazed(CvCity *pCity, PlayerTypes ePlayer) = 0;
+ virtual void cityAcquired(PlayerTypes eOldOwner, PlayerTypes ePlayer,
CvCity* pCity, bool bConquest, bool bTrade) = 0;
+ virtual void cityAcquiredAndKept(PlayerTypes ePlayer, CvCity* pCity) = 0;
+ virtual void cityLost(CvCity *pCity) = 0;
+ virtual void cultureExpansion( CvCity *pCity, PlayerTypes ePlayer) = 0;
+ virtual void cityGrowth(CvCity *pCity, PlayerTypes ePlayer) = 0;
+ virtual void cityDoTurn(CvCity *pCity, PlayerTypes ePlayer) = 0;
+ virtual void cityBuildingUnit(CvCity* pCity, UnitTypes eUnitType) = 0;
+ virtual void cityBuildingBuilding(CvCity* pCity, BuildingTypes
eBuildingType) = 0;
+ virtual void cityRename(CvCity* pCity) = 0;
+ virtual void cityHurry(CvCity* pCity, HurryTypes eHurry) = 0;
+
+ virtual void selectionGroupPushMission(CvSelectionGroup* pSelectionGroup,
MissionTypes eMission) = 0;
+
+ virtual void unitMove(CvPlot* pPlot, CvUnit* pUnit, CvPlot* pOldPlot) = 0;
+ virtual void unitSetXY(CvPlot* pPlot, CvUnit* pUnit) = 0;
+ virtual void unitCreated(CvUnit *pUnit) = 0;
+ virtual void unitBuilt(CvCity *pCity, CvUnit *pUnit) = 0;
+ virtual void unitKilled(CvUnit *pUnit, PlayerTypes eAttacker) = 0;
+ virtual void unitLost(CvUnit *pUnit) = 0;
+ virtual void unitPromoted(CvUnit *pUnit, PromotionTypes ePromotion) = 0;
+ virtual void unitSelected(CvUnit *pUnit) = 0;
+ virtual void unitRename(CvUnit* pUnit) = 0;
+ virtual void unitPillage(CvUnit* pUnit, ImprovementTypes eImprovement,
RouteTypes eRoute, PlayerTypes ePlayer) = 0;
+ virtual void unitSpreadReligionAttempt(CvUnit* pUnit, ReligionTypes
eReligion, bool bSuccess) = 0;
+ virtual void unitGifted(CvUnit* pUnit, PlayerTypes eGiftingPlayer,
CvPlot* pPlotLocation) = 0;
+ virtual void unitBuildImprovement(CvUnit* pUnit, BuildTypes eBuild, bool
bFinished) = 0;
+
+ virtual void goodyReceived(PlayerTypes ePlayer, CvPlot *pGoodyPlot,
CvUnit *pGoodyUnit, GoodyTypes eGoodyType) = 0;
+
+ virtual void greatPersonBorn(CvUnit *pUnit, PlayerTypes ePlayer, CvCity
*pCity) = 0;
+
+ virtual void buildingBuilt(CvCity *pCity, BuildingTypes eBuilding) = 0;
+ virtual void projectBuilt(CvCity *pCity, ProjectTypes eProject) = 0;
+
+ virtual void techAcquired(TechTypes eType, TeamTypes eTeam, PlayerTypes
ePlayer, bool bAnnounce) = 0;
+ virtual void techSelected(TechTypes eTech, PlayerTypes ePlayer) = 0;
+
+ virtual void religionFounded(ReligionTypes eType, PlayerTypes ePlayer) =
0;
+ virtual void religionSpread(ReligionTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity) = 0;
+ virtual void religionRemove(ReligionTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity) = 0;
+
+ virtual void corporationFounded(CorporationTypes eType, PlayerTypes
ePlayer) = 0;
+ virtual void corporationSpread(CorporationTypes eType, PlayerTypes
ePlayer, CvCity* pSpreadCity) = 0;
+ virtual void corporationRemove(CorporationTypes eType, PlayerTypes
ePlayer, CvCity* pSpreadCity) = 0;
+
+ virtual void goldenAge(PlayerTypes ePlayer) = 0;
+ virtual void endGoldenAge(PlayerTypes ePlayer) = 0;
+ virtual void changeWar(bool bWar, TeamTypes eTeam, TeamTypes eOtherTeam)
= 0;
+
+ virtual void setPlayerAlive(PlayerTypes ePlayerID, bool bNewValue) = 0;
+ virtual void playerChangeStateReligion(PlayerTypes ePlayerID,
ReligionTypes eNewReligion, ReligionTypes eOldReligion) = 0;
+ virtual void playerGoldTrade(PlayerTypes eFromPlayer, PlayerTypes
eToPlayer, int iAmount) = 0;
+
+ virtual void chat(char *szString) = 0;
+
+ virtual void victory(TeamTypes eNewWinner, VictoryTypes eNewVictory) = 0;
+
+ virtual void vassalState(TeamTypes eMaster, TeamTypes eVassal, bool
bVassal) = 0;
+};
+
+#endif // CvDLLEventReporterIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLFAStarIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,37 @@
+#pragma once
+
+#ifndef CvDLLFAStarIFaceBase_h
+#define CvDLLFAStarIFaceBase_h
+
+//
+// abstract interface for FAStar functions used by DLL
+//
+
+class FAStar;
+class FAStarNode;
+
+// Function prototype for Cost and Validity functions
+typedef int(*FAPointFunc)(int, int, const void*, FAStar*);
+typedef int(*FAHeuristic)(int, int, int, int);
+typedef int(*FAStarFunc)(FAStarNode*, FAStarNode*, int, const void*,
FAStar*);
+
+class CvDLLFAStarIFaceBase
+{
+public:
+ virtual FAStar* create() = 0;
+ virtual void destroy(FAStar*& ptr, bool bSafeDelete=true) = 0;
+ virtual bool GeneratePath(FAStar*, int iXstart, int iYstart, int iXdest,
int iYdest, bool bCardinalOnly = false, int iInfo = 0, bool bReuse = false)
= 0;
+ virtual void Initialize(FAStar*, int iColumns, int iRows, bool bWrapX,
bool bWrapY, FAPointFunc DestValidFunc, FAHeuristic HeuristicFunc,
FAStarFunc CostFunc, FAStarFunc ValidFunc, FAStarFunc NotifyChildFunc,
FAStarFunc NotifyListFunc, void *pData) = 0;
+ virtual void SetData(FAStar*, const void* pData) = 0;
+ virtual FAStarNode *GetLastNode(FAStar*) = 0;
+ virtual bool IsPathStart(FAStar*, int iX, int iY) = 0;
+ virtual bool IsPathDest(FAStar*, int iX, int iY) = 0;
+ virtual int GetStartX(FAStar*) = 0;
+ virtual int GetStartY(FAStar*) = 0;
+ virtual int GetDestX(FAStar*) = 0;
+ virtual int GetDestY(FAStar*) = 0;
+ virtual int GetInfo(FAStar*) = 0;
+ virtual void ForceReset(FAStar*) = 0;
+};
+
+#endif // CvDLLFAStarIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLFlagEntityIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,44 @@
+// $Header:
//depot/main/Civilization4/CvGameCoreDLL/CvDLLFlagEntityIFaceBase.h#3 $
+//------------------------------------------------------------------------------------------------
+//
+// ***************** CIV4 GAME ENGINE ********************
+//
+//! \file CvDLLFlagEntityIFaceBase.h
+//! \author Bart Muzzin -- 4-12-2005
+//! \brief DLL Stub interface for CvFlagEntity
+//
+//------------------------------------------------------------------------------------------------
+// Copyright (c) 2005 Firaxis Games, Inc. All rights reserved.
+//------------------------------------------------------------------------------------------------
+
+#pragma once
+#ifndef CvDLLFlagEntityIFaceBase_H
+#define CvDLLFlagEntityIFaceBase_H
+
+#include "CvDLLEntityIFaceBase.h"
+#include "CvDLLUtilityIFaceBase.h"
+#include "CvGlobals.h" // for gDLL
+
+class CvPlot;
+class CvFlagEntity;
+
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// CLASS: CvDLLFlagEntityIFaceBase
+//! \brief abstract interface for CvFlagEntity functions used by DLL
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+class CvDLLFlagEntityIFaceBase : public CvDLLEntityIFaceBase
+{
+ public:
+
+ virtual CvFlagEntity * create( PlayerTypes ePlayer) = 0;
+
+ virtual PlayerTypes getPlayer(CvFlagEntity * pkFlag) const = 0;
+ virtual CvPlot* getPlot( CvFlagEntity * pkFlag ) const = 0;
+ virtual void setPlot( CvFlagEntity * pkFlag, CvPlot * pkPlot, bool
bOffset ) = 0;
+ virtual void updateUnitInfo( CvFlagEntity * pkFlag, const CvPlot *
pkPlot, bool bOffset ) = 0;
+ virtual void updateGraphicEra(CvFlagEntity *pkFlag) = 0;
+ virtual void setVisible(CvFlagEntity* pEnt, bool bVis) {
gDLL->getEntityIFace()->setVisible((CvEntity*)pEnt, bVis); }
+ virtual void destroy(CvFlagEntity*& pImp, bool bSafeDelete=true) = 0;
+};
+
+#endif // CvDLLFlagEntityIFaceBase_H
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLIniParserIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,24 @@
+#pragma once
+
+#ifndef CvDLLIniParserIFaceBase_h
+#define CvDLLIniParserIFaceBase_h
+
+//
+// abstract interface for FIniParser functions used by DLL
+//
+class FIniParser;
+class CvDLLIniParserIFaceBase
+{
+public:
+ virtual FIniParser* create(const char* szFile) = 0;
+ virtual void destroy(FIniParser*& pParser, bool bSafeDelete=true) = 0;
+ virtual bool SetGroupKey(FIniParser* pParser, const LPCTSTR pGroupKey) =
0;
+ virtual bool GetKeyValue(FIniParser* pParser, const LPCTSTR szKey, bool
*iValue) = 0;
+ virtual bool GetKeyValue(FIniParser* pParser, const LPCTSTR szKey, short
*iValue) = 0;
+ virtual bool GetKeyValue(FIniParser* pParser, const LPCTSTR szKey, int
*iValue) = 0;
+ virtual bool GetKeyValue(FIniParser* pParser, const LPCTSTR szKey, float
*fValue) = 0;
+ virtual bool GetKeyValue(FIniParser* pParser, const LPCTSTR szKey, LPTSTR
szValue) = 0;
+
+};
+
+#endif // CvDLLIniParserIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLInterfaceIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,220 @@
+#pragma once
+
+#ifndef CvDLLInterfaceIFaceBase_h
+#define CvDLLInterfaceIFaceBase_h
+
+//
+// abstract class containing CvInterface functions that the DLL needs
+//
+
+//#include "CvStructs.h"
+#include "LinkedList.h"
+
+class CvUnit;
+class CvCity;
+class CvPlot;
+class CvSelectionGroup;
+class CvPopupInfo;
+class CvPopup;
+class CvTalkingHeadMessage;
+typedef std::list<CvPopupInfo*> CvPopupQueue;
+
+class CvDLLInterfaceIFaceBase
+{
+public:
+ virtual void lookAtSelectionPlot(bool bRelease = false) = 0;
+
+ virtual bool canHandleAction(int iAction, CvPlot* pPlot = NULL, bool
bTestVisible = false) = 0;
+ virtual bool canDoInterfaceMode(InterfaceModeTypes eInterfaceMode,
CvSelectionGroup* pSelectionGroup) = 0;
+
+ virtual CvPlot* getLookAtPlot() = 0;
+ virtual CvPlot* getSelectionPlot() = 0;
+ virtual CvUnit* getInterfacePlotUnit(const CvPlot* pPlot, int iIndex) = 0;
+ virtual CvUnit* getSelectionUnit(int iIndex) = 0;
+ virtual CvUnit* getHeadSelectedUnit() = 0;
+ virtual void selectUnit(CvUnit* pUnit, bool bClear, bool bToggle = false,
bool bSound = false) = 0;
+ virtual void selectGroup(CvUnit* pUnit, bool bShift, bool bCtrl, bool
bAlt) = 0;
+ virtual void selectAll(CvPlot* pPlot) = 0;
+
+ virtual bool removeFromSelectionList(CvUnit* pUnit) = 0;
+ virtual void makeSelectionListDirty() = 0;
+ virtual bool mirrorsSelectionGroup() = 0;
+ virtual bool canSelectionListFound() = 0;
+
+ virtual void bringToTop(CvPopup *pPopup) = 0;
+ virtual bool isPopupUp() = 0;
+ virtual bool isPopupQueued() = 0;
+ virtual bool isDiploOrPopupWaiting() = 0;
+
+ virtual CvUnit* getLastSelectedUnit() = 0;
+ virtual void setLastSelectedUnit(CvUnit* pUnit) = 0;
+ virtual void changePlotListColumn(int iChange) = 0;
+ virtual CvPlot* getGotoPlot() = 0;
+ virtual CvPlot* getSingleMoveGotoPlot() = 0;
+ virtual CvPlot* getOriginalPlot() = 0;
+
+ virtual void playGeneralSound(LPCTSTR pszSound, NiPoint3 vPos =
NiPoint3(-1.0f, -1.0f, -1.0f)) = 0;
+ virtual void playGeneralSound(int iSoundId, int iSoundType = 1, NiPoint3
vPos = NiPoint3(-1.0f, -1.0f, -1.0f)) = 0;
+ virtual void clearQueuedPopups() = 0;
+
+ virtual CvSelectionGroup* getSelectionList() = 0;
+ virtual void clearSelectionList() = 0;
+ virtual void insertIntoSelectionList(CvUnit* pUnit, bool bClear, bool
bToggle, bool bGroup = false, bool bSound = false, bool bMinimalChange =
false) = 0;
+ virtual void selectionListPostChange() = 0;
+ virtual void selectionListPreChange() = 0;
+ virtual int getSymbolID(int iSymbol) = 0;
+ virtual CLLNode<IDInfo>* deleteSelectionListNode(CLLNode<IDInfo>* pNode)
= 0;
+ virtual CLLNode<IDInfo>* nextSelectionListNode(CLLNode<IDInfo>* pNode) =
0;
+ virtual int getLengthSelectionList() = 0;
+ virtual CLLNode<IDInfo>* headSelectionListNode() = 0;
+
+ virtual void selectCity(CvCity* pNewValue, bool bTestProduction = false)
= 0;
+ virtual void selectLookAtCity(bool bAdd = false) = 0;
+ virtual void addSelectedCity(CvCity* pNewValue) = 0;
+ virtual void clearSelectedCities() = 0;
+ virtual bool isCitySelected(CvCity *pCity) = 0;
+ virtual CvCity* getHeadSelectedCity() = 0;
+ virtual bool isCitySelection() = 0;
+ virtual CLLNode<IDInfo>* nextSelectedCitiesNode(CLLNode<IDInfo>* pNode) =
0;
+ virtual CLLNode<IDInfo>* headSelectedCitiesNode() = 0;
+
+ virtual void addMessage(PlayerTypes ePlayer, bool bForce, int iLength,
CvWString szString, LPCTSTR pszSound = NULL,
+ InterfaceMessageTypes eType = MESSAGE_TYPE_INFO, LPCSTR pszIcon = NULL,
ColorTypes eFlashColor = NO_COLOR,
+ int iFlashX = -1, int iFlashY = -1, bool bShowOffScreenArrows = false,
bool bShowOnScreenArrows = false) = 0;
+ virtual void addCombatMessage(PlayerTypes ePlayer, CvWString szString) =
0;
+ virtual void addQuestMessage(PlayerTypes ePlayer, CvWString szString, int
iQuestId) = 0;
+ virtual void showMessage(CvTalkingHeadMessage& msg) = 0;
+ virtual void flushTalkingHeadMessages() = 0;
+ virtual void clearEventMessages() = 0;
+ virtual void addPopup(CvPopupInfo* pInfo, PlayerTypes ePlayer =
NO_PLAYER, bool bImmediate = false, bool bFront = false) = 0;
+ virtual void getDisplayedButtonPopups(CvPopupQueue& infos) = 0;
+
+ virtual int getCycleSelectionCounter() = 0;
+ virtual void setCycleSelectionCounter(int iNewValue) = 0;
+ virtual void changeCycleSelectionCounter(int iChange) = 0;
+
+ virtual int getEndTurnCounter() = 0;
+ virtual void setEndTurnCounter(int iNewValue) = 0;
+ virtual void changeEndTurnCounter(int iChange) = 0;
+
+ virtual bool isCombatFocus() = 0;
+ virtual void setCombatFocus(bool bNewValue) = 0;
+ virtual void setDiploQueue(CvDiploParameters* pDiploParams, PlayerTypes
ePlayer = NO_PLAYER) = 0;
+
+ virtual bool isDirty(InterfaceDirtyBits eDirtyItem) = 0;
+ virtual void setDirty(InterfaceDirtyBits eDirtyItem, bool bNewValue) = 0;
+ virtual void makeInterfaceDirty() = 0;
+ virtual bool updateCursorType() = 0;
+
+ virtual void lookAt(NiPoint3 pt3Target, CameraLookAtTypes type, NiPoint3
attackDirection = NiPoint3(0, 1, 0)) = 0;
+ virtual void centerCamera(CvUnit*) = 0;
+ virtual void releaseLockedCamera() = 0;
+ virtual bool isFocusedWidget() = 0;
+ virtual bool isFocused() = 0;
+ virtual bool isBareMapMode() = 0;
+ virtual void toggleBareMapMode() = 0;
+ virtual bool isShowYields() = 0;
+ virtual void toggleYieldVisibleMode() = 0;
+ virtual bool isScoresVisible() = 0;
+ virtual void toggleScoresVisible() = 0;
+ virtual bool isScoresMinimized() = 0;
+ virtual void toggleScoresMinimized() = 0;
+ virtual bool isNetStatsVisible() = 0;
+
+ virtual int getOriginalPlotCount() = 0;
+ virtual bool isCityScreenUp() = 0;
+ virtual bool isEndTurnMessage() = 0;
+ virtual void setInterfaceMode(InterfaceModeTypes eNewValue) = 0;
+ virtual void setFlashing(PlayerTypes eWho, bool bFlashing = true) = 0;
+ virtual bool isFlashing(PlayerTypes eWho) = 0;
+ virtual void setDiplomacyLocked(bool bLocked) = 0;
+ virtual bool isDiplomacyLocked() = 0;
+
+ virtual void setMinimapColor(MinimapModeTypes eMinimapMode, int iX, int
iY, ColorTypes eColor, float fAlpha) = 0;
+ virtual unsigned char* getMinimapBaseTexture() const = 0;
+ virtual void setEndTurnMessage(bool bNewValue) = 0;
+
+ virtual bool isHasMovedUnit() = 0;
+ virtual void setHasMovedUnit(bool bNewValue) = 0;
+
+ virtual bool isForcePopup() = 0;
+ virtual void setForcePopup(bool bNewValue) = 0;
+
+ virtual void lookAtCityOffset(int iCity) = 0;
+
+ virtual void toggleTurnLog() = 0;
+ virtual void showTurnLog(ChatTargetTypes eTarget = NO_CHATTARGET) = 0;
+ virtual void dirtyTurnLog(PlayerTypes ePlayer) = 0;
+
+ virtual int getPlotListColumn() = 0;
+ virtual void verifyPlotListColumn() = 0;
+ virtual int getPlotListOffset() = 0;
+
+ virtual void unlockPopupHelp() = 0;
+
+ virtual void showDetails(bool bPasswordOnly = false) = 0;
+ virtual void showAdminDetails() = 0;
+
+ virtual void toggleClockAlarm(bool bValue, int iHour = 0, int iMin = 0) =
0;
+ virtual bool isClockAlarmOn() = 0;
+
+ virtual void setScreenDying(int iPythonFileID, bool bDying) = 0;
+#ifdef CYBERFRONT // load: wb exit
+ virtual void exitingToMainMenu(const wchar* szLoadFile=NULL) = 0;
+#else
+ virtual void exitingToMainMenu(const char* szLoadFile=NULL) = 0;
+#endif // CYBERFRONT
+ virtual void setWorldBuilder(bool bTurnOn) = 0;
+
+ virtual int getFontLeftJustify() = 0;
+ virtual int getFontRightJustify() = 0;
+ virtual int getFontCenterJustify() = 0;
+ virtual int getFontCenterVertically() = 0;
+ virtual int getFontAdditive() = 0;
+
+ virtual void popupSetHeaderString( CvPopup* pPopup, CvWString szText,
uint uiFlags = DLL_FONT_CENTER_JUSTIFY ) = 0;
+ virtual void popupSetBodyString( CvPopup* pPopup, CvWString szText, uint
uiFlags = DLL_FONT_LEFT_JUSTIFY, char *szName = NULL, CvWString szHelpText
= "" ) = 0;
+ virtual void popupLaunch( CvPopup* pPopup, bool bCreateOkButton = true,
PopupStates bState = POPUPSTATE_QUEUED, int iNumPixelScroll = 0 ) = 0;
+ virtual void popupSetPopupType( CvPopup* pPopup, PopupEventTypes
ePopupType, LPCTSTR szArtFileName = NULL ) = 0;
+ virtual void popupSetStyle( CvPopup* pPopup, const char* styleId ) = 0;
+
+ virtual void popupAddDDS( CvPopup* pPopup, const char* szIconFilename,
int iWidth = 0, int iHeight = 0, CvWString szHelpText = "") = 0;
+
+ virtual void popupAddSeparator( CvPopup* pPopup, int iSpace = 0) = 0;
+
+ virtual void popupAddGenericButton( CvPopup* pPopup, CvWString szText,
const char* szIcon = 0, int iButtonId = -1, WidgetTypes eWidgetType =
WIDGET_GENERAL, int iData1 = MAX_INT, int iData2 = MAX_INT,
+ bool bOption = true, PopupControlLayout ctrlLayout =
POPUP_LAYOUT_CENTER, unsigned int textJustifcation = DLL_FONT_LEFT_JUSTIFY
) = 0;
+
+ virtual void popupCreateEditBox( CvPopup* pPopup, CvWString
szDefaultString = "", WidgetTypes eWidgetType = WIDGET_GENERAL, CvWString
szHelpText = "", int iGroup = 0,
+ PopupControlLayout ctrlLayout = POPUP_LAYOUT_STRETCH, unsigned int
preferredCharWidth = 0, unsigned int maxCharCount = 256 ) = 0;
+ virtual void popupEnableEditBox( CvPopup* pPopup, int iGroup = 0, bool
bEnable = false ) = 0;
+
+ virtual void popupCreateRadioButtons( CvPopup * pPopup, int iNumButtons,
int iGroup = 0, WidgetTypes eWidgetType = WIDGET_GENERAL,
PopupControlLayout ctrlLayout = POPUP_LAYOUT_CENTER ) = 0;
+ virtual void popupSetRadioButtonText( CvPopup * pPopup, int
iRadioButtonID, CvWString szText, int iGroup = 0, CvWString szHelpText = ""
) = 0;
+
+ virtual void popupCreateCheckBoxes( CvPopup* pPopup, int iNumBoxes, int
iGroup = 0, WidgetTypes eWidgetType = WIDGET_GENERAL, PopupControlLayout
ctrlLayout = POPUP_LAYOUT_CENTER ) = 0;
+ virtual void popupSetCheckBoxText( CvPopup* pPopup, int iCheckBoxID,
CvWString szText, int iGroup = 0, CvWString szHelpText = "") = 0;
+ virtual void popupSetCheckBoxState( CvPopup* pPopup, int iCheckBoxID,
bool bChecked, int iGroup = 0 ) = 0;
+
+ virtual void popupSetAsCancelled(CvPopup* pPopup) = 0;
+ virtual bool popupIsDying(CvPopup* pPopup) = 0;
+ virtual void setCityTabSelectionRow(CityTabTypes eTabType) = 0;
+
+ virtual bool noTechSplash() = 0;
+
+ virtual EspionageMissionTypes getEspionageActiveMission() = 0;
+ virtual void setEspionageActiveMission(EspionageMissionTypes eMission) =
0;
+ virtual PlayerTypes getEspionageTargetPlayer() = 0;
+ virtual void setEspionageTargetPlayer(PlayerTypes ePlayer) = 0;
+
+ virtual bool isInAdvancedStart() const = 0;
+ virtual void setInAdvancedStart(bool bAdvancedStart) = 0;
+
+ virtual bool isSpaceshipScreenUp() const = 0;
+ virtual bool isDebugMenuCreated() const = 0;
+
+ virtual void setBusy(bool bBusy) = 0;
+};
+
+
+#endif // CvDLLInterfaceIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLPlotBuilderIFaceBase.h Sat Sep 19
06:38:49 2009
@@ -0,0 +1,26 @@
+#pragma once
+
+#ifndef CvDLLPlotBuilderIFaceBase_h
+#define CvDLLPlotBuilderIFaceBase_h
+
+#include "CvDLLEntityIFaceBase.h"
+#include "CvDLLUtilityIFaceBase.h"
+#include "CvGlobals.h" // for gDLL
+
+//
+// abstract interface for CvPlotBuilder functions used by DLL
+//
+class CvPlotBuilder;
+class CvDLLPlotBuilderIFaceBase : public CvDLLEntityIFaceBase
+{
+public:
+ virtual void init(CvPlotBuilder*, CvPlot*) = 0;
+ virtual CvPlotBuilder* create() = 0;
+
+ // derived methods
+ virtual void destroy(CvPlotBuilder*& pPlotBuilder, bool bSafeDelete=true)
{
+ gDLL->getEntityIFace()->destroyEntity((CvEntity*&)pPlotBuilder,
bSafeDelete);
+ }
+};
+
+#endif // CvDLLPlotBuilderIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLPython.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,79 @@
+#include "CvGameCoreDLL.h"
+#include "CyMap.h"
+#include "CyPlayer.h"
+#include "CyPlot.h"
+#include "CyGame.h"
+#include "CyUnit.h"
+#include "CyGlobalContext.h"
+#include "CyCity.h"
+
+void CyCityPythonInterface1(python::class_<CyCity>& x);
+void CyPlotPythonInterface1(python::class_<CyPlot>& x);
+void CyPlayerPythonInterface1(python::class_<CyPlayer>& x);
+void CyPlayerPythonInterface2(python::class_<CyPlayer>& x);
+void CyUnitPythonInterface1(python::class_<CyUnit>& x);
+void CyGlobalContextPythonInterface1(python::class_<CyGlobalContext>& x);
+void CyGlobalContextPythonInterface2(python::class_<CyGlobalContext>& x);
+void CyGlobalContextPythonInterface3(python::class_<CyGlobalContext>& x);
+void CyGlobalContextPythonInterface4(python::class_<CyGlobalContext>& x);
+void CyGamePythonInterface();
+void CyRandomPythonInterface();
+void CyEnumsPythonInterface();
+void CyTeamPythonInterface();
+void CyAreaPythonInterface();
+void CyStructsPythonInterface1();
+void CyMapPythonInterface();
+void CyMapGeneratorPythonInterface();
+void CyInfoPythonInterface1();
+void CyInfoPythonInterface2();
+void CyInfoPythonInterface3();
+void CySelectionGroupInterface();
+void CyArtFileMgrPythonInterface();
+void CyGameTextMgrInterface();
+void CyHallOfFameInterface();
+void CyGameCoreUtilsPythonInterface();
+
+//
+//
+//
+DllExport void DLLPublishToPython()
+{
+ CyEnumsPythonInterface();
+ CyGamePythonInterface();
+ CyRandomPythonInterface();
+ CyTeamPythonInterface();
+ CyAreaPythonInterface();
+ CyStructsPythonInterface1();
+ CyMapPythonInterface();
+ CyMapGeneratorPythonInterface();
+ CySelectionGroupInterface();
+ CyArtFileMgrPythonInterface();
+ CyGameTextMgrInterface();
+ CyInfoPythonInterface1();
+ CyInfoPythonInterface2();
+ CyInfoPythonInterface3();
+ CyHallOfFameInterface();
+ CyGameCoreUtilsPythonInterface();
+
+ //
+ // large interfaces which can be split across files if need be
+ //
+ python::class_<CyCity> city ("CyCity"); // define city class
+ CyCityPythonInterface1(city); // publish it's methods
+
+ python::class_<CyPlayer> player ("CyPlayer"); // define player class
+ CyPlayerPythonInterface1(player); // publish it's methods
+ CyPlayerPythonInterface2(player); // publish it's methods
+
+ python::class_<CyUnit> unit ("CyUnit"); // define unit class
+ CyUnitPythonInterface1(unit); // publish it's methods
+
+ python::class_<CyPlot> plot ("CyPlot"); // define plot class
+ CyPlotPythonInterface1(plot); // publish it's methods
+
+ python::class_<CyGlobalContext> gc ("CyGlobalContext"); // define globals
class
+ CyGlobalContextPythonInterface1(gc); // publish it's methods
+ CyGlobalContextPythonInterface2(gc); // publish it's methods
+ CyGlobalContextPythonInterface3(gc); // publish it's methods
+ CyGlobalContextPythonInterface4(gc); // publish it's methods
+}
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLPythonIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,196 @@
+#pragma once
+
+#ifndef CvDLLPythonIFaceBase_h
+#define CvDLLPythonIFaceBase_h
+
+//
+// abstract interface for Python functions used by DLL
+// Creator - Mustafa Thamer
+// Copyright 2005 Firaxis Games
+//
+
+//#include "CvEnums.h"
+# include <boost/python/object.hpp>
+namespace python = boost::python;
+
+class CvUnit;
+class CvPlot;
+class CvDLLPythonIFaceBase
+{
+public:
+
+ virtual const char* getMapScriptModule() = 0;
+
+ template <typename T> void setSeqFromArray(const T* /*src*/, int size,
PyObject* /*dst*/);
+ template <typename T> int putSeqInArray(PyObject* /*src*/, T** /*dst*/);
+ template <typename T> int putStringSeqInArray(PyObject* /*src*/, T**
/*dst*/);
+ template <typename T> int putFloatSeqInArray(PyObject* /*src*/, T**
/*dst*/);
+ template <typename T> PyObject* makePythonObject(T*);
+
+ virtual PyObject* MakeFunctionArgs(void** args, int argc) = 0;
+
+ virtual bool moduleExists(const char* moduleName, bool bLoadIfNecessary)
= 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg=NULL) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, long* result) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, CvString* result) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, CvWString* result) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, std::vector<byte>* pList) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, std::vector<int> *pIntList) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, int* pIntList, int* iListSize) = 0;
+ virtual bool callFunction(const char* moduleName, const char* fxnName,
void* fxnArg, std::vector<float> *pFloatList) = 0;
+ virtual bool callPythonFunction(const char* szModName, const char*
szFxnName, int iArg, long* result) = 0; // HELPER version that handles 1
arg for you
+
+ virtual bool pythonGetGridSize(WorldSizeTypes eWorldSize, int
*iGridWidth, int *iGridHeight) = 0;
+ virtual bool pythonGetWrapXY(bool *bWrapX, bool *bWrapY) = 0;
+ virtual bool pythonGetLatitudes(int *iTopLatitude, int *iBottomLatitude)
= 0;
+ virtual bool pythonIsBonusIgnoreLatitudes(bool *bBonusIgnoreLatitudes) =
0;
+ virtual bool pythonCalculateScore(PlayerTypes id, long* plScore, bool
bFinal = false, bool bVictory = false) = 0;
+ virtual bool pythonDoGoody(PlayerTypes id, CvPlot* pGoodyPlot, CvUnit*
pGoodyUnit) = 0;
+ virtual bool pythonAssignStartingPlots() = 0;
+ virtual bool pythonFindStartingArea(PlayerTypes id, long* result) = 0;
+ virtual bool pythonFindStartingPlot(PlayerTypes id, long* result) = 0;
+ virtual bool pythonAddLakes() = 0;
+ virtual bool pythonAddRivers() = 0;
+ virtual bool pythonGetRiverStartCardinalDirection(CvPlot* pRiverPlot,
long* result) = 0;
+ virtual bool pythonGetRiverAltitude(CvPlot* pRiverPlot, long* result) = 0;
+ virtual bool pythonAddFeatures() = 0;
+ virtual bool pythonAddBonuses() = 0;
+ virtual bool pythonAddBonusType(BonusTypes eBonusType) = 0;
+ virtual bool pythonCanPlaceBonusAt(CvPlot* pBonusPlot, long* result) = 0;
+ virtual bool pythonAddGoodies() = 0;
+ virtual bool pythonCanPlaceGoodyAt(CvPlot* pGoodyPlot, long* result) = 0;
+ virtual bool pythonGeneratePlotTypes(std::vector<int>& plotTypesOut) = 0;
+ virtual bool pythonGenerateTerrainTypes(std::vector<int>&
terrainTypesOut) = 0;
+ virtual bool pythonGenerateRandomMap() = 0;
+ virtual bool pythonNormalizeStartingPlotLocations() = 0;
+ virtual bool pythonNormalizeAddRiver() = 0;
+ virtual bool pythonNormalizeRemovePeaks() = 0;
+ virtual bool pythonNormalizeAddLakes() = 0;
+ virtual bool pythonNormalizeRemoveBadFeatures() = 0;
+ virtual bool pythonNormalizeRemoveBadTerrain() = 0;
+ virtual bool pythonNormalizeAddFoodBonuses() = 0;
+ virtual bool pythonNormalizeAddGoodTerrain() = 0;
+ virtual bool pythonNormalizeAddExtras() = 0;
+ virtual bool pythonUsingDefaultImpl() = 0;
+};
+
+template <typename T>
+PyObject* CvDLLPythonIFaceBase::makePythonObject(T* pObj)
+{
+ if (!pObj)
+ return Py_None;
+
+ boost::python::object bpo(pObj);
+ PyObject* pyobj = bpo.ptr();
+ Py_INCREF(pyobj);
+ assert(pyobj->ob_refcnt==2);
+ return pyobj; // decrefs pyobj when bpo goes out of scope
+}
+
+//
+// static
+// convert array to python list
+//
+template <typename T>
+void CvDLLPythonIFaceBase::setSeqFromArray(const T* aSrc, int size,
PyObject* dst)
+{
+ if (size<1)
+ return;
+
+ int iSeqSize=PySequence_Length(dst);
+ FAssertMsg(iSeqSize>=size, "sequence length too small");
+
+ int i;
+ int ret=0;
+ for (i=0;i<size;i++)
+ {
+ PyObject* x = PyInt_FromLong(aSrc[i]);
+ ret=PySequence_SetItem(dst, i, x);
+ FAssertMsg(ret!=-1, "PySequence_SetItem failed");
+ Py_DECREF(x);
+ }
+
+ // trim extra space
+ if (iSeqSize>size)
+ {
+ ret=PySequence_DelSlice(dst, size, iSeqSize);
+ FAssertMsg(ret!=-1, "PySequence_DelSlice failed");
+ }
+}
+
+//
+// static
+// convert python list to array
+// allocates array
+//
+template <typename T>
+int CvDLLPythonIFaceBase::putSeqInArray(PyObject* src, T** aDst)
+{
+ *aDst = NULL;
+ int size = PySequence_Length(src);
+ if (size<1)
+ return 0;
+
+ *aDst = new T[size];
+ int i;
+ for (i=0;i<size;i++)
+ {
+ PyObject* item = PySequence_GetItem(src, i); /* Can't fail */
+ FAssertMsg(PyInt_Check(item), "sequence item is not an int");
+ (*aDst)[i] = (T)PyInt_AsLong(item);
+ Py_DECREF(item);
+ }
+ return size;
+}
+
+//
+// static
+// convert python list to array
+// allocates array
+//
+template <typename T>
+int CvDLLPythonIFaceBase::putFloatSeqInArray(PyObject* src, T** aDst)
+{
+ *aDst = NULL;
+ int size = PySequence_Length(src);
+ if (size<1)
+ return 0;
+
+ *aDst = new T[size];
+ int i;
+ for (i=0;i<size;i++)
+ {
+ PyObject* item = PySequence_GetItem(src, i); /* Can't fail */
+ FAssertMsg(PyFloat_Check(item), "sequence item is not an float");
+ (*aDst)[i] = (T)PyFloat_AsDouble(item);
+ Py_DECREF(item);
+ }
+ return size;
+}
+
+//
+// static
+// convert python list to array
+// allocates array
+//
+template <typename T>
+int CvDLLPythonIFaceBase::putStringSeqInArray(PyObject* src, T** aDst)
+{
+ *aDst = NULL;
+ int size = PySequence_Length(src);
+ if (size<1)
+ return 0;
+
+ *aDst = new T[size];
+ int i;
+ for (i=0;i<size;i++)
+ {
+ PyObject* item = PySequence_GetItem(src, i); /* Can't fail */
+ FAssertMsg(PyString_Check(item), "sequence item is not a string");
+ (*aDst)[i] = (T)PyString_AsString(item);
+ Py_DECREF(item);
+ }
+ return size;
+}
+
+#endif // CvDLLPythonIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLSymbolIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,83 @@
+#pragma once
+
+#ifndef CvDLLSymbolIFaceBase_h
+#define CvDLLSymbolIFaceBase_h
+
+//#include "CvEnums.h"
+#include "CvDLLUtilityIFaceBase.h"
+#include "CvGlobals.h" // for gDLL
+
+//
+// abstract interface for CvSymbol functions used by DLL
+//
+
+class CvSymbol;
+class CvPlot;
+class CvRoute;
+class CvFeature;
+class CvRiver;
+class CvDLLSymbolIFaceBase
+{
+public:
+ virtual void init(CvSymbol* , int iID, int iOffset, int iType, CvPlot*
pPlot) = 0;
+ virtual CvSymbol* createSymbol() = 0;
+ virtual void destroy(CvSymbol*&, bool bSafeDelete=true ) = 0;
+ virtual void setAlpha(CvSymbol*, float fAlpha) = 0;
+ virtual void setScale(CvSymbol*, float fScale) = 0;
+ virtual void Hide(CvSymbol*, bool bHide) = 0;
+ virtual bool IsHidden(CvSymbol*) = 0;
+ virtual void updatePosition(CvSymbol*) = 0;
+ virtual int getID(CvSymbol*) = 0;
+ virtual SymbolTypes getSymbol(CvSymbol* pSym) = 0;
+ virtual void setTypeYield(CvSymbol *, int iType, int count) =0;
+};
+
+class CvDLLFeatureIFaceBase
+{
+public:
+ virtual CvFeature* createFeature() = 0;
+ virtual void init(CvFeature*, int iID, int iOffset, int iType, CvPlot*
pPlot) = 0;
+ virtual FeatureTypes getFeature(CvFeature* pObj) = 0;
+ virtual void setDummyVisibility(CvFeature *feature, const char *dummyTag,
bool show) = 0;
+ virtual void addDummyModel(CvFeature *feature, const char *dummyTag,
const char *modelTag) = 0;
+ virtual void setDummyTexture(CvFeature *feature, const char *dummyTag,
const char *textureTag) = 0;
+ virtual CvString pickDummyTag(CvFeature *feature, int mouseX, int mouseY)
= 0;
+ virtual void resetModel(CvFeature *feature) = 0;
+
+ // derived methods
+ virtual void destroy(CvFeature*& pObj, bool bSafeDelete=true) {
gDLL->getSymbolIFace()->destroy((CvSymbol*&)pObj, bSafeDelete); }
+ virtual void Hide(CvFeature* pObj, bool bHide) {
gDLL->getSymbolIFace()->Hide((CvSymbol*)pObj, bHide); }
+ virtual bool IsHidden(CvFeature* pObj) { return
gDLL->getSymbolIFace()->IsHidden((CvSymbol*)pObj); }
+ virtual void updatePosition(CvFeature* pObj) {
gDLL->getSymbolIFace()->updatePosition((CvSymbol*)pObj); }
+};
+
+class CvDLLRouteIFaceBase
+{
+public:
+ virtual CvRoute* createRoute() = 0;
+ virtual void init(CvRoute*, int iID, int iOffset, int iType, CvPlot*
pPlot) = 0;
+ virtual RouteTypes getRoute(CvRoute* pObj) = 0;
+
+ // derived methods
+ virtual void destroy(CvRoute*& pObj, bool bSafeDelete=true) {
gDLL->getSymbolIFace()->destroy((CvSymbol*&)pObj, bSafeDelete); }
+ virtual void Hide(CvRoute* pObj, bool bHide) {
gDLL->getSymbolIFace()->Hide((CvSymbol*)pObj, bHide); }
+ virtual bool IsHidden(CvRoute* pObj) { return
gDLL->getSymbolIFace()->IsHidden((CvSymbol*)pObj); }
+ virtual void updatePosition(CvRoute* pObj) {
gDLL->getSymbolIFace()->updatePosition((CvSymbol*)pObj); }
+ virtual int getConnectionMask(CvRoute* pObj) = 0;
+ virtual void updateGraphicEra(CvRoute *pObj) = 0;
+};
+
+class CvDLLRiverIFaceBase
+{
+public:
+ virtual CvRiver* createRiver() = 0;
+ virtual void init(CvRiver*, int iID, int iOffset, int iType, CvPlot*
pPlot) = 0;
+
+ // derived methods
+ virtual void destroy(CvRiver*& pObj, bool bSafeDelete=true) {
gDLL->getRouteIFace()->destroy((CvRoute*&)pObj, bSafeDelete); }
+ virtual void Hide(CvRiver* pObj, bool bHide) {
gDLL->getRouteIFace()->Hide((CvRoute*)pObj, bHide); }
+ virtual bool IsHidden(CvRiver* pObj) { return
gDLL->getRouteIFace()->IsHidden((CvRoute*)pObj); }
+ virtual void updatePosition(CvRiver* pObj) {
gDLL->getRouteIFace()->updatePosition((CvRoute*)pObj); }
+};
+
+#endif // CvDLLSymbolIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLUtilityIFaceBase.h Sat Sep 19 06:38:49
2009
@@ -0,0 +1,284 @@
+#pragma once
+
+#ifndef CvDLLUtilityIFaceBase_h
+#define CvDLLUtilityIFaceBase_h
+
+//#include "CvEnums.h"
+#include "LinkedList.h"
+
+//
+// abstract interface for utility functions used by DLL
+// Creator- Mustafa Thamer
+// Copyright 2005 Firaxis Games
+//
+class CvDLLEntityIFaceBase;
+class CvDLLInterfaceIFaceBase;
+class CvDLLEngineIFaceBase;
+class CvDLLIniParserIFaceBase;
+class CvDLLPlotBuilderIFaceBase;
+class CvDLLSymbolIFaceBase;
+class CvDLLFeatureIFaceBase;
+class CvDLLRouteIFaceBase;
+class CvDLLRiverIFaceBase;
+class CvDLLFAStarIFaceBase;
+class CvDLLEventReporterIFaceBase;
+class CvDLLXmlIFaceBase;
+class CvDLLFlagEntityIFaceBase;
+class CvDLLPythonIFaceBase;
+
+class CvSymbol;
+class CvPlot;
+class CvUnit;
+class CvCity;
+class CvCacheObject;
+class CvFont;
+class CvDiploParameters;
+class CvAudioGame;
+struct ProfileSample;
+class CvReplayInfo;
+class CvPopupInfo;
+
+class CvDLLUtilityIFaceBase
+{
+public:
+ // accessors for other abstract interfaces
+ virtual CvDLLEntityIFaceBase* getEntityIFace() = 0;
+ virtual CvDLLInterfaceIFaceBase* getInterfaceIFace() = 0;
+ virtual CvDLLEngineIFaceBase* getEngineIFace() = 0;
+ virtual CvDLLIniParserIFaceBase* getIniParserIFace() = 0;
+ virtual CvDLLSymbolIFaceBase* getSymbolIFace() = 0;
+ virtual CvDLLFeatureIFaceBase* getFeatureIFace() = 0;
+ virtual CvDLLRouteIFaceBase* getRouteIFace() = 0;
+ virtual CvDLLPlotBuilderIFaceBase* getPlotBuilderIFace() = 0;
+ virtual CvDLLRiverIFaceBase* getRiverIFace() = 0;
+ virtual CvDLLFAStarIFaceBase* getFAStarIFace() = 0;
+ virtual CvDLLEventReporterIFaceBase* getEventReporterIFace() = 0;
+ virtual CvDLLXmlIFaceBase* getXMLIFace() = 0;
+ virtual CvDLLFlagEntityIFaceBase* getFlagEntityIFace() = 0;
+ virtual CvDLLPythonIFaceBase* getPythonIFace() = 0;
+
+ virtual void delMem(void *p) = 0;
+ virtual void* newMem(size_t size) = 0;
+
+ virtual void delMem(void *p, const char* pcFile, int iLine) = 0;
+ virtual void* newMem(size_t size, const char* pcFile, int iLine) = 0;
+
+ virtual void delMemArray(void *p, const char* pcFile, int iLine) = 0;
+ virtual void* newMemArray(size_t size, const char* pcFile, int iLine) = 0;
+
+ virtual void* reallocMem(void* a, unsigned int uiBytes, const char*
pcFile, int iLine) = 0;
+ virtual unsigned int memSize(void* a) = 0;
+
+ virtual void clearVector(std::vector<int>& vec) = 0;
+ virtual void clearVector(std::vector<byte>& vec) = 0;
+ virtual void clearVector(std::vector<float>& vec) = 0;
+
+ virtual int getAssignedNetworkID(int iPlayerID) = 0;
+ virtual bool isConnected(int iNetID) = 0;
+ virtual bool isGameActive() = 0;
+ virtual int GetLocalNetworkID() = 0;
+ virtual int GetSyncOOS(int iNetID) = 0;
+ virtual int GetOptionsOOS(int iNetID) = 0;
+ virtual int GetLastPing(int iNetID) = 0;
+
+ virtual bool IsModem() = 0;
+ virtual void SetModem(bool bModem) = 0;
+
+ virtual void AcceptBuddy(const char * szName, int iRequestID) = 0;
+ virtual void RejectBuddy(const char * szName, int iRequestID) = 0;
+
+ virtual void messageControlLog(char* s) = 0;
+ virtual int getChtLvl() = 0;
+ virtual void setChtLvl(int iLevel) = 0;
+ virtual bool GetWorldBuilderMode() = 0;
+ virtual int getCurrentLanguage() const = 0;
+ virtual void setCurrentLanguage(int iNewLanguage) = 0;
+ virtual bool isModularXMLLoading() const = 0;
+
+ virtual bool IsPitbossHost() const = 0;
+ virtual CvString GetPitbossSmtpHost() const = 0;
+ virtual CvWString GetPitbossSmtpLogin() const = 0;
+ virtual CvWString GetPitbossSmtpPassword() const = 0;
+ virtual CvString GetPitbossEmail() const = 0;
+
+ virtual void sendPlayerInfo(PlayerTypes eActivePlayer) = 0;
+ virtual void sendGameInfo(const CvWString& szGameName, const CvWString&
szAdminPassword) = 0;
+ virtual void sendPlayerOption(PlayerOptionTypes eOption, bool bValue) = 0;
+ virtual void sendExtendedGame() = 0;
+ virtual void sendAutoMoves() = 0;
+ virtual void sendTurnComplete() = 0;
+ virtual void sendJoinGroup(int iUnitID, int iHeadID) = 0;
+ virtual void sendPushMission(int iUnitID, MissionTypes eMission, int
iData1, int iData2, int iFlags, bool bShift) = 0;
+ virtual void sendAutoMission(int iUnitID) = 0;
+ virtual void sendDoCommand(int iUnitID, CommandTypes eCommand, int
iData1, int iData2, bool bAlt) = 0;
+ virtual void sendPushOrder(int iCityID, OrderTypes eOrder, int iData,
bool bAlt, bool bShift, bool bCtrl) = 0;
+ virtual void sendPopOrder(int iCity, int iNum) = 0;
+ virtual void sendDoTask(int iCity, TaskTypes eTask, int iData1, int
iData2, bool bOption, bool bAlt, bool bShift, bool bCtrl) = 0;
+ virtual void sendResearch(TechTypes eTech, int iDiscover, bool bShift) =
0;
+ virtual void sendPercentChange(CommerceTypes eCommerce, int iChange) = 0;
+ virtual void sendConvert(ReligionTypes eReligion) = 0;
+ virtual void sendChat(const CvWString& szChatString, ChatTargetTypes
eTarget) = 0;
+ virtual void sendPing(int iX, int iY) = 0;
+ virtual void sendPause(int iPauseID = -1) = 0;
+ virtual void sendMPRetire() = 0;
+ virtual void sendToggleTradeMessage(PlayerTypes eWho, TradeableItems
eItemType, int iData, int iOtherWho, bool bAIOffer, bool bSendToAll =
false) = 0;
+ virtual void sendClearTableMessage(PlayerTypes eWhoTradingWith) = 0;
+ virtual void sendImplementDealMessage(PlayerTypes eOtherWho,
CLinkList<TradeData>* pOurList, CLinkList<TradeData>* pTheirList) = 0;
+ virtual void sendChangeWar(TeamTypes iRivalTeam, bool bWar) = 0;
+ virtual void sendChangeVassal(TeamTypes iMasterTeam, bool bVassal, bool
bCapitulated) = 0;
+ virtual void sendChooseElection(int iSelection, int iVoteId) = 0;
+ virtual void sendDiploVote(int iVoteId, PlayerVoteTypes eChoice) = 0;
+ virtual void sendContactCiv(NetContactTypes eContactType, PlayerTypes
eWho) = 0;
+ virtual void sendOffer() = 0;
+ virtual void sendDiploEvent(PlayerTypes eWhoTradingWith, DiploEventTypes
eDiploEvent, int iData1, int iData2) = 0;
+ virtual void sendRenegotiate(PlayerTypes eWhoTradingWith) = 0;
+ virtual void sendRenegotiateThisItem(PlayerTypes ePlayer2, TradeableItems
eItemType, int iData) = 0;
+ virtual void sendExitTrade() = 0;
+ virtual void sendKillDeal(int iDealID, bool bFromDiplomacy) = 0;
+ virtual void sendUpdateCivics(CivicTypes* paeCivics) = 0;
+ virtual void sendDiplomacy(PlayerTypes ePlayer, CvDiploParameters*
pParams) = 0;
+ virtual void sendPopup(PlayerTypes ePlayer, CvPopupInfo* pInfo) = 0;
+ virtual void sendEventTriggered(PlayerTypes ePlayer, EventTypes eEvent,
int iEventTriggeredId) = 0;
+ virtual void sendEmpireSplit(PlayerTypes ePlayer, int iAreaId) = 0;
+ virtual void sendLaunch(PlayerTypes ePlayer, VictoryTypes eVictory) = 0;
+ virtual void sendAdvancedStartAction(AdvancedStartActionTypes eAction,
PlayerTypes ePlayer, int iX, int iY, int iData, bool bAdd) = 0;
+ virtual void sendFoundReligion(PlayerTypes ePlayer, ReligionTypes
eReligion, ReligionTypes eSlotReligion) = 0;
+
+ virtual int getMillisecsPerTurn() = 0;
+ virtual float getSecsPerTurn() = 0;
+ virtual int getTurnsPerSecond() = 0;
+ virtual int getTurnsPerMinute() = 0;
+
+ virtual void openSlot(PlayerTypes eID) = 0;
+ virtual void closeSlot(PlayerTypes eID) = 0;
+
+ virtual CvWString getMapScriptName() = 0;
+ virtual bool getTransferredMap() = 0;
+ virtual bool isDescFileName(const char * szFileName) = 0;
+ virtual bool isWBMapScript() = 0;
+ virtual bool isWBMapNoPlayers() = 0;
+ virtual bool pythonMapExists(const char * szMapName) = 0;
+
+ virtual const wchar* getPlayerName(int iIndex, uint uiForm = 0) = 0;
+ virtual const wchar* getPlayerNameKey(int iIndex) = 0;
+ virtual const wchar* getCivDescription(int iIndex, uint uiForm = 0) = 0;
+ virtual const wchar* getCivDescriptionKey(int iIndex) = 0;
+ virtual const wchar* getCivShortDesc(int iIndex, uint uiForm = 0) = 0;
+ virtual const wchar* getCivShortDescKey(int iIndex) = 0;
+ virtual const wchar* getCivAdjective(int iIndex, uint uiForm = 0) = 0;
+ virtual const wchar* getCivAdjectiveKey(int iIndex) = 0;
+ virtual void stripSpecialCharacters(CvWString& szName) = 0;
+
+ virtual void initGlobals() = 0;
+ virtual void uninitGlobals() = 0;
+
+ virtual void callUpdater() = 0;
+
+ virtual bool Uncompress(byte** bufIn, unsigned long* bufLenIn, unsigned
long maxBufLenOut, int offset=0) = 0;
+ virtual bool Compress(byte** bufIn, unsigned long* bufLenIn, int
offset=0) = 0;
+
+ virtual void NiTextOut(const TCHAR* szText) = 0;
+ virtual void MessageBox(const TCHAR* szText, const TCHAR* szCaption) = 0;
+ virtual void SetDone(bool bDone) = 0;
+ virtual bool GetDone() = 0;
+ virtual bool GetAutorun() = 0;
+
+ virtual void beginDiplomacy(CvDiploParameters* pDiploParams, PlayerTypes
ePlayer) = 0;
+ virtual void endDiplomacy() = 0;
+ virtual bool isDiplomacy() = 0;
+ virtual int getDiplomacyPlayer() = 0;
+ virtual void updateDiplomacyAttitude(bool bForce = false) = 0;
+ virtual bool isMPDiplomacy() = 0;
+ virtual bool isMPDiplomacyScreenUp() = 0;
+ virtual int getMPDiplomacyPlayer() = 0;
+ virtual void beginMPDiplomacy( PlayerTypes eWhoTalkingTo, bool
bRenegotiate = false, bool bSimultaneous = true) = 0;
+ virtual void endMPDiplomacy() = 0;
+
+ virtual bool getAudioDisabled() = 0;
+ virtual int getAudioTagIndex(const TCHAR* szTag, int iScriptType = -1) =
0;
+
+ virtual void DoSound( int iScriptId ) = 0;
+ virtual void Do3DSound( int iScriptId, NiPoint3 vPosition ) = 0;
+
+ virtual FDataStreamBase* createFileStream() = 0;
+ virtual void destroyDataStream(FDataStreamBase*& stream) = 0;
+
+ virtual CvCacheObject* createGlobalTextCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createGlobalDefinesCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createTechInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createBuildingInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createUnitInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createLeaderHeadInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createCivilizationInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createPromotionInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createDiplomacyInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createEventInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createEventTriggerInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+
+ virtual CvCacheObject* createCivicInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createHandicapInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createBonusInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+ virtual CvCacheObject* createImprovementInfoCacheObject(const TCHAR*
szCacheFileName) = 0;
+
+ virtual bool cacheRead(CvCacheObject* pCache, const TCHAR*
szSourceFileName=NULL) = 0;
+ virtual bool cacheWrite(CvCacheObject* pCache) = 0;
+ virtual void destroyCache(CvCacheObject*& pCache) = 0;
+
+ virtual bool fileManagerEnabled() = 0;
+
+ virtual void logMsg(const TCHAR* pLogFileName, const TCHAR* pBuf, bool
bWriteToConsole=false, bool bTimeStamp=true) = 0;
+ virtual void logMemState(const char* msg) = 0;
+
+ virtual int getSymbolID(int iID) = 0;
+
+ virtual CvWString getText(CvWString szIDTag, ...) = 0;
+ virtual CvWString getObjectText(CvWString szIDTag, uint uiForm, bool
bNoSubs = false) = 0;
+ virtual void addText(const TCHAR* szIDTag, const wchar* szString, const
wchar* szGender = L"N", const wchar* szPlural = L"false") = 0;
+ virtual uint getNumForms(CvWString szIDTag) = 0;
+
+ virtual WorldSizeTypes getWorldSize() = 0;
+ virtual uint getFrameCounter() const = 0;
+
+ virtual bool altKey() = 0;
+ virtual bool shiftKey() = 0;
+ virtual bool ctrlKey() = 0;
+ virtual bool scrollLock() = 0;
+ virtual bool capsLock() = 0;
+ virtual bool numLock() = 0;
+
+ virtual void ProfilerBegin()=0;
+ virtual void ProfilerEnd()=0;
+ virtual void BeginSample(ProfileSample *pSample)=0;
+ virtual void EndSample(ProfileSample *pSample)=0;
+ virtual bool isGameInitializing() = 0;
+
+ virtual void enumerateFiles(std::vector<CvString>& files, const char*
szPattern) = 0;
+ virtual void enumerateModuleFiles(std::vector<CvString>& aszFiles, const
CvString& refcstrRootDirectory, const CvString& refcstrModularDirectory,
const CvString& refcstrExtension, bool bSearchSubdirectories) = 0;
+ virtual bool getTestingFont() const = 0;
+
+ virtual void SaveGame(SaveGameTypes eSaveGame) = 0;
+ virtual void LoadGame() = 0;
+ virtual int loadReplays(std::vector<CvReplayInfo*>& listReplays) = 0;
+ virtual void QuickSave() = 0;
+ virtual void QuickLoad() = 0;
+ virtual void sendPbemTurn(PlayerTypes ePlayer) = 0;
+ virtual void getPassword(PlayerTypes ePlayer) = 0;
+
+ virtual bool getGraphicOption(GraphicOptionTypes eGraphicOption) = 0;
+ virtual bool getPlayerOption(PlayerOptionTypes ePlayerOption) = 0;
+ virtual int getMainMenu() = 0;
+
+ virtual bool isFMPMgrHost() = 0;
+ virtual bool isFMPMgrPublic() = 0;
+ virtual void handleRetirement(PlayerTypes ePlayer) = 0;
+
+ virtual bool ChangeINIKeyValue(const char* szGroupKey, const char*
szKeyValue, const char* szOut) = 0;
+
+ virtual char* md5String(char* szString) = 0;
+
+ virtual const char* getModName(bool bFullPath = true) const = 0;
+ virtual bool hasSkippedSaveChecksum() const = 0;
+ virtual void resetStatistics() = 0;
+};
+
+#endif // CvDLLUtilityIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLWidgetData.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,5658 @@
+#include "CvGameCoreDLL.h"
+#include "CvGameCoreUtils.h"
+#include "CvCity.h"
+#include "CvUnit.h"
+#include "CvGlobals.h"
+#include "CvGameAI.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvTeamAI.h"
+#include "CvPlayerAI.h"
+#include "CvGameCoreUtils.h"
+#include "CyArgsList.h"
+#include "CvGameTextMgr.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLPythonIFaceBase.h"
+#include "CvDLLEngineIFaceBase.h"
+#include "CvDLLEventReporterIFaceBase.h"
+#include "CvDLLWidgetData.h"
+#include "CvPopupInfo.h"
+#include "FProfiler.h"
+
+CvDLLWidgetData* CvDLLWidgetData::m_pInst = NULL;
+
+CvDLLWidgetData& CvDLLWidgetData::getInstance()
+{
+ if (m_pInst == NULL)
+ {
+ m_pInst = new CvDLLWidgetData;
+ }
+ return *m_pInst;
+}
+
+void CvDLLWidgetData::freeInstance()
+{
+ delete m_pInst;
+ m_pInst = NULL;
+}
+
+void CvDLLWidgetData::parseHelp(CvWStringBuffer &szBuffer,
CvWidgetDataStruct &widgetDataStruct)
+{
+ switch (widgetDataStruct.m_eWidgetType)
+ {
+ case WIDGET_PLOT_LIST:
+ parsePlotListHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PLOT_LIST_SHIFT:
+ szBuffer.assign(gDLL->getText("TXT_KEY_MISC_CTRL_SHIFT",
(GC.getDefineINT("MAX_PLOT_LIST_SIZE") - 1)));
+ break;
+
+ case WIDGET_CITY_SCROLL:
+ break;
+
+ case WIDGET_LIBERATE_CITY:
+ parseLiberateCityHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CITY_NAME:
+ parseCityNameHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_UNIT_NAME:
+ szBuffer.append(gDLL->getText("TXT_KEY_CHANGE_NAME"));
+ break;
+
+ case WIDGET_CREATE_GROUP:
+ szBuffer.append(gDLL->getText("TXT_KEY_WIDGET_CREATE_GROUP"));
+ break;
+
+ case WIDGET_DELETE_GROUP:
+ szBuffer.append(gDLL->getText("TXT_KEY_WIDGET_DELETE_GROUP"));
+ break;
+
+ case WIDGET_TRAIN:
+ parseTrainHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CONSTRUCT:
+ parseConstructHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CREATE:
+ parseCreateHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_MAINTAIN:
+ parseMaintainHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HURRY:
+ parseHurryHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_MENU_ICON:
+ szBuffer.append(gDLL->getText("TXT_KEY_MAIN_MENU"));
+
+ case WIDGET_CONSCRIPT:
+ parseConscriptHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_ACTION:
+ parseActionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CITIZEN:
+ parseCitizenHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_FREE_CITIZEN:
+ parseFreeCitizenHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_DISABLED_CITIZEN:
+ parseDisabledCitizenHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_ANGRY_CITIZEN:
+ parseAngryCitizenHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CHANGE_SPECIALIST:
+ parseChangeSpecialistHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_RESEARCH:
+ parseResearchHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_TECH_TREE:
+ parseTechTreeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CHANGE_PERCENT:
+ parseChangePercentHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CITY_TAB:
+ {
+ CvWString szTemp;
+ szTemp.Format(L"%s",
GC.getCityTabInfo((CityTabTypes)widgetDataStruct.m_iData1).getDescription());
+ szBuffer.assign(szTemp);
+ }
+ break;
+
+ case WIDGET_CONTACT_CIV:
+ parseContactCivHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_SCORE_BREAKDOWN:
+ parseScoreHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_ZOOM_CITY:
+ szBuffer.append(gDLL->getText("TXT_KEY_ZOOM_CITY_HELP"));
+ break;
+
+ case WIDGET_END_TURN:
+ szBuffer.append(gDLL->getText("TXT_KEY_WIDGET_END_TURN"));
+ break;
+
+ case WIDGET_LAUNCH_VICTORY:
+ szBuffer.append(gDLL->getText("TXT_KEY_WIDGET_LAUNCH_VICTORY"));
+ break;
+
+ case WIDGET_AUTOMATE_CITIZENS:
+ parseAutomateCitizensHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_AUTOMATE_PRODUCTION:
+ parseAutomateProductionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_EMPHASIZE:
+ parseEmphasizeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_TRADE_ITEM:
+ parseTradeItem(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_UNIT_MODEL:
+ parseUnitModelHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_FLAG:
+ parseFlagHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_MAINTENANCE:
+ parseMaintenanceHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_RELIGION:
+ parseReligionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_RELIGION_CITY:
+ parseReligionHelpCity(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_CORPORATION_CITY:
+ parseCorporationHelpCity(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_NATIONALITY:
+ parseNationalityHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_DEFENSE:
+ break;
+
+ case WIDGET_HELP_HEALTH:
+ parseHealthHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_HAPPINESS:
+ parseHappinessHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_POPULATION:
+ parsePopulationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_PRODUCTION:
+ parseProductionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_CULTURE:
+ parseCultureHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_GREAT_PEOPLE:
+ parseGreatPeopleHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_GREAT_GENERAL:
+ parseGreatGeneralHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_SELECTED:
+ parseSelectedHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_BUILDING:
+ parseBuildingHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TRADE_ROUTE_CITY:
+ parseTradeRouteCityHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_ESPIONAGE_COST:
+ parseEspionageCostHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TECH_ENTRY:
+ parseTechEntryHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TECH_PREPREQ:
+ parseTechPrereqHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_OBSOLETE:
+ parseObsoleteHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_OBSOLETE_BONUS:
+ parseObsoleteBonusString(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_OBSOLETE_SPECIAL:
+ parseObsoleteSpecialHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_MOVE_BONUS:
+ parseMoveHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FREE_UNIT:
+ parseFreeUnitHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FEATURE_PRODUCTION:
+ parseFeatureProductionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_WORKER_RATE:
+ parseWorkerRateHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TRADE_ROUTES:
+ parseTradeRouteHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_HEALTH_RATE:
+ parseHealthRateHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_HAPPINESS_RATE:
+ parseHappinessRateHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FREE_TECH:
+ parseFreeTechHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_LOS_BONUS:
+ parseLOSHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_MAP_CENTER:
+ parseMapCenterHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_MAP_REVEAL:
+ parseMapRevealHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_MAP_TRADE:
+ parseMapTradeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TECH_TRADE:
+ parseTechTradeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_GOLD_TRADE:
+ parseGoldTradeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_OPEN_BORDERS:
+ parseOpenBordersHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_DEFENSIVE_PACT:
+ parseDefensivePactHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_PERMANENT_ALLIANCE:
+ parsePermanentAllianceHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_VASSAL_STATE:
+ parseVassalStateHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_BUILD_BRIDGE:
+ parseBuildBridgeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_IRRIGATION:
+ parseIrrigationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_IGNORE_IRRIGATION:
+ parseIgnoreIrrigationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_WATER_WORK:
+ parseWaterWorkHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_IMPROVEMENT:
+ parseBuildHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_DOMAIN_EXTRA_MOVES:
+ parseDomainExtraMovesHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_ADJUST:
+ parseAdjustHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_TERRAIN_TRADE:
+ parseTerrainTradeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_SPECIAL_BUILDING:
+ parseSpecialBuildingHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_YIELD_CHANGE:
+ parseYieldChangeHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_BONUS_REVEAL:
+ parseBonusRevealHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_CIVIC_REVEAL:
+ parseCivicRevealHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_PROCESS_INFO:
+ parseProcessInfoHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FOUND_RELIGION:
+ parseFoundReligionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FOUND_CORPORATION:
+ parseFoundCorporationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_NUM_UNITS:
+ parseFinanceNumUnits(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_UNIT_COST:
+ parseFinanceUnitCost(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_AWAY_SUPPLY:
+ parseFinanceAwaySupply(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_CITY_MAINT:
+ parseFinanceCityMaint(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_CIVIC_UPKEEP:
+ parseFinanceCivicUpkeep(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_FOREIGN_INCOME:
+ parseFinanceForeignIncome(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_INFLATED_COSTS:
+ parseFinanceInflatedCosts(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_GROSS_INCOME:
+ parseFinanceGrossIncome(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_NET_GOLD:
+ parseFinanceNetGold(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_HELP_FINANCE_GOLD_RESERVE:
+ parseFinanceGoldReserve(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_TECH:
+ parseTechEntryHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_REQUIRED_TECH:
+ parseTechTreePrereq(widgetDataStruct, szBuffer, false);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_DERIVED_TECH:
+ parseTechTreePrereq(widgetDataStruct, szBuffer, true);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_UNIT:
+ parseUnitHelp(widgetDataStruct, szBuffer);
+ break;
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ case WIDGET_PEDIA_JUMP_TO_HERO:
+ parseHeroHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CHECK_CORE_TROOP:
+ parseCheckCoreTroopHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CHECK_MEMBER_TROOP:
+ parseCheckMemberTroopHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_FORM_LEGION:
+ break;
+
+ case WIDGET_CYCLE_LEGION:
+ parseCycleLegionHelp(widgetDataStruct, szBuffer);
+ break;
+ // Sanguo Mod Hero, end
+
+ case WIDGET_PEDIA_JUMP_TO_BUILDING:
+ parseBuildingHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_BACK:
+ // parsePediaBack(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_FORWARD:
+ // parsePediaForward(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_BONUS:
+ parseBonusHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_MAIN:
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_PROMOTION:
+ case WIDGET_HELP_PROMOTION:
+ parsePromotionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_CHOOSE_EVENT:
+ parseEventHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_UNIT_COMBAT:
+ parseUnitCombatHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_IMPROVEMENT:
+ parseImprovementHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CIVIC:
+ parseCivicHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CIV:
+ parseCivilizationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_LEADER:
+ parseLeaderHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_SPECIALIST:
+ if (widgetDataStruct.m_iData1 != NO_SPECIALIST &&
widgetDataStruct.m_iData2 != 0)
+ {
+ CvWString szTemp;
+ szTemp.Format(L"%s",
GC.getSpecialistInfo((SpecialistTypes)widgetDataStruct.m_iData1).getDescription());
+ szBuffer.assign(szTemp);
+ }
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_PROJECT:
+ parseProjectHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_RELIGION:
+ parseReligionHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CORPORATION:
+ parseCorporationHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_TERRAIN:
+ parseTerrainHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_FEATURE:
+ parseFeatureHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_DESCRIPTION:
+ parseDescriptionHelp(widgetDataStruct, szBuffer, false);
+ break;
+
+ case WIDGET_CLOSE_SCREEN:
+ //parseCloseScreenHelp(szBuffer);
+ break;
+
+ case WIDGET_DEAL_KILL:
+ parseKillDealHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_PEDIA_DESCRIPTION_NO_HELP:
+ //parseDescriptionHelp(widgetDataStruct, szBuffer, true);
+ break;
+
+ case WIDGET_MINIMAP_HIGHLIGHT:
+ break;
+
+ case WIDGET_PRODUCTION_MOD_HELP:
+ parseProductionModHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_LEADERHEAD:
+ parseLeaderheadHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_LEADER_LINE:
+ parseLeaderLineHelp(widgetDataStruct, szBuffer);
+ break;
+
+ case WIDGET_COMMERCE_MOD_HELP:
+ parseCommerceModHelp(widgetDataStruct, szBuffer);
+ break;
+
+ }
+}
+
+// Protected Functions...
+bool CvDLLWidgetData::executeAction( CvWidgetDataStruct &widgetDataStruct )
+{
+ bool bHandled = false; // Right now general bHandled = false; We can
specific case this to true later. Game will run with this = false;
+
+ switch (widgetDataStruct.m_eWidgetType)
+ {
+
+ case WIDGET_PLOT_LIST:
+ doPlotList(widgetDataStruct);
+ break;
+
+ case WIDGET_PLOT_LIST_SHIFT:
+
gDLL->getInterfaceIFace()->changePlotListColumn(widgetDataStruct.m_iData1 *
((gDLL->ctrlKey()) ? (GC.getDefineINT("MAX_PLOT_LIST_SIZE") - 1) : 1));
+ break;
+
+ case WIDGET_CITY_SCROLL:
+ if ( widgetDataStruct.m_iData1 > 0 )
+ {
+ GC.getGameINLINE().doControl(CONTROL_NEXTCITY);
+ }
+ else
+ {
+ GC.getGameINLINE().doControl(CONTROL_PREVCITY);
+ }
+ break;
+
+ case WIDGET_LIBERATE_CITY:
+ doLiberateCity();
+ break;
+
+ case WIDGET_CITY_NAME:
+ doRenameCity();
+ break;
+
+ case WIDGET_UNIT_NAME:
+ doRenameUnit();
+ break;
+
+ case WIDGET_CREATE_GROUP:
+ doCreateGroup();
+ break;
+
+ case WIDGET_DELETE_GROUP:
+ doDeleteGroup();
+ break;
+
+ case WIDGET_TRAIN:
+ doTrain(widgetDataStruct);
+ break;
+
+ case WIDGET_CONSTRUCT:
+ doConstruct(widgetDataStruct);
+ break;
+
+ case WIDGET_CREATE:
+ doCreate(widgetDataStruct);
+ break;
+
+ case WIDGET_MAINTAIN:
+ doMaintain(widgetDataStruct);
+ break;
+
+ case WIDGET_HURRY:
+ doHurry(widgetDataStruct);
+ break;
+
+ case WIDGET_MENU_ICON:
+ doMenu();
+
+ case WIDGET_CONSCRIPT:
+ doConscript();
+ break;
+
+ case WIDGET_ACTION:
+ doAction(widgetDataStruct);
+ break;
+
+ case WIDGET_CITIZEN:
+ break;
+
+ case WIDGET_FREE_CITIZEN:
+ break;
+
+ case WIDGET_DISABLED_CITIZEN:
+ break;
+
+ case WIDGET_ANGRY_CITIZEN:
+ break;
+
+ case WIDGET_CHANGE_SPECIALIST:
+ doChangeSpecialist(widgetDataStruct);
+ break;
+
+ case WIDGET_RESEARCH:
+ case WIDGET_TECH_TREE:
+ doResearch(widgetDataStruct);
+ break;
+
+ case WIDGET_CHANGE_PERCENT:
+ doChangePercent(widgetDataStruct);
+ break;
+
+ case WIDGET_CITY_TAB:
+ doCityTab(widgetDataStruct);
+ break;
+
+ case WIDGET_CONTACT_CIV:
+ doContactCiv(widgetDataStruct);
+ break;
+
+ case WIDGET_END_TURN:
+ GC.getGameINLINE().doControl(CONTROL_FORCEENDTURN);
+ break;
+
+ case WIDGET_LAUNCH_VICTORY:
+ doLaunch(widgetDataStruct);
+ break;
+
+ case WIDGET_CONVERT:
+ doConvert(widgetDataStruct);
+ break;
+
+ case WIDGET_REVOLUTION:
+ // handled in Python
+ break;
+
+ case WIDGET_AUTOMATE_CITIZENS:
+ doAutomateCitizens();
+ break;
+
+ case WIDGET_AUTOMATE_PRODUCTION:
+ doAutomateProduction();
+ break;
+
+ case WIDGET_EMPHASIZE:
+ doEmphasize(widgetDataStruct);
+ break;
+
+ case WIDGET_DIPLOMACY_RESPONSE:
+ // CLEANUP -- PD
+// GC.getDiplomacyScreen().handleClick(m_pWidget);
+ break;
+
+ case WIDGET_TRADE_ITEM:
+ break;
+
+ case WIDGET_UNIT_MODEL:
+ doUnitModel();
+ break;
+
+ case WIDGET_FLAG:
+ doFlag();
+ break;
+
+ case WIDGET_HELP_SELECTED:
+ doSelected(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_UNIT:
+ doPediaUnitJump(widgetDataStruct);
+ break;
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ case WIDGET_PEDIA_JUMP_TO_HERO:
+ doPediaHeroJump(widgetDataStruct);
+ break;
+
+ case WIDGET_CHECK_CORE_TROOP:
+ doCheckCoreTroop(widgetDataStruct);
+ break;
+
+ case WIDGET_CHECK_MEMBER_TROOP:
+ doCheckMemberTroop(widgetDataStruct);
+ break;
+
+ case WIDGET_FORM_LEGION:
+ doFormLegion(widgetDataStruct);
+ break;
+
+ case WIDGET_CYCLE_LEGION:
+ doCycleLegion(widgetDataStruct);
+ break;
+ // Sanguo Mod Hero, end
+
+ case WIDGET_PEDIA_JUMP_TO_BUILDING:
+ doPediaBuildingJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_TECH:
+ case WIDGET_PEDIA_JUMP_TO_REQUIRED_TECH:
+ case WIDGET_PEDIA_JUMP_TO_DERIVED_TECH:
+ doPediaTechJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_BACK:
+ doPediaBack();
+ break;
+ case WIDGET_PEDIA_FORWARD:
+ doPediaForward();
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_BONUS:
+ doPediaBonusJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_MAIN:
+ doPediaMain(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_PROMOTION:
+ doPediaPromotionJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_UNIT_COMBAT:
+ doPediaUnitCombatJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_IMPROVEMENT:
+ doPediaImprovementJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CIVIC:
+ doPediaCivicJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CIV:
+ doPediaCivilizationJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_LEADER:
+ doPediaLeaderJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_SPECIALIST:
+ doPediaSpecialistJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_PROJECT:
+ doPediaProjectJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_RELIGION:
+ doPediaReligionJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_CORPORATION:
+ doPediaCorporationJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_TERRAIN:
+ doPediaTerrainJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_JUMP_TO_FEATURE:
+ doPediaFeatureJump(widgetDataStruct);
+ break;
+
+ case WIDGET_PEDIA_DESCRIPTION:
+ case WIDGET_PEDIA_DESCRIPTION_NO_HELP:
+ doPediaDescription(widgetDataStruct);
+ break;
+
+ case WIDGET_TURN_EVENT:
+ doGotoTurnEvent(widgetDataStruct);
+ break;
+
+ case WIDGET_FOREIGN_ADVISOR:
+ doForeignAdvisor(widgetDataStruct);
+ break;
+
+ case WIDGET_DEAL_KILL:
+ doDealKill(widgetDataStruct);
+ break;
+
+ case WIDGET_MINIMAP_HIGHLIGHT:
+ doRefreshMilitaryAdvisor(widgetDataStruct);
+ break;
+
+ case WIDGET_CHOOSE_EVENT:
+ break;
+
+ case WIDGET_ZOOM_CITY:
+ break;
+
+ case WIDGET_HELP_TECH_PREPREQ:
+ case WIDGET_HELP_OBSOLETE:
+ case WIDGET_HELP_OBSOLETE_BONUS:
+ case WIDGET_HELP_OBSOLETE_SPECIAL:
+ case WIDGET_HELP_MOVE_BONUS:
+ case WIDGET_HELP_FREE_UNIT:
+ case WIDGET_HELP_FEATURE_PRODUCTION:
+ case WIDGET_HELP_WORKER_RATE:
+ case WIDGET_HELP_TRADE_ROUTES:
+ case WIDGET_HELP_HEALTH_RATE:
+ case WIDGET_HELP_HAPPINESS_RATE:
+ case WIDGET_HELP_FREE_TECH:
+ case WIDGET_HELP_LOS_BONUS:
+ case WIDGET_HELP_MAP_CENTER:
+ case WIDGET_HELP_MAP_REVEAL:
+ case WIDGET_HELP_MAP_TRADE:
+ case WIDGET_HELP_TECH_TRADE:
+ case WIDGET_HELP_GOLD_TRADE:
+ case WIDGET_HELP_OPEN_BORDERS:
+ case WIDGET_HELP_DEFENSIVE_PACT:
+ case WIDGET_HELP_PERMANENT_ALLIANCE:
+ case WIDGET_HELP_VASSAL_STATE:
+ case WIDGET_HELP_BUILD_BRIDGE:
+ case WIDGET_HELP_IRRIGATION:
+ case WIDGET_HELP_IGNORE_IRRIGATION:
+ case WIDGET_HELP_WATER_WORK:
+ case WIDGET_HELP_IMPROVEMENT:
+ case WIDGET_HELP_DOMAIN_EXTRA_MOVES:
+ case WIDGET_HELP_ADJUST:
+ case WIDGET_HELP_TERRAIN_TRADE:
+ case WIDGET_HELP_SPECIAL_BUILDING:
+ case WIDGET_HELP_YIELD_CHANGE:
+ case WIDGET_HELP_BONUS_REVEAL:
+ case WIDGET_HELP_CIVIC_REVEAL:
+ case WIDGET_HELP_PROCESS_INFO:
+ case WIDGET_HELP_FINANCE_NUM_UNITS:
+ case WIDGET_HELP_FINANCE_UNIT_COST:
+ case WIDGET_HELP_FINANCE_AWAY_SUPPLY:
+ case WIDGET_HELP_FINANCE_CITY_MAINT:
+ case WIDGET_HELP_FINANCE_CIVIC_UPKEEP:
+ case WIDGET_HELP_FINANCE_FOREIGN_INCOME:
+ case WIDGET_HELP_FINANCE_INFLATED_COSTS:
+ case WIDGET_HELP_FINANCE_GROSS_INCOME:
+ case WIDGET_HELP_FINANCE_NET_GOLD:
+ case WIDGET_HELP_FINANCE_GOLD_RESERVE:
+ case WIDGET_HELP_RELIGION_CITY:
+ case WIDGET_HELP_CORPORATION_CITY:
+ case WIDGET_HELP_PROMOTION:
+ case WIDGET_LEADERHEAD:
+ case WIDGET_LEADER_LINE:
+ case WIDGET_CLOSE_SCREEN:
+ case WIDGET_SCORE_BREAKDOWN:
+ // Nothing on clicked
+ break;
+ }
+
+ return bHandled;
+}
+
+// right clicking action
+bool CvDLLWidgetData::executeAltAction( CvWidgetDataStruct
&widgetDataStruct )
+{
+ CvWidgetDataStruct widgetData = widgetDataStruct;
+
+ bool bHandled = true;
+ switch (widgetDataStruct.m_eWidgetType)
+ {
+ case WIDGET_HELP_TECH_ENTRY:
+ case WIDGET_HELP_TECH_PREPREQ:
+ case WIDGET_RESEARCH:
+ case WIDGET_TECH_TREE:
+ doPediaTechJump(widgetDataStruct);
+ break;
+ case WIDGET_TRAIN:
+ doPediaTrainJump(widgetDataStruct);
+ break;
+ case WIDGET_CONSTRUCT:
+ doPediaConstructJump(widgetDataStruct);
+ break;
+ case WIDGET_CREATE:
+ doPediaProjectJump(widgetDataStruct);
+ break;
+ case WIDGET_PEDIA_JUMP_TO_UNIT:
+ case WIDGET_HELP_FREE_UNIT:
+ doPediaUnitJump(widgetDataStruct);
+ break;
+ case WIDGET_HELP_FOUND_RELIGION:
+ widgetData.m_iData1 = widgetData.m_iData2;
+ // Intentional fallthrough...
+ case WIDGET_PEDIA_JUMP_TO_RELIGION:
+ doPediaReligionJump(widgetData);
+ break;
+ case WIDGET_HELP_FOUND_CORPORATION:
+ widgetData.m_iData1 = widgetData.m_iData2;
+ // Intentional fallthrough...
+ case WIDGET_PEDIA_JUMP_TO_CORPORATION:
+ doPediaCorporationJump(widgetData);
+ break;
+ case WIDGET_PEDIA_JUMP_TO_BUILDING:
+ doPediaBuildingJump(widgetDataStruct);
+ break;
+ case WIDGET_PEDIA_JUMP_TO_PROMOTION:
+ doPediaPromotionJump(widgetDataStruct);
+ break;
+ case WIDGET_HELP_OBSOLETE:
+ doPediaBuildingJump(widgetDataStruct);
+ break;
+ case WIDGET_HELP_IMPROVEMENT:
+ doPediaBuildJump(widgetDataStruct);
+ break;
+ case WIDGET_HELP_YIELD_CHANGE:
+ doPediaImprovementJump(widgetDataStruct, true);
+ break;
+ case WIDGET_HELP_BONUS_REVEAL:
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLWidgetData.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,221 @@
+#pragma once
+
+#ifndef _CVDLLWIDGETDATA_H_
+#define _CVDLLWIDGETDATA_H_
+
+//#include "CvEnums.h"
+
+class CvDLLWidgetData
+{
+
+public:
+
+ DllExport static CvDLLWidgetData& getInstance();
+ DllExport static void freeInstance();
+
+ // This will parse the help for the widget
+ DllExport void parseHelp(CvWStringBuffer &szBuffer, CvWidgetDataStruct
&widgetDataStruct);
+
+ // This will execute the action for the widget
+ DllExport bool executeAction( CvWidgetDataStruct &widgetDataStruct );
+
+ // This will execute an alternate action for the widget
+ DllExport bool executeAltAction( CvWidgetDataStruct &widgetDataStruct );
+
+ DllExport bool isLink(const CvWidgetDataStruct &widgetDataStruct) const;
+
+ // Actions to be executed
+ void doPlotList(CvWidgetDataStruct &widgetDataStruct);
+ void doLiberateCity();
+ void doRenameCity();
+ void doRenameUnit();
+ void doCreateGroup();
+ void doDeleteGroup();
+ void doTrain(CvWidgetDataStruct &widgetDataStruct);
+ void doConstruct(CvWidgetDataStruct &widgetDataStruct);
+ void doCreate(CvWidgetDataStruct &widgetDataStruct);
+ void doMaintain(CvWidgetDataStruct &widgetDataStruct);
+ void doHurry(CvWidgetDataStruct &widgetDataStruct);
+ void doConscript();
+ void doAction(CvWidgetDataStruct &widgetDataStruct);
+ void doChangeSpecialist(CvWidgetDataStruct &widgetDataStruct);
+ void doResearch(CvWidgetDataStruct &widgetDataStruct);
+ void doChangePercent(CvWidgetDataStruct &widgetDataStruct);
+ void doCityTab(CvWidgetDataStruct &widgetDataStruct);
+ void doContactCiv(CvWidgetDataStruct &widgetDataStruct);
+ void doConvert(CvWidgetDataStruct &widgetDataStruct);
+ void doAutomateCitizens();
+ void doAutomateProduction();
+ void doEmphasize(CvWidgetDataStruct &widgetDataStruct);
+ void doCancelCivics();
+ void applyCityEdit();
+ void doUnitModel();
+ void doFlag();
+ void doSelected(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaTechJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaUnitJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaBuildingJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaBack();
+ void doPediaForward();
+ void doPediaBonusJump(CvWidgetDataStruct &widgetDataStruct, bool bData2 =
false);
+ void doPediaSpecialistJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaProjectJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaReligionJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaCorporationJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaTerrainJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaFeatureJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaMain(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaPromotionJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaUnitCombatJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaImprovementJump(CvWidgetDataStruct &widgetDataStruct, bool
bData2 = false);
+ void doPediaCivicJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaCivilizationJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaLeaderJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaDescription(CvWidgetDataStruct &widgetDataStruct);
+ void doGotoTurnEvent(CvWidgetDataStruct &widgetDataStruct);
+ void doForeignAdvisor(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaConstructJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaTrainJump(CvWidgetDataStruct &widgetDataStruct);
+ void doPediaBuildJump(CvWidgetDataStruct &widgetDataStruct);
+ void doDealKill(CvWidgetDataStruct &widgetDataStruct);
+ void doRefreshMilitaryAdvisor(CvWidgetDataStruct &widgetDataStruct);
+ void doMenu( void );
+ void doLaunch(CvWidgetDataStruct &widgetDataStruct);
+
+ // Help parsing
+ void parsePlotListHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseLiberateCityHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCityNameHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTrainHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseConstructHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCreateHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseMaintainHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseHurryHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseConscriptHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseActionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCitizenHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFreeCitizenHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseDisabledCitizenHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseAngryCitizenHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseChangeSpecialistHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseResearchHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTechTreeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseChangePercentHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseContactCivHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseScoreHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseConvertHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseRevolutionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+// void parsePopupQueue(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseAutomateCitizensHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseAutomateProductionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseEmphasizeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTradeItem(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseUnitModelHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFlagHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseMaintenanceHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseNationalityHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseHealthHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseHappinessHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parsePopulationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseProductionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCultureHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseGreatPeopleHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseGreatGeneralHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseSelectedHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTradeRouteCityHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseEspionageCostHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseBuildingHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseProjectHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTerrainHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFeatureHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTechEntryHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTechPrereqHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTechTreePrereq(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer, bool bTechTreeInfo);
+ void parseObsoleteHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseObsoleteBonusString(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseObsoleteSpecialHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseMoveHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseFreeUnitHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFeatureProductionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseWorkerRateHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTradeRouteHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseHealthRateHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseHappinessRateHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFreeTechHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseLOSHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseMapCenterHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseMapRevealHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseMapTradeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTechTradeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseGoldTradeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseOpenBordersHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseDefensivePactHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parsePermanentAllianceHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseVassalStateHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseBuildBridgeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseIrrigationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseIgnoreIrrigationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseWaterWorkHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseBuildHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseDomainExtraMovesHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseAdjustHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseTerrainTradeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseSpecialBuildingHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseYieldChangeHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseBonusRevealHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCivicRevealHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseProcessInfoHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFoundReligionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFoundCorporationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceNumUnits(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceUnitCost(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceAwaySupply(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceCityMaint(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceCivicUpkeep(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceForeignIncome(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceInflatedCosts(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceGrossIncome(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceNetGold(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseFinanceGoldReserve(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseUnitHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parsePediaBack(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parsePediaForward(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseBonusHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseReligionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseReligionHelpCity(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCorporationHelpCity(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCorporationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parsePromotionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseEventHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseUnitCombatHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseImprovementHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCivicHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void parseCivilizationHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseLeaderHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseDescriptionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer, bool bMinimal);
+ void parseCloseScreenHelp(CvWStringBuffer &szBuffer);
+ void parseKillDealHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseProductionModHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseLeaderheadHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseLeaderLineHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void parseCommerceModHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ void parseHeroHelp(CvWidgetDataStruct &widgetDataStruct, CvWStringBuffer
&szBuffer);
+ void doPediaHeroJump(CvWidgetDataStruct &widgetDataStruct);
+ void parseCheckCoreTroopHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void doCheckCoreTroop(CvWidgetDataStruct &widgetDataStruct);
+ void parseCheckMemberTroopHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void doCheckMemberTroop(CvWidgetDataStruct &widgetDataStruct);
+ void doFormLegion(CvWidgetDataStruct &widgetDataStruct);
+ void parseCycleLegionHelp(CvWidgetDataStruct &widgetDataStruct,
CvWStringBuffer &szBuffer);
+ void doCycleLegion(CvWidgetDataStruct &widgetDataStruct);
+ // Sanguo Mod Hero, end
+
+protected:
+
+ static CvDLLWidgetData* m_pInst;
+
+};
+
+#endif//_CVDLLWIDGETDATA_H_
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDLLXMLIFaceBase.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,108 @@
+#pragma once
+
+#ifndef CvDLLXMLIFaceBase_h
+#define CvDLLXMLIFaceBase_h
+
+//
+// abstract interface for FXml functions used by DLL
+//
+class FXml;
+class FXmlSchemaCache;
+class CvDLLXmlIFaceBase
+{
+public:
+ virtual FXml* CreateFXml(FXmlSchemaCache* pSchemaCache=0) = 0;
+ virtual void DestroyFXml(FXml*& xml) = 0;
+
+ virtual void DestroyFXmlSchemaCache(FXmlSchemaCache*&) = 0;
+ virtual FXmlSchemaCache* CreateFXmlSchemaCache() = 0;
+
+ // load an xml file into memory, returns true if successfully loaded and
false otherwise
+ virtual bool LoadXml(FXml* xml, const TCHAR* pszXmlFile) = 0;
+ // validate the document/xml, returns true if successful and false
otherwise,
+ // if validate fails we also return an error string to indicate why it
failed
+ virtual bool Validate(FXml* xml, TCHAR* pszError=NULL) = 0;
+ // locate a node in the document, returns true if a node is found and
false otherwise
+ virtual bool LocateNode(FXml* xml, const TCHAR* pszXmlNode) = 0;
+ // locate the first sibling node in this sub-tree layer that has the xml
tag name,
+ // returns true if a node is found and false otherwise
+ virtual bool LocateFirstSiblingNodeByTagName(FXml* xml, TCHAR*
pszTagName) = 0;
+ // locate the next sibling node in this sub-tree layer that has the xml
tag name,
+ // returns true if a node is found and false otherwise
+ virtual bool LocateNextSiblingNodeByTagName(FXml* xml, TCHAR* pszTagName)
= 0;
+ // Set the last located xml node member variable to the next sibling of
the current
+ // last located xml node, returns true if a next sibling was found and
false otherwise
+ virtual bool NextSibling(FXml* xml) = 0;
+ // Set the last located xml node member variable to the prev sibling of
the current
+ // last located xml node, returns true if a next sibling was found and
false otherwise
+ virtual bool PrevSibling(FXml* xml) = 0;
+ // Set the last located xml node member variable to the it's first child,
+ // returns true if a next child was found and set, false otherwise
+ virtual bool SetToChild(FXml* xml) = 0;
+ // set to the child node that has the tag name
+ virtual bool SetToChildByTagName(FXml* xml, const TCHAR* szTagName) = 0;
+ // Set the last located xml node member variable to the it's parent,
+ // returns true if it's parent is found and set, false otherwise
+ virtual bool SetToParent(FXml* xml) = 0;
+ // add a node to the document as the child of the last located node,
+ // returns true if the node was successfully added and false otherwise
+ virtual bool AddChildNode(FXml* xml, TCHAR* pszNewNode) = 0;
+ // adds a node to the document as a sibling to the last node located,
+ // node is added before the last node located,
+ // returns true if the node was successfully added and false otherwise
+ virtual bool AddSiblingNodeBefore(FXml* xml, TCHAR* pszNewNode) = 0;
+ // adds a node to the document as a sibling to the last node located,
+ // node is added after the last node located,
+ // returns true if the node was successfully added and false otherwise
+ virtual bool AddSiblingNodeAfter(FXml* xml, TCHAR* pszNewNode) = 0;
+ // write the xml document to disk, returns true if the write was
successful and false otherwise
+ virtual bool WriteXml(FXml* xml, TCHAR* pszXmlFile) = 0;
+ // set the inserted node's attribute, returns true if successful and
false otherwise
+ virtual bool SetInsertedNodeAttribute(FXml* xml, TCHAR* pszAttributeName,
TCHAR* pszAttributeValue) = 0;
+ // get the size of the text from the last located node, returns the size
+ virtual int GetLastNodeTextSize(FXml* xml) = 0;
+ // get the text from the last located node, returns true if successful
and false otherwise
+ virtual bool GetLastNodeText(FXml* xml, TCHAR* pszText) = 0;
+ // get the value from the last located node, returns true if successful
and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, std::string& pszText) = 0;
+ virtual bool GetLastNodeValue(FXml* xml, std::wstring& pszText) = 0;
+ // get the value from the last located node, returns true if successful
and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, char* pszText) = 0;
+ virtual bool GetLastNodeValue(FXml* xml, wchar* pszText) = 0;
+ // get the boolean value from the last located node, returns true if
successful and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, bool* pbVal) = 0;
+ // get the integer value from the last located node, returns true if
successful and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, int* piVal) = 0;
+ // get the float value from the last located node, returns true if
successful and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, float* pfVal) = 0;
+ // get the unsigned int value from the last located node, returns true if
successful and false otherwise
+ virtual bool GetLastNodeValue(FXml* xml, unsigned int* puiVal) = 0;
+ // get the size of the text from the last inserted node, returns the size
+ virtual int GetInsertedNodeTextSize(FXml* xml) = 0;
+ // get the text from the last inserted node, returns true if successful
and false otherwise
+ virtual bool GetInsertedNodeText(FXml* xml, TCHAR* pszText) = 0;
+ // set the text from the last located node, returns true if successful
and false otherwise
+ //bool SetLastNodeText(TCHAR* pszText);
+ // set the text from the last inserted node, returns true if successful
and false otherwise
+ virtual bool SetInsertedNodeText(FXml* xml, TCHAR* pszText) = 0;
+ // get the type of the last located node, returns true if there was a
type set and false otherwise
+ virtual bool GetLastLocatedNodeType(FXml* xml, TCHAR* pszType) = 0;
+ // get the type of the last inserted node, returns true if there was a
type set and false otherwise
+ virtual bool GetLastInsertedNodeType(FXml* xml, TCHAR* pszType) = 0;
+ // Indicates if the last located node is a comment node or not, returns
true if it is and false otherwise
+ virtual bool IsLastLocatedNodeCommentNode(FXml* xml) = 0;
+ // returns the number of elements that have the tag name
+ virtual int NumOfElementsByTagName(FXml* xml, TCHAR* pszTagName) = 0;
+ // returns the number of children with the tag name
+ virtual int NumOfChildrenByTagName(FXml* xml, const TCHAR* pszTagName) =
0;
+ // returns the number of siblings the current selected item/node has
+ virtual int GetNumSiblings(FXml* xml) = 0;
+ // returns the number of children the current selected item/node has
+ virtual int GetNumChildren(FXml* xml) = 0;
+ // returns the tag name of the last located node, returns true if there
is/was a last located node and false otherwise
+ virtual bool GetLastLocatedNodeTagName(FXml* xml, TCHAR* pszTagName) = 0;
+ virtual bool IsAllowXMLCaching() = 0;
+ virtual void MapChildren(FXml*) = 0;
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDeal.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,1231 @@
+// CvDeal.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvGlobals.h"
+#include "CvGameAI.h"
+#include "CvTeamAI.h"
+#include "CvPlayerAI.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvGameCoreUtils.h"
+#include "CvGameTextMgr.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLEventReporterIFaceBase.h"
+
+// Public Functions...
+
+CvDeal::CvDeal()
+{
+ reset();
+}
+
+
+CvDeal::~CvDeal()
+{
+ uninit();
+}
+
+
+void CvDeal::init(int iID, PlayerTypes eFirstPlayer, PlayerTypes
eSecondPlayer)
+{
+ //--------------------------------
+ // Init saved data
+ reset(iID, eFirstPlayer, eSecondPlayer);
+
+ //--------------------------------
+ // Init non-saved data
+
+ //--------------------------------
+ // Init other game data
+ setInitialGameTurn(GC.getGameINLINE().getGameTurn());
+}
+
+
+void CvDeal::uninit()
+{
+ m_firstTrades.clear();
+ m_secondTrades.clear();
+}
+
+
+// FUNCTION: reset()
+// Initializes data members that are serialized.
+void CvDeal::reset(int iID, PlayerTypes eFirstPlayer, PlayerTypes
eSecondPlayer)
+{
+ //--------------------------------
+ // Uninit class
+ uninit();
+
+ m_iID = iID;
+ m_iInitialGameTurn = 0;
+
+ m_eFirstPlayer = eFirstPlayer;
+ m_eSecondPlayer = eSecondPlayer;
+}
+
+
+void CvDeal::kill(bool bKillTeam)
+{
+ if ((getLengthFirstTrades() > 0) || (getLengthSecondTrades() > 0))
+ {
+ CvWString szString;
+ CvWStringBuffer szDealString;
+ CvWString szCancelString = gDLL->getText("TXT_KEY_POPUP_DEAL_CANCEL");
+
+ if
(GET_TEAM(GET_PLAYER(getFirstPlayer()).getTeam()).isHasMet(GET_PLAYER(getSecondPlayer()).getTeam()))
+ {
+ szDealString.clear();
+ GAMETEXT.getDealString(szDealString, *this, getFirstPlayer());
+ szString.Format(L"%s: %s", szCancelString.GetCString(),
szDealString.getCString());
+ gDLL->getInterfaceIFace()->addMessage((PlayerTypes)getFirstPlayer(),
true, GC.getEVENT_MESSAGE_TIME(), szString, "AS2D_DEAL_CANCELLED");
+ }
+
+ if
(GET_TEAM(GET_PLAYER(getSecondPlayer()).getTeam()).isHasMet(GET_PLAYER(getFirstPlayer()).getTeam()))
+ {
+ szDealString.clear();
+ GAMETEXT.getDealString(szDealString, *this, getSecondPlayer());
+ szString.Format(L"%s: %s", szCancelString.GetCString(),
szDealString.getCString());
+ gDLL->getInterfaceIFace()->addMessage((PlayerTypes)getSecondPlayer(),
true, GC.getEVENT_MESSAGE_TIME(), szString, "AS2D_DEAL_CANCELLED");
+ }
+ }
+
+ CLLNode<TradeData>* pNode;
+
+ for (pNode = headFirstTradesNode(); (pNode != NULL); pNode =
nextFirstTradesNode(pNode))
+ {
+ endTrade(pNode->m_data, getFirstPlayer(), getSecondPlayer(), bKillTeam);
+ }
+
+ for (pNode = headSecondTradesNode(); (pNode != NULL); pNode =
nextSecondTradesNode(pNode))
+ {
+ endTrade(pNode->m_data, getSecondPlayer(), getFirstPlayer(), bKillTeam);
+ }
+
+ GC.getGameINLINE().deleteDeal(getID());
+}
+
+
+void CvDeal::addTrades(CLinkList<TradeData>* pFirstList,
CLinkList<TradeData>* pSecondList, bool bCheckAllowed)
+{
+ CLLNode<TradeData>* pNode;
+ bool bAlliance;
+ bool bSave;
+ int iValue;
+
+ if (isVassalTrade(pFirstList) && isVassalTrade(pSecondList))
+ {
+ return;
+ }
+
+ if (pFirstList != NULL)
+ {
+ for (pNode = pFirstList->head(); pNode; pNode = pFirstList->next(pNode))
+ {
+ if (bCheckAllowed)
+ {
+ if (!(GET_PLAYER(getFirstPlayer()).canTradeItem(getSecondPlayer(),
pNode->m_data)))
+ {
+ return;
+ }
+ }
+ }
+ }
+
+ if (pSecondList != NULL)
+ {
+ for (pNode = pSecondList->head(); pNode; pNode =
pSecondList->next(pNode))
+ {
+ if (bCheckAllowed
&& !(GET_PLAYER(getSecondPlayer()).canTradeItem(getFirstPlayer(),
pNode->m_data)))
+ {
+ return;
+ }
+ }
+ }
+
+ TeamTypes eFirstTeam = GET_PLAYER(getFirstPlayer()).getTeam();
+ TeamTypes eSecondTeam = GET_PLAYER(getSecondPlayer()).getTeam();
+
+ if (atWar(eFirstTeam, eSecondTeam))
+ {
+ // free vassals of capitulating team before peace is signed
+ if (isVassalTrade(pSecondList))
+ {
+ for (int iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ TeamTypes eLoopTeam = (TeamTypes) iI;
+ CvTeam& kLoopTeam = GET_TEAM(eLoopTeam);
+ if ((eLoopTeam != eFirstTeam) && (eLoopTeam != eSecondTeam))
+ {
+ if (kLoopTeam.isAlive() && kLoopTeam.isVassal(eSecondTeam))
+ {
+ GET_TEAM(eSecondTeam).freeVassal(eLoopTeam);
+ int iSecondSuccess =
GET_TEAM(eFirstTeam).AI_getWarSuccess(eSecondTeam) +
GC.getDefineINT("WAR_SUCCESS_CITY_CAPTURING") *
GET_TEAM(eSecondTeam).getNumCities();
+ GET_TEAM(eFirstTeam).AI_setWarSuccess(eLoopTeam,
std::max(iSecondSuccess, GET_TEAM(eFirstTeam).AI_getWarSuccess(eLoopTeam)));
+ }
+ }
+ }
+ }
+
+ if (isVassalTrade(pFirstList))
+ {
+ for (int iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ TeamTypes eLoopTeam = (TeamTypes) iI;
+ CvTeam& kLoopTeam = GET_TEAM(eLoopTeam);
+ if ((eLoopTeam != eFirstTeam) && (eLoopTeam != eSecondTeam))
+ {
+ if (kLoopTeam.isAlive() && kLoopTeam.isVassal(eFirstTeam))
+ {
+ GET_TEAM(eFirstTeam).freeVassal(eLoopTeam);
+ int iFirstSuccess =
GET_TEAM(eSecondTeam).AI_getWarSuccess(eFirstTeam) +
GC.getDefineINT("WAR_SUCCESS_CITY_CAPTURING") *
GET_TEAM(eFirstTeam).getNumCities();
+ GET_TEAM(eSecondTeam).AI_setWarSuccess(eLoopTeam,
std::max(iFirstSuccess, GET_TEAM(eSecondTeam).AI_getWarSuccess(eLoopTeam)));
+ }
+ }
+ }
+ }
+
+ GET_TEAM(eFirstTeam).makePeace(eSecondTeam, !isVassalTrade(pFirstList)
&& !isVassalTrade(pSecondList));
+ }
+ else
+ {
+ if (!isPeaceDealBetweenOthers(pFirstList, pSecondList))
+ {
+ if ((pSecondList != NULL) && (pSecondList->getLength() > 0))
+ {
+ iValue = GET_PLAYER(getFirstPlayer()).AI_dealVal(getSecondPlayer(),
pSecondList, true);
+
+ if ((pFirstList != NULL) && (pFirstList->getLength() > 0))
+ {
+
GET_PLAYER(getFirstPlayer()).AI_changePeacetimeTradeValue(getSecondPlayer(),
iValue);
+ // Sanguo Mod Performance start, added by poyuzhe 07.26.09
+
GET_PLAYER(getFirstPlayer()).AI_invalidateAttitudeCache(getSecondPlayer());
+
GET_PLAYER(getSecondPlayer()).AI_invalidateAttitudeCache(getFirstPlayer());
+ // Sanguo Mod Performance, end
+ }
+ else
+ {
+
GET_PLAYER(getFirstPlayer()).AI_changePeacetimeGrantValue(getSecondPlayer(),
iValue);
+ // Sanguo Mod Performance start, added by poyuzhe 07.26.09
+
GET_PLAYER(getFirstPlayer()).AI_invalidateAttitudeCache(getSecondPlayer());
+ // Sanguo Mod Performance, end
+ }
+ }
+ if ((pFirstList != NULL) && (pFirstList->getLength() > 0))
+ {
+ iValue = GET_PLAYER(getSecondPlayer()).AI_dealVal(getFirstPlayer(),
pFirstList, true);
+
+ if ((pSecondList != NULL) && (pSecondList->getLength() > 0))
+ {
+
GET_PLAYER(getSecondPlayer()).AI_changePeacetimeTradeValue(getFirstPlayer(),
iValue);
+ // Sanguo Mod Performance start, added by poyuzhe 07.26.09
+
GET_PLAYER(getFirstPlayer()).AI_invalidateAttitudeCache(getSecondPlayer());
+
GET_PLAYER(getSecondPlayer()).AI_invalidateAttitudeCache(getFirstPlayer());
+ // Sanguo Mod Performance, end
+ }
+ else
+ {
+
GET_PLAYER(getSecondPlayer()).AI_changePeacetimeGrantValue(getFirstPlayer(),
iValue);
+ // Sanguo Mod Performance start, added by poyuzhe 07.26.09
+
GET_PLAYER(getSecondPlayer()).AI_invalidateAttitudeCache(getFirstPlayer());
+ // Sanguo Mod Performance, end
+ }
+ }
+ }
+ }
+
+ if (pFirstList != NULL)
+ {
+ for (pNode = pFirstList->head(); pNode; pNode = pFirstList->next(pNode))
+ {
+ bSave = startTrade(pNode->m_data, getFirstPlayer(), getSecondPlayer());
+
+ if (bSave)
+ {
+ insertAtEndFirstTrades(pNode->m_data);
+ }
+ }
+ }
+
+ if (pSecondList != NULL)
+ {
+ for (pNode = pSecondList->head(); pNode; pNode =
pSecondList->next(pNode))
+ {
+ bSave = startTrade(pNode->m_data, getSecondPlayer(), getFirstPlayer());
+
+ if (bSave)
+ {
+ insertAtEndSecondTrades(pNode->m_data);
+ }
+ }
+ }
+
+ bAlliance = false;
+
+ if (pFirstList != NULL)
+ {
+ for (pNode = pFirstList->head(); pNode; pNode = pFirstList->next(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_PERMANENT_ALLIANCE)
+ {
+ bAlliance = true;
+ }
+ }
+ }
+
+ if (pSecondList != NULL)
+ {
+ for (pNode = pSecondList->head(); pNode; pNode =
pSecondList->next(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_PERMANENT_ALLIANCE)
+ {
+ bAlliance = true;
+ }
+ }
+ }
+
+ if (bAlliance)
+ {
+ if (eFirstTeam < eSecondTeam)
+ {
+ GET_TEAM(eFirstTeam).addTeam(eSecondTeam);
+ }
+ else if (eSecondTeam < eFirstTeam)
+ {
+ GET_TEAM(eSecondTeam).addTeam(eFirstTeam);
+ }
+ }
+}
+
+
+void CvDeal::doTurn()
+{
+ int iValue;
+
+ if (!isPeaceDeal())
+ {
+ if (getLengthSecondTrades() > 0)
+ {
+ iValue = (GET_PLAYER(getFirstPlayer()).AI_dealVal(getSecondPlayer(),
getSecondTrades()) / GC.getDefineINT("PEACE_TREATY_LENGTH"));
+
+ if (getLengthFirstTrades() > 0)
+ {
+
GET_PLAYER(getFirstPlayer()).AI_changePeacetimeTradeValue(getSecondPlayer(),
iValue);
+ }
+ else
+ {
+
GET_PLAYER(getFirstPlayer()).AI_changePeacetimeGrantValue(getSecondPlayer(),
iValue);
+ }
+ }
+
+ if (getLengthFirstTrades() > 0)
+ {
+ iValue = (GET_PLAYER(getSecondPlayer()).AI_dealVal(getFirstPlayer(),
getFirstTrades()) / GC.getDefineINT("PEACE_TREATY_LENGTH"));
+
+ if (getLengthSecondTrades() > 0)
+ {
+
GET_PLAYER(getSecondPlayer()).AI_changePeacetimeTradeValue(getFirstPlayer(),
iValue);
+ }
+ else
+ {
+
GET_PLAYER(getSecondPlayer()).AI_changePeacetimeGrantValue(getFirstPlayer(),
iValue);
+ }
+ }
+ }
+}
+
+
+// XXX probably should have some sort of message for the user or
something...
+void CvDeal::verify()
+{
+ CLLNode<TradeData>* pNode;
+ bool bCancelDeal;
+
+ bCancelDeal = false;
+
+ for (pNode = headFirstTradesNode(); (pNode != NULL); pNode =
nextFirstTradesNode(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_RESOURCES)
+ {
+ // XXX embargoes?
+ if
((GET_PLAYER(getFirstPlayer()).getNumTradeableBonuses((BonusTypes)(pNode->m_data.m_iData))
< 0) ||
+
!(GET_PLAYER(getFirstPlayer()).canTradeNetworkWith(getSecondPlayer())))
+ {
+ bCancelDeal = true;
+ }
+ }
+ }
+
+ for (pNode = headSecondTradesNode(); (pNode != NULL); pNode =
nextSecondTradesNode(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_RESOURCES)
+ {
+ // XXX embargoes?
+ if
((GET_PLAYER(getSecondPlayer()).getNumTradeableBonuses((BonusTypes)(pNode->m_data.m_iData))
< 0) ||
+
!(GET_PLAYER(getSecondPlayer()).canTradeNetworkWith(getFirstPlayer())))
+ {
+ bCancelDeal = true;
+ }
+ }
+ }
+
+ if (isCancelable(NO_PLAYER))
+ {
+ if (isPeaceDeal())
+ {
+ bCancelDeal = true;
+ }
+ }
+
+ if (bCancelDeal)
+ {
+ kill();
+ }
+}
+
+
+bool CvDeal::isPeaceDeal() const
+{
+ CLLNode<TradeData>* pNode;
+
+ for (pNode = headFirstTradesNode(); (pNode != NULL); pNode =
nextFirstTradesNode(pNode))
+ {
+ if (pNode->m_data.m_eItemType == getPeaceItem())
+ {
+ return true;
+ }
+ }
+
+ for (pNode = headSecondTradesNode(); (pNode != NULL); pNode =
nextSecondTradesNode(pNode))
+ {
+ if (pNode->m_data.m_eItemType == getPeaceItem())
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CvDeal::isVassalDeal() const
+{
+ return (isVassalTrade(&m_firstTrades) || isVassalTrade(&m_secondTrades));
+}
+
+bool CvDeal::isVassalTrade(const CLinkList<TradeData>* pList)
+{
+ if (pList)
+ {
+ for (CLLNode<TradeData>* pNode = pList->head(); pNode != NULL; pNode =
pList->next(pNode))
+ {
+ if (isVassal(pNode->m_data.m_eItemType))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+bool CvDeal::isUncancelableVassalDeal(PlayerTypes eByPlayer, CvWString*
pszReason) const
+{
+ CLLNode<TradeData>* pNode;
+ CvWStringBuffer szBuffer;
+
+ for (pNode = headFirstTradesNode(); (pNode != NULL); pNode =
nextFirstTradesNode(pNode))
+ {
+ if (isVassal(pNode->m_data.m_eItemType))
+ {
+ if (eByPlayer == getSecondPlayer())
+ {
+ if (pszReason)
+ {
+ *pszReason += gDLL->getText("TXT_KEY_MISC_DEAL_NO_CANCEL_EVER");
+ }
+
+ return true;
+ }
+ }
+
+ if (pNode->m_data.m_eItemType == TRADE_SURRENDER)
+ {
+ CvTeam& kVassal = GET_TEAM(GET_PLAYER(getFirstPlayer()).getTeam());
+ TeamTypes eMaster = GET_PLAYER(getSecondPlayer()).getTeam();
+
+ // Sanguo Mod Civilization Trait, start, by poyuzhe 12.21.08
+ // Zang Ba, TRAIT_DIPLOMATIC
+ bool bDiplomatic = false;
+ for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
+ {
+ if (bDiplomatic)
+ {
+ break;
+ }
+ if (GET_PLAYER((PlayerTypes)iI).getTeam() ==
kVassal.getID())
+ {
+ for (int iJ = 0; iJ < GC.getNumTraitInfos(); iJ++)
+ {
+ if
(GET_PLAYER((PlayerTypes)iI).hasTrait((TraitTypes)iJ) &&
GC.getTraitInfo((TraitTypes)iJ).isDiplomatic())
+ {
+ bDiplomatic = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (bDiplomatic)
+ {
+ return false;
+ }
+ // Sanguo Mod Emperor, end
+
+ if (!kVassal.canVassalRevolt(eMaster))
+ {
+ if (pszReason)
+ {
+ szBuffer.clear();
+ GAMETEXT.setVassalRevoltHelp(szBuffer, eMaster,
GET_PLAYER(getFirstPlayer()).getTeam());
+ *pszReason = szBuffer.getCString();
+ }
+
+ return true;
+ }
+ }
+ }
+
+ for (pNode = headSecondTradesNode(); (pNode != NULL); pNode =
nextSecondTradesNode(pNode))
+ {
+ if (isVassal(pNode->m_data.m_eItemType))
+ {
+ if (eByPlayer == getFirstPlayer())
+ {
+ if (pszReason)
+ {
+ *pszReason += gDLL->getText("TXT_KEY_MISC_DEAL_NO_CANCEL_EVER");
+ }
+
+ return true;
+ }
+ }
+
+ if (pNode->m_data.m_eItemType == TRADE_SURRENDER)
+ {
+ CvTeam& kVassal = GET_TEAM(GET_PLAYER(getSecondPlayer()).getTeam());
+ TeamTypes eMaster = GET_PLAYER(getFirstPlayer()).getTeam();
+
+ if (!kVassal.canVassalRevolt(eMaster))
+ {
+ if (pszReason)
+ {
+ if (pszReason)
+ {
+ szBuffer.clear();
+ GAMETEXT.setVassalRevoltHelp(szBuffer, eMaster,
GET_PLAYER(getFirstPlayer()).getTeam());
+ *pszReason = szBuffer.getCString();
+ }
+ }
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool CvDeal::isVassalTributeDeal(const CLinkList<TradeData>* pList)
+{
+ for (CLLNode<TradeData>* pNode = pList->head(); pNode != NULL; pNode =
pList->next(pNode))
+ {
+ if (pNode->m_data.m_eItemType != TRADE_RESOURCES)
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool CvDeal::isPeaceDealBetweenOthers(CLinkList<TradeData>* pFirstList,
CLinkList<TradeData>* pSecondList) const
+{
+ CLLNode<TradeData>* pNode;
+
+ if (pFirstList != NULL)
+ {
+ for (pNode = pFirstList->head(); pNode; pNode = pFirstList->next(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_PEACE)
+ {
+ return true;
+ }
+ }
+ }
+
+ if (pSecondList != NULL)
+ {
+ for (pNode = pSecondList->head(); pNode; pNode =
pSecondList->next(pNode))
+ {
+ if (pNode->m_data.m_eItemType == TRADE_PEACE)
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+
+int CvDeal::getID() const
+{
+ return m_iID;
+}
+
+
+void CvDeal::setID(int iID)
+{
+ m_iID = iID;
+}
+
+
+int CvDeal::getInitialGameTurn() const
+{
+ return m_iInitialGameTurn;
+}
+
+
+void CvDeal::setInitialGameTurn(int iNewValue)
+{
+ m_iInitialGameTurn = iNewValue;
+}
+
+
+PlayerTypes CvDeal::getFirstPlayer() const
+{
+ return m_eFirstPlayer;
+}
+
+
+PlayerTypes CvDeal::getSecondPlayer() const
+{
+ return m_eSecondPlayer;
+}
+
+
+void CvDeal::clearFirstTrades()
+{
+ m_firstTrades.clear();
+}
+
+
+void CvDeal::insertAtEndFirstTrades(TradeData trade)
+{
+ m_firstTrades.insertAtEnd(trade);
+}
+
+
+CLLNode<TradeData>* CvDeal::nextFirstTradesNode(CLLNode<TradeData>* pNode)
const
+{
+ return m_firstTrades.next(pNode);
+}
+
+
+int CvDeal::getLengthFirstTrades() const
+{
+ return m_firstTrades.getLength();
+}
+
+
+CLLNode<TradeData>* CvDeal::headFirstTradesNode() const
+{
+ return m_firstTrades.head();
+}
+
+
+const CLinkList<TradeData>* CvDeal::getFirstTrades() const
+{
+ return &(m_firstTrades);
+}
+
+
+void CvDeal::clearSecondTrades()
+{
+ m_secondTrades.clear();
+}
+
+
+void CvDeal::insertAtEndSecondTrades(TradeData trade)
+{
+ m_secondTrades.insertAtEnd(trade);
+}
+
+
+CLLNode<TradeData>* CvDeal::nextSecondTradesNode(CLLNode<TradeData>*
pNode) const
+{
+ return m_secondTrades.next(pNode);
+}
+
+
+int CvDeal::getLengthSecondTrades() const
+{
+ return m_secondTrades.getLength();
+}
+
+
+CLLNode<TradeData>* CvDeal::headSecondTradesNode() const
+{
+ return m_secondTrades.head();
+}
+
+
+const CLinkList<TradeData>* CvDeal::getSecondTrades() const
+{
+ return &(m_secondTrades);
+}
+
+
+void CvDeal::write(FDataStreamBase* pStream)
+{
+ uint uiFlag=0;
+ pStream->Write(uiFlag); // flag for expansion
+
+ pStream->Write(m_iID);
+ pStream->Write(m_iInitialGameTurn);
+
+ pStream->Write(m_eFirstPlayer);
+ pStream->Write(m_eSecondPlayer);
+
+ m_firstTrades.Write(pStream);
+ m_secondTrades.Write(pStream);
+}
+
+void CvDeal::read(FDataStreamBase* pStream)
+{
+ uint uiFlag=0;
+ pStream->Read(&uiFlag); // flags for expansion
+
+ pStream->Read(&m_iID);
+ pStream->Read(&m_iInitialGameTurn);
+
+ pStream->Read((int*)&m_eFirstPlayer);
+ pStream->Read((int*)&m_eSecondPlayer);
+
+ m_firstTrades.Read(pStream);
+ m_secondTrades.Read(pStream);
+}
+
+// Protected Functions...
+
+// Returns true if the trade should be saved...
+bool CvDeal::startTrade(TradeData trade, PlayerTypes eFromPlayer,
PlayerTypes eToPlayer)
+{
+ CivicTypes* paeNewCivics;
+ CvCity* pCity;
+ CvPlot* pLoopPlot;
+ bool bSave;
+ int iI;
+
+ bSave = false;
+
+ switch (trade.m_eItemType)
+ {
+ case TRADE_TECHNOLOGIES:
+
GET_TEAM(GET_PLAYER(eToPlayer).getTeam()).setHasTech(((TechTypes)trade.m_iData),
true, eToPlayer, true, true);
+
GET_TEAM(GET_PLAYER(eToPlayer).getTeam()).setNoTradeTech(((TechTypes)trade.m_iData),
true);
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iI).getTeam() ==
GET_PLAYER(eToPlayer).getTeam())
+ {
+ GET_PLAYER((PlayerTypes)iI).AI_changeMemoryCount(eFromPlayer,
MEMORY_TRADED_TECH_TO_US, 1);
+ }
+ else
+ {
+ if
(GET_TEAM(GET_PLAYER((PlayerTypes)iI).getTeam()).isHasMet(GET_PLAYER(eToPlayer).getTeam()))
+ {
+ GET_PLAYER((PlayerTypes)iI).AI_changeMemoryCount(eToPlayer,
MEMORY_RECEIVED_TECH_FROM_ANY, 1);
+ }
+ }
+ }
+ }
+ break;
+
+ case TRADE_RESOURCES:
+ GET_PLAYER(eFromPlayer).changeBonusExport(((BonusTypes)trade.m_iData),
1);
+ GET_PLAYER(eToPlayer).changeBonusImport(((BonusTypes)trade.m_iData), 1);
+ bSave = true;
+ break;
+
+ case TRADE_CITIES:
+ pCity = GET_PLAYER(eFromPlayer).getCity(trade.m_iData);
+ if (pCity != NULL)
+ {
+ pCity->doTask(TASK_GIFT, eToPlayer);
+ }
+ break;
+
+ // Sanguo Mod trade prisoner, start, added by poyuzhe 09.10.09
+ case TRADE_HERO:
+ GET_PLAYER(eFromPlayer).releaseHero((HeroTypes)trade.m_iData);
+ break;
+ // Sanguo Mod end
+
+ case TRADE_GOLD:
+ GET_PLAYER(eFromPlayer).changeGold(-(trade.m_iData));
+ GET_PLAYER(eToPlayer).changeGold(trade.m_iData);
+ GET_PLAYER(eFromPlayer).AI_changeGoldTradedTo(eToPlayer, trade.m_iData);
+
+ // Python Event
+ gDLL->getEventReporterIFace()->playerGoldTrade(eFromPlayer, eToPlayer,
trade.m_iData);
+
+ break;
+
+ case TRADE_GOLD_PER_TURN:
+ GET_PLAYER(eFromPlayer).changeGoldPerTurnByPlayer(eToPlayer,
-(trade.m_iData));
+ GET_PLAYER(eToPlayer).changeGoldPerTurnByPlayer(eFromPlayer,
trade.m_iData);
+ bSave = true;
+ break;
+
+ case TRADE_MAPS:
+ for (iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
+ {
+ pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
+
+ if (pLoopPlot->isRevealed(GET_PLAYER(eFromPlayer).getTeam(), false))
+ {
+ pLoopPlot->setRevealed(GET_PLAYER(eToPlayer).getTeam(), true, false,
GET_PLAYER(eFromPlayer).getTeam(), false);
+ }
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iI).getTeam() ==
GET_PLAYER(eToPlayer).getTeam())
+ {
+ GET_PLAYER((PlayerTypes)iI).updatePlotGroups();
+ }
+ }
+ }
+ break;
+
+ case TRADE_SURRENDER:
+ case TRADE_VASSAL:
+ if (trade.m_iData == 0)
+ {
+ startTeamTrade(trade.m_eItemType, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam(), false);
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setVassal(GET_PLAYER(eToPlayer).getTeam(),
true, TRADE_SURRENDER == trade.m_eItemType);
+ }
+ else
+ {
+ bSave = true;
+ }
+
+
+ break;
+
+ case TRADE_PEACE:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).makePeace((TeamTypes)trade.m_iData);
+ break;
+
+ case TRADE_WAR:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).declareWar(((TeamTypes)trade.m_iData),
true, NO_WARPLAN);
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iI).getTeam() ==
((TeamTypes)trade.m_iData))
+ {
+ GET_PLAYER((PlayerTypes)iI).AI_changeMemoryCount(eToPlayer,
MEMORY_HIRED_WAR_ALLY, 1);
+ }
+ }
+ }
+ break;
+
+ case TRADE_EMBARGO:
+ GET_PLAYER(eFromPlayer).stopTradingWithTeam((TeamTypes)trade.m_iData);
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iI).getTeam() ==
((TeamTypes)trade.m_iData))
+ {
+ GET_PLAYER((PlayerTypes)iI).AI_changeMemoryCount(eToPlayer,
MEMORY_HIRED_TRADE_EMBARGO, 1);
+ }
+ }
+ }
+ break;
+
+ case TRADE_CIVIC:
+ paeNewCivics = new CivicTypes[GC.getNumCivicOptionInfos()];
+
+ for (iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
+ {
+ paeNewCivics[iI] =
GET_PLAYER(eFromPlayer).getCivics((CivicOptionTypes)iI);
+ }
+
+
paeNewCivics[GC.getCivicInfo((CivicTypes)trade.m_iData).getCivicOptionType()]
= ((CivicTypes)trade.m_iData);
+
+ GET_PLAYER(eFromPlayer).revolution(paeNewCivics, true);
+
+ if (GET_PLAYER(eFromPlayer).AI_getCivicTimer() <
GC.getDefineINT("PEACE_TREATY_LENGTH"))
+ {
+
GET_PLAYER(eFromPlayer).AI_setCivicTimer(GC.getDefineINT("PEACE_TREATY_LENGTH"));
+ }
+
+ SAFE_DELETE_ARRAY(paeNewCivics);
+ break;
+
+ case TRADE_RELIGION:
+ GET_PLAYER(eFromPlayer).convert((ReligionTypes)trade.m_iData);
+
+ if (GET_PLAYER(eFromPlayer).AI_getReligionTimer() <
GC.getDefineINT("PEACE_TREATY_LENGTH"))
+ {
+
GET_PLAYER(eFromPlayer).AI_setReligionTimer(GC.getDefineINT("PEACE_TREATY_LENGTH"));
+ }
+ break;
+
+ case TRADE_OPEN_BORDERS:
+ if (trade.m_iData == 0)
+ {
+ startTeamTrade(TRADE_OPEN_BORDERS, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam(), true);
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setOpenBorders(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
true);
+ }
+ else
+ {
+ bSave = true;
+ }
+ break;
+
+ case TRADE_DEFENSIVE_PACT:
+ if (trade.m_iData == 0)
+ {
+ startTeamTrade(TRADE_DEFENSIVE_PACT, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam(), true);
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setDefensivePact(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
true);
+ }
+ else
+ {
+ bSave = true;
+ }
+ break;
+
+ case TRADE_PERMANENT_ALLIANCE:
+ break;
+
+ case TRADE_PEACE_TREATY:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setForcePeace(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
true);
+ bSave = true;
+ break;
+
+ default:
+ FAssert(false);
+ break;
+ }
+
+ return bSave;
+}
+
+
+void CvDeal::endTrade(TradeData trade, PlayerTypes eFromPlayer,
PlayerTypes eToPlayer, bool bTeam)
+{
+ int iI, iJ;
+
+ switch (trade.m_eItemType)
+ {
+ case TRADE_TECHNOLOGIES:
+ FAssert(false);
+ break;
+
+ case TRADE_RESOURCES:
+ GET_PLAYER(eToPlayer).changeBonusImport(((BonusTypes)trade.m_iData), -1);
+ GET_PLAYER(eFromPlayer).changeBonusExport(((BonusTypes)trade.m_iData),
-1);
+ break;
+
+ case TRADE_CITIES:
+ case TRADE_GOLD:
+ // Sanguo Mod trade prisoner, start, added by poyuzhe 09.10.09
+ case TRADE_HERO:
+ // Sanguo Mod end
+ FAssert(false);
+ break;
+
+ case TRADE_GOLD_PER_TURN:
+ GET_PLAYER(eFromPlayer).changeGoldPerTurnByPlayer(eToPlayer,
trade.m_iData);
+ GET_PLAYER(eToPlayer).changeGoldPerTurnByPlayer(eFromPlayer,
-(trade.m_iData));
+ break;
+
+ case TRADE_MAPS:
+ case TRADE_PEACE:
+ case TRADE_WAR:
+ case TRADE_EMBARGO:
+ case TRADE_CIVIC:
+ case TRADE_RELIGION:
+ FAssert(false);
+ break;
+
+ case TRADE_VASSAL:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setVassal(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
false, false);
+ if (bTeam)
+ {
+ endTeamTrade(TRADE_VASSAL, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam());
+ }
+ break;
+
+ case TRADE_SURRENDER:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setVassal(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
false, true);
+ if (bTeam)
+ {
+ endTeamTrade(TRADE_SURRENDER, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam());
+ }
+ break;
+
+ case TRADE_OPEN_BORDERS:
+
GET_TEAM(GET_PLAYER(eFromPlayer).getTeam()).setOpenBorders(((TeamTypes)(GET_PLAYER(eToPlayer).getTeam())),
false);
+ if (bTeam)
+ {
+ endTeamTrade(TRADE_OPEN_BORDERS, GET_PLAYER(eFromPlayer).getTeam(),
GET_PLAYER(eToPlayer).getTeam());
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDeal.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,97 @@
+#pragma once
+
+// CvDeal.h
+
+#ifndef CIV4_DEAL_H
+#define CIV4_DEAL_H
+
+//#include "CvStructs.h"
+#include "LinkedList.h"
+
+class CvDeal
+{
+
+public:
+
+ CvDeal();
+ virtual ~CvDeal();
+
+ void init(int iID, PlayerTypes eFirstPlayer, PlayerTypes eSecondPlayer);
+ void uninit();
+ void reset(int iID = 0, PlayerTypes eFirstPlayer = NO_PLAYER, PlayerTypes
eSecondPlayer = NO_PLAYER);
+
+ DllExport void kill(bool bKillTeam = true);
+
+ void addTrades(CLinkList<TradeData>* pFirstList, CLinkList<TradeData>*
pSecondList, bool bCheckAllowed);
+
+ void doTurn();
+
+ void verify();
+
+ bool isPeaceDeal() const;
+ bool isPeaceDealBetweenOthers(CLinkList<TradeData>* pFirstList,
CLinkList<TradeData>* pSecondList) const;
+ bool isVassalDeal() const;
+ bool isUncancelableVassalDeal(PlayerTypes eByPlayer, CvWString* pszReason
= NULL) const;
+ DllExport static bool isVassalTributeDeal(const CLinkList<TradeData>*
pList);
+
+ DllExport int getID() const;
+ void setID(int iID);
+
+ int getInitialGameTurn() const;
+ void setInitialGameTurn(int iNewValue);
+
+ DllExport PlayerTypes getFirstPlayer() const;
+ DllExport PlayerTypes getSecondPlayer() const;
+
+ void clearFirstTrades();
+ void insertAtEndFirstTrades(TradeData trade);
+ DllExport CLLNode<TradeData>* nextFirstTradesNode(CLLNode<TradeData>*
pNode) const;
+ int getLengthFirstTrades() const;
+ DllExport CLLNode<TradeData>* headFirstTradesNode() const;
+ const CLinkList<TradeData>* getFirstTrades() const;
+
+ void clearSecondTrades();
+ void insertAtEndSecondTrades(TradeData trade);
+ DllExport CLLNode<TradeData>* nextSecondTradesNode(CLLNode<TradeData>*
pNode) const;
+ int getLengthSecondTrades() const;
+ DllExport CLLNode<TradeData>* headSecondTradesNode() const;
+ const CLinkList<TradeData>* getSecondTrades() const;
+
+ DllExport bool isCancelable(PlayerTypes eByPlayer = NO_PLAYER, CvWString*
pszReason = NULL);
+ DllExport int turnsToCancel(PlayerTypes eByPlayer = NO_PLAYER);
+
+ DllExport static bool isAnnual(TradeableItems eItem);
+ DllExport static bool isDual(TradeableItems eItem, bool bExcludePeace =
false);
+ DllExport static bool hasData(TradeableItems eItem);
+ DllExport static bool isGold(TradeableItems eItem);
+ DllExport static bool isEndWar(TradeableItems eItem);
+ DllExport static bool isVassal(TradeableItems eItem);
+ DllExport static TradeableItems getPeaceItem();
+ DllExport static TradeableItems getGoldItem();
+ DllExport static TradeableItems getGoldPerTurnItem();
+
+ void read(FDataStreamBase* pStream);
+ void write(FDataStreamBase* pStream);
+
+protected:
+
+ bool startTrade(TradeData trade, PlayerTypes eFromPlayer, PlayerTypes
eToPlayer);
+ void endTrade(TradeData trade, PlayerTypes eFromPlayer, PlayerTypes
eToPlayer, bool bTeam);
+
+ void startTeamTrade(TradeableItems eItem, TeamTypes eFromTeam, TeamTypes
eToTeam, bool bDual);
+ void endTeamTrade(TradeableItems eItem, TeamTypes eFromTeam, TeamTypes
eToTeam);
+
+ static bool isVassalTrade(const CLinkList<TradeData>* pFirstList);
+
+ int m_iID;
+ int m_iInitialGameTurn;
+
+ PlayerTypes m_eFirstPlayer;
+ PlayerTypes m_eSecondPlayer;
+
+ CLinkList<TradeData> m_firstTrades;
+ CLinkList<TradeData> m_secondTrades;
+
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDefines.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,141 @@
+#pragma once
+
+#ifndef CVDEFINES_H
+#define CVDEFINES_H
+
+// defines.h
+
+// The following #defines should not be moddable...
+
+#define MOVE_IGNORE_DANGER (0x00000001)
+#define MOVE_SAFE_TERRITORY (0x00000002)
+#define MOVE_NO_ENEMY_TERRITORY (0x00000004)
+#define MOVE_DECLARE_WAR (0x00000008)
+#define MOVE_DIRECT_ATTACK (0x00000010)
+#define MOVE_THROUGH_ENEMY (0x00000020)
+#define MOVE_MAX_MOVES (0x00000040)
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
01/01/09 jdog5000 */
+/**
*/
+/** General
AI
*/
+/*************************************************************************************************/
+// These two flags signal to weight the cost of moving through or adjacent
to enemy territory higher
+// Used to reduce exposure to attack for approaching enemy cities
+#define MOVE_AVOID_ENEMY_WEIGHT_2 (0x00000080)
+#define MOVE_AVOID_ENEMY_WEIGHT_3 (0x00000100)
+/*************************************************************************************************/
+/** BETTER_BTS_AI_MOD
END */
+/*************************************************************************************************/
+
+
+#define RANDPLOT_LAND (0x00000001)
+#define RANDPLOT_UNOWNED (0x00000002)
+#define RANDPLOT_ADJACENT_UNOWNED (0x00000004)
+#define RANDPLOT_ADJACENT_LAND (0x00000008)
+#define RANDPLOT_PASSIBLE (0x00000010)
+#define RANDPLOT_NOT_VISIBLE_TO_CIV (0x00000020)
+#define RANDPLOT_NOT_CITY (0x00000040)
+
+#ifdef _USRDLL
+
+// sanguo mod start, 18 -> 32
+#define MAX_CIV_PLAYERS (32)
+// sanguo mod end
+
+#else
+#define MAX_CIV_PLAYERS
(CvGlobals::getInstance().getMaxCivPlayers())
+#endif
+
+#define MAX_CIV_TEAMS (MAX_CIV_PLAYERS)
+#define MAX_PLAYERS (MAX_CIV_PLAYERS + 1)
+#define MAX_TEAMS (MAX_PLAYERS)
+#define BARBARIAN_PLAYER ((PlayerTypes)MAX_CIV_PLAYERS)
+#define BARBARIAN_TEAM ((TeamTypes)MAX_CIV_TEAMS)
+
+// Char Count limit for edit boxes
+#define PREFERRED_EDIT_CHAR_COUNT (15)
+#define MAX_GAMENAME_CHAR_COUNT (32)
+#define MAX_PLAYERINFO_CHAR_COUNT (32)
+#define MAX_PLAYEREMAIL_CHAR_COUNT (64)
+#define MAX_PASSWORD_CHAR_COUNT (32)
+#define MAX_GSLOGIN_CHAR_COUNT (17)
+#define MAX_GSEMAIL_CHAR_COUNT (50)
+#define MAX_GSPASSWORD_CHAR_COUNT (30)
+#define MAX_CHAT_CHAR_COUNT (256)
+#define MAX_ADDRESS_CHAR_COUNT (64)
+
+#define INVALID_PLOT_COORD (-(MAX_INT)) // don't use -1 since
that is a valid wrap coordinate
+#define DIRECTION_RADIUS (1)
+#define DIRECTION_DIAMETER ((DIRECTION_RADIUS * 2) + 1)
+#define NUM_CITY_PLOTS (21)
+#define CITY_HOME_PLOT (0)
+#define CITY_PLOTS_RADIUS (2)
+#define CITY_PLOTS_DIAMETER ((CITY_PLOTS_RADIUS*2) + 1)
+
+#define GAME_NAME ("Game")
+
+#define LANDSCAPE_FOW_RESOLUTION (4)
+
+#define Z_ORDER_LAYER (-0.1f)
+#define Z_ORDER_LEVEL (-0.3f)
+
+#define CIV4_GUID "civ4bts"
+#define CIV4_PRODUCT_ID 11081
+#define CIV4_NAMESPACE_ID 17
+#define CIV4_NAMESPACE_EXT "-tk"
+
+#define MAP_TRANSFER_EXT "_t"
+
+#define USER_CHANNEL_PREFIX "#civ4buser!"
+
+#define SETCOLR L"<color=%d,%d,%d,%d>"
+#define ENDCOLR L"</color>"
+#define NEWLINE L"\n"
+#define SEPARATOR L"\n-----------------------"
+#define TEXT_COLOR(szColor)
((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().r
* 255)),
((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().g
* 255)),
((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().b
* 255)),
((int)(GC.getColorInfo((ColorTypes)GC.getInfoTypeForString(szColor)).getColor().a
* 255))
+
+// Version Verification files and folders
+#ifdef _DEBUG
+#define CIV4_EXE_FILE ".\\Civ4BeyondSword_DEBUG.exe"
+#define CIV4_DLL_FILE ".\\Assets\\CvGameCoreDLL_DEBUG.dll"
+#else
+#define CIV4_EXE_FILE ".\\Civ4BeyondSword.exe"
+#define CIV4_DLL_FILE ".\\Assets\\CvGameCoreDLL.dll"
+#endif
+#define CIV4_SHADERS ".\\Shaders\\FXO"
+#define CIV4_ASSETS_PYTHON ".\\Assets\\Python"
+#define CIV4_ASSETS_XML ".\\Assets\\XML"
+
+#define TUTORIAL_MOD_NAME "Mods\\Tutorial\\"
+
+#define MAX_PLAYER_NAME_LEN (64)
+#define MAX_VOTE_CHOICES (8)
+#define VOTE_TIMEOUT (600000) // 10 minute vote timeout -
temporary
+
+#define ANIMATION_DEFAULT (1) // Default idle animation
+
+// python module names
+#define PYDebugToolModule "CvDebugInterface"
+#define PYScreensModule "CvScreensInterface"
+#define PYCivModule "CvAppInterface"
+#define PYWorldBuilderModule "CvWBInterface"
+#define PYPopupModule "CvPopupInterface"
+#define PYDiplomacyModule "CvDiplomacyInterface"
+#define PYUnitControlModule "CvUnitControlInterface"
+#define PYTextMgrModule "CvTextMgrInterface"
+#define PYPerfTestModule "CvPerfTest"
+#define PYDebugScriptsModule "DebugScripts"
+#define PYPitBossModule "PbMain"
+#define PYTranslatorModule "CvTranslator"
+#define PYGameModule "CvGameInterface"
+#define PYEventModule "CvEventInterface"
+#define PYRandomEventModule "CvRandomEventInterface"
+// Sanguo Mod Hero, start, added by poyuzhe 01.09.09
+#define PYSanguoModule "CvSanguoInterface"
+// Sanguo Mod Hero, end
+
+// Sanguo Mod Performance, start, added by poyuzhe 08.12.09
+#define DANGER_RANGE (4)
+// Sanguo Mod Performance, end
+
+#endif // CVDEFINES_H
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDiploParameters.cpp Sat Sep 19 06:38:49
2009
@@ -0,0 +1,270 @@
+#include "CvGameCoreDLL.h"
+#include "CvDiploParameters.h"
+
+CvDiploParameters::CvDiploParameters(PlayerTypes ePlayer) :
+ m_eWhoTalkingTo(ePlayer),
+ m_eCommentType(NO_DIPLOCOMMENT),
+ m_bRenegotiate(false),
+ m_bAIContact(false),
+ m_bPendingDelete(false),
+ m_iData(-1),
+ m_bHumanDiplo(false),
+ m_bOurOffering(false),
+ m_bTheirOffering(false)
+{
+ m_ourOffer.clear();
+ m_theirOffer.clear();
+}
+
+CvDiploParameters::~CvDiploParameters()
+{
+ m_ourOffer.clear();
+ m_theirOffer.clear();
+}
+
+void CvDiploParameters::setWhoTalkingTo(PlayerTypes eWhoTalkingTo)
+{
+ m_eWhoTalkingTo = eWhoTalkingTo;
+}
+
+PlayerTypes CvDiploParameters::getWhoTalkingTo() const
+{
+ return m_eWhoTalkingTo;
+}
+
+void addVar(std::vector<FVariable>& argsList, const wchar *arg)
+{
+ if (arg)
+ {
+ FVariable var;
+ var.m_eType = FVARTYPE_WSTRING;
+ var.m_wszValue = new wchar[wcslen(arg)+1];
+ wcscpy(var.m_wszValue, arg);
+ argsList.push_back(var);
+ }
+}
+
+void addVar(std::vector<FVariable>& argsList, int arg)
+{
+ if (arg != MAX_INT)
+ {
+ FVariable var;
+ var.m_eType = FVARTYPE_INT;
+ var.m_iValue = arg;
+ argsList.push_back(var);
+ }
+}
+
+#define SET_DIPLO_COMMENT_ARGS \
+{ \
+ std::vector<FVariable> argsList; \
+ addVar(argsList, arg1); \
+ addVar(argsList, arg2); \
+ addVar(argsList, arg3); \
+ setDiploComment(eCommentType, argsList.size() ? &argsList : NULL); \
+}
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
CvWString arg1, CvWString arg2, CvWString arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
CvWString arg1, CvWString arg2, int arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
CvWString arg1, int arg2, CvWString arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
CvWString arg1, int arg2, int arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
int arg1, CvWString arg2, CvWString arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
int arg1, CvWString arg2, int arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
int arg1, int arg2, CvWString arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
int arg1, int arg2, int arg3)
+SET_DIPLO_COMMENT_ARGS
+
+void CvDiploParameters::setDiploComment(DiploCommentTypes eCommentType,
const std::vector<FVariable>* args)
+{
+ m_eCommentType = eCommentType;
+ if (args)
+ m_diploCommentArgs = *args;
+}
+
+DiploCommentTypes CvDiploParameters::getDiploComment() const
+{
+ return m_eCommentType;
+}
+
+void CvDiploParameters::setOurOfferList(const CLinkList<TradeData>&
ourOffer)
+{
+ CLLNode<TradeData> *pNode;
+
+ m_ourOffer.clear();
+
+ for (pNode = ourOffer.head(); pNode; pNode = ourOffer.next(pNode))
+ {
+ m_ourOffer.insertAtEnd(pNode->m_data);
+ }
+}
+
+const CLinkList<TradeData>& CvDiploParameters::getOurOfferList() const
+{
+ return m_ourOffer;
+}
+
+void CvDiploParameters::setTheirOfferList(const CLinkList<TradeData>&
theirOffer)
+{
+ CLLNode<TradeData> *pNode;
+
+ m_theirOffer.clear();
+
+ for (pNode = theirOffer.head(); pNode; pNode = theirOffer.next(pNode))
+ {
+ m_theirOffer.insertAtEnd(pNode->m_data);
+ }
+}
+
+const CLinkList<TradeData>& CvDiploParameters::getTheirOfferList() const
+{
+ return m_theirOffer;
+}
+
+void CvDiploParameters::setRenegotiate(bool bValue)
+{
+ m_bRenegotiate = bValue;
+}
+
+bool CvDiploParameters::getRenegotiate() const
+{
+ return m_bRenegotiate;
+}
+
+void CvDiploParameters::setAIContact(bool bValue)
+{
+ m_bAIContact = bValue;
+}
+
+bool CvDiploParameters::getAIContact() const
+{
+ return m_bAIContact;
+}
+
+
+void CvDiploParameters::setPendingDelete(bool bPending)
+{
+ m_bPendingDelete = bPending;
+}
+
+bool CvDiploParameters::getPendingDelete() const
+{
+ return m_bPendingDelete;
+}
+
+
+void CvDiploParameters::setData(int iData)
+{
+ m_iData = iData;
+}
+
+int CvDiploParameters::getData() const
+{
+ return m_iData;
+}
+
+void CvDiploParameters::setHumanDiplo(bool bValue)
+{
+ m_bHumanDiplo = bValue;
+}
+
+bool CvDiploParameters::getHumanDiplo() const
+{
+ return m_bHumanDiplo;
+}
+
+void CvDiploParameters::setOurOffering(bool bValue)
+{
+ m_bOurOffering = bValue;
+}
+
+bool CvDiploParameters::getOurOffering() const
+{
+ return m_bOurOffering;
+}
+
+void CvDiploParameters::setTheirOffering(bool bValue)
+{
+ m_bTheirOffering = bValue;
+}
+
+bool CvDiploParameters::getTheirOffering() const
+{
+ return m_bTheirOffering;
+}
+
+void CvDiploParameters::setChatText(const wchar* szText)
+{
+ m_szChatText = szText;
+}
+
+const wchar* CvDiploParameters::getChatText() const
+{
+ return m_szChatText;
+}
+
+
+void CvDiploParameters::read(FDataStreamBase& stream)
+{
+ int iType;
+ uint uiFlag=0;
+ stream.Read(&uiFlag); // flags for expansion
+
+ stream.Read(&iType);
+ m_eWhoTalkingTo = (PlayerTypes)iType;
+ stream.Read(&iType);
+ m_eCommentType = (DiploCommentTypes)iType;
+ m_ourOffer.Read(&stream);
+ m_theirOffer.Read(&stream);
+ stream.Read(&m_bRenegotiate);
+ stream.Read(&m_bAIContact);
+ stream.Read(&m_iData);
+ stream.Read(&m_bHumanDiplo);
+ stream.Read(&m_bOurOffering);
+ stream.Read(&m_bTheirOffering);
+ stream.ReadString(m_szChatText);
+
+ // read diplo args vec
+ int i, iSize;
+ stream.Read(&iSize);
+ m_diploCommentArgs.resize(iSize);
+ for(i=0;i<iSize;i++)
+ m_diploCommentArgs[i].Read(&stream);
+}
+
+void CvDiploParameters::write(FDataStreamBase& stream) const
+{
+ uint uiFlag=0;
+ stream.Write(uiFlag); // flag for expansion
+
+ stream.Write(m_eWhoTalkingTo);
+ stream.Write(m_eCommentType);
+ m_ourOffer.Write(&stream);
+ m_theirOffer.Write(&stream);
+ stream.Write(m_bRenegotiate);
+ stream.Write(m_bAIContact);
+ stream.Write(m_iData);
+ stream.Write(m_bHumanDiplo);
+ stream.Write(m_bOurOffering);
+ stream.Write(m_bTheirOffering);
+ stream.WriteString(m_szChatText);
+
+ // write diplo args vec
+ int i, iSize = m_diploCommentArgs.size();
+ stream.Write(iSize);
+ for(i=0;i<iSize;i++)
+ m_diploCommentArgs[i].Write(&stream);
+}
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDiploParameters.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,71 @@
+#pragma once
+#ifndef CVDIPLOPARAMETERS_H
+#define CVDIPLOPARAMETERS_H
+
+#include "LinkedList.h"
+//#include "CvStructs.h"
+#include "FVariableSystem.h"
+
+class CvDiploParameters
+{
+public:
+ DllExport CvDiploParameters(PlayerTypes ePlayer);
+ DllExport virtual ~CvDiploParameters();
+
+ DllExport void setWhoTalkingTo(PlayerTypes eWhoTalkingTo);
+ DllExport PlayerTypes getWhoTalkingTo() const;
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, const
std::vector<FVariable>* args=NULL);
+
+ // allow 3 args either int or string. can't really use va_argslist here
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, CvWString
arg1, CvWString arg2="", CvWString arg3="");
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, CvWString
arg1, CvWString arg2, int arg3=MAX_INT);
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, CvWString
arg1, int arg2, CvWString arg3="");
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, CvWString
arg1, int arg2, int arg3=MAX_INT);
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, int arg1,
CvWString arg2="", CvWString arg3="");
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, int arg1,
CvWString arg2, int arg3=MAX_INT);
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, int arg1,
int arg2=MAX_INT, CvWString arg3="");
+ DllExport void setDiploComment(DiploCommentTypes eCommentType, int arg1,
int arg2, int arg3=MAX_INT);
+
+ DllExport DiploCommentTypes getDiploComment() const;
+ DllExport void setOurOfferList(const CLinkList<TradeData>& ourOffer);
+ DllExport const CLinkList<TradeData>& getOurOfferList() const;
+ DllExport void setTheirOfferList(const CLinkList<TradeData>& theirOffer);
+ DllExport const CLinkList<TradeData>& getTheirOfferList() const;
+ DllExport void setRenegotiate(bool bValue);
+ DllExport bool getRenegotiate() const;
+ DllExport void setAIContact(bool bValue);
+ DllExport bool getAIContact() const;
+ DllExport void setPendingDelete(bool bPending);
+ DllExport bool getPendingDelete() const;
+ DllExport void setData(int iData);
+ DllExport int getData() const;
+ DllExport void setHumanDiplo(bool bValue);
+ DllExport bool getHumanDiplo() const;
+ DllExport void setOurOffering(bool bValue);
+ DllExport bool getOurOffering() const;
+ DllExport void setTheirOffering(bool bValue);
+ DllExport bool getTheirOffering() const;
+ DllExport void setChatText(const wchar* szText);
+ DllExport const wchar* getChatText() const;
+ DllExport const std::vector<FVariable>& getDiploCommentArgs() const {
return m_diploCommentArgs; }
+
+ DllExport void read(FDataStreamBase& stream);
+ DllExport void write(FDataStreamBase& stream) const;
+
+private:
+ PlayerTypes m_eWhoTalkingTo;
+ DiploCommentTypes m_eCommentType;
+ CLinkList<TradeData> m_ourOffer;
+ CLinkList<TradeData> m_theirOffer;
+ bool m_bRenegotiate;
+ bool m_bAIContact;
+ bool m_bPendingDelete;
+ int m_iData;
+ bool m_bHumanDiplo;
+ bool m_bOurOffering;
+ bool m_bTheirOffering;
+ CvWString m_szChatText;
+ std::vector<FVariable> m_diploCommentArgs;
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDllPythonEvents.cpp Sat Sep 19 06:38:49
2009
@@ -0,0 +1,314 @@
+#include "CvGameCoreDLL.h"
+#include "CvDllPythonEvents.h"
+#include "CvDLLEngineIFaceBase.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CyArgsList.h"
+#include "CyUnit.h"
+#include "CyPlot.h"
+//ztjal
+#include "CvDLLEventReporterIFaceBase.h"
+
+
+
+void CvDllPythonEvents::reportGenericEvent(const char* szEventName, void
*pyArgs)
+{
+ gDLL->getEventReporterIFace()->genericEvent(szEventName, pyArgs);
+}
+
+void CvDllPythonEvents::reportGameEnd()
+{
+ gDLL->getEventReporterIFace()->gameEnd();
+}
+
+void CvDllPythonEvents::reportBeginGameTurn(int iGameTurn)
+{
+ gDLL->getEventReporterIFace()->beginGameTurn(iGameTurn);
+}
+
+void CvDllPythonEvents::reportEndGameTurn(int iGameTurn)
+{
+ gDLL->getEventReporterIFace()->endGameTurn(iGameTurn);
+}
+
+void CvDllPythonEvents::reportBeginPlayerTurn(int iGameTurn, PlayerTypes
ePlayer)
+{
+ gDLL->getEventReporterIFace()->beginPlayerTurn(iGameTurn, ePlayer);
+}
+
+void CvDllPythonEvents::reportEndPlayerTurn(int iGameTurn, PlayerTypes
ePlayer)
+{
+ gDLL->getEventReporterIFace()->endPlayerTurn(iGameTurn, ePlayer);
+}
+
+void CvDllPythonEvents::reportFirstContact(TeamTypes eTeamID1, TeamTypes
eTeamID2)
+{
+ gDLL->getEventReporterIFace()->firstContact(eTeamID1, eTeamID2);
+}
+
+void CvDllPythonEvents::reportCombatResult(CvUnit* pWinner, CvUnit* pLoser)
+{
+ gDLL->getEventReporterIFace()->combatResult(pWinner, pLoser);
+}
+
+void CvDllPythonEvents::reportImprovementBuilt(int iImprovementType, int
iX, int iY)
+{
+ gDLL->getEventReporterIFace()->improvementBuilt(iImprovementType, iX, iY);
+}
+
+void CvDllPythonEvents::reportImprovementDestroyed(int iImprovementType,
int iPlayer, int iX, int iY)
+{
+ gDLL->getEventReporterIFace()->improvementDestroyed(iImprovementType,
iPlayer, iX, iY);
+}
+
+void CvDllPythonEvents::reportRouteBuilt(int iRouteType, int iX, int iY)
+{
+ gDLL->getEventReporterIFace()->routeBuilt(iRouteType, iX, iY);
+}
+
+void CvDllPythonEvents::reportPlotRevealed(CvPlot *pPlot, TeamTypes eTeam)
+{
+ gDLL->getEventReporterIFace()->plotRevealed(pPlot, eTeam);
+}
+
+void CvDllPythonEvents::reportPlotFeatureRemoved(CvPlot *pPlot,
FeatureTypes eFeature, CvCity* pCity)
+{
+ gDLL->getEventReporterIFace()->plotFeatureRemoved(pPlot, eFeature, pCity);
+}
+
+void CvDllPythonEvents::reportNukeExplosion(CvPlot *pPlot, CvUnit*
pNukeUnit)
+{
+ gDLL->getEventReporterIFace()->nukeExplosion(pPlot, pNukeUnit);
+}
+
+void CvDllPythonEvents::reportCityBuilt( CvCity *pCity )
+{
+ gDLL->getEventReporterIFace()->cityBuilt(pCity);
+}
+
+void CvDllPythonEvents::reportCityRazed( CvCity *pCity, PlayerTypes
ePlayer )
+{
+ gDLL->getEventReporterIFace()->cityRazed(pCity, ePlayer);
+}
+
+void CvDllPythonEvents::reportCityAcquired(PlayerTypes eOldOwner,
PlayerTypes ePlayer, CvCity* pOldCity, bool bConquest, bool bTrade)
+{
+ gDLL->getEventReporterIFace()->cityAcquired(eOldOwner, ePlayer, pOldCity,
bConquest, bTrade);
+}
+
+void CvDllPythonEvents::reportCityAcquiredAndKept(PlayerTypes ePlayer,
CvCity* pOldCity)
+{
+ gDLL->getEventReporterIFace()->cityAcquiredAndKept(ePlayer, pOldCity);
+}
+
+void CvDllPythonEvents::reportCityLost(CvCity* pCity)
+{
+ gDLL->getEventReporterIFace()->cityLost(pCity);
+}
+
+void CvDllPythonEvents::reportCultureExpansion( CvCity *pCity, PlayerTypes
ePlayer )
+{
+ gDLL->getEventReporterIFace()->cultureExpansion(pCity, ePlayer);
+}
+
+void CvDllPythonEvents::reportCityGrowth( CvCity *pCity, PlayerTypes
ePlayer )
+{
+ gDLL->getEventReporterIFace()->cityGrowth(pCity, ePlayer);
+}
+
+void CvDllPythonEvents::reportCityProduction( CvCity *pCity, PlayerTypes
ePlayer )
+{
+ gDLL->getEventReporterIFace()->cityDoTurn(pCity, ePlayer);
+}
+
+void CvDllPythonEvents::reportCityBuildingUnit( CvCity *pCity, UnitTypes
eUnitType )
+{
+ gDLL->getEventReporterIFace()->cityBuildingUnit(pCity, eUnitType);
+}
+
+void CvDllPythonEvents::reportCityBuildingBuilding( CvCity *pCity,
BuildingTypes eBuildingType )
+{
+ gDLL->getEventReporterIFace()->cityBuildingBuilding(pCity, eBuildingType);
+}
+
+void CvDllPythonEvents::reportCityRename( CvCity *pCity )
+{
+ gDLL->getEventReporterIFace()->cityRename(pCity);
+}
+
+void CvDllPythonEvents::reportCityHurry( CvCity *pCity, HurryTypes eHurry )
+{
+ gDLL->getEventReporterIFace()->cityHurry(pCity, eHurry);
+}
+
+void CvDllPythonEvents::reportSelectionGroupPushMission(CvSelectionGroup*
pSelectionGroup, MissionTypes eMission)
+{
+ gDLL->getEventReporterIFace()->selectionGroupPushMission(pSelectionGroup,
eMission);
+}
+
+void CvDllPythonEvents::reportUnitMove(CvPlot* pPlot, CvUnit* pUnit,
CvPlot* pOldPlot)
+{
+ gDLL->getEventReporterIFace()->unitMove(pPlot, pUnit, pOldPlot);
+}
+
+void CvDllPythonEvents::reportUnitSetXY(CvPlot* pPlot, CvUnit* pUnit)
+{
+ gDLL->getEventReporterIFace()->unitSetXY(pPlot, pUnit);
+}
+
+void CvDllPythonEvents::reportUnitCreated(CvUnit* pUnit)
+{
+ gDLL->getEventReporterIFace()->unitCreated(pUnit);
+}
+
+void CvDllPythonEvents::reportUnitBuilt(CvCity *pCity, CvUnit* pUnit)
+{
+ gDLL->getEventReporterIFace()->unitBuilt(pCity, pUnit);
+}
+
+void CvDllPythonEvents::reportUnitKilled(CvUnit* pUnit, PlayerTypes
eAttacker)
+{
+ gDLL->getEventReporterIFace()->unitKilled(pUnit, eAttacker);
+}
+
+void CvDllPythonEvents::reportUnitLost(CvUnit* pUnit)
+{
+ gDLL->getEventReporterIFace()->unitLost(pUnit);
+}
+
+void CvDllPythonEvents::reportUnitPromoted(CvUnit* pUnit, PromotionTypes
ePromotion)
+{
+ gDLL->getEventReporterIFace()->unitPromoted(pUnit, ePromotion);
+}
+
+void CvDllPythonEvents::reportUnitRename(CvUnit *pUnit)
+{
+ gDLL->getEventReporterIFace()->unitRename(pUnit);
+}
+
+void CvDllPythonEvents::reportUnitPillage(CvUnit* pUnit, ImprovementTypes
eImprovement, RouteTypes eRoute, PlayerTypes ePlayer)
+{
+ gDLL->getEventReporterIFace()->unitPillage(pUnit, eImprovement, eRoute,
ePlayer);
+}
+
+void CvDllPythonEvents::reportUnitSpreadReligionAttempt(CvUnit* pUnit,
ReligionTypes eReligion, bool bSuccess)
+{
+ gDLL->getEventReporterIFace()->unitSpreadReligionAttempt(pUnit,
eReligion, bSuccess);
+}
+
+void CvDllPythonEvents::reportUnitGifted(CvUnit* pUnit, PlayerTypes
eGiftingPlayer, CvPlot* pPlotLocation)
+{
+ gDLL->getEventReporterIFace()->unitGifted(pUnit, eGiftingPlayer,
pPlotLocation);
+}
+
+void CvDllPythonEvents::reportUnitBuildImprovement(CvUnit* pUnit,
BuildTypes eBuild, bool bFinished)
+{
+ gDLL->getEventReporterIFace()->unitBuildImprovement(pUnit, eBuild,
bFinished);
+}
+
+void CvDllPythonEvents::reportGoodyReceived(PlayerTypes ePlayer, CvPlot
*pGoodyPlot, CvUnit *pGoodyUnit, GoodyTypes eGoodyType)
+{
+ gDLL->getEventReporterIFace()->goodyReceived(ePlayer, pGoodyPlot,
pGoodyUnit, eGoodyType);
+}
+
+void CvDllPythonEvents::reportGreatPersonBorn( CvUnit *pUnit, PlayerTypes
ePlayer, CvCity *pCity )
+{
+ gDLL->getEventReporterIFace()->greatPersonBorn(pUnit, ePlayer, pCity);
+}
+
+void CvDllPythonEvents::reportBuildingBuilt(CvCity *pCity, BuildingTypes
eBuilding)
+{
+ gDLL->getEventReporterIFace()->buildingBuilt(pCity, eBuilding);
+}
+
+void CvDllPythonEvents::reportProjectBuilt(CvCity *pCity, ProjectTypes
eProject)
+{
+ gDLL->getEventReporterIFace()->projectBuilt(pCity, eProject);
+}
+
+void CvDllPythonEvents::reportTechAcquired(TechTypes eType, TeamTypes
eTeam, PlayerTypes ePlayer, bool bAnnounce)
+{
+ gDLL->getEventReporterIFace()->techAcquired(eType, eTeam, ePlayer,
bAnnounce);
+}
+
+void CvDllPythonEvents::reportTechSelected(TechTypes eTech, PlayerTypes
ePlayer)
+{
+ gDLL->getEventReporterIFace()->techSelected(eTech, ePlayer);
+}
+
+void CvDllPythonEvents::reportReligionFounded(ReligionTypes eType,
PlayerTypes ePlayer)
+{
+ gDLL->getEventReporterIFace()->religionFounded(eType, ePlayer);
+}
+
+void CvDllPythonEvents::reportReligionSpread(ReligionTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ gDLL->getEventReporterIFace()->religionSpread(eType, ePlayer,
pSpreadCity);
+}
+
+void CvDllPythonEvents::reportReligionRemove(ReligionTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ gDLL->getEventReporterIFace()->religionRemove(eType, ePlayer,
pSpreadCity);
+}
+
+void CvDllPythonEvents::reportCorporationFounded(CorporationTypes eType,
PlayerTypes ePlayer)
+{
+ gDLL->getEventReporterIFace()->corporationFounded(eType, ePlayer);
+}
+
+void CvDllPythonEvents::reportCorporationSpread(CorporationTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ gDLL->getEventReporterIFace()->corporationSpread(eType, ePlayer,
pSpreadCity);
+}
+
+void CvDllPythonEvents::reportCorporationRemove(CorporationTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ gDLL->getEventReporterIFace()->corporationRemove(eType, ePlayer,
pSpreadCity);
+}
+
+void CvDllPythonEvents::reportGoldenAge(PlayerTypes ePlayer)
+{
+ gDLL->getEventReporterIFace()->goldenAge(ePlayer);
+}
+
+void CvDllPythonEvents::reportEndGoldenAge(PlayerTypes ePlayer)
+{
+ gDLL->getEventReporterIFace()->endGoldenAge(ePlayer);
+}
+
+void CvDllPythonEvents::reportChangeWar(bool bWar, TeamTypes eTeam,
TeamTypes eOtherTeam)
+{
+ gDLL->getEventReporterIFace()->changeWar(bWar, eTeam, eOtherTeam);
+}
+
+void CvDllPythonEvents::reportVictory(TeamTypes eNewWinner, VictoryTypes
eNewVictory)
+{
+ gDLL->getEventReporterIFace()->victory(eNewWinner, eNewVictory);
+}
+
+void CvDllPythonEvents::reportVassalState(TeamTypes eMaster, TeamTypes
eVassal, bool bVassal)
+{
+ gDLL->getEventReporterIFace()->vassalState(eMaster, eVassal, bVassal);
+}
+
+void CvDllPythonEvents::reportSetPlayerAlive( PlayerTypes ePlayerID, bool
bNewValue )
+{
+ gDLL->getEventReporterIFace()->setPlayerAlive(ePlayerID, bNewValue);
+}
+
+void CvDllPythonEvents::reportPlayerChangeStateReligion(PlayerTypes
ePlayerID, ReligionTypes eNewReligion, ReligionTypes eOldReligion)
+{
+ gDLL->getEventReporterIFace()->playerChangeStateReligion(ePlayerID,
eNewReligion, eOldReligion);
+}
+
+
+void CvDllPythonEvents::reportPlayerGoldTrade(PlayerTypes eFromPlayer,
PlayerTypes eToPlayer, int iAmount)
+{
+ gDLL->getEventReporterIFace()->playerGoldTrade(eFromPlayer, eToPlayer,
iAmount);
+}
+
+
+
+
+
+
+
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDllPythonEvents.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,106 @@
+#ifndef CIV4_DLL_PYTHON_EVENTS_H
+#define CIV4_DLL_PYTHON_EVENTS_H
+
+class CyArgsList;
+
+class CvDllPythonEvents
+{
+public:
+ void reportGenericEvent(const char* szEventName, void *pyArgs);
+
+
+
+
+
+
+
+
+ void reportGameEnd();
+
+
+ void reportBeginGameTurn(int iGameTurn);
+ void reportEndGameTurn(int iGameTurn);
+
+ void reportBeginPlayerTurn(int iGameTurn, PlayerTypes);
+ void reportEndPlayerTurn(int iGameTurn, PlayerTypes);
+
+ void reportFirstContact(TeamTypes iTeamID1, TeamTypes iTeamID2);
+ void reportCombatResult(CvUnit* pWinner, CvUnit* pLoser);
+ void reportImprovementBuilt(int iImprovementType, int iX, int iY);
+ void reportImprovementDestroyed(int iImprovementType, int iPlayer, int
iX, int iY);
+ void reportRouteBuilt(int iRouteType, int iX, int iY);
+
+ void reportPlotRevealed(CvPlot *pPlot, TeamTypes eTeam);
+ void reportPlotFeatureRemoved(CvPlot *pPlot, FeatureTypes eFeature,
CvCity* pCity);
+
+ void reportNukeExplosion(CvPlot *pPlot, CvUnit* pNukeUnit);
+
+
+ void reportCityBuilt(CvCity *pCity);
+ void reportCityRazed(CvCity *pCity, PlayerTypes ePlayer);
+ void reportCityAcquired(PlayerTypes eOldOwner, PlayerTypes ePlayer,
CvCity* pOldCity, bool bConquest, bool bTrade);
+ void reportCityAcquiredAndKept(PlayerTypes ePlayer, CvCity* pCity);
+ void reportCityLost(CvCity *pCity);
+ void reportCultureExpansion(CvCity *pCity, PlayerTypes ePlayer);
+ void reportCityGrowth(CvCity *pCity, PlayerTypes ePlayer);
+ void reportCityProduction(CvCity *pCity, PlayerTypes ePlayer);
+ void reportCityBuildingUnit(CvCity *pCity, UnitTypes eUnitType);
+ void reportCityBuildingBuilding(CvCity *pCity, BuildingTypes
eBuildingType);
+ void reportCityRename(CvCity *pCity);
+ void reportCityHurry(CvCity *pCity, HurryTypes eHurry);
+
+ void reportSelectionGroupPushMission(CvSelectionGroup* pSelectionGroup,
MissionTypes eMission);
+
+ void reportUnitMove(CvPlot* pPlot, CvUnit* pUnit, CvPlot* pOldPlot);
+ void reportUnitSetXY(CvPlot* pPlot, CvUnit* pUnit);
+ void reportUnitCreated(CvUnit *pUnit);
+ void reportUnitBuilt(CvCity *pCity, CvUnit *pUnit);
+ void reportUnitKilled(CvUnit *pUnit, PlayerTypes eAttacker);
+ void reportUnitLost(CvUnit *pUnit);
+ void reportUnitPromoted(CvUnit* pUnit, PromotionTypes ePromotion);
+
+ void reportUnitRename(CvUnit *pUnit);
+ void reportUnitPillage(CvUnit* pUnit, ImprovementTypes eImprovement,
RouteTypes eRoute, PlayerTypes ePlayer);
+ void reportUnitSpreadReligionAttempt(CvUnit* pUnit, ReligionTypes
eReligion, bool bSuccess);
+ void reportUnitGifted(CvUnit* pUnit, PlayerTypes eGiftingPlayer, CvPlot*
pPlotLocation);
+ void reportUnitBuildImprovement(CvUnit* pUnit, BuildTypes eBuild, bool
bFinished);
+
+ void reportGoodyReceived(PlayerTypes ePlayer, CvPlot *pGoodyPlot, CvUnit
*pGoodyUnit, GoodyTypes eGoodyType);
+
+ void reportGreatPersonBorn(CvUnit *pUnit, PlayerTypes ePlayer, CvCity
*pCity);
+
+ void reportBuildingBuilt(CvCity *pCity, BuildingTypes eBuilding);
+ void reportProjectBuilt(CvCity *pCity, ProjectTypes eProject);
+
+ void reportTechAcquired(TechTypes eType, TeamTypes eTeam, PlayerTypes
ePlayer, bool bAnnounce);
+ void reportTechSelected(TechTypes eTech, PlayerTypes ePlayer);
+
+ void reportReligionFounded(ReligionTypes eType, PlayerTypes ePlayer);
+ void reportReligionSpread(ReligionTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+ void reportReligionRemove(ReligionTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+
+ void reportCorporationFounded(CorporationTypes eType, PlayerTypes
ePlayer);
+ void reportCorporationSpread(CorporationTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+ void reportCorporationRemove(CorporationTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+
+ void reportGoldenAge(PlayerTypes ePlayer);
+ void reportEndGoldenAge(PlayerTypes ePlayer);
+ void reportChangeWar(bool bWar, TeamTypes eTeam, TeamTypes eOtherTeam);
+
+ void reportVictory(TeamTypes eNewWinner, VictoryTypes eNewVictory);
+
+ void reportVassalState(TeamTypes eMaster, TeamTypes eVassal, bool
bVassal);
+
+ void reportSetPlayerAlive(PlayerTypes ePlayerID, bool bNewValue);
+ void reportPlayerChangeStateReligion(PlayerTypes ePlayerID, ReligionTypes
eNewReligion, ReligionTypes eOldReligion);
+ void reportPlayerGoldTrade(PlayerTypes eFromPlayer, PlayerTypes
eToPlayer, int iAmount);
+
+
+
+
+private:
+ //
+
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDllTranslator.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,139 @@
+#include "CvGameCoreDLL.h"
+#include "CvDllTranslator.h"
+
+void CvDllTranslator::initializeTags(CvWString& szTagStartIcon, CvWString&
szTagStartOur, CvWString& szTagStartCT, CvWString& szTagStartColor,
CvWString& szTagStartLink, CvWString& szTagEndLink, CvWString&
szEndLinkReplacement, std::map<std::wstring, CvWString>& aIconMap,
std::map<std::wstring, CvWString>& aColorMap)
+{
+ szTagStartIcon = L"[ICON_";
+ szTagStartOur = L"[OUR_";
+ szTagStartCT = L"[CT_";
+ szTagStartColor = L"[COLOR_";
+ szTagStartLink = L"[LINK";
+ szTagEndLink = L"[\\LINK";
+ szEndLinkReplacement = L"</link>";
+
+ //create icons map
+ aIconMap[L"[ICON_BULLET]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(BULLET_CHAR));
+ aIconMap[L"[ICON_HAPPY]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(HAPPY_CHAR));
+ aIconMap[L"[ICON_UNHAPPY]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(UNHAPPY_CHAR));
+ aIconMap[L"[ICON_HEALTHY]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(HEALTHY_CHAR));
+ aIconMap[L"[ICON_UNHEALTHY]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(UNHEALTHY_CHAR));
+ aIconMap[L"[ICON_STRENGTH]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(STRENGTH_CHAR));
+ aIconMap[L"[ICON_MOVES]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(MOVES_CHAR));
+ aIconMap[L"[ICON_RELIGION]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(RELIGION_CHAR));
+ aIconMap[L"[ICON_STAR]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(STAR_CHAR));
+ aIconMap[L"[ICON_SILVER_STAR]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(SILVER_STAR_CHAR));
+ aIconMap[L"[ICON_TRADE]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(TRADE_CHAR));
+ aIconMap[L"[ICON_DEFENSE]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(DEFENSE_CHAR));
+ aIconMap[L"[ICON_GREATPEOPLE]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(GREAT_PEOPLE_CHAR));
+ aIconMap[L"[ICON_BAD_GOLD]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(BAD_GOLD_CHAR));
+ aIconMap[L"[ICON_BAD_FOOD]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(BAD_FOOD_CHAR));
+ aIconMap[L"[ICON_EATENFOOD]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(EATEN_FOOD_CHAR));
+ aIconMap[L"[ICON_GOLDENAGE]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(GOLDEN_AGE_CHAR));
+ aIconMap[L"[ICON_ANGRYPOP]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(ANGRY_POP_CHAR));
+ aIconMap[L"[ICON_OPENBORDERS]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(OPEN_BORDERS_CHAR));
+ aIconMap[L"[ICON_DEFENSIVEPACT]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(DEFENSIVE_PACT_CHAR));
+ aIconMap[L"[ICON_MAP]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(MAP_CHAR));
+ aIconMap[L"[ICON_OCCUPATION]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(OCCUPATION_CHAR));
+ aIconMap[L"[ICON_POWER]"] = std::wstring(1,
(wchar)gDLL->getSymbolID(POWER_CHAR));
+
+ aIconMap[L"[ICON_GOLD]"] = std::wstring(1,
(wchar)GC.getCommerceInfo(COMMERCE_GOLD).getChar());
+ aIconMap[L"[ICON_RESEARCH]"] = std::wstring(1,
(wchar)GC.getCommerceInfo(COMMERCE_RESEARCH).getChar());
+ aIconMap[L"[ICON_CULTURE]"] = std::wstring(1,
(wchar)GC.getCommerceInfo(COMMERCE_CULTURE).getChar());
+ aIconMap[L"[ICON_ESPIONAGE]"] = std::wstring(1,
(wchar)GC.getCommerceInfo(COMMERCE_ESPIONAGE).getChar());
+
+ aIconMap[L"[ICON_FOOD]"] = std::wstring(1,
(wchar)GC.getYieldInfo(YIELD_FOOD).getChar());
+ aIconMap[L"[ICON_PRODUCTION]"] = std::wstring(1,
(wchar)GC.getYieldInfo(YIELD_PRODUCTION).getChar());
+ aIconMap[L"[ICON_COMMERCE]"] = std::wstring(1,
(wchar)GC.getYieldInfo(YIELD_COMMERCE).getChar());
+
+ //create color map
+ aColorMap[L"[COLOR_REVERT]"] = CvWString(L"</color>");
+ for(int i=0; i < GC.getNumColorInfos(); i++)
+ {
+ const NiColorA& color = GC.getColorInfo((ColorTypes) i).getColor();
+ CvWString colorType(GC.getColorInfo((ColorTypes) i).getType());
+ CvWString wideColorType;
+ wideColorType.Format(L"[%s]", colorType.GetCString());
+ CvWString colorOut;
+ colorOut.Format(L"<color=%i,%i,%i,%i>", (int) (color.r * 255), (int)
(color.g * 255), (int) (color.b * 255), (int) (color.a * 255));
+ aColorMap[wideColorType.GetCString()] = colorOut;
+ }
+}
+
+bool CvDllTranslator::replaceOur(const CvWString& szKey, int iForm,
CvWString& szReplacement)
+{
+ CvPlayerAI& player = GET_PLAYER((PlayerTypes) gDLL->getDiplomacyPlayer());
+ if (szKey == L"[OUR_NAME")
+ {
+ szReplacement = player.getName(iForm);
+ }
+ else if (szKey == L"[OUR_EMPIRE")
+ {
+ szReplacement = player.getCivilizationDescription(iForm);
+ }
+ else if(szKey == L"[OUR_CIV_SHORT")
+ {
+ szReplacement = player.getCivilizationShortDescription(iForm);
+ }
+ else if(szKey == L"[OUR_CIV_ADJ")
+ {
+ szReplacement = player.getCivilizationAdjective(iForm);
+ }
+ else if(szKey == L"[OUR_STATE_RELIGION")
+ {
+ szReplacement = player.getStateReligionName(iForm);
+ }
+ else if(szKey == L"[OUR_BEST_UNIT")
+ {
+ szReplacement = player.getBestAttackUnitName(iForm);
+ }
+ else if(szKey == L"[OUR_WORST_ENEMY")
+ {
+ szReplacement = player.getWorstEnemyName();
+ }
+ else
+ {
+ FAssertMsg(false, "Unknown Diplomacy String");
+ return false;
+ }
+ return true;
+}
+
+bool CvDllTranslator::replaceCt(const CvWString& szKey, int iForm,
CvWString& szReplacement)
+{
+ CvPlayerAI& player = GET_PLAYER(GC.getGameINLINE().getActivePlayer());
+ if (szKey == L"[CT_NAME")
+ {
+ szReplacement = player.getName(iForm);
+ }
+ else if (szKey == L"[CT_EMPIRE")
+ {
+ szReplacement = player.getCivilizationDescription(iForm);
+ }
+ else if(szKey == L"[CT_CIV_SHORT")
+ {
+ szReplacement = player.getCivilizationShortDescription(iForm);
+ }
+ else if(szKey == L"[CT_CIV_ADJ")
+ {
+ szReplacement = player.getCivilizationAdjective(iForm);
+ }
+ else if(szKey == L"[CT_STATE_RELIGION")
+ {
+ szReplacement = player.getStateReligionName(iForm);
+ }
+ else if(szKey == L"[CT_BEST_UNIT")
+ {
+ szReplacement = player.getBestAttackUnitName(iForm);
+ }
+ else if(szKey == L"[CT_WORST_ENEMY")
+ {
+ szReplacement = player.getWorstEnemyName();
+ }
+ else
+ {
+ FAssertMsg(false, "Unknown Diplomacy String");
+ return false;
+ }
+ return true;
+}
+
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvDllTranslator.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,12 @@
+#ifndef CV_DLL_TRANSLATOR_H
+#define CV_DLL_TRANSLATOR_H
+
+class CvDllTranslator
+{
+public:
+ DllExport static void initializeTags(CvWString& szTagStartIcon,
CvWString& szTagStartOur, CvWString& szTagStartCT, CvWString&
szTagStartColor, CvWString& szTagStartLink, CvWString& szTagEndLink,
CvWString& szEndLinkReplacement, std::map<std::wstring, CvWString>&
aIconMap, std::map<std::wstring, CvWString>& aColorMap);
+ DllExport static bool replaceOur(const CvWString& szKey, int iForm,
CvWString& szReplacement);
+ DllExport static bool replaceCt(const CvWString& szKey, int iForm,
CvWString& szReplacement);
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvEnums.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,2847 @@
+#pragma once
+
+#ifndef CVENUMS_h
+#define CVENUMS_h
+
+// enums.h
+
+#include "CvDefines.h"
+
+enum DllExport GameStateTypes // Exposed to Python
+{
+ GAMESTATE_ON,
+ GAMESTATE_OVER,
+ GAMESTATE_EXTENDED,
+};
+
+enum DllExport PopupStates // Exposed to Python
+{
+ POPUPSTATE_IMMEDIATE,
+ POPUPSTATE_QUEUED,
+ POPUPSTATE_MINIMIZED,
+};
+
+enum DllExport PopupEventTypes
+{
+ POPUPEVENT_NONE,
+ POPUPEVENT_PRODUCTION,
+ POPUPEVENT_TECHNOLOGY,
+ POPUPEVENT_RELIGION,
+ POPUPEVENT_WARNING,
+ POPUPEVENT_CIVIC,
+};
+
+enum DllExport CameraLookAtTypes // Exposed to Python
+{
+ CAMERALOOKAT_NORMAL,
+ CAMERALOOKAT_CITY_ZOOM_IN,
+ CAMERALOOKAT_BATTLE,
+ CAMERALOOKAT_BATTLE_ZOOM_IN,
+ CAMERALOOKAT_SHRINE_ZOOM_IN,
+ CAMERALOOKAT_IMMEDIATE,
+ CAMERALOOKAT_HOTSEAT,
+};
+
+enum DllExport CameraMovementSpeeds // Exposed to Python
+{
+ CAMERAMOVEMENTSPEED_NORMAL,
+ CAMERAMOVEMENTSPEED_SLOW,
+ CAMERAMOVEMENTSPEED_FAST,
+};
+
+enum DllExport CameraAnimationTypes
+{
+ NO_CAMERA_ANIMATION = -1,
+};
+
+enum DllExport ZoomLevelTypes // Exposed to Python
+{
+ ZOOM_UNKNOWN = 0x00000000,
+ ZOOM_DETAIL = 0x00000001,
+ ZOOM_NORMAL = 0x00000002,
+ ZOOM_GLOBEVIEW_TRANSITION = 0x00000004,
+ ZOOM_GLOBEVIEW = 0x00000008
+};
+
+enum DllExport DirectionTypes // Exposed to Python
+{
+ NO_DIRECTION = -1,
+
+ DIRECTION_NORTH,
+ DIRECTION_NORTHEAST,
+ DIRECTION_EAST,
+ DIRECTION_SOUTHEAST,
+ DIRECTION_SOUTH,
+ DIRECTION_SOUTHWEST,
+ DIRECTION_WEST,
+ DIRECTION_NORTHWEST,
+
+#ifdef _USRDLL
+ NUM_DIRECTION_TYPES,
+#endif
+
+ DIRECTION_NORTH_MASK = 1 << DIRECTION_NORTH,
+ DIRECTION_NORTHEAST_MASK = 1 << DIRECTION_NORTHEAST,
+ DIRECTION_EAST_MASK = 1 << DIRECTION_EAST,
+ DIRECTION_SOUTHEAST_MASK = 1 << DIRECTION_SOUTHEAST,
+ DIRECTION_SOUTH_MASK = 1 << DIRECTION_SOUTH,
+ DIRECTION_SOUTHWEST_MASK = 1 << DIRECTION_SOUTHWEST,
+ DIRECTION_WEST_MASK = 1 << DIRECTION_WEST,
+ DIRECTION_NORTHWEST_MASK = 1 << DIRECTION_NORTHWEST,
+};
+
+enum DllExport CardinalDirectionTypes // Exposed to Python
+{
+ NO_CARDINALDIRECTION = -1,
+
+ CARDINALDIRECTION_NORTH,
+ CARDINALDIRECTION_EAST,
+ CARDINALDIRECTION_SOUTH,
+ CARDINALDIRECTION_WEST,
+
+#ifdef _USRDLL
+ NUM_CARDINALDIRECTION_TYPES
+#endif
+};
+
+enum DllExport RotationTypes
+{
+ ROTATE_NONE = 0,
+ ROTATE_90CW,
+ ROTATE_180CW,
+ ROTATE_270CW,
+ NUM_ROTATION_TYPES,
+
+ ROTATE_NONE_MASK = 1 << ROTATE_NONE,
+ ROTATE_90CW_MASK = 1 << ROTATE_90CW,
+ ROTATE_180CW_MASK = 1 << ROTATE_180CW,
+ ROTATE_270CW_MASK = 1 << ROTATE_270CW,
+};
+
+// camera wrap helper
+enum DllExport WrapDirection
+{
+ WRAP_SAVE,
+ WRAP_NONE = WRAP_SAVE,
+ WRAP_RESTORE,
+ WRAP_LEFT,
+ WRAP_RIGHT,
+ WRAP_UP,
+ WRAP_DOWN,
+
+#ifdef _USRDLL
+ NUM_WRAP_DIRECTIONS,
+#endif
+
+ WRAP_LEFT_MASK = 1 << WRAP_LEFT,
+ WRAP_RIGHT_MASK = 1 << WRAP_RIGHT,
+ WRAP_UP_MASK = 1 << WRAP_UP,
+ WRAP_DOWN_MASK = 1 << WRAP_DOWN,
+};
+
+enum DllExport ColorTypes // Exposed to Python
+{
+ NO_COLOR = -1,
+};
+
+enum DllExport PlayerColorTypes // Exposed to Python
+{
+ NO_PLAYERCOLOR = -1,
+};
+
+//Warning: these values correspond to locations in the plot texture [JW]
+enum DllExport PlotStyles // Exposed to Python
+{
+ PLOT_STYLE_NONE = -1,
+
+ //first row
+ PLOT_STYLE_NUMPAD_1 = 0,
+ PLOT_STYLE_NUMPAD_2,
+ PLOT_STYLE_NUMPAD_3,
+ PLOT_STYLE_NUMPAD_4,
+ PLOT_STYLE_NUMPAD_6,
+ PLOT_STYLE_NUMPAD_7,
+ PLOT_STYLE_NUMPAD_8,
+ PLOT_STYLE_NUMPAD_9,
+
+ //second row
+ PLOT_STYLE_NUMPAD_1_ANGLED = 8,
+ PLOT_STYLE_NUMPAD_2_ANGLED,
+ PLOT_STYLE_NUMPAD_3_ANGLED,
+ PLOT_STYLE_NUMPAD_4_ANGLED,
+ PLOT_STYLE_NUMPAD_6_ANGLED,
+ PLOT_STYLE_NUMPAD_7_ANGLED,
+ PLOT_STYLE_NUMPAD_8_ANGLED,
+ PLOT_STYLE_NUMPAD_9_ANGLED,
+
+ //third row
+ PLOT_STYLE_BOX_FILL = 16,
+ PLOT_STYLE_BOX_OUTLINE,
+ PLOT_STYLE_RIVER_SOUTH,
+ PLOT_STYLE_RIVER_EAST,
+ PLOT_STYLE_SIDE_ARROWS,
+ PLOT_STYLE_CIRCLE,
+ PLOT_STYLE_TARGET,
+ PLOT_STYLE_DOT_TARGET,
+
+ //fourth row
+ PLOT_STYLE_WAVES = 24,
+ PLOT_STYLE_DOTS,
+ PLOT_STYLE_CIRCLES,
+};
+
+//Warning: these values are used as an index into a fixed array
+enum DllExport PlotLandscapeLayers // Exposed to Python
+{
+ PLOT_LANDSCAPE_LAYER_ALL = -1,
+ PLOT_LANDSCAPE_LAYER_BASE = 0,
+ PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS = 1,
+ PLOT_LANDSCAPE_LAYER_WORLD_BUILDER = 2,
+ PLOT_LANDSCAPE_LAYER_NUMPAD_HELP = 2,
+ PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS = 1,
+};
+
+enum DllExport AreaBorderLayers
+{
+ AREA_BORDER_LAYER_REVEALED_PLOTS,
+ AREA_BORDER_LAYER_WORLD_BUILDER,
+ AREA_BORDER_LAYER_FOUNDING_BORDER,
+ AREA_BORDER_LAYER_CITY_RADIUS,
+ AREA_BORDER_LAYER_RANGED,
+ AREA_BORDER_LAYER_HIGHLIGHT_PLOT,
+ AREA_BORDER_LAYER_BLOCKADING,
+ AREA_BORDER_LAYER_BLOCKADED,
+ NUM_AREA_BORDER_LAYERS
+};
+
+enum DllExport EffectTypes
+{
+ NO_EFFECT = -1,
+};
+
+enum DllExport AttachableTypes
+{
+ NO_ATTACHABLE = -1,
+};
+
+enum DllExport InterfaceModeTypes // Exposed to Python
+{
+ NO_INTERFACEMODE = -1,
+
+ INTERFACEMODE_SELECTION,
+ INTERFACEMODE_PING,
+ INTERFACEMODE_SIGN,
+ INTERFACEMODE_GRIP,
+ INTERFACEMODE_GLOBELAYER_INPUT,
+ INTERFACEMODE_GO_TO,
+ INTERFACEMODE_GO_TO_TYPE,
+ INTERFACEMODE_GO_TO_ALL,
+ INTERFACEMODE_ROUTE_TO,
+ INTERFACEMODE_AIRLIFT,
+ INTERFACEMODE_NUKE,
+ INTERFACEMODE_RECON,
+ INTERFACEMODE_PARADROP,
+ INTERFACEMODE_AIRBOMB,
+ INTERFACEMODE_RANGE_ATTACK,
+ INTERFACEMODE_AIRSTRIKE,
+ INTERFACEMODE_REBASE,
+ INTERFACEMODE_PYTHON_PICK_PLOT,
+ INTERFACEMODE_SAVE_PLOT_NIFS,
+ // Sanguo Mod Hero, start, added by poyuzhe 01.20.09
+ INTERFACEMODE_GO_TO_LEGION,
+ INTERFACEMODE_BOMBARD,
+ INTERFACEMODE_ABOMBARD,
+ // Sanguo Mod Hero, end
+
+#ifdef _USRDLL
+ NUM_INTERFACEMODE_TYPES
+#endif
+};
+
+enum DllExport InterfaceMessageTypes // Exposed to Python
+{
+ NO_MESSAGE_TYPE = -1,
+
+ MESSAGE_TYPE_INFO,
+ MESSAGE_TYPE_DISPLAY_ONLY,
+ MESSAGE_TYPE_MAJOR_EVENT,
+ MESSAGE_TYPE_MINOR_EVENT,
+ MESSAGE_TYPE_CHAT,
+ MESSAGE_TYPE_COMBAT_MESSAGE,
+ MESSAGE_TYPE_QUEST,
+
+#ifdef _USRDLL
+ NUM_INTERFACE_MESSAGE_TYPES
+#endif
+};
+
+enum DllExport FlyoutTypes
+{
+ NO_FLYOUT = -1,
+
+ FLYOUT_HURRY,
+ FLYOUT_CONSCRIPT,
+ FLYOUT_TRAIN,
+ FLYOUT_CONSTRUCT,
+ FLYOUT_CREATE,
+ FLYOUT_MAINTAIN,
+ FLYOUT_MOVE_TO,
+ FLYOUT_SELECT_UNIT,
+ FLYOUT_SELECT_ALL,
+ FLYOUT_WAKE_ALL,
+ FLYOUR_FORTIFY_ALL,
+ FLYOUR_SLEEP_ALL,
+};
+
+enum DllExport MinimapModeTypes // Exposed to Python
+{
+ NO_MINIMAPMODE = -1,
+
+ MINIMAPMODE_TERRITORY,
+ MINIMAPMODE_TERRAIN,
+ MINIMAPMODE_REPLAY,
+ MINIMAPMODE_MILITARY,
+
+#ifdef _USRDLL
+ NUM_MINIMAPMODE_TYPES
+#endif
+};
+
+enum DllExport EngineDirtyBits // Exposed to Python
+{
+ GlobeTexture_DIRTY_BIT,
+ GlobePartialTexture_DIRTY_BIT,
+ MinimapTexture_DIRTY_BIT,
+ CultureBorders_DIRTY_BIT,
+
+#ifdef _USRDLL
+ NUM_ENGINE_DIRTY_BITS
+#endif
+};
+
+enum DllExport InterfaceDirtyBits // Exposed to Python
+{
+ SelectionCamera_DIRTY_BIT,
+ Fog_DIRTY_BIT,
+ GlobeLayer_DIRTY_BIT,
+ GlobeInfo_DIRTY_BIT,
+ Waypoints_DIRTY_BIT,
+ PercentButtons_DIRTY_BIT,
+ MiscButtons_DIRTY_BIT,
+ PlotListButtons_DIRTY_BIT,
+ SelectionButtons_DIRTY_BIT,
+ CitizenButtons_DIRTY_BIT,
+ ResearchButtons_DIRTY_BIT,
+ Event_DIRTY_BIT,
+ Center_DIRTY_BIT,
+ GameData_DIRTY_BIT,
+ Score_DIRTY_BIT,
+ TurnTimer_DIRTY_BIT,
+ Help_DIRTY_BIT,
+ MinimapSection_DIRTY_BIT,
+ SelectionSound_DIRTY_BIT,
+ Cursor_DIRTY_BIT,
+ CityInfo_DIRTY_BIT,
+ UnitInfo_DIRTY_BIT,
+ Popup_DIRTY_BIT,
+ CityScreen_DIRTY_BIT,
+ InfoPane_DIRTY_BIT,
+ Flag_DIRTY_BIT,
+ HighlightPlot_DIRTY_BIT,
+ ColoredPlots_DIRTY_BIT,
+ BlockadedPlots_DIRTY_BIT,
+ Financial_Screen_DIRTY_BIT,
+ Foreign_Screen_DIRTY_BIT,
+ Soundtrack_DIRTY_BIT,
+ Domestic_Advisor_DIRTY_BIT,
+ Espionage_Advisor_DIRTY_BIT,
+ Advanced_Start_DIRTY_BIT,
+
+#ifdef _USRDLL
+ NUM_INTERFACE_DIRTY_BITS
+#endif
+};
+
+enum DllExport CityTabTypes // Exposed to Python
+{
+ NO_CITYTAB = -1,
+
+ CITYTAB_UNITS,
+ CITYTAB_BUILDINGS,
+ CITYTAB_WONDERS,
+
+#ifdef _USRDLL
+ NUM_CITYTAB_TYPES
+#endif
+};
+
+enum DllExport WidgetTypes // Exposed to Python
+{
+ WIDGET_PLOT_LIST,
+ WIDGET_PLOT_LIST_SHIFT,
+ WIDGET_CITY_SCROLL,
+ WIDGET_LIBERATE_CITY,
+ WIDGET_CITY_NAME,
+ WIDGET_UNIT_NAME,
+ WIDGET_CREATE_GROUP,
+ WIDGET_DELETE_GROUP,
+ WIDGET_TRAIN,
+ WIDGET_CONSTRUCT,
+ WIDGET_CREATE,
+ WIDGET_MAINTAIN,
+ WIDGET_HURRY,
+ WIDGET_MENU_ICON,
+ WIDGET_CONSCRIPT,
+ WIDGET_ACTION,
+ WIDGET_DISABLED_CITIZEN,
+ WIDGET_CITIZEN,
+ WIDGET_FREE_CITIZEN,
+ WIDGET_ANGRY_CITIZEN,
+ WIDGET_CHANGE_SPECIALIST,
+ WIDGET_RESEARCH,
+ WIDGET_TECH_TREE,
+ WIDGET_CHANGE_PERCENT,
+ WIDGET_CITY_TAB,
+ WIDGET_CONTACT_CIV,
+ WIDGET_SCORE_BREAKDOWN,
+ WIDGET_ZOOM_CITY,
+ WIDGET_END_TURN,
+ WIDGET_LAUNCH_VICTORY,
+ WIDGET_CONVERT,
+ WIDGET_AUTOMATE_CITIZENS,
+ WIDGET_AUTOMATE_PRODUCTION,
+ WIDGET_EMPHASIZE,
+ WIDGET_DIPLOMACY_RESPONSE,
+ WIDGET_GENERAL,
+ WIDGET_FILE_LISTBOX,
+ WIDGET_FILE_EDITBOX,
+ WIDGET_WB_UNITNAME_EDITBOX,
+ WIDGET_WB_CITYNAME_EDITBOX,
+ WIDGET_WB_SAVE_BUTTON,
+ WIDGET_WB_LOAD_BUTTON,
+ WIDGET_WB_ALL_PLOTS_BUTTON,
+ WIDGET_WB_LANDMARK_BUTTON,
+ WIDGET_WB_ERASE_BUTTON,
+ WIDGET_WB_EXIT_BUTTON,
+ WIDGET_WB_UNIT_EDIT_BUTTON,
+ WIDGET_WB_CITY_EDIT_BUTTON,
+ WIDGET_WB_NORMAL_PLAYER_TAB_MODE_BUTTON,
+ WIDGET_WB_NORMAL_MAP_TAB_MODE_BUTTON,
+ WIDGET_WB_REVEAL_TAB_MODE_BUTTON,
+ WIDGET_WB_DIPLOMACY_MODE_BUTTON,
+ WIDGET_WB_REVEAL_ALL_BUTTON,
+ WIDGET_WB_UNREVEAL_ALL_BUTTON,
+ WIDGET_WB_REGENERATE_MAP,
+ WIDGET_TRADE_ITEM,
+ WIDGET_UNIT_MODEL,
+ WIDGET_FLAG,
+ WIDGET_POPUP_QUEUE,
+
+ // This is meant for python buttons, it will call python functions for
display and execution
+ WIDGET_PYTHON,
+
+ // This button type is reserved for widgets meant to be displayed only.
This is meant for general interface text and such...
+ WIDGET_HELP_MAINTENANCE,
+ WIDGET_HELP_RELIGION,
+ WIDGET_HELP_RELIGION_CITY,
+ WIDGET_HELP_CORPORATION_CITY,
+ WIDGET_HELP_NATIONALITY,
+ WIDGET_HELP_DEFENSE,
+ WIDGET_HELP_HEALTH,
+ WIDGET_HELP_HAPPINESS,
+ WIDGET_HELP_POPULATION,
+ WIDGET_HELP_PRODUCTION,
+ WIDGET_HELP_CULTURE,
+ WIDGET_HELP_GREAT_PEOPLE,
+ WIDGET_HELP_GREAT_GENERAL,
+ WIDGET_HELP_SELECTED,
+ WIDGET_HELP_BUILDING,
+ WIDGET_HELP_TRADE_ROUTE_CITY,
+ WIDGET_HELP_ESPIONAGE_COST,
+ WIDGET_HELP_TECH_ENTRY,
+ WIDGET_HELP_TECH_PREPREQ,
+ WIDGET_HELP_OBSOLETE,
+ WIDGET_HELP_OBSOLETE_BONUS,
+ WIDGET_HELP_OBSOLETE_SPECIAL,
+ WIDGET_HELP_MOVE_BONUS,
+ WIDGET_HELP_FREE_UNIT,
+ WIDGET_HELP_FEATURE_PRODUCTION,
+ WIDGET_HELP_WORKER_RATE,
+ WIDGET_HELP_TRADE_ROUTES,
+ WIDGET_HELP_HEALTH_RATE,
+ WIDGET_HELP_HAPPINESS_RATE,
+ WIDGET_HELP_FREE_TECH,
+ WIDGET_HELP_LOS_BONUS,
+ WIDGET_HELP_MAP_CENTER,
+ WIDGET_HELP_MAP_REVEAL,
+ WIDGET_HELP_MAP_TRADE,
+ WIDGET_HELP_TECH_TRADE,
+ WIDGET_HELP_GOLD_TRADE,
+ WIDGET_HELP_OPEN_BORDERS,
+ WIDGET_HELP_DEFENSIVE_PACT,
+ WIDGET_HELP_PERMANENT_ALLIANCE,
+ WIDGET_HELP_VASSAL_STATE,
+ WIDGET_HELP_BUILD_BRIDGE,
+ WIDGET_HELP_IRRIGATION,
+ WIDGET_HELP_IGNORE_IRRIGATION,
+ WIDGET_HELP_WATER_WORK,
+ WIDGET_HELP_IMPROVEMENT,
+ WIDGET_HELP_DOMAIN_EXTRA_MOVES,
+ WIDGET_HELP_ADJUST,
+ WIDGET_HELP_TERRAIN_TRADE,
+ WIDGET_HELP_SPECIAL_BUILDING,
+ WIDGET_HELP_YIELD_CHANGE,
+ WIDGET_HELP_BONUS_REVEAL,
+ WIDGET_HELP_CIVIC_REVEAL,
+ WIDGET_HELP_PROCESS_INFO,
+ WIDGET_HELP_FOUND_RELIGION,
+ WIDGET_HELP_FOUND_CORPORATION,
+ WIDGET_HELP_FINANCE_NUM_UNITS,
+ WIDGET_HELP_FINANCE_UNIT_COST,
+ WIDGET_HELP_FINANCE_AWAY_SUPPLY,
+ WIDGET_HELP_FINANCE_CITY_MAINT,
+ WIDGET_HELP_FINANCE_CIVIC_UPKEEP,
+ WIDGET_HELP_FINANCE_FOREIGN_INCOME,
+ WIDGET_HELP_FINANCE_INFLATED_COSTS,
+ WIDGET_HELP_FINANCE_GROSS_INCOME,
+ WIDGET_HELP_FINANCE_NET_GOLD,
+ WIDGET_HELP_FINANCE_GOLD_RESERVE,
+ WIDGET_HELP_PROMOTION,
+
+ WIDGET_CHOOSE_EVENT,
+ WIDGET_PEDIA_JUMP_TO_TECH,
+ WIDGET_PEDIA_JUMP_TO_UNIT,
+ WIDGET_PEDIA_JUMP_TO_BUILDING,
+ WIDGET_PEDIA_JUMP_TO_REQUIRED_TECH,
+ WIDGET_PEDIA_JUMP_TO_DERIVED_TECH,
+ WIDGET_PEDIA_BACK,
+ WIDGET_PEDIA_FORWARD,
+ WIDGET_PEDIA_JUMP_TO_BONUS,
+ WIDGET_PEDIA_MAIN,
+ WIDGET_PEDIA_JUMP_TO_PROMOTION,
+ WIDGET_PEDIA_JUMP_TO_UNIT_COMBAT,
+ WIDGET_PEDIA_JUMP_TO_IMPROVEMENT,
+ WIDGET_PEDIA_JUMP_TO_CIVIC,
+ WIDGET_PEDIA_JUMP_TO_CIV,
+ WIDGET_PEDIA_JUMP_TO_LEADER,
+ WIDGET_PEDIA_JUMP_TO_SPECIALIST,
+ WIDGET_PEDIA_JUMP_TO_PROJECT,
+ WIDGET_PEDIA_JUMP_TO_TERRAIN,
+ WIDGET_PEDIA_JUMP_TO_FEATURE,
+ WIDGET_TURN_EVENT,
+ WIDGET_FOREIGN_ADVISOR,
+ WIDGET_REVOLUTION,
+ WIDGET_PEDIA_DESCRIPTION,
+ WIDGET_PEDIA_DESCRIPTION_NO_HELP,
+ WIDGET_DEAL_KILL,
+ WIDGET_MINIMAP_HIGHLIGHT,
+ WIDGET_PRODUCTION_MOD_HELP,
+ WIDGET_LEADERHEAD,
+ WIDGET_LEADER_LINE,
+ WIDGET_COMMERCE_MOD_HELP,
+ WIDGET_CLOSE_SCREEN,
+ WIDGET_PEDIA_JUMP_TO_RELIGION,
+ WIDGET_PEDIA_JUMP_TO_CORPORATION,
+ WIDGET_GLOBELAYER,
+ WIDGET_GLOBELAYER_OPTION,
+ WIDGET_GLOBELAYER_TOGGLE,
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ WIDGET_PEDIA_JUMP_TO_HERO,
+ WIDGET_CHECK_CORE_TROOP,
+ WIDGET_CHECK_MEMBER_TROOP,
+ WIDGET_FORM_LEGION,
+ WIDGET_CYCLE_LEGION,
+ // Sanguo Mod Hero, end
+
+#ifdef _USRDLL
+ NUM_WIDGET_TYPES
+#endif
+};
+
+enum DllExport ButtonPopupTypes // Exposed to Python
+{
+ BUTTONPOPUP_TEXT,
+ BUTTONPOPUP_MAIN_MENU,
+ BUTTONPOPUP_CONFIRM_MENU,
+ BUTTONPOPUP_DECLAREWARMOVE,
+ BUTTONPOPUP_CONFIRMCOMMAND,
+ BUTTONPOPUP_LOADUNIT,
+ BUTTONPOPUP_LEADUNIT,
+ BUTTONPOPUP_DOESPIONAGE,
+ BUTTONPOPUP_DOESPIONAGE_TARGET,
+ BUTTONPOPUP_CHOOSETECH,
+ BUTTONPOPUP_RAZECITY,
+ BUTTONPOPUP_DISBANDCITY,
+ BUTTONPOPUP_CHOOSEPRODUCTION,
+ BUTTONPOPUP_CHANGECIVIC,
+ BUTTONPOPUP_CHANGERELIGION,
+ BUTTONPOPUP_CHOOSEELECTION,
+ BUTTONPOPUP_DIPLOVOTE,
+ BUTTONPOPUP_ALARM,
+ BUTTONPOPUP_DEAL_CANCELED,
+ BUTTONPOPUP_PYTHON,
+ BUTTONPOPUP_PYTHON_SCREEN,
+ BUTTONPOPUP_DETAILS,
+ BUTTONPOPUP_ADMIN,
+ BUTTONPOPUP_ADMIN_PASSWORD,
+ BUTTONPOPUP_EXTENDED_GAME,
+ BUTTONPOPUP_DIPLOMACY,
+ BUTTONPOPUP_ADDBUDDY,
+ BUTTONPOPUP_FORCED_DISCONNECT,
+ BUTTONPOPUP_PITBOSS_DISCONNECT,
+ BUTTONPOPUP_KICKED,
+ BUTTONPOPUP_VASSAL_DEMAND_TRIBUTE,
+ BUTTONPOPUP_VASSAL_GRANT_TRIBUTE,
+ BUTTONPOPUP_EVENT,
+ BUTTONPOPUP_FREE_COLONY,
+ BUTTONPOPUP_LAUNCH,
+ BUTTONPOPUP_FOUND_RELIGION,
+
+#ifdef _USRDLL
+ NUM_BUTTONPOPUP_TYPES
+#endif
+};
+
+enum DllExport ClimateTypes // Exposed to Python
+{
+ NO_CLIMATE = -1,
+};
+
+enum DllExport SeaLevelTypes // Exposed to Python
+{
+ NO_SEALEVEL = -1,
+};
+
+enum DllExport CustomMapOptionTypes // Exposed to Python
+{
+ NO_CUSTOM_MAPOPTION = -1,
+};
+
+enum DllExport WorldSizeTypes // Exposed to Python
+{
+ NO_WORLDSIZE = -1,
+
+ WORLDSIZE_DUEL,
+ WORLDSIZE_TINY,
+ WORLDSIZE_SMALL,
+ WORLDSIZE_STANDARD,
+ WORLDSIZE_LARGE,
+ WORLDSIZE_HUGE,
+
+#ifdef _USRDLL
+ NUM_WORLDSIZE_TYPES
+#endif
+};
+
+// This is our current relationship with each
+// one of our connected network peers
+enum DllExport InitStates
+{
+ INIT_INACTIVE,
+ INIT_CONNECTED,
+ INIT_SENT_READY,
+ INIT_READY,
+ INIT_ASSIGNED_ID,
+ INIT_SENT_ID,
+ INIT_PEER,
+ INIT_FILE_TRANSFER,
+ INIT_TRANSFER_COMPLETE,
+ INIT_AUTHORIZED,
+ INIT_MAP_CONFIRMED,
+ INIT_GAME_STARTED,
+};
+
+enum DllExport TerrainTypes // Exposed to Python
+{
+ NO_TERRAIN = -1,
+};
+
+enum DllExport PlotTypes // Exposed to Python
+{
+ NO_PLOT = -1,
+
+ PLOT_PEAK,
+ PLOT_HILLS,
+ PLOT_LAND,
+ PLOT_OCEAN,
+
+#ifdef _USRDLL
+ NUM_PLOT_TYPES
+#endif
+};
+
+enum DllExport YieldTypes // Exposed to Python
+{
+ NO_YIELD = -1,
+
+ YIELD_FOOD,
+ YIELD_PRODUCTION,
+ YIELD_COMMERCE,
+
+#ifdef _USRDLL
+ NUM_YIELD_TYPES
+#endif
+};
+
+enum DllExport CommerceTypes // Exposed to Python
+{
+ NO_COMMERCE = -1,
+
+ COMMERCE_GOLD,
+ COMMERCE_RESEARCH,
+ COMMERCE_CULTURE,
+ COMMERCE_ESPIONAGE,
+
+#ifdef _USRDLL
+ NUM_COMMERCE_TYPES
+#endif
+};
+
+enum DllExport AdvisorTypes // Exposed to Python
+{
+ NO_ADVISOR = -1
+};
+
+enum DllExport FlavorTypes // Exposed to Python
+{
+ NO_FLAVOR = -1
+};
+
+enum DllExport EmphasizeTypes // Exposed to Python
+{
+ NO_EMPHASIZE = -1,
+};
+
+enum DllExport GameOptionTypes // Exposed to Python
+{
+ NO_GAMEOPTION = -1,
+
+ GAMEOPTION_ADVANCED_START,
+ GAMEOPTION_NO_CITY_RAZING,
+ GAMEOPTION_NO_CITY_FLIPPING,
+ GAMEOPTION_FLIPPING_AFTER_CONQUEST,
+ GAMEOPTION_NO_BARBARIANS,
+ GAMEOPTION_RAGING_BARBARIANS,
+ GAMEOPTION_AGGRESSIVE_AI,
+ GAMEOPTION_LEAD_ANY_CIV,
+ GAMEOPTION_RANDOM_PERSONALITIES,
+ GAMEOPTION_PICK_RELIGION,
+ GAMEOPTION_NO_TECH_TRADING,
+ GAMEOPTION_NO_TECH_BROKERING,
+ GAMEOPTION_PERMANENT_ALLIANCES,
+ GAMEOPTION_ALWAYS_WAR,
+ GAMEOPTION_ALWAYS_PEACE,
+ GAMEOPTION_ONE_CITY_CHALLENGE,
+ GAMEOPTION_NO_CHANGING_WAR_PEACE,
+ GAMEOPTION_NEW_RANDOM_SEED,
+ GAMEOPTION_LOCK_MODS,
+ GAMEOPTION_COMPLETE_KILLS,
+ GAMEOPTION_NO_VASSAL_STATES,
+ GAMEOPTION_NO_GOODY_HUTS,
+ GAMEOPTION_NO_EVENTS,
+ GAMEOPTION_NO_ESPIONAGE,
+ // Sanguo Mod Hero, start, added by poyuzhe 02.08.09
+ GAMEOPTION_NO_HERO_DEATH_FROM_COMBAT,
+ GAMEOPTION_NO_SETTLER,
+ // Sanguo Mod Hero, end
+
+#ifdef _USRDLL
+ NUM_GAMEOPTION_TYPES
+#endif
+};
+
+enum DllExport MultiplayerOptionTypes // Exposed to Python
+{
+ NO_MPOPTION = -1,
+
+ MPOPTION_SIMULTANEOUS_TURNS,
+ MPOPTION_TAKEOVER_AI,
+ MPOPTION_SHUFFLE_TEAMS,
+ MPOPTION_ANONYMOUS,
+ MPOPTION_TURN_TIMER,
+
+#ifdef _USRDLL
+ NUM_MPOPTION_TYPES
+#endif
+};
+
+enum DllExport SpecialOptionTypes // Exposed to Python
+{
+ NO_SPECIALOPTION = -1,
+
+ SPECIALOPTION_REPORT_STATS,
+
+#ifdef _USRDLL
+ NUM_SPECIALOPTION_TYPES
+#endif
+};
+
+enum DllExport PlayerOptionTypes // Exposed to Python
+{
+ NO_PLAYEROPTION = -1,
+
+ PLAYEROPTION_ADVISOR_POPUPS,
+ PLAYEROPTION_ADVISOR_HELP,
+ PLAYEROPTION_WAIT_END_TURN,
+ PLAYEROPTION_MINIMIZE_POP_UPS,
+ PLAYEROPTION_SHOW_FRIENDLY_MOVES,
+ PLAYEROPTION_SHOW_ENEMY_MOVES,
+ PLAYEROPTION_QUICK_MOVES,
+ PLAYEROPTION_QUICK_ATTACK,
+ PLAYEROPTION_QUICK_DEFENSE,
+ PLAYEROPTION_STACK_ATTACK,
+ PLAYEROPTION_AUTO_PROMOTION,
+ PLAYEROPTION_START_AUTOMATED,
+ PLAYEROPTION_SAFE_AUTOMATION,
+ PLAYEROPTION_NUMPAD_HELP,
+ PLAYEROPTION_NO_UNIT_CYCLING,
+ PLAYEROPTION_NO_UNIT_RECOMMENDATIONS,
+ PLAYEROPTION_RIGHT_CLICK_MENU,
+ PLAYEROPTION_LEAVE_FORESTS,
+ PLAYEROPTION_MISSIONARIES_AUTOMATED,
+ PLAYEROPTION_MODDER_1,
+ PLAYEROPTION_MODDER_2,
+ PLAYEROPTION_MODDER_3,
+
+#ifdef _USRDLL
+ NUM_PLAYEROPTION_TYPES
+#endif
+};
+
+enum DllExport GraphicOptionTypes // Exposed to Python
+{
+ NO_GRAPHICOPTION = -1,
+
+ GRAPHICOPTION_SINGLE_UNIT_GRAPHICS,
+ GRAPHICOPTION_HEALTH_BARS,
+ GRAPHICOPTION_CITY_DETAIL,
+ GRAPHICOPTION_NO_COMBAT_ZOOM,
+ GRAPHICOPTION_NO_ENEMY_GLOW,
+ GRAPHICOPTION_FROZEN_ANIMATIONS,
+ GRAPHICOPTION_EFFECTS_DISABLED,
+ GRAPHICOPTION_GLOBE_VIEW_BUILDINGS_DISABLED,
+ GRAPHICOPTION_FULLSCREEN,
+ GRAPHICOPTION_LOWRES_TEXTURES,
+ GRAPHICOPTION_HIRES_TERRAIN,
+ GRAPHICOPTION_NO_MOVIES,
+ GRAPHICOPTION_CITY_RADIUS,
+
+#ifdef _USRDLL
+ NUM_GRAPHICOPTION_TYPES
+#endif
+};
+
+enum DllExport ForceControlTypes // Exposed to Python
+{
+ NO_FORCECONTROL = -1,
+
+ FORCECONTROL_SPEED,
+ FORCECONTROL_HANDICAP,
+ FORCECONTROL_OPTIONS,
+ FORCECONTROL_VICTORIES,
+ FORCECONTROL_MAX_TURNS,
+ FORCECONTROL_MAX_CITY_ELIMINATION,
+ FORCECONTROL_ADVANCED_START,
+
+#ifdef _USRDLL
+ NUM_FORCECONTROL_TYPES
+#endif
+};
+
+enum DllExport TileArtTypes
+{
+ TILE_ART_TYPE_NONE = -1,
+ TILE_ART_TYPE_TREES,
+ TILE_ART_TYPE_HALF_TILING,
+ TILE_ART_TYPE_PLOT_TILING,
+ NUM_TILE_ART_TYPES
+};
+
+enum DllExport LightTypes
+{
+ LIGHT_TYPE_NONE = -1,
+ LIGHT_TYPE_SUN,
+ LIGHT_TYPE_TERRAIN,
+ LIGHT_TYPE_UNIT,
+ NUM_LIGHT_TYPES
+};
+
+enum DllExport VictoryTypes // Exposed to Python
+{
+ NO_VICTORY = -1,
+};
+
+enum DllExport FeatureTypes // Exposed to Python
+{
+ NO_FEATURE = -1,
+};
+
+enum DllExport BonusTypes // Exposed to Python
+{
+ NO_BONUS = -1,
+};
+
+enum DllExport BonusClassTypes // Exposed to Python
+{
+ NO_BONUSCLASS = -1,
+};
+
+enum DllExport ImprovementTypes // Exposed to Python
+{
+ NO_IMPROVEMENT = -1,
+};
+
+enum DllExport RouteTypes // Exposed to Python
+{
+ NO_ROUTE = -1,
+};
+
+enum DllExport RiverTypes // Exposed to Python
+{
+ NO_RIVER = -1,
+};
+
+enum DllExport GoodyTypes // Exposed to Python
+{
+ NO_GOODY = -1,
+};
+
+enum DllExport BuildTypes // Exposed to Python
+{
+ NO_BUILD = -1,
+};
+
+enum DllExport SymbolTypes // Exposed to Python
+{
+ NO_SYMBOL = -1,
+};
+
+enum DllExport FontSymbols // Exposed to Python
+{
+ // 'OTHER' symbols
+ HAPPY_CHAR = 0,
+ UNHAPPY_CHAR,
+ HEALTHY_CHAR,
+ UNHEALTHY_CHAR,
+ BULLET_CHAR,
+ STRENGTH_CHAR,
+ MOVES_CHAR,
+ RELIGION_CHAR,
+ STAR_CHAR,
+ SILVER_STAR_CHAR,
+ TRADE_CHAR,
+ DEFENSE_CHAR,
+ GREAT_PEOPLE_CHAR,
+ BAD_GOLD_CHAR,
+ BAD_FOOD_CHAR,
+ EATEN_FOOD_CHAR,
+ GOLDEN_AGE_CHAR,
+ ANGRY_POP_CHAR,
+ OPEN_BORDERS_CHAR,
+ DEFENSIVE_PACT_CHAR,
+ MAP_CHAR,
+ OCCUPATION_CHAR,
+ POWER_CHAR,
+
+#ifdef _USRDLL
+ MAX_NUM_SYMBOLS
+#endif
+};
+
+enum DllExport HandicapTypes // Exposed to Python
+{
+ NO_HANDICAP = -1,
+};
+
+enum DllExport GameSpeedTypes // Exposed to Python
+{
+ NO_GAMESPEED = -1,
+};
+
+enum DllExport TurnTimerTypes // Exposed to Python
+{
+ NO_TURNTIMER = -1,
+};
+
+enum DllExport EraTypes // Exposed to Python
+{
+ NO_ERA = -1,
+};
+
+enum DllExport CivilizationTypes // Exposed to Python
+{
+ NO_CIVILIZATION = -1,
+};
+
+enum DllExport LeaderHeadTypes // Exposed to Python
+{
+ NO_LEADER = -1,
+};
+
+// Used for managing Art Differences based on nationality
+enum DllExport ArtStyleTypes // Exposed to Python
+{
+ NO_ARTSTYLE = -1,
+};
+
+enum DllExport UnitArtStyleTypes
+{
+ NO_UNIT_ARTSTYLE = -1,
+};
+
+enum DllExport CitySizeTypes // Exposed to Python
+{
+ NO_CITYSIZE = -1,
+
+ CITYSIZE_SMALL,
+ CITYSIZE_MEDIUM,
+ CITYSIZE_LARGE,
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvEventReporter.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,324 @@
+#include "CvGameCoreDLL.h"
+#include "CvEventReporter.h"
+#include "CvDllPythonEvents.h"
+#include "CvInitCore.h"
+
+
+//
+// static, singleton accessor
+//
+CvEventReporter& CvEventReporter::getInstance()
+{
+ static CvEventReporter gEventReporter;
+ return gEventReporter;
+}
+
+void CvEventReporter::resetStatistics()
+{
+ m_kStatistics.reset();
+}
+
+void CvEventReporter::genericEvent(const char* szEventName, void *pyArgs)
+{
+ m_kPythonEventMgr.reportGenericEvent(szEventName, pyArgs);
+}
+
+void CvEventReporter::gameEnd()
+{
+ m_kPythonEventMgr.reportGameEnd();
+}
+
+void CvEventReporter::beginGameTurn(int iGameTurn)
+{
+ m_kPythonEventMgr.reportBeginGameTurn(iGameTurn);
+}
+
+void CvEventReporter::endGameTurn(int iGameTurn)
+{
+ m_kPythonEventMgr.reportEndGameTurn(iGameTurn);
+}
+
+void CvEventReporter::beginPlayerTurn(int iGameTurn, PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportBeginPlayerTurn(iGameTurn, ePlayer);
+}
+
+void CvEventReporter::endPlayerTurn(int iGameTurn, PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportEndPlayerTurn(iGameTurn, ePlayer);
+}
+
+void CvEventReporter::firstContact(TeamTypes eTeamID1, TeamTypes eTeamID2)
+{
+ m_kPythonEventMgr.reportFirstContact(eTeamID1, eTeamID2);
+}
+
+void CvEventReporter::combatResult(CvUnit* pWinner, CvUnit* pLoser)
+{
+ m_kPythonEventMgr.reportCombatResult(pWinner, pLoser);
+}
+
+void CvEventReporter::improvementBuilt(int iImprovementType, int iX, int
iY)
+{
+ m_kPythonEventMgr.reportImprovementBuilt(iImprovementType, iX, iY);
+}
+
+void CvEventReporter::improvementDestroyed(int iImprovementType, int
iPlayer, int iX, int iY)
+{
+ m_kPythonEventMgr.reportImprovementDestroyed(iImprovementType, iPlayer,
iX, iY);
+}
+
+void CvEventReporter::routeBuilt(int iRouteType, int iX, int iY)
+{
+ m_kPythonEventMgr.reportRouteBuilt(iRouteType, iX, iY);
+}
+
+void CvEventReporter::plotRevealed(CvPlot *pPlot, TeamTypes eTeam)
+{
+ m_kPythonEventMgr.reportPlotRevealed(pPlot, eTeam);
+}
+
+void CvEventReporter::plotFeatureRemoved(CvPlot *pPlot, FeatureTypes
eFeature, CvCity* pCity)
+{
+ m_kPythonEventMgr.reportPlotFeatureRemoved(pPlot, eFeature, pCity);
+}
+
+void CvEventReporter::nukeExplosion(CvPlot *pPlot, CvUnit* pNukeUnit)
+{
+ m_kPythonEventMgr.reportNukeExplosion(pPlot, pNukeUnit);
+}
+
+void CvEventReporter::cityBuilt( CvCity *pCity )
+{
+ m_kPythonEventMgr.reportCityBuilt(pCity);
+ m_kStatistics.cityBuilt(pCity);
+}
+
+void CvEventReporter::cityRazed( CvCity *pCity, PlayerTypes ePlayer )
+{
+ m_kPythonEventMgr.reportCityRazed(pCity, ePlayer);
+ m_kStatistics.cityRazed(pCity, ePlayer);
+}
+
+void CvEventReporter::cityAcquired(PlayerTypes eOldOwner, PlayerTypes
iPlayer, CvCity* pCity, bool bConquest, bool bTrade)
+{
+ m_kPythonEventMgr.reportCityAcquired(eOldOwner, iPlayer, pCity,
bConquest, bTrade);
+}
+
+
+void CvEventReporter::cityAcquiredAndKept(PlayerTypes iPlayer, CvCity*
pCity)
+{
+ m_kPythonEventMgr.reportCityAcquiredAndKept(iPlayer, pCity);
+}
+
+void CvEventReporter::cityLost( CvCity *pCity)
+{
+ m_kPythonEventMgr.reportCityLost(pCity);
+}
+
+void CvEventReporter::cultureExpansion( CvCity *pCity, PlayerTypes ePlayer
)
+{
+ m_kPythonEventMgr.reportCultureExpansion(pCity, ePlayer);
+}
+
+void CvEventReporter::cityGrowth(CvCity *pCity, PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportCityGrowth(pCity, ePlayer);
+}
+
+void CvEventReporter::cityDoTurn( CvCity *pCity, PlayerTypes ePlayer )
+{
+ m_kPythonEventMgr.reportCityProduction(pCity, ePlayer);
+}
+
+void CvEventReporter::cityBuildingUnit(CvCity* pCity, UnitTypes eUnitType)
+{
+ m_kPythonEventMgr.reportCityBuildingUnit(pCity, eUnitType);
+}
+
+void CvEventReporter::cityBuildingBuilding(CvCity* pCity, BuildingTypes
eBuildingType)
+{
+ m_kPythonEventMgr.reportCityBuildingBuilding(pCity, eBuildingType);
+}
+
+void CvEventReporter::cityRename(CvCity* pCity)
+{
+ m_kPythonEventMgr.reportCityRename(pCity);
+}
+
+void CvEventReporter::cityHurry(CvCity* pCity, HurryTypes eHurry)
+{
+ m_kPythonEventMgr.reportCityHurry(pCity, eHurry);
+}
+
+void CvEventReporter::selectionGroupPushMission(CvSelectionGroup*
pSelectionGroup, MissionTypes eMission)
+{
+ m_kPythonEventMgr.reportSelectionGroupPushMission(pSelectionGroup,
eMission);
+}
+
+void CvEventReporter::unitMove(CvPlot* pPlot, CvUnit* pUnit, CvPlot*
pOldPlot)
+{
+ m_kPythonEventMgr.reportUnitMove(pPlot, pUnit, pOldPlot);
+}
+
+void CvEventReporter::unitSetXY(CvPlot* pPlot, CvUnit* pUnit)
+{
+ m_kPythonEventMgr.reportUnitSetXY(pPlot, pUnit);
+}
+
+void CvEventReporter::unitCreated(CvUnit *pUnit)
+{
+ m_kPythonEventMgr.reportUnitCreated(pUnit);
+}
+
+void CvEventReporter::unitBuilt(CvCity *pCity, CvUnit *pUnit)
+{
+ m_kPythonEventMgr.reportUnitBuilt(pCity, pUnit);
+ m_kStatistics.unitBuilt(pUnit);
+}
+
+void CvEventReporter::unitKilled(CvUnit *pUnit, PlayerTypes eAttacker )
+{
+ m_kPythonEventMgr.reportUnitKilled(pUnit, eAttacker);
+ m_kStatistics.unitKilled(pUnit, eAttacker);
+}
+
+void CvEventReporter::unitLost(CvUnit *pUnit)
+{
+ m_kPythonEventMgr.reportUnitLost(pUnit);
+}
+
+void CvEventReporter::unitPromoted(CvUnit *pUnit, PromotionTypes
ePromotion)
+{
+ m_kPythonEventMgr.reportUnitPromoted(pUnit, ePromotion);
+}
+
+void CvEventReporter::unitRename(CvUnit* pUnit)
+{
+ m_kPythonEventMgr.reportUnitRename(pUnit);
+}
+
+void CvEventReporter::unitPillage(CvUnit* pUnit, ImprovementTypes
eImprovement, RouteTypes eRoute, PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportUnitPillage(pUnit, eImprovement, eRoute, ePlayer);
+}
+
+void CvEventReporter::unitSpreadReligionAttempt(CvUnit* pUnit,
ReligionTypes eReligion, bool bSuccess)
+{
+ m_kPythonEventMgr.reportUnitSpreadReligionAttempt(pUnit, eReligion,
bSuccess);
+}
+
+void CvEventReporter::unitGifted(CvUnit* pUnit, PlayerTypes
eGiftingPlayer, CvPlot* pPlotLocation)
+{
+ m_kPythonEventMgr.reportUnitGifted(pUnit, eGiftingPlayer, pPlotLocation);
+}
+
+void CvEventReporter::unitBuildImprovement(CvUnit* pUnit, BuildTypes
eBuild, bool bFinished)
+{
+ m_kPythonEventMgr.reportUnitBuildImprovement(pUnit, eBuild, bFinished);
+}
+
+void CvEventReporter::goodyReceived(PlayerTypes ePlayer, CvPlot
*pGoodyPlot, CvUnit *pGoodyUnit, GoodyTypes eGoodyType)
+{
+ m_kPythonEventMgr.reportGoodyReceived(ePlayer, pGoodyPlot, pGoodyUnit,
eGoodyType);
+}
+
+void CvEventReporter::greatPersonBorn(CvUnit *pUnit, PlayerTypes ePlayer,
CvCity *pCity)
+{
+ m_kPythonEventMgr.reportGreatPersonBorn( pUnit, ePlayer, pCity);
+ m_kStatistics.unitBuilt(pUnit);
+}
+
+void CvEventReporter::buildingBuilt(CvCity *pCity, BuildingTypes eBuilding)
+{
+ m_kPythonEventMgr.reportBuildingBuilt(pCity, eBuilding);
+ m_kStatistics.buildingBuilt(pCity, eBuilding);
+}
+
+void CvEventReporter::projectBuilt(CvCity *pCity, ProjectTypes eProject)
+{
+ m_kPythonEventMgr.reportProjectBuilt(pCity, eProject);
+}
+
+void CvEventReporter::techAcquired(TechTypes eType, TeamTypes eTeam,
PlayerTypes ePlayer, bool bAnnounce)
+{
+ m_kPythonEventMgr.reportTechAcquired(eType, eTeam, ePlayer, bAnnounce);
+}
+
+void CvEventReporter::techSelected(TechTypes eTech, PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportTechSelected(eTech, ePlayer);
+}
+
+void CvEventReporter::religionFounded(ReligionTypes eType, PlayerTypes
ePlayer)
+{
+ m_kPythonEventMgr.reportReligionFounded(eType, ePlayer);
+ m_kStatistics.religionFounded(eType, ePlayer);
+}
+
+void CvEventReporter::religionSpread(ReligionTypes eType, PlayerTypes
ePlayer, CvCity* pSpreadCity)
+{
+ m_kPythonEventMgr.reportReligionSpread(eType, ePlayer, pSpreadCity);
+}
+
+void CvEventReporter::religionRemove(ReligionTypes eType, PlayerTypes
ePlayer, CvCity* pSpreadCity)
+{
+ m_kPythonEventMgr.reportReligionRemove(eType, ePlayer, pSpreadCity);
+}
+
+void CvEventReporter::corporationFounded(CorporationTypes eType,
PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportCorporationFounded(eType, ePlayer);
+}
+
+void CvEventReporter::corporationSpread(CorporationTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ m_kPythonEventMgr.reportCorporationSpread(eType, ePlayer, pSpreadCity);
+}
+
+void CvEventReporter::corporationRemove(CorporationTypes eType,
PlayerTypes ePlayer, CvCity* pSpreadCity)
+{
+ m_kPythonEventMgr.reportCorporationRemove(eType, ePlayer, pSpreadCity);
+}
+
+void CvEventReporter::goldenAge(PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportGoldenAge(ePlayer);
+ m_kStatistics.goldenAge(ePlayer);
+}
+
+void CvEventReporter::endGoldenAge(PlayerTypes ePlayer)
+{
+ m_kPythonEventMgr.reportEndGoldenAge(ePlayer);
+}
+
+void CvEventReporter::changeWar(bool bWar, TeamTypes eTeam, TeamTypes
eOtherTeam)
+{
+ m_kPythonEventMgr.reportChangeWar(bWar, eTeam, eOtherTeam);
+}
+
+void CvEventReporter::setPlayerAlive( PlayerTypes ePlayerID, bool
bNewValue )
+{
+ m_kPythonEventMgr.reportSetPlayerAlive( ePlayerID, bNewValue );
+}
+
+void CvEventReporter::playerChangeStateReligion(PlayerTypes ePlayerID,
ReligionTypes eNewReligion, ReligionTypes eOldReligion)
+{
+ m_kPythonEventMgr.reportPlayerChangeStateReligion(ePlayerID,
eNewReligion, eOldReligion);
+}
+
+void CvEventReporter::playerGoldTrade(PlayerTypes eFromPlayer, PlayerTypes
eToPlayer, int iAmount)
+{
+ m_kPythonEventMgr.reportPlayerGoldTrade(eFromPlayer, eToPlayer, iAmount);
+}
+
+void CvEventReporter::victory(TeamTypes eWinner, VictoryTypes eVictory)
+{
+ m_kPythonEventMgr.reportVictory(eWinner, eVictory);
+ m_kStatistics.setVictory(eWinner, eVictory);
+}
+
+void CvEventReporter::vassalState(TeamTypes eMaster, TeamTypes eVassal,
bool bVassal)
+{
+ m_kPythonEventMgr.reportVassalState(eMaster, eVassal, bVassal);
+}
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvEventReporter.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,131 @@
+#pragma once
+
+#ifndef CvEventReporter_h
+#define CvEventReporter_h
+
+#include "CvStatistics.h"
+#include "CvDllPythonEvents.h"
+
+//
+// A singleton class which is used to track game events.
+// It will report events to python and the stats collector.
+//
+
+struct CvStatBase;
+struct TradeData;
+class CyDiplomacyTrade;
+class CvUnit;
+class CvCity;
+class CvPlot;
+class CvSelectionGroup;
+class CvEventReporter
+{
+ friend class CyStatistics;
+public:
+ DllExport static CvEventReporter& getInstance(); // singleton accessor
+ DllExport void resetStatistics();
+
+
+
+ void genericEvent(const char* szEventName, void *pyArgs);
+
+
+
+
+
+
+
+
+
+
+ void gameEnd();
+
+
+ void beginGameTurn(int iGameTurn);
+ void endGameTurn(int iGameTurn);
+
+ void beginPlayerTurn(int iGameTurn, PlayerTypes);
+ void endPlayerTurn(int iGameTurn, PlayerTypes);
+
+ void firstContact(TeamTypes eTeamID1, TeamTypes eTeamID2);
+ void combatResult(CvUnit* pWinner, CvUnit* pLoser);
+ void improvementBuilt(int iImprovementType, int iX, int iY);
+ void improvementDestroyed(int iImprovementType, int iPlayer, int iX, int
iY);
+ void routeBuilt(int iRouteType, int iX, int iY);
+
+ void plotRevealed(CvPlot *pPlot, TeamTypes eTeam);
+ void plotFeatureRemoved(CvPlot *pPlot, FeatureTypes eFeature, CvCity*
pCity);
+
+ void nukeExplosion(CvPlot *pPlot, CvUnit* pNukeUnit);
+
+
+ void cityBuilt(CvCity *pCity);
+ void cityRazed(CvCity *pCity, PlayerTypes ePlayer);
+ void cityAcquired(PlayerTypes eOldOwner, PlayerTypes ePlayer, CvCity*
pCity, bool bConquest, bool bTrade);
+ void cityAcquiredAndKept(PlayerTypes ePlayer, CvCity* pCity);
+ void cityLost(CvCity *pCity);
+ void cultureExpansion( CvCity *pCity, PlayerTypes ePlayer);
+ void cityGrowth(CvCity *pCity, PlayerTypes ePlayer);
+ void cityDoTurn(CvCity *pCity, PlayerTypes ePlayer);
+ void cityBuildingUnit(CvCity* pCity, UnitTypes eUnitType);
+ void cityBuildingBuilding(CvCity* pCity, BuildingTypes eBuildingType);
+ void cityRename(CvCity* pCity);
+ void cityHurry(CvCity* pCity, HurryTypes eHurry);
+
+ void selectionGroupPushMission(CvSelectionGroup* pSelectionGroup,
MissionTypes eMission);
+
+ void unitMove(CvPlot* pPlot, CvUnit* pUnit, CvPlot* pOldPlot);
+ void unitSetXY(CvPlot* pPlot, CvUnit* pUnit);
+ void unitCreated(CvUnit *pUnit);
+ void unitBuilt(CvCity *pCity, CvUnit *pUnit);
+ void unitKilled(CvUnit *pUnit, PlayerTypes eAttacker);
+ void unitLost(CvUnit *pUnit);
+ void unitPromoted(CvUnit *pUnit, PromotionTypes ePromotion);
+
+ void unitRename(CvUnit* pUnit);
+ void unitPillage(CvUnit* pUnit, ImprovementTypes eImprovement, RouteTypes
eRoute, PlayerTypes ePlayer);
+ void unitSpreadReligionAttempt(CvUnit* pUnit, ReligionTypes eReligion,
bool bSuccess);
+ void unitGifted(CvUnit* pUnit, PlayerTypes eGiftingPlayer, CvPlot*
pPlotLocation);
+ void unitBuildImprovement(CvUnit* pUnit, BuildTypes eBuild, bool
bFinished);
+
+ void goodyReceived(PlayerTypes ePlayer, CvPlot *pGoodyPlot, CvUnit
*pGoodyUnit, GoodyTypes eGoodyType);
+
+ void greatPersonBorn(CvUnit *pUnit, PlayerTypes ePlayer, CvCity *pCity );
+
+ void buildingBuilt(CvCity *pCity, BuildingTypes eBuilding);
+ void projectBuilt(CvCity *pCity, ProjectTypes eProject);
+
+ void techAcquired(TechTypes eType, TeamTypes eTeam, PlayerTypes ePlayer,
bool bAnnounce);
+ void techSelected(TechTypes eTech, PlayerTypes ePlayer);
+
+ void religionFounded(ReligionTypes eType, PlayerTypes ePlayer);
+ void religionSpread(ReligionTypes eType, PlayerTypes ePlayer, CvCity*
pSpreadCity);
+ void religionRemove(ReligionTypes eType, PlayerTypes ePlayer, CvCity*
pSpreadCity);
+
+ void corporationFounded(CorporationTypes eType, PlayerTypes ePlayer);
+ void corporationSpread(CorporationTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+ void corporationRemove(CorporationTypes eType, PlayerTypes ePlayer,
CvCity* pSpreadCity);
+
+ void goldenAge(PlayerTypes ePlayer);
+ void endGoldenAge(PlayerTypes ePlayer);
+ void changeWar(bool bWar, TeamTypes eTeam, TeamTypes eOtherTeam);
+
+ void setPlayerAlive( PlayerTypes ePlayerID, bool bNewValue );
+ void playerChangeStateReligion(PlayerTypes ePlayerID, ReligionTypes
eNewReligion, ReligionTypes eOldReligion);
+ void playerGoldTrade(PlayerTypes eFromPlayer, PlayerTypes eToPlayer, int
iAmount);
+
+
+
+ void victory(TeamTypes eWinner, VictoryTypes eVictory);
+
+ void vassalState(TeamTypes eMaster, TeamTypes eVassal, bool bVassal);
+
+private:
+ CvDllPythonEvents m_kPythonEventMgr;
+ CvStatistics m_kStatistics;
+};
+
+// helper
+#define EVENT_REPORTER CvEventReporter::getInstance()
+
+#endif // CvEventReporter_h
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvFractal.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,417 @@
+// fractal.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvFractal.h"
+#include "CvRandom.h"
+#include "CvGameCoreUtils.h"
+#include "CvGameCoreUtils.h"
+#include "FProfiler.h"
+
+
+#define FLOAT_PRECISION (1000)
+
+
+// Public Functions...
+
+CvFractal::CvFractal()
+{
+ reset();
+}
+
+CvFractal::~CvFractal()
+{
+ uninit();
+}
+
+void CvFractal::uninit()
+{
+ if (m_aaiFrac != NULL)
+ {
+ for (int iX = 0; iX < m_iFracX + 1; iX++)
+ {
+ SAFE_DELETE_ARRAY(m_aaiFrac[iX]);
+ }
+ SAFE_DELETE_ARRAY(m_aaiFrac);
+ }
+}
+
+void CvFractal::reset()
+{
+ m_aaiFrac = NULL;
+ m_iFracXExp = -1;
+ m_iFracYExp = -1;
+ m_iXs = -1;
+ m_iYs = -1;
+ m_iFlags = 0;
+ m_iFracX = -1;
+ m_iFracY = -1;
+}
+
+void CvFractal::fracInit(int iNewXs, int iNewYs, int iGrain, CvRandom&
random, int iFlags, CvFractal* pRifts, int iFracXExp/*=7*/, int
iFracYExp/*=6*/)
+{
+ fracInitInternal(iNewXs, iNewYs, iGrain, random, NULL, -1, iFlags,
pRifts, iFracXExp, iFracYExp);
+}
+
+// pbyHints should be a 1d array of bytes representing a 2d array
+// with width = 2^(iFracXExp - minExp + iGrain) +
(GC.getMapINLINE().isWrapXINLINE() ? 0 : 1)
+// and height = 2^(iFracYExp - minExp + iGrain) +
(GC.getMapINLINE().isWrapYINLINE() ? 0 : 1)
+// where minExp = std::min(iFracXExp, iFracYExp)
+// Note above that an extra value is required in a dimension in which the
map does not wrap.
+
+void CvFractal::fracInitHinted(int iNewXs, int iNewYs, int iGrain,
CvRandom& random, byte* pbyHints, int iHintsLength, int iFlags, CvFractal*
pRifts, int iFracXExp/*=7*/, int iFracYExp/*=6*/)
+{
+ int iFlagsNonPolar = iFlags & (~FRAC_POLAR);
+ fracInitInternal(iNewXs, iNewYs, iGrain, random, pbyHints, iHintsLength,
iFlagsNonPolar, pRifts, iFracXExp, iFracYExp);
+}
+
+void CvFractal::fracInitInternal(int iNewXs, int iNewYs, int iGrain,
CvRandom& random, byte* pbyHints, int iHintsLength, int iFlags, CvFractal*
pRifts, int iFracXExp, int iFracYExp)
+{
+ PROFILE("CvFractal::fracInit()");
+ int iSmooth;
+ int iScreen; // This screens out already marked spots in m_aaiFrac[][];
+ int iPass;
+ int iSum;
+ int iX, iY;
+ int iI;
+
+ reset();
+
+ if (iFracXExp < 0)
+ {
+ iFracXExp = DEFAULT_FRAC_X_EXP;
+ }
+ if (iFracYExp < 0)
+ {
+ iFracYExp = DEFAULT_FRAC_Y_EXP;
+ }
+
+ m_iFracXExp = iFracXExp;
+ m_iFracYExp = iFracYExp;
+ m_iFracX = 1 << iFracXExp;
+ m_iFracY = 1 << iFracYExp;
+
+ // Init m_aaiFrac to all zeroes:
+ m_aaiFrac = new int*[m_iFracX + 1];
+ for (iX = 0; iX < m_iFracX + 1; iX++)
+ {
+ m_aaiFrac[iX] = new int[m_iFracY + 1];
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ m_aaiFrac[iX][iY] = 0;
+ }
+ }
+
+ m_iXs = iNewXs;
+ m_iYs = iNewYs;
+ m_iFlags = iFlags;
+ m_iXInc = ((m_iFracX * FLOAT_PRECISION) / m_iXs);
+ m_iYInc = ((m_iFracY * FLOAT_PRECISION) / m_iYs);
+
+ int iMinExp = std::min(m_iFracXExp, m_iFracYExp);
+ iSmooth = range(iMinExp - iGrain, 0, iMinExp);
+
+ int iHintsWidth = (1 << (m_iFracXExp - iSmooth)) + ((m_iFlags &
FRAC_WRAP_X) ? 0 : 1);
+ int iHintsHeight = (1 << (m_iFracYExp - iSmooth)) + ((m_iFlags &
FRAC_WRAP_Y) ? 0 : 1);
+ if (pbyHints != NULL)
+ {
+ FAssertMsg(iHintsLength == iHintsWidth*iHintsHeight, "pbyHints is the
wrong size!")
+ }
+
+ for (iPass = iSmooth; iPass >= 0; iPass--)
+ {
+ iScreen = 0;
+
+ for (iI = 0; iI <= iPass; iI++)
+ {
+ iScreen |= (1 << iI);
+ }
+
+ if (m_iFlags & FRAC_WRAP_Y)
+ {
+ for (iX = 0; iX < m_iFracX + 1; iX++)
+ {
+ m_aaiFrac[iX][m_iFracY] = m_aaiFrac[iX][0];
+ }
+ }
+ else if (m_iFlags & FRAC_POLAR)
+ {
+ for (iX = 0; iX < m_iFracX + 1; iX++)
+ {
+ m_aaiFrac[iX][ 0 ] = 0;
+ m_aaiFrac[iX][m_iFracY] = 0;
+ }
+ }
+
+ if (m_iFlags & FRAC_WRAP_X)
+ {
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ m_aaiFrac[m_iFracX][iY] = m_aaiFrac[0][iY];
+ }
+ }
+ else if (m_iFlags & FRAC_POLAR)
+ {
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ m_aaiFrac[ 0 ][iY] = 0;
+ m_aaiFrac[m_iFracX][iY] = 0;
+ }
+ }
+
+ if (m_iFlags & FRAC_CENTER_RIFT)
+ {
+ if (m_iFlags & FRAC_WRAP_Y)
+ {
+ for (iX = 0; iX < m_iFracX + 1; iX++)
+ {
+ for (iY = 0; iY < (m_iFracY / 6); iY++)
+ {
+ m_aaiFrac[iX][ iY ] /= (abs((m_iFracY / 12) - iY) +
1);
+ m_aaiFrac[iX][(m_iFracY / 2) + iY] /= (abs((m_iFracY / 12) - iY) +
1);
+ }
+ }
+ }
+
+ if (m_iFlags & FRAC_WRAP_X)
+ {
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ for (iX = 0; iX < (m_iFracX / 6); iX++)
+ {
+ m_aaiFrac[ iX ][iY] /= (abs((m_iFracX / 12) - iX) +
1);
+ m_aaiFrac[(m_iFracX / 2) + iX][iY] /= (abs((m_iFracX / 12) - iX) +
1);
+ }
+ }
+ }
+ }
+
+ for (iX = 0; iX < (m_iFracX >> iPass) + ((m_iFlags & FRAC_WRAP_X) ? 0 :
1); iX++)
+ {
+ gDLL->callUpdater();
+ for (iY = 0; iY < (m_iFracY >> iPass) + ((m_iFlags & FRAC_WRAP_Y) ? 0 :
1); iY++)
+ {
+ if ((iPass == iSmooth))// If this is the first, pass, set the initial
random spots
+ {
+ if (pbyHints == NULL)
+ {
+ m_aaiFrac[iX << iPass][iY << iPass] = random.get(256, "Fractal Gen");
+ }
+ else
+ {
+ int iXX = iX % iHintsWidth; // wrap
+ int iYY = iY % iHintsHeight; // wrap
+ int iHintsI = iYY*iHintsWidth + iXX;
+ FAssertMsg(iHintsI < iHintsLength, "iHintsI out of range");
+ m_aaiFrac[iX << iPass][iY << iPass] = pbyHints[iHintsI];
+ }
+ }
+ else // Interpolate
+ {
+ iSum = 0;
+ if ((iX << iPass) & iScreen)
+ {
+ if ((iY << iPass) & iScreen) // (center)
+ {
+ iSum += m_aaiFrac[(iX-1) << iPass][(iY-1) << iPass];
+ iSum += m_aaiFrac[(iX+1) << iPass][(iY-1) << iPass];
+ iSum += m_aaiFrac[(iX-1) << iPass][(iY+1) << iPass];
+ iSum += m_aaiFrac[(iX+1) << iPass][(iY+1) << iPass];
+ iSum >>= 2;
+ iSum += random.get(1 << (8 - iSmooth + iPass), "Fractal Gen 2");
+ iSum -= 1 << (7 - iSmooth + iPass);
+ iSum = range(iSum, 0, 255);
+ m_aaiFrac[iX << iPass][iY << iPass] = iSum;
+ }
+ else // (horizontal)
+ {
+ iSum += m_aaiFrac[(iX-1) << iPass][iY << iPass];
+ iSum += m_aaiFrac[(iX+1) << iPass][iY << iPass];
+ iSum >>= 1;
+ iSum += random.get (1 << (8 - iSmooth + iPass), "Fractal Gen 3");
+ iSum -= 1 << (7 - iSmooth + iPass);
+ iSum = range (iSum, 0, 255);
+ m_aaiFrac[iX << iPass][iY << iPass] = iSum;
+ }
+ }
+ else
+ {
+ if ((iY << iPass) & iScreen) // (vertical)
+ {
+ iSum += m_aaiFrac[iX << iPass][(iY-1) << iPass];
+ iSum += m_aaiFrac[iX << iPass][(iY+1) << iPass];
+ iSum >>= 1;
+ iSum += random.get (1 << (8 - iSmooth + iPass), "Fractal Gen 4");
+ iSum -= 1 << (7 - iSmooth + iPass);
+ iSum = range (iSum, 0, 255);
+ m_aaiFrac[iX << iPass][iY << iPass] = (BYTE) iSum;
+ }
+ else
+ {
+ continue; // (corner) This was already set in an earlier iPass.
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (pRifts)
+ {
+ tectonicAction(pRifts); // Assumes FRAC_WRAP_X is on.
+ }
+
+ if (m_iFlags & FRAC_INVERT_HEIGHTS)
+ {
+ for (iX = 0; iX < m_iFracX; iX++)
+ {
+ for (iY = 0; iY < m_iFracY; iY++)
+ {
+ m_aaiFrac[iX][iY] = (255 - m_aaiFrac[iX][iY]);
+ }
+ }
+ }
+}
+
+
+int CvFractal::getHeight(int iX, int iY)
+{
+ int iErrX;
+ int iErrY;
+ int iSum;
+ int iHeight;
+ int iLowX;
+ int iLowY;
+ int iI;
+
+ FAssertMsg(0 <= iX && iX < m_iXs, "iX out of range");
+ FAssertMsg(0 <= iY && iY < m_iYs, "iY out of range");
+ iLowX = ((m_iXInc * iX) / FLOAT_PRECISION);
+ if (iLowX > m_iFracX - 1)
+ {
+ iLowX = m_iFracX - 1; // clamp so that iLowX+1 doesn't overrun array
+ }
+ iLowY = ((m_iYInc * iY) / FLOAT_PRECISION);
+ if (iLowY > m_iFracY - 1)
+ {
+ iLowY = m_iFracY - 1; // clamp so that iLowY+1 doesn't overrun array
+ }
+ iErrX = ((m_iXInc * iX) - (iLowX * FLOAT_PRECISION));
+ iErrY = ((m_iYInc * iY) - (iLowY * FLOAT_PRECISION));
+
+ iSum = 0;
+ iSum += ((FLOAT_PRECISION - iErrX) * (FLOAT_PRECISION - iErrY) *
m_aaiFrac[iLowX ][iLowY ]);
+ iSum += (( iErrX) * (FLOAT_PRECISION - iErrY) *
m_aaiFrac[iLowX + 1][iLowY ]);
+ iSum += ((FLOAT_PRECISION - iErrX) * ( iErrY) *
m_aaiFrac[iLowX ][iLowY + 1]);
+ iSum += (( iErrX) * ( iErrY) *
m_aaiFrac[iLowX + 1][iLowY + 1]);
+
+ iSum /= (FLOAT_PRECISION * FLOAT_PRECISION);
+
+ iHeight = range(iSum, 0, 255);
+
+ if (m_iFlags & FRAC_PERCENT)
+ {
+ iI = ((iHeight * 100) >> 8);
+
+ return iI;
+ }
+ else
+ {
+ return iHeight;
+ }
+}
+
+
+int CvFractal::getHeightFromPercent(int iPercent)
+{
+ PROFILE("CvFractal::getHeightFromPercent()");
+ int iEstimate;
+ int iLowerBound;
+ int iUpperBound;
+ int iSum;
+ int iX, iY;
+
+ iLowerBound = 0;
+ iUpperBound = 255;
+
+ iPercent = range(iPercent, 0, 100);
+ iEstimate = 255 * iPercent / 100;
+
+ while (iEstimate != iLowerBound)
+ {
+ iSum = 0;
+
+ for (iX = 0; iX < m_iFracX; iX++)
+ {
+ for (iY = 0; iY < m_iFracY; iY++)
+ {
+ if (m_aaiFrac[iX][iY] < iEstimate)
+ {
+ iSum++;
+ }
+ }
+ }
+ if ((100 * iSum / m_iFracX / m_iFracY) > iPercent)
+ {
+ iUpperBound = iEstimate;
+ iEstimate = (iUpperBound + iLowerBound) / 2;
+ }
+ else
+ {
+ iLowerBound = iEstimate;
+ iEstimate = (iUpperBound + iLowerBound) / 2;
+ }
+ }
+
+ return iEstimate;
+}
+
+// Protected Functions...
+
+void CvFractal::tectonicAction(CvFractal* pRifts) // Assumes FRAC_WRAP_X
is on.
+{
+ int iRift1x;
+ int iRift2x;
+ int iDeep;
+ int iWidth;
+ int iRx, iLx;
+ int iX, iY;
+
+ iRift1x = (m_iFracX / 4);
+ iRift2x = ((m_iFracX / 4) * 3);
+
+ iWidth = 16;
+
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ for (iX = 0; iX < iWidth; iX++)
+ {
+ // Rift along edge of map.
+ iDeep = 0;
+ iRx = yieldX (((((pRifts->m_aaiFrac[iRift2x][iY] - 128) * m_iFracX) /
128) / 8) + iX);
+ iLx = yieldX (((((pRifts->m_aaiFrac[iRift2x][iY] - 128) * m_iFracX) /
128) / 8) - iX);
+ m_aaiFrac[iRx][iY] = (((m_aaiFrac[iRx][iY] * iX) + iDeep * (iWidth -
iX)) / iWidth);
+ m_aaiFrac[iLx][iY] = (((m_aaiFrac[iLx][iY] * iX) + iDeep * (iWidth -
iX)) / iWidth);
+ }
+ }
+
+ for (iY = 0; iY < m_iFracY + 1; iY++)
+ {
+ m_aaiFrac[m_iFracX][iY] = m_aaiFrac[0][iY];
+ }
+}
+
+
+int CvFractal::yieldX(int iBadX) // Assumes FRAC_WRAP_X is on.
+{
+ if (iBadX < 0)
+ {
+ return (iBadX + m_iFracX);
+ }
+
+ if (iBadX >= m_iFracX)
+ {
+ return (iBadX - m_iFracX);
+ }
+
+ return iBadX;
+}
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvFractal.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,65 @@
+#pragma once
+
+// fractal.h
+
+#ifndef CIV4_FRACTAL_H
+#define CIV4_FRACTAL_H
+
+class CvRandom;
+class CvFractal
+{
+
+public:
+
+ enum DllExport FracVals // Exposed to Python
+ {
+ FRAC_WRAP_X = (0x0001),
+ FRAC_WRAP_Y = (0x0002),
+ FRAC_PERCENT = (0x0004), // Returns raw data as a percent.
+ FRAC_POLAR = (0x0008), // Sets polar regions to zero.
+ FRAC_CENTER_RIFT = (0x0010), // Draws rift in center of world, too.
+ FRAC_INVERT_HEIGHTS = (0x0020), // Draws inverts the heights
+ DEFAULT_FRAC_X_EXP = 7,
+ DEFAULT_FRAC_Y_EXP = 6
+ };
+
+ // Smoothness varies with 2^grain.
+ // Totally random is grain = min (iFracXExp, iFracYExp).
+ // As smooth as possible is grain = 0;
+
+ // iFracXExp should be 8 or less
+ // iFracYExp should be one less than iFracXExp for Civ3 worlds
+
+ DllExport void fracInit(int iNewXs, int iNewYs, int iGrain, CvRandom&
random, int iFlags, CvFractal* pRifts=NULL, int
iFracXExp=DEFAULT_FRAC_X_EXP, int iFracYExp=DEFAULT_FRAC_Y_EXP); // Exposed
to Python
+ DllExport void fracInitHinted(int iNewXs, int iNewYs, int iGrain,
CvRandom& random, byte* pbyHints, int iHintsLength, int iFlags, CvFractal*
pRifts, int iFracXExp=DEFAULT_FRAC_X_EXP, int
iFracYExp=DEFAULT_FRAC_Y_EXP); // Exposed to Python
+
+ DllExport int getHeight(int x, int y); // Exposed to
Python
+ DllExport int getHeightFromPercent(int iPercent); //
Exposed to Python
+
+ DllExport void reset();
+ DllExport CvFractal();
+ DllExport virtual ~CvFractal();
+ DllExport void uninit();
+
+protected:
+
+ int m_iXs;
+ int m_iYs;
+ int m_iFlags;
+
+ int m_iFracX;
+ int m_iFracY;
+ int m_iFracXExp;
+ int m_iFracYExp;
+
+ int m_iXInc;
+ int m_iYInc;
+
+ int **m_aaiFrac; //[FRAC_X + 1][FRAC_Y + 1];
+ void fracInitInternal(int iNewXs, int iNewYs, int iGrain, CvRandom&
random, byte* pbyHints, int iHintsLength, int iFlags, CvFractal* pRifts,
int iFracXExp, int iFracYExp);
+ void tectonicAction(CvFractal* pRifts);
+ int yieldX(int iBadX);
+
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvGame.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,11777 @@
+// game.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvGameCoreUtils.h"
+#include "CvGame.h"
+#include "CvGameAI.h"
+#include "CvMap.h"
+#include "CvPlot.h"
+#include "CvPlayerAI.h"
+#include "CvRandom.h"
+#include "CvTeamAI.h"
+#include "CvGlobals.h"
+#include "CvInitCore.h"
+#include "CvMapGenerator.h"
+#include "CvArtFileMgr.h"
+#include "CvDiploParameters.h"
+#include "CvReplayMessage.h"
+#include "CyArgsList.h"
+#include "CvInfos.h"
+#include "CvPopupInfo.h"
+#include "FProfiler.h"
+#include "CvReplayInfo.h"
+#include "CvGameTextMgr.h"
+#include <set>
+
+// interface uses
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLEngineIFaceBase.h"
+#include "CvDLLEventReporterIFaceBase.h"
+#include "CvDLLPythonIFaceBase.h"
+
+#include "Math.h"
+
+// Public Functions...
+
+CvGame::CvGame()
+{
+ m_aiEndTurnMessagesReceived = new int[MAX_PLAYERS];
+ m_aiRankPlayer = new int[MAX_PLAYERS]; // Ordered by rank...
+ m_aiPlayerRank = new int[MAX_PLAYERS]; // Ordered by player ID...
+ m_aiPlayerScore = new int[MAX_PLAYERS]; // Ordered by player ID...
+ m_aiRankTeam = new int[MAX_TEAMS]; // Ordered by rank...
+ m_aiTeamRank = new int[MAX_TEAMS]; // Ordered by team ID...
+ m_aiTeamScore = new int[MAX_TEAMS]; // Ordered by team ID...
+
+ m_paiUnitCreatedCount = NULL;
+ m_paiUnitClassCreatedCount = NULL;
+ m_paiBuildingClassCreatedCount = NULL;
+ m_paiProjectCreatedCount = NULL;
+ m_paiForceCivicCount = NULL;
+ m_paiVoteOutcome = NULL;
+ m_paiReligionGameTurnFounded = NULL;
+ m_paiCorporationGameTurnFounded = NULL;
+ m_aiSecretaryGeneralTimer = NULL;
+ m_aiVoteTimer = NULL;
+ m_aiDiploVote = NULL;
+
+ m_pabSpecialUnitValid = NULL;
+ m_pabSpecialBuildingValid = NULL;
+ m_abReligionSlotTaken = NULL;
+
+ m_paHolyCity = NULL;
+ m_paHeadquarters = NULL;
+
+ m_pReplayInfo = NULL;
+
+ m_aiShrineBuilding = NULL;
+ m_aiShrineReligion = NULL;
+
+ reset(NO_HANDICAP, true);
+}
+
+
+CvGame::~CvGame()
+{
+ uninit();
+
+ SAFE_DELETE_ARRAY(m_aiEndTurnMessagesReceived);
+ SAFE_DELETE_ARRAY(m_aiRankPlayer);
+ SAFE_DELETE_ARRAY(m_aiPlayerRank);
+ SAFE_DELETE_ARRAY(m_aiPlayerScore);
+ SAFE_DELETE_ARRAY(m_aiRankTeam);
+ SAFE_DELETE_ARRAY(m_aiTeamRank);
+ SAFE_DELETE_ARRAY(m_aiTeamScore);
+}
+
+void CvGame::init(HandicapTypes eHandicap)
+{
+ bool bValid;
+ int iStartTurn;
+ int iEstimateEndTurn;
+ int iI;
+
+ //--------------------------------
+ // Init saved data
+ reset(eHandicap);
+
+ //--------------------------------
+ // Init containers
+ m_deals.init();
+ m_voteSelections.init();
+ m_votesTriggered.init();
+
+ m_mapRand.init(GC.getInitCore().getMapRandSeed() % 73637381);
+ m_sorenRand.init(GC.getInitCore().getSyncRandSeed() % 52319761);
+
+ //--------------------------------
+ // Init non-saved data
+
+ //--------------------------------
+ // Init other game data
+
+ // Turn off all MP options if it's a single player game
+ if (GC.getInitCore().getType() == GAME_SP_NEW ||
+ GC.getInitCore().getType() == GAME_SP_SCENARIO)
+ {
+ for (iI = 0; iI < NUM_MPOPTION_TYPES; ++iI)
+ {
+ setMPOption((MultiplayerOptionTypes)iI, false);
+ }
+ }
+
+ // If this is a hot seat game, simultaneous turns is always off
+ if (isHotSeat() || isPbem())
+ {
+ setMPOption(MPOPTION_SIMULTANEOUS_TURNS, false);
+ }
+ // If we didn't set a time in the Pitboss, turn timer off
+ if (isPitboss() && getPitbossTurnTime() == 0)
+ {
+ setMPOption(MPOPTION_TURN_TIMER, false);
+ }
+
+ if (isMPOption(MPOPTION_SHUFFLE_TEAMS))
+ {
+ int aiTeams[MAX_CIV_PLAYERS];
+
+ int iNumPlayers = 0;
+ for (int i = 0; i < MAX_CIV_PLAYERS; i++)
+ {
+ if (GC.getInitCore().getSlotStatus((PlayerTypes)i) == SS_TAKEN)
+ {
+ aiTeams[iNumPlayers] = GC.getInitCore().getTeam((PlayerTypes)i);
+ ++iNumPlayers;
+ }
+ }
+
+ for (int i = 0; i < iNumPlayers; i++)
+ {
+ int j = (getSorenRand().get(iNumPlayers - i, NULL) + i);
+
+ if (i != j)
+ {
+ int iTemp = aiTeams[i];
+ aiTeams[i] = aiTeams[j];
+ aiTeams[j] = iTemp;
+ }
+ }
+
+ iNumPlayers = 0;
+ for (int i = 0; i < MAX_CIV_PLAYERS; i++)
+ {
+ if (GC.getInitCore().getSlotStatus((PlayerTypes)i) == SS_TAKEN)
+ {
+ GC.getInitCore().setTeam((PlayerTypes)i,
(TeamTypes)aiTeams[iNumPlayers]);
+ ++iNumPlayers;
+ }
+ }
+ }
+
+ if (isOption(GAMEOPTION_LOCK_MODS))
+ {
+ if (isGameMultiPlayer())
+ {
+ setOption(GAMEOPTION_LOCK_MODS, false);
+ }
+ else
+ {
+ static const int iPasswordSize = 8;
+ char szRandomPassword[iPasswordSize];
+ for (int i = 0; i < iPasswordSize-1; i++)
+ {
+ szRandomPassword[i] = getSorenRandNum(128, NULL);
+ }
+ szRandomPassword[iPasswordSize-1] = 0;
+
+ GC.getInitCore().setAdminPassword(szRandomPassword);
+ }
+ }
+
+ if (getGameTurn() == 0)
+ {
+ iStartTurn = 0;
+
+ for (iI = 0; iI <
GC.getGameSpeedInfo(getGameSpeedType()).getNumTurnIncrements(); iI++)
+ {
+ iStartTurn +=
GC.getGameSpeedInfo(getGameSpeedType()).getGameTurnInfo(iI).iNumGameTurnsPerIncrement;
+ }
+
+ iStartTurn *= GC.getEraInfo(getStartEra()).getStartPercent();
+ iStartTurn /= 100;
+
+ setGameTurn(iStartTurn);
+ }
+
+ setStartTurn(getGameTurn());
+
+ if (getMaxTurns() == 0)
+ {
+ iEstimateEndTurn = 0;
+
+ for (iI = 0; iI <
GC.getGameSpeedInfo(getGameSpeedType()).getNumTurnIncrements(); iI++)
+ {
+ iEstimateEndTurn +=
GC.getGameSpeedInfo(getGameSpeedType()).getGameTurnInfo(iI).iNumGameTurnsPerIncrement;
+ }
+
+ setEstimateEndTurn(iEstimateEndTurn);
+
+ if (getEstimateEndTurn() > getGameTurn())
+ {
+ bValid = false;
+
+ for (iI = 0; iI < GC.getNumVictoryInfos(); iI++)
+ {
+ if (isVictoryValid((VictoryTypes)iI))
+ {
+ if (GC.getVictoryInfo((VictoryTypes)iI).isEndScore())
+ {
+ bValid = true;
+ break;
+ }
+ }
+ }
+
+ if (bValid)
+ {
+ setMaxTurns(getEstimateEndTurn() - getGameTurn());
+ }
+ }
+ }
+ else
+ {
+ setEstimateEndTurn(getGameTurn() + getMaxTurns());
+ }
+
+ setStartYear(GC.getDefineINT("START_YEAR"));
+
+ for (iI = 0; iI < GC.getNumSpecialUnitInfos(); iI++)
+ {
+ if (GC.getSpecialUnitInfo((SpecialUnitTypes)iI).isValid())
+ {
+ makeSpecialUnitValid((SpecialUnitTypes)iI);
+ }
+ }
+
+ for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
+ {
+ if (GC.getSpecialBuildingInfo((SpecialBuildingTypes)iI).isValid())
+ {
+ makeSpecialBuildingValid((SpecialBuildingTypes)iI);
+ }
+ }
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.16.09
+ int iJ;
+ for (iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ HeroData kData;
+ kData.m_iHeroID = iI;
+ kData.m_iDebutStatus = -1;
+ kData.m_iUnitID = -1;
+ kData.m_fExperience = 0;
+ kData.m_iLevel = 1;
+ kData.m_bPromotionReady = false;
+ kData.m_iVitality = GC.getHeroInfo((HeroTypes)iI).getVitality();
+ kData.m_bWounded = false;
+ kData.m_bLegionUnitMoved = false;
+ kData.m_eCapturePlayer = NO_PLAYER;
+ kData.m_iSurrenderRand = -1;
+ kData.m_eCurrentNineTransformationPromotion = NO_PROMOTION;
+ kData.aNineTransformationPromotions.clear();
+ kData.aLegionMemberList.clear();
+ kData.aLegionMemberBackUpList.clear();
+ kData.aSeeInvisibleCount.clear();
+ for (iJ = 0; iJ < GC.getNumInvisibleInfos(); iJ++)
+ {
+ kData.aSeeInvisibleCount.push_back(0);
+ }
+
+ m_mapHeroes[(HeroTypes)iI] = kData;
+
+ for (iJ = 0; iJ < GC.getNumUnitCombatInfos(); iJ++)
+ {
+ setHeroUnitCombatLevel((HeroTypes)iI, (UnitCombatTypes)iJ,
GC.getHeroInfo((HeroTypes)iI).getUnitCombatLevel(iJ));
+ }
+ for (iJ = 0; iJ < GC.getNumPromotionInfos(); iJ++)
+ {
+ setHeroPromotionStatus((HeroTypes)iI, (PromotionTypes)iJ,
GC.getHeroInfo((HeroTypes)iI).getUnitPromotionStatus(iJ));
+ }
+
+ if (GC.getHeroInfo((HeroTypes)iI).getHistoricalDieYear() <=
getGameTurnYear())
+ {
+ setHeroDebutStatus((HeroTypes)iI, -3);
+ }
+ if (GC.getHeroInfo((HeroTypes)iI).isNineTransformation())
+ {
+ doNineTransformationPromotions((HeroTypes)iI, 1);
+ }
+ }
+ // Sanguo Mod Hero, end
+
+ AI_init();
+
+ doUpdateCacheOnTurn();
+}
+
+//
+// Set initial items (units, techs, etc...)
+//
+void CvGame::setInitialItems()
+{
+ PROFILE_FUNC();
+
+ initFreeState();
+ assignStartingPlots();
+ normalizeStartingPlots();
+ initFreeUnits();
+
+ for (int i = 0; i < MAX_PLAYERS; ++i)
+ {
+ CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)i);
+ if (kPlayer.isAlive())
+ {
+ kPlayer.AI_updateFoundValues();
+ }
+ }
+}
+
+
+void CvGame::regenerateMap()
+{
+ int iI;
+
+ if (GC.getInitCore().getWBMapScript())
+ {
+ return;
+ }
+
+ setFinalInitialized(false);
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ GET_PLAYER((PlayerTypes)iI).killUnits();
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ GET_PLAYER((PlayerTypes)iI).killCities();
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ GET_PLAYER((PlayerTypes)iI).killAllDeals();
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ GET_PLAYER((PlayerTypes)iI).setFoundedFirstCity(false);
+ GET_PLAYER((PlayerTypes)iI).setStartingPlot(NULL, false);
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ GC.getMapINLINE().setRevealedPlots(((TeamTypes)iI), false);
+ }
+
+ gDLL->getEngineIFace()->clearSigns();
+
+ GC.getMapINLINE().erasePlots();
+
+ CvMapGenerator::GetInstance().generateRandomMap();
+ CvMapGenerator::GetInstance().addGameElements();
+
+ gDLL->getEngineIFace()->RebuildAllPlots();
+
+ gDLL->resetStatistics();
+
+ setInitialItems();
+
+ initScoreCalculation();
+ setFinalInitialized(true);
+
+ GC.getMapINLINE().setupGraphical();
+ gDLL->getEngineIFace()->SetDirty(GlobeTexture_DIRTY_BIT, true);
+ gDLL->getEngineIFace()->SetDirty(MinimapTexture_DIRTY_BIT, true);
+ gDLL->getInterfaceIFace()->setDirty(ColoredPlots_DIRTY_BIT, true);
+
+ gDLL->getInterfaceIFace()->setCycleSelectionCounter(1);
+
+ gDLL->getEngineIFace()->AutoSave(true);
+
+ if (NO_PLAYER != getActivePlayer())
+ {
+ CvPlot* pPlot = GET_PLAYER(getActivePlayer()).getStartingPlot();
+
+ if (NULL != pPlot)
+ {
+ gDLL->getInterfaceIFace()->lookAt(pPlot->getPoint(),
CAMERALOOKAT_NORMAL);
+ }
+ }
+}
+
+
+void CvGame::uninit()
+{
+ SAFE_DELETE_ARRAY(m_aiShrineBuilding);
+ SAFE_DELETE_ARRAY(m_aiShrineReligion);
+ SAFE_DELETE_ARRAY(m_paiUnitCreatedCount);
+ SAFE_DELETE_ARRAY(m_paiUnitClassCreatedCount);
+ SAFE_DELETE_ARRAY(m_paiBuildingClassCreatedCount);
+ SAFE_DELETE_ARRAY(m_paiProjectCreatedCount);
+ SAFE_DELETE_ARRAY(m_paiForceCivicCount);
+ SAFE_DELETE_ARRAY(m_paiVoteOutcome);
+ SAFE_DELETE_ARRAY(m_paiReligionGameTurnFounded);
+ SAFE_DELETE_ARRAY(m_paiCorporationGameTurnFounded);
+ SAFE_DELETE_ARRAY(m_aiSecretaryGeneralTimer);
+ SAFE_DELETE_ARRAY(m_aiVoteTimer);
+ SAFE_DELETE_ARRAY(m_aiDiploVote);
+
+ SAFE_DELETE_ARRAY(m_pabSpecialUnitValid);
+ SAFE_DELETE_ARRAY(m_pabSpecialBuildingValid);
+ SAFE_DELETE_ARRAY(m_abReligionSlotTaken);
+
+ SAFE_DELETE_ARRAY(m_paHolyCity);
+ SAFE_DELETE_ARRAY(m_paHeadquarters);
+
+ m_aszDestroyedCities.clear();
+ m_aszGreatPeopleBorn.clear();
+
+ m_deals.uninit();
+ m_voteSelections.uninit();
+ m_votesTriggered.uninit();
+
+ m_mapRand.uninit();
+ m_sorenRand.uninit();
+
+ clearReplayMessageMap();
+ SAFE_DELETE(m_pReplayInfo);
+
+ m_aPlotExtraYields.clear();
+ m_aPlotExtraCosts.clear();
+ m_mapVoteSourceReligions.clear();
+ m_aeInactiveTriggers.clear();
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ if ((int)m_ppaiHeroUnitCombatLevel.size() > 0)
+ {
+ for (int iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ SAFE_DELETE_ARRAY(m_ppaiHeroUnitCombatLevel[iI]);
+ }
+ m_ppaiHeroUnitCombatLevel.clear();
+ }
+
+ if ((int)m_ppaiHeroPromotionStatus.size() > 0)
+ {
+ for (int iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ SAFE_DELETE_ARRAY(m_ppaiHeroPromotionStatus[iI]);
+ }
+ m_ppaiHeroPromotionStatus.clear();
+ }
+ // Sanguo Mod Hero, end
+}
+
+
+// FUNCTION: reset()
+// Initializes data members that are serialized.
+void CvGame::reset(HandicapTypes eHandicap, bool bConstructorCall)
+{
+ int iI;
+
+ //--------------------------------
+ // Uninit class
+ uninit();
+
+ // Sanguo Mod Hero, start, added by poyuzhe 08.10.09
+ while(m_paNewHeroes.size() > 0)
+ {
+ GC.getHeroInfo().pop_back();
+ GC.setInfoTypeFromString(m_paNewHeroes.back()->getType(), -1);
+ m_paNewHeroes.pop_back();
+ }
+ // Sanguo Mod Hero, end
+
+ m_iEndTurnMessagesSent = 0;
+ m_iElapsedGameTurns = 0;
+ m_iStartTurn = 0;
+ m_iStartYear = 0;
+ m_iEstimateEndTurn = 0;
+ m_iTurnSlice = 0;
+ m_iCutoffSlice = 0;
+ m_iNumGameTurnActive = 0;
+ m_iNumCities = 0;
+ m_iTotalPopulation = 0;
+ m_iTradeRoutes = 0;
+ m_iFreeTradeCount = 0;
+ m_iNoNukesCount = 0;
+ m_iNukesExploded = 0;
+ m_iMaxPopulation = 0;
+ m_iMaxLand = 0;
+ m_iMaxTech = 0;
+ m_iMaxWonders = 0;
+ m_iInitPopulation = 0;
+ m_iInitLand = 0;
+ m_iInitTech = 0;
+ m_iInitWonders = 0;
+ m_iAIAutoPlay = 0;
+
+ m_uiInitialTime = 0;
+
+ m_bScoreDirty = false;
+ m_bCircumnavigated = false;
+ m_bDebugMode = false;
+ m_bDebugModeCache = false;
+ m_bFinalInitialized = false;
+ m_bPbemTurnSent = false;
+ m_bHotPbemBetweenTurns = false;
+ m_bPlayerOptionsSent = false;
+ m_bNukesValid = false;
+
+ m_eHandicap = eHandicap;
+ m_ePausePlayer = NO_PLAYER;
+ m_eBestLandUnit = NO_UNIT;
+ m_eWinner = NO_TEAM;
+ m_eVictory = NO_VICTORY;
+ m_eGameState = GAMESTATE_ON;
+
+ m_szScriptData = "";
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ m_aiEndTurnMessagesReceived[iI] = 0;
+ m_aiRankPlayer[iI] = 0;
+ m_aiPlayerRank[iI] = 0;
+ m_aiPlayerScore[iI] = 0;
+ }
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ m_aiRankTeam[iI] = 0;
+ m_aiTeamRank[iI] = 0;
+ m_aiTeamScore[iI] = 0;
+ }
+
+ if (!bConstructorCall)
+ {
+ FAssertMsg(m_paiUnitCreatedCount==NULL, "about to leak memory,
CvGame::m_paiUnitCreatedCount");
+ m_paiUnitCreatedCount = new int[GC.getNumUnitInfos()];
+ for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
+ {
+ m_paiUnitCreatedCount[iI] = 0;
+ }
+
+ FAssertMsg(m_paiUnitClassCreatedCount==NULL, "about to leak memory,
CvGame::m_paiUnitClassCreatedCount");
+ m_paiUnitClassCreatedCount = new int[GC.getNumUnitClassInfos()];
+ for (iI = 0; iI < GC.getNumUnitClassInfos(); iI++)
+ {
+ m_paiUnitClassCreatedCount[iI] = 0;
+ }
+
+ FAssertMsg(m_paiBuildingClassCreatedCount==NULL, "about to leak memory,
CvGame::m_paiBuildingClassCreatedCount");
+ m_paiBuildingClassCreatedCount = new int[GC.getNumBuildingClassInfos()];
+ for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
+ {
+ m_paiBuildingClassCreatedCount[iI] = 0;
+ }
+
+ FAssertMsg(m_paiProjectCreatedCount==NULL, "about to leak memory,
CvGame::m_paiProjectCreatedCount");
+ m_paiProjectCreatedCount = new int[GC.getNumProjectInfos()];
+ for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
+ {
+ m_paiProjectCreatedCount[iI] = 0;
+ }
+
+ FAssertMsg(m_paiForceCivicCount==NULL, "about to leak memory,
CvGame::m_paiForceCivicCount");
+ m_paiForceCivicCount = new int[GC.getNumCivicInfos()];
+ for (iI = 0; iI < GC.getNumCivicInfos(); iI++)
+ {
+ m_paiForceCivicCount[iI] = 0;
+ }
+
+ FAssertMsg(0 < GC.getNumVoteInfos(), "GC.getNumVoteInfos() is not
greater than zero in CvGame::reset");
+ FAssertMsg(m_paiVoteOutcome==NULL, "about to leak memory,
CvGame::m_paiVoteOutcome");
+ m_paiVoteOutcome = new PlayerVoteTypes[GC.getNumVoteInfos()];
+ for (iI = 0; iI < GC.getNumVoteInfos(); iI++)
+ {
+ m_paiVoteOutcome[iI] = NO_PLAYER_VOTE;
+ }
+
+ FAssertMsg(0 < GC.getNumVoteSourceInfos(), "GC.getNumVoteSourceInfos()
is not greater than zero in CvGame::reset");
+ FAssertMsg(m_aiDiploVote==NULL, "about to leak memory,
CvGame::m_aiDiploVote");
+ m_aiDiploVote = new int[GC.getNumVoteSourceInfos()];
+ for (iI = 0; iI < GC.getNumVoteSourceInfos(); iI++)
+ {
+ m_aiDiploVote[iI] = 0;
+ }
+
+ FAssertMsg(m_pabSpecialUnitValid==NULL, "about to leak memory,
CvGame::m_pabSpecialUnitValid");
+ m_pabSpecialUnitValid = new bool[GC.getNumSpecialUnitInfos()];
+ for (iI = 0; iI < GC.getNumSpecialUnitInfos(); iI++)
+ {
+ m_pabSpecialUnitValid[iI] = false;
+ }
+
+ FAssertMsg(m_pabSpecialBuildingValid==NULL, "about to leak memory,
CvGame::m_pabSpecialBuildingValid");
+ m_pabSpecialBuildingValid = new bool[GC.getNumSpecialBuildingInfos()];
+ for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
+ {
+ m_pabSpecialBuildingValid[iI] = false;
+ }
+
+ FAssertMsg(m_paiReligionGameTurnFounded==NULL, "about to leak memory,
CvGame::m_paiReligionGameTurnFounded");
+ m_paiReligionGameTurnFounded = new int[GC.getNumReligionInfos()];
+ FAssertMsg(m_abReligionSlotTaken==NULL, "about to leak memory,
CvGame::m_abReligionSlotTaken");
+ m_abReligionSlotTaken = new bool[GC.getNumReligionInfos()];
+ FAssertMsg(m_paHolyCity==NULL, "about to leak memory,
CvGame::m_paHolyCity");
+ m_paHolyCity = new IDInfo[GC.getNumReligionInfos()];
+ for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
+ {
+ m_paiReligionGameTurnFounded[iI] = -1;
+ m_paHolyCity[iI].reset();
+ m_abReligionSlotTaken[iI] = false;
+ }
+
+ FAssertMsg(m_paiCorporationGameTurnFounded==NULL, "about to leak memory,
CvGame::m_paiCorporationGameTurnFounded");
+ m_paiCorporationGameTurnFounded = new int[GC.getNumCorporationInfos()];
+ m_paHeadquarters = new IDInfo[GC.getNumCorporationInfos()];
+ for (iI = 0; iI < GC.getNumCorporationInfos(); iI++)
+ {
+ m_paiCorporationGameTurnFounded[iI] = -1;
+ m_paHeadquarters[iI].reset();
+ }
+
+ FAssertMsg(m_aiShrineBuilding==NULL, "about to leak memory,
CvGame::m_aiShrineBuilding");
+ FAssertMsg(m_aiShrineReligion==NULL, "about to leak memory,
CvGame::m_aiShrineReligion");
+ m_aiShrineBuilding = new int[GC.getNumBuildingInfos()];
+ m_aiShrineReligion = new int[GC.getNumBuildingInfos()];
+ for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
+ {
+ m_aiShrineBuilding[iI] = (int) NO_BUILDING;
+ m_aiShrineReligion[iI] = (int) NO_RELIGION;
+ }
+
+ FAssertMsg(m_aiSecretaryGeneralTimer==NULL, "about to leak memory,
CvGame::m_aiSecretaryGeneralTimer");
+ FAssertMsg(m_aiVoteTimer==NULL, "about to leak memory,
CvGame::m_aiVoteTimer");
+ m_aiSecretaryGeneralTimer = new int[GC.getNumVoteSourceInfos()];
+ m_aiVoteTimer = new int[GC.getNumVoteSourceInfos()];
+ for (iI = 0; iI < GC.getNumVoteSourceInfos(); iI++)
+ {
+ m_aiSecretaryGeneralTimer[iI] = 0;
+ m_aiVoteTimer[iI] = 0;
+ }
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ FAssertMsg(0 < GC.getNumHeroInfos(), "GC.getNumHeroInfos() is not
greater than zero but it is used to allocate memory in CvGame::reset");
+ FAssertMsg((int)m_ppaiHeroUnitCombatLevel.size() == 0, "about to leak
memory, CvGame::m_ppaiHeroUnitCombatLevel");
+ FAssertMsg((int)m_ppaiHeroPromotionStatus.size() == 0, "about to leak
memory, CvGame::m_ppaiHeroPromotionStatus");
+ //m_ppaiHeroUnitCombatLevel = new int*[GC.getNumHeroInfos()];
+ //m_ppaiHeroPromotionStatus = new int*[GC.getNumHeroInfos()];
+ for (iI = 0; iI < GC.getNumHeroInfos(); iI++)
+ {
+ int iJ;
+ m_ppaiHeroUnitCombatLevel.push_back(new
int[GC.getNumUnitCombatInfos()]);
+ for (iJ = 0; iJ < GC.getNumUnitCombatInfos(); iJ++)
+ {
+ m_ppaiHeroUnitCombatLevel[iI][iJ] = 0;
+ }
+
+ m_ppaiHeroPromotionStatus.push_back(new int[GC.getNumPromotionInfos()]);
+ for (iJ = 0; iJ < GC.getNumPromotionInfos(); iJ++)
+ {
+ m_ppaiHeroPromotionStatus[iI][iJ] = 0;
+ }
+ }
+ // Sanguo Mod Hero, end
+ }
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.16.09
+ m_mapHeroes.clear();
+ m_paNewHeroes.clear();
+ // Sanguo Mod Hero, end
+
+ m_deals.removeAll();
+ m_voteSelections.removeAll();
+ m_votesTriggered.removeAll();
+
+ m_mapRand.reset();
+ m_sorenRand.reset();
+
+ m_iNumSessions = 1;
+
+ m_iShrineBuildingCount = 0;
+ m_iNumCultureVictoryCities = 0;
+ m_eCultureVictoryCultureLevel = NO_CULTURELEVEL;
+
+ if (!bConstructorCall)
+ {
+ AI_reset();
+ }
+
+ // Sanguo Mod Civilization Trait, start added by poyuzhe 07.30.09
+ // Zhang Yang, TRAIT_FOREIGNOR
+ int iJ, iK;
+ for (iI = 0; iI < GC.getNumSanguoCampInfos(); iI++)
+ {
+ for (iJ = 0; iJ < GC.getNumBonusInfos(); iJ++)
+ {
+ for (iK = 0; iK < GC.getNumUnitInfos(); iK++)
+ {
+ if
(GC.getSanguoCampInfo((SanguoCampTypes)iI).getBonusUnitSprawlingChance(iJ,
iK) > 0)
+ {
+ GC.getSanguoCampInfo((SanguoCampTypes)iI).setBonusUnitSprawl(iJ,
true);
+ break;
+ }
+ }
+ }
+ }
+ // Sanguo Mod Civilization Trait, end
+ // Sanguo Mod Performance start, added by poyuzhe 07.27.09
+ UnitTypes eUnit;
+ std::vector<UnitTypes> aUpgradeUnits;
+
+ for (iI = 0; iI < GC.getNumUnitInfos(); iI++)
+ {
+ eUnit = (UnitTypes)iI;
+ aUpgradeUnits.clear();
+ do
+ {
+ for (iJ = 0; iJ < GC.getNumUnitClassInfos(); iJ++)
+ {
+ if (GC.getUnitInfo(eUnit).getUpgradeUnitClass(iJ))
+ {
+ GC.getUnitInfo((UnitTypes)iI).addUpgradeUnitClassTypes(iJ);
+
aUpgradeUnits.push_back((UnitTypes)GC.getUnitClassInfo((UnitClassTypes)iJ).getDefaultUnitIndex());
+ }
+ }
+ if (aUpgradeUnits.size() > 0)
+ {
+ eUnit = aUpgradeUnits.front();
+ aUpgradeUnits.erase(aUpgradeUnits.begin());
+ }
+ else
+ {
+ break;
+ }
+ }while(aUpgradeUnits.size() >= 0);
+ }
+ // Sanguo Mod Performance, end
+}
+
+
+void CvGame::initDiplomacy()
+{
+ PROFILE_FUNC();
+
+ int iI, iJ;
+
+ for (iI = 0; iI < MAX_TEAMS; iI++)
+ {
+ GET_TEAM((TeamTypes)iI).meet(((TeamTypes)iI), false);
+
+ if (GET_TEAM((TeamTypes)iI).isBarbarian() ||
GET_TEAM((TeamTypes)iI).isMinorCiv())
+ {
+ for (iJ = 0; iJ < MAX_CIV_TEAMS; iJ++)
+ {
+ if (iI != iJ)
+ {
+ // Sanguo Mod Civilization Trait, start, by poyuzhe 12.22.08
+ // Yellow Turban, TRAIT_PEASANT
+ //GET_TEAM((TeamTypes)iI).declareWar(((TeamTypes)iJ), false,
NO_WARPLAN);
+ bool bPeasant = false;
+ for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; iPlayer++)
+ {
+ if (bPeasant == true)
+ {
+ break;
+ }
+
+ if (GET_PLAYER((PlayerTypes)iPlayer).getLeaderType() >= 0 &&
GET_PLAYER((PlayerTypes)iPlayer).isAlive() &&
GET_PLAYER((PlayerTypes)iPlayer).getTeam() == (TeamTypes)iJ)
+ {
+ for (int iTrait = 0; iTrait < GC.getNumTraitInfos(); iTrait++)
+ {
+ if
(GET_PLAYER((PlayerTypes)iPlayer).hasTrait((TraitTypes)iTrait) &&
GC.getTraitInfo((TraitTypes)iTrait).isPeasant())
+ {
+ bPeasant = true;
+
GET_TEAM((TeamTypes)iJ).signOpenBorders((TeamTypes)iI);
+ break;
+ }
+ }
+ }
+ }
+
+ if (!bPeasant)
+ {
+ GET_TEAM((TeamTypes)iI).declareWar(((TeamTypes)iJ), false,
NO_WARPLAN);
+ }
+ // Sanguo Mod Civilization Trait, end
+ }
+ }
+ }
+ }
+
+ // Forced peace at the beginning of Advanced starts
+ if (isOption(GAMEOPTION_ADVANCED_START))
+ {
+ CLinkList<TradeData> player1List;
+ CLinkList<TradeData> player2List;
+ TradeData kTradeData;
+ setTradeItem(&kTradeData, TRADE_PEACE_TREATY);
+ player1List.insertAtEnd(kTradeData);
+ player2List.insertAtEnd(kTradeData);
+
+ for (int iPlayer1 = 0; iPlayer1 < MAX_CIV_PLAYERS; ++iPlayer1)
+ {
+ CvPlayer& kLoopPlayer1 = GET_PLAYER((PlayerTypes)iPlayer1);
+
+ if (kLoopPlayer1.isAlive())
+ {
+ for (int iPlayer2 = iPlayer1 + 1; iPlayer2 < MAX_CIV_PLAYERS;
++iPlayer2)
+ {
+ CvPlayer& kLoopPlayer2 = GET_PLAYER((PlayerTypes)iPlayer2);
+
+ if (kLoopPlayer2.isAlive())
+ {
+ if
(GET_TEAM(kLoopPlayer1.getTeam()).canChangeWarPeace(kLoopPlayer2.getTeam()))
+ {
+ implementDeal((PlayerTypes)iPlayer1, (PlayerTypes)iPlayer2,
&player1List, &player2List);
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void CvGame::initFreeState()
+{
+ bool bValid;
+ int iI, iJ, iK;
+
+ for (iI = 0; iI < GC.getNumTechInfos(); iI++)
+ {
+ for (iJ = 0; iJ < MAX_TEAMS; iJ++)
+ {
+ if (GET_TEAM((TeamTypes)iJ).isAlive())
+ {
+ bValid = false;
+
+ if (!bValid)
+ {
+ if ((GC.getHandicapInfo(getHandicapType()).isFreeTechs(iI)) ||
+ (!(GET_TEAM((TeamTypes)iJ).isHuman())&&
GC.getHandicapInfo(getHandicapType()).isAIFreeTechs(iI)) ||
+ (GC.getTechInfo((TechTypes)iI).getEra() < getStartEra()))
+ {
+ bValid = true;
+ }
+ }
+
+ if (!bValid)
+ {
+ for (iK = 0; iK < MAX_PLAYERS; iK++)
+ {
+ if (GET_PLAYER((PlayerTypes)iK).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iK).getTeam() == iJ)
+ {
+ if
(GC.getCivilizationInfo(GET_PLAYER((PlayerTypes)iK).getCivilizationType()).isCivilizationFreeTechs(iI))
+ {
+ bValid = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ GET_TEAM((TeamTypes)iJ).setHasTech(((TechTypes)iI), bValid, NO_PLAYER,
false, false);
+ if (bValid && GC.getTechInfo((TechTypes)iI).isMapVisible())
+ {
+ GC.getMapINLINE().setRevealedPlots((TeamTypes)iJ, true, true);
+ }
+ }
+ }
+ }
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ GET_PLAYER((PlayerTypes)iI).initFreeState();
+ }
+ }
+}
+
+
+void CvGame::initFreeUnits()
+{
+ int iI;
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if ((GET_PLAYER((PlayerTypes)iI).getNumUnits() == 0) &&
(GET_PLAYER((PlayerTypes)iI).getNumCities() == 0))
+ {
+ GET_PLAYER((PlayerTypes)iI).initFreeUnits();
+ }
+ }
+ }
+}
+
+
+void CvGame::assignStartingPlots()
+{
+ PROFILE_FUNC();
+
+ CvPlot* pPlot;
+ CvPlot* pBestPlot;
+ bool bStartFound;
+ bool bValid;
+ int iRandOffset;
+ int iLoopTeam;
+ int iLoopPlayer;
+ int iHumanSlot;
+ int iValue;
+ int iBestValue;
+ int iI, iJ, iK;
+
+ std::vector<int> playerOrder;
+ std::vector<int>::iterator playerOrderIter;
+
+ for (iI = 0; iI < MAX_CIV_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iI).getStartingPlot() == NULL)
+ {
+ iBestValue = 0;
+ pBestPlot = NULL;
+
+ for (iJ = 0; iJ < GC.getMapINLINE().numPlotsINLINE(); iJ++)
+ {
+ gDLL->callUpdater(); // allow window updates during launch
+
+ pPlot = GC.getMapINLINE().plotByIndexINLINE(iJ);
+
+ if (pPlot->isStartingPlot())
+ {
+ bValid = true;
+
+ for (iK = 0; iK < MAX_CIV_PLAYERS; iK++)
+ {
+ if (GET_PLAYER((PlayerTypes)iK).isAlive())
+ {
+ if (GET_PLAYER((PlayerTypes)iK).getStartingPlot() == pPlot)
+ {
+ bValid = false;
+ break;
+ }
+ }
+ }
+
+ if (bValid)
+ {
+ iValue = (1 + getSorenRandNum(1000, "Starting Plot"));
+
+ if (iValue > iBestValue)
+ {
+ iBestValue = iValue;
+ pBestPlot = pPlot;
+ }
+ }
+ }
+ }
+
+ if (pBestPlot != NULL)
+ {
+ GET_PLAYER((PlayerTypes)iI).setStartingPlot(pBestPlot, true);
+ }
+ }
+ }
+ }
+
+ if (gDLL->getPythonIFace()->pythonAssignStartingPlots()
&& !gDLL->getPythonIFace()->pythonUsingDefaultImpl())
+ {
+ return; // Python override
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvGame.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,759 @@
+#pragma once
+
+// game.h
+
+#ifndef CIV4_GAME_H
+#define CIV4_GAME_H
+
+//#include "CvStructs.h"
+#include "CvDeal.h"
+#include "CvRandom.h"
+
+class CvPlot;
+class CvCity;
+class CvReplayMessage;
+class CvReplayInfo;
+
+typedef std::vector<const CvReplayMessage*> ReplayMessageList;
+// Sanguo Mod Hero, start, added by poyuzhe 01.16.09
+typedef stdext::hash_map<HeroTypes, HeroData> CvHeroMap;
+class CvHeroInfo;
+// Sanguo Mod Hero, end
+
+class CvGame
+{
+
+public:
+
+ DllExport CvGame();
+ DllExport virtual ~CvGame();
+
+ DllExport void init(HandicapTypes eHandicap);
+ DllExport void reset(HandicapTypes eHandicap, bool bConstructorCall =
false);
+
+protected:
+
+ void uninit();
+
+public:
+
+ DllExport void setInitialItems();
+ DllExport void regenerateMap();
+
+ DllExport void initDiplomacy();
+ DllExport void initFreeState();
+ DllExport void initFreeUnits();
+
+ DllExport void assignStartingPlots();
+ DllExport void normalizeStartingPlots();
+
+ DllExport void update();
+ DllExport void updateScore(bool bForce = false);
+
+ DllExport void updateColoredPlots();
+ DllExport void updateBlockadedPlots();
+
+ DllExport void updatePlotGroups();
+ DllExport void updateBuildingCommerce();
+ DllExport void updateCitySight(bool bIncrement);
+ DllExport void updateTradeRoutes();
+
+ DllExport void updateSelectionList();
+ DllExport void updateTestEndTurn();
+
+ DllExport void testExtendedGame();
+
+ DllExport CvUnit* getPlotUnit(const CvPlot* pPlot, int iIndex);
+ DllExport void getPlotUnits(const CvPlot *pPlot, std::vector<CvUnit*>&
plotUnits);
+
+ DllExport void cycleCities(bool bForward = true, bool bAdd = false);
// Exposed to Python
+ DllExport void cycleSelectionGroups(bool bClear, bool bForward = true,
bool bWorkers = false); // Exposed to Python
+ DllExport bool cyclePlotUnits(CvPlot* pPlot, bool bForward = true, bool
bAuto = false, int iCount = -1); // Exposed to Python
+
+ DllExport void selectionListMove(CvPlot* pPlot, bool bAlt, bool bShift,
bool bCtrl); // Exposed to Python
+ DllExport void selectionListGameNetMessage(int eMessage, int iData2 = -1,
int iData3 = -1, int iData4 = -1, int iFlags = 0, bool bAlt = false, bool
bShift = false); // Exposed to Python
+ DllExport void selectedCitiesGameNetMessage(int eMessage, int iData2 =
-1, int iData3 = -1, int iData4 = -1, bool bOption = false, bool bAlt =
false, bool bShift = false, bool bCtrl = false); // Exposed to Python
+ DllExport void cityPushOrder(CvCity* pCity, OrderTypes eOrder, int iData,
bool bAlt = false, bool bShift = false, bool bCtrl = false); // Exposed to
Python
+
+ DllExport void selectUnit(CvUnit* pUnit, bool bClear, bool bToggle =
false, bool bSound = false);
+ DllExport void selectGroup(CvUnit* pUnit, bool bShift, bool bCtrl, bool
bAlt);
+ DllExport void selectAll(CvPlot* pPlot);
+
+ DllExport bool selectionListIgnoreBuildingDefense();
+
+ DllExport bool canHandleAction(int iAction, CvPlot* pPlot = NULL, bool
bTestVisible = false, bool bUseCache = false);
+ DllExport void setupActionCache();
+ DllExport void handleAction(int iAction);
+
+ DllExport bool canDoControl(ControlTypes eControl);
+ DllExport void doControl(ControlTypes eControl);
+
+ DllExport void implementDeal(PlayerTypes eWho, PlayerTypes eOtherWho,
CLinkList<TradeData>* pOurList, CLinkList<TradeData>* pTheirList, bool
bForce = false);
+ DllExport void verifyDeals();
+
+ DllExport void getGlobeviewConfigurationParameters(TeamTypes eTeam, bool&
bStarsVisible, bool& bWorldIsRound);
+
+ DllExport int getSymbolID(int iSymbol); // Exposed to
Python
+
+ int getProductionPerPopulation(HurryTypes eHurry); // Exposed
to Python
+
+ int getAdjustedPopulationPercent(VictoryTypes eVictory) const; //
Exposed to Python
+ int getAdjustedLandPercent(VictoryTypes eVictory) const; //
Exposed to Python
+
+ bool isTeamVote(VoteTypes eVote) const; // Exposed to Python
+ bool isChooseElection(VoteTypes eVote) const; // Exposed to Python
+ bool isTeamVoteEligible(TeamTypes eTeam, VoteSourceTypes eVoteSource)
const; // Exposed to Python
+ int countVote(const VoteTriggeredData& kData, PlayerVoteTypes eChoice)
const;
+ int countPossibleVote(VoteTypes eVote, VoteSourceTypes eVoteSource)
const; // Exposed to Python
+ TeamTypes findHighestVoteTeam(const VoteTriggeredData& kData) const;
+ int getVoteRequired(VoteTypes eVote, VoteSourceTypes eVoteSource) const;
// Exposed to Python
+ TeamTypes getSecretaryGeneral(VoteSourceTypes eVoteSource) const;
// Exposed to Python
+ bool canHaveSecretaryGeneral(VoteSourceTypes eVoteSource) const;
// Exposed to Python
+ void clearSecretaryGeneral(VoteSourceTypes eVoteSource);
+ void updateSecretaryGeneral();
+
+ DllExport int countCivPlayersAlive() const; // Exposed
to Python
+ DllExport int countCivPlayersEverAlive() const; // Exposed
to Python
+ DllExport int countCivTeamsAlive() const; // Exposed to
Python
+ DllExport int countCivTeamsEverAlive() const; // Exposed
to Python
+ DllExport int countHumanPlayersAlive() const; // Exposed
to Python
+
+ int countTotalCivPower(); // Exposed to Python
+ int countTotalNukeUnits(); // Exposed to Python
+ int countKnownTechNumTeams(TechTypes eTech); // Exposed to
Python
+ int getNumFreeBonuses(BuildingTypes eBuilding); // Exposed to
Python
+
+ DllExport int countReligionLevels(ReligionTypes eReligion); //
Exposed to Python
+ DllExport int calculateReligionPercent(ReligionTypes eReligion) const;
// Exposed to Python
+ DllExport int countCorporationLevels(CorporationTypes eCorporation);
// Exposed to Python
+ void replaceCorporation(CorporationTypes eCorporation1, CorporationTypes
eCorporation2);
+
+ DllExport int goldenAgeLength() const; // Exposed to
Python
+ DllExport int victoryDelay(VictoryTypes eVictory) const; // Exposed
to Python
+ DllExport int getImprovementUpgradeTime(ImprovementTypes eImprovement)
const; // Exposed to Python
+
+ DllExport bool canTrainNukes() const; // Exposed to
Python
+ DllExport EraTypes getCurrentEra() const; // Exposed to Python
+
+ DllExport TeamTypes getActiveTeam(); // Exposed to Python
+ DllExport CivilizationTypes getActiveCivilizationType(); //
Exposed to Python
+
+ DllExport unsigned int getLastEndTurnMessageSentTime();
+ DllExport bool isNetworkMultiPlayer() const; // Exposed
to Python
+ DllExport bool isGameMultiPlayer() const; // Exposed to
Python
+ DllExport bool isTeamGame() const; // Exposed to
Python
+
+ DllExport bool isModem();
+ DllExport void setModem(bool bModem);
+
+ DllExport void reviveActivePlayer(); // Exposed to Python
+
+ DllExport int getNumHumanPlayers(); // Exposed to Python
+
+ DllExport int getEndTurnMessagesSent();
+ DllExport void incrementEndTurnMessagesSent();
+
+ DllExport int getGameTurn(); // Exposed to Python
+ DllExport void setGameTurn(int iNewValue); // Exposed to
Python
+ DllExport void incrementGameTurn();
+ DllExport int getTurnYear(int iGameTurn); // Exposed to
Python
+ DllExport int getGameTurnYear(); // Exposed to Python
+
+ DllExport int getElapsedGameTurns() const; // Exposed to
Python
+ DllExport void incrementElapsedGameTurns();
+
+ DllExport int getMaxTurns() const; // Exposed to Python
+ DllExport void setMaxTurns(int iNewValue); // Exposed to
Python
+ DllExport void changeMaxTurns(int iChange); // Exposed to
Python
+
+ DllExport int getMaxCityElimination() const; // Exposed to
Python
+ DllExport void setMaxCityElimination(int iNewValue); // Exposed
to Python
+
+ DllExport int getNumAdvancedStartPoints() const; // Exposed
to Python
+ DllExport void setNumAdvancedStartPoints(int iNewValue); //
Exposed to Python
+
+ DllExport int getStartTurn() const; // Exposed to Python
+ DllExport void setStartTurn(int iNewValue);
+
+ DllExport int getStartYear() const; // Exposed to Python
+ DllExport void setStartYear(int iNewValue); // Exposed to
Python
+
+ DllExport int getEstimateEndTurn() const; // Exposed to
Python
+ DllExport void setEstimateEndTurn(int iNewValue); // Exposed
to Python
+
+ DllExport int getTurnSlice() const; // Exposed to Python
+ DllExport int getMinutesPlayed() const; // Exposed to
Python
+ DllExport void setTurnSlice(int iNewValue);
+ DllExport void changeTurnSlice(int iChange);
+
+ DllExport int getCutoffSlice() const;
+ DllExport void setCutoffSlice(int iNewValue);
+ DllExport void changeCutoffSlice(int iChange);
+
+ DllExport int getTurnSlicesRemaining();
+ DllExport void resetTurnTimer();
+ DllExport void incrementTurnTimer(int iNumTurnSlices);
+ DllExport int getMaxTurnLen();
+
+ DllExport int getTargetScore() const; // Exposed to
Python
+ DllExport void setTargetScore(int iNewValue); // Exposed to
Python
+
+ DllExport int getNumGameTurnActive(); // Exposed to
Python
+ DllExport int countNumHumanGameTurnActive(); // Exposed to
Python
+ DllExport void changeNumGameTurnActive(int iChange);
+
+ DllExport int getNumCities() const; // Exposed to
Python
+ DllExport int getNumCivCities() const; // Exposed to
Python
+ DllExport void changeNumCities(int iChange);
+
+ DllExport int getTotalPopulation() const; // Exposed to
Python
+ DllExport void changeTotalPopulation(int iChange);
+
+ DllExport int getTradeRoutes() const; // Exposed to
Python
+ DllExport void changeTradeRoutes(int iChange); // Exposed to
Python
+
+ DllExport int getFreeTradeCount() const; // Exposed to
Python
+ DllExport bool isFreeTrade() const; // Exposed to Python
+ DllExport void changeFreeTradeCount(int iChange); // Exposed
to Python
+
+ DllExport int getNoNukesCount() const; // Exposed to
Python
+ DllExport bool isNoNukes() const; // Exposed to Python
+ DllExport void changeNoNukesCount(int iChange); // Exposed to
Python
+
+ DllExport int getSecretaryGeneralTimer(VoteSourceTypes eVoteSource)
const; // Exposed to Python
+ DllExport void setSecretaryGeneralTimer(VoteSourceTypes eVoteSource, int
iNewValue);
+ DllExport void changeSecretaryGeneralTimer(VoteSourceTypes eVoteSource,
int iChange);
+
+ DllExport int getVoteTimer(VoteSourceTypes eVoteSource) const;
// Exposed to Python
+ DllExport void setVoteTimer(VoteSourceTypes eVoteSource, int iNewValue);
+ DllExport void changeVoteTimer(VoteSourceTypes eVoteSource, int iChange);
+
+ DllExport int getNukesExploded() const; // Exposed to
Python
+ DllExport void changeNukesExploded(int iChange); // Exposed to
Python
+
+ DllExport int getMaxPopulation() const; // Exposed to
Python
+ DllExport int getMaxLand() const; // Exposed to Python
+ DllExport int getMaxTech() const; // Exposed to Python
+ DllExport int getMaxWonders() const; // Exposed to Python
+ DllExport int getInitPopulation() const; // Exposed to
Python
+ DllExport int getInitLand() const; // Exposed to Python
+ DllExport int getInitTech() const; // Exposed to Python
+ DllExport int getInitWonders() const; // Exposed to
Python
+ DllExport void initScoreCalculation();
+
+ DllExport int getAIAutoPlay(); // Exposed to Python
+ DllExport void setAIAutoPlay(int iNewValue); // Exposed to
Python
+ DllExport void changeAIAutoPlay(int iChange);
+
+ DllExport unsigned int getInitialTime();
+ DllExport void setInitialTime(unsigned int uiNewValue);
+
+ bool isScoreDirty() const; // Exposed to Python
+ void setScoreDirty(bool bNewValue); // Exposed to Python
+
+ DllExport bool isCircumnavigated() const; // Exposed to
Python
+ DllExport void makeCircumnavigated(); // Exposed to
Python
+ bool circumnavigationAvailable() const;
+
+ DllExport bool isDiploVote(VoteSourceTypes eVoteSource) const;
// Exposed to Python
+ int getDiploVoteCount(VoteSourceTypes eVoteSource) const;
+ DllExport void changeDiploVote(VoteSourceTypes eVoteSource, int iChange);
// Exposed to Python
+ DllExport bool canDoResolution(VoteSourceTypes eVoteSource, const
VoteSelectionSubData& kData) const;
+ bool isValidVoteSelection(VoteSourceTypes eVoteSource, const
VoteSelectionSubData& kData) const;
+
+ DllExport bool isDebugMode() const; // Exposed to Python
+ DllExport void toggleDebugMode(); // Exposed to Python
+ DllExport void updateDebugModeCache();
+
+ DllExport int getPitbossTurnTime() const; // Exposed to
Python
+ DllExport void setPitbossTurnTime(int iHours); //
Exposed to Python
+
+ DllExport bool isHotSeat() const; // Exposed to
Python
+ DllExport bool isPbem() const; // Exposed to Python
+ DllExport bool isPitboss() const; // Exposed to
Python
+ DllExport bool isSimultaneousTeamTurns() const; //
Exposed to Python
+
+ DllExport bool isFinalInitialized() const; // Exposed to
Python
+ DllExport void setFinalInitialized(bool bNewValue);
+
+ DllExport bool getPbemTurnSent() const;
+ DllExport void setPbemTurnSent(bool bNewValue);
+
+ DllExport bool getHotPbemBetweenTurns() const;
+ DllExport void setHotPbemBetweenTurns(bool bNewValue);
+
+ DllExport bool isPlayerOptionsSent() const;
+ DllExport void sendPlayerOptions(bool bForce = false);
+
+ DllExport PlayerTypes getActivePlayer() const; //
Exposed to Python
+ DllExport void setActivePlayer(PlayerTypes eNewValue, bool bForceHotSeat
= false); // Exposed to Python
+ DllExport void updateUnitEnemyGlow();
+
+ DllExport HandicapTypes getHandicapType() const;
+ DllExport void setHandicapType(HandicapTypes eHandicap);
+
+ DllExport PlayerTypes getPausePlayer(); // Exposed to
Python
+ DllExport bool isPaused(); // Exposed to Python
+ DllExport void setPausePlayer(PlayerTypes eNewValue);
+
+ DllExport UnitTypes getBestLandUnit(); // Exposed to
Python
+ DllExport int getBestLandUnitCombat(); // Exposed to
Python
+ DllExport void setBestLandUnit(UnitTypes eNewValue);
+
+ DllExport TeamTypes getWinner() const; // Exposed to
Python
+ DllExport VictoryTypes getVictory() const; // Exposed to
Python
+ DllExport void setWinner(TeamTypes eNewWinner, VictoryTypes eNewVictory);
// Exposed to Python
+
+ DllExport GameStateTypes getGameState(); // Exposed to
Python
+ DllExport void setGameState(GameStateTypes eNewValue);
+
+ DllExport EraTypes getStartEra() const; // Exposed to
Python
+
+ DllExport CalendarTypes getCalendar() const; // Exposed to
Python
+
+ DllExport GameSpeedTypes getGameSpeedType() const; // Exposed
to Python
+
+ DllExport int getEndTurnMessagesReceived(int iIndex);
+ DllExport void incrementEndTurnMessagesReceived(int iIndex);
+
+ DllExport PlayerTypes getRankPlayer(int iRank); // Exposed
to Python
+ DllExport void setRankPlayer(int iRank, PlayerTypes ePlayer);
+
+ DllExport int getPlayerRank(PlayerTypes ePlayer); // Exposed
to Python
+ DllExport void setPlayerRank(PlayerTypes ePlayer, int iRank);
+
+ DllExport int getPlayerScore(PlayerTypes ePlayer); // Exposed
to Python
+ DllExport void setPlayerScore(PlayerTypes ePlayer, int iScore);
+
+ DllExport TeamTypes getRankTeam(int iRank); // Exposed to
Python
+ DllExport void setRankTeam(int iRank, TeamTypes eTeam);
+
+ DllExport int getTeamRank(TeamTypes eTeam); // Exposed to
Python
+ DllExport void setTeamRank(TeamTypes eTeam, int iRank);
+
+ DllExport int getTeamScore(TeamTypes eTeam) const; //
Exposed to Python
+ DllExport void setTeamScore(TeamTypes eTeam, int iScore);
+
+ DllExport bool isOption(GameOptionTypes eIndex) const; //
Exposed to Python
+ DllExport void setOption(GameOptionTypes eIndex, bool bEnabled);
+
+ DllExport bool isMPOption(MultiplayerOptionTypes eIndex) const;
// Exposed to Python
+ DllExport void setMPOption(MultiplayerOptionTypes eIndex, bool bEnabled);
+
+ DllExport bool isForcedControl(ForceControlTypes eIndex) const;
// Exposed to Python
+ DllExport void setForceControl(ForceControlTypes eIndex, bool bEnabled);
+
+ DllExport int getUnitCreatedCount(UnitTypes eIndex); //
Exposed to Python
+ DllExport void incrementUnitCreatedCount(UnitTypes eIndex);
+
+ DllExport int getUnitClassCreatedCount(UnitClassTypes eIndex);
// Exposed to Python
+ DllExport bool isUnitClassMaxedOut(UnitClassTypes eIndex, int iExtra =
0); // Exposed to Python
+ DllExport void incrementUnitClassCreatedCount(UnitClassTypes eIndex);
+
+ DllExport int getBuildingClassCreatedCount(BuildingClassTypes eIndex);
// Exposed to Python
+ DllExport bool isBuildingClassMaxedOut(BuildingClassTypes eIndex, int
iExtra = 0); // Exposed to Python
+ DllExport void incrementBuildingClassCreatedCount(BuildingClassTypes
eIndex);
+
+ DllExport int getProjectCreatedCount(ProjectTypes eIndex);
// Exposed to Python
+ DllExport bool isProjectMaxedOut(ProjectTypes eIndex, int iExtra = 0);
// Exposed to Python
+ DllExport void incrementProjectCreatedCount(ProjectTypes eIndex, int
iExtra = 1);
+
+ DllExport int getForceCivicCount(CivicTypes eIndex) const;
// Exposed to Python
+ DllExport bool isForceCivic(CivicTypes eIndex) const; //
Exposed to Python
+ DllExport bool isForceCivicOption(CivicOptionTypes eCivicOption) const;
// Exposed to Python
+ DllExport void changeForceCivicCount(CivicTypes eIndex, int iChange);
+
+ DllExport PlayerVoteTypes getVoteOutcome(VoteTypes eIndex) const;
// Exposed to Python
+ DllExport bool isVotePassed(VoteTypes eIndex) const; //
Exposed to Python
+ DllExport void setVoteOutcome(const VoteTriggeredData& kData,
PlayerVoteTypes eNewValue);
+
+ DllExport bool isVictoryValid(VictoryTypes eIndex) const;
// Exposed to Python
+ DllExport void setVictoryValid(VictoryTypes eIndex, bool bValid);
+
+ DllExport bool isSpecialUnitValid(SpecialUnitTypes eIndex);
// Exposed to Python
+ DllExport void makeSpecialUnitValid(SpecialUnitTypes eIndex);
// Exposed to Python
+
+ DllExport bool isSpecialBuildingValid(SpecialBuildingTypes eIndex);
// Exposed to Python
+ DllExport void makeSpecialBuildingValid(SpecialBuildingTypes eIndex, bool
bAnnounce = false); // Exposed to Python
+
+ DllExport bool isNukesValid() const; // Exposed to Python
+ DllExport void makeNukesValid(bool bValid = true); // Exposed
to Python
+
+ DllExport bool isInAdvancedStart() const; // Exposed to
Python
+
+ DllExport void setVoteChosen(int iSelection, int iVoteId);
+
+ DllExport int getReligionGameTurnFounded(ReligionTypes eIndex);
// Exposed to Python
+ DllExport bool isReligionFounded(ReligionTypes eIndex); //
Exposed to Python
+ void makeReligionFounded(ReligionTypes eIndex, PlayerTypes ePlayer);
+
+ bool isReligionSlotTaken(ReligionTypes eReligion) const; //
Exposed to Python
+ void setReligionSlotTaken(ReligionTypes eReligion, bool bTaken);
+
+ DllExport CvCity* getHolyCity(ReligionTypes eIndex); //
Exposed to Python
+ DllExport void setHolyCity(ReligionTypes eIndex, CvCity* pNewValue, bool
bAnnounce); // Exposed to Python
+
+ DllExport int getCorporationGameTurnFounded(CorporationTypes eIndex);
// Exposed to Python
+ DllExport bool isCorporationFounded(CorporationTypes eIndex);
// Exposed to Python
+ DllExport void makeCorporationFounded(CorporationTypes eIndex,
PlayerTypes ePlayer);
+
+ DllExport CvCity* getHeadquarters(CorporationTypes eIndex);
// Exposed to Python
+ DllExport void setHeadquarters(CorporationTypes eIndex, CvCity*
pNewValue, bool bAnnounce); // Exposed to Python
+
+ DllExport PlayerVoteTypes getPlayerVote(PlayerTypes eOwnerIndex, int
iVoteId) const; // Exposed to Python
+ DllExport void setPlayerVote(PlayerTypes eOwnerIndex, int iVoteId,
PlayerVoteTypes eNewValue);
+ DllExport void castVote(PlayerTypes eOwnerIndex, int iVoteId,
PlayerVoteTypes ePlayerVote);
+
+ DllExport const CvWString & getName();
+ DllExport void setName(const TCHAR* szName);
+
+ // Script data needs to be a narrow string for pickling in Python
+ std::string getScriptData() const; // Exposed to
Python
+ void setScriptData(std::string szNewValue); //
Exposed to Python
+
+ DllExport bool isDestroyedCityName(CvWString& szName) const;
+ DllExport void addDestroyedCityName(const CvWString& szName);
+
+ DllExport bool isGreatPersonBorn(CvWString& szName) const;
+ DllExport void addGreatPersonBornName(const CvWString& szName);
+
+ DllExport int getIndexAfterLastDeal(); // Exposed
to Python
+ DllExport int getNumDeals(); // Exposed to
Python
+ DllExport CvDeal* getDeal(int iID); // Exposed
to Python
+ DllExport CvDeal* addDeal();
+ DllExport void deleteDeal(int iID);
+ // iteration
+ DllExport CvDeal* firstDeal(int *pIterIdx, bool bRev=false);
// Exposed to Python
+ DllExport CvDeal* nextDeal(int *pIterIdx, bool bRev=false);
// Exposed to Python
+
+ VoteSelectionData* getVoteSelection(int iID) const;
+ VoteSelectionData* addVoteSelection(VoteSourceTypes eVoteSource);
+ void deleteVoteSelection(int iID);
+
+ VoteTriggeredData* getVoteTriggered(int iID) const;
+ VoteTriggeredData* addVoteTriggered(const VoteSelectionData& kData, int
iChoice);
+ VoteTriggeredData* addVoteTriggered(VoteSourceTypes eVoteSource, const
VoteSelectionSubData& kOptionData);
+ void deleteVoteTriggered(int iID);
+
+ DllExport CvRandom& getMapRand(); // Exposed to
Python
+ DllExport int getMapRandNum(int iNum, const char* pszLog);
+
+ DllExport CvRandom& getSorenRand(); // Exposed
to Python
+ DllExport int getSorenRandNum(int iNum, const char* pszLog);
+
+ DllExport int calculateSyncChecksum(); // Exposed
to Python
+ DllExport int calculateOptionsChecksum(); //
Exposed to Python
+
+ DllExport void addReplayMessage(ReplayMessageTypes eType =
NO_REPLAY_MESSAGE, PlayerTypes ePlayer = NO_PLAYER, CvWString pszText = L"",
+ int iPlotX = -1, int iPlotY = -1, ColorTypes eColor = NO_COLOR);
+ DllExport void clearReplayMessageMap();
+ DllExport int getReplayMessageTurn(uint i) const;
+ DllExport ReplayMessageTypes getReplayMessageType(uint i) const;
+ DllExport int getReplayMessagePlotX(uint i) const;
+ DllExport int getReplayMessagePlotY(uint i) const;
+ DllExport PlayerTypes getReplayMessagePlayer(uint i) const;
+ DllExport LPCWSTR getReplayMessageText(uint i) const;
+ DllExport uint getNumReplayMessages() const;
+ DllExport ColorTypes getReplayMessageColor(uint i) const;
+
+ DllExport virtual void read(FDataStreamBase* pStream);
+ DllExport virtual void write(FDataStreamBase* pStream);
+ DllExport virtual void writeReplay(FDataStreamBase& stream, PlayerTypes
ePlayer);
+
+ DllExport virtual void AI_init() = 0;
+ DllExport virtual void AI_reset() = 0;
+ DllExport virtual void AI_makeAssignWorkDirty() = 0;
+ DllExport virtual void AI_updateAssignWork() = 0;
+ DllExport virtual int AI_combatValue(UnitTypes eUnit) = 0;
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.10.09
+ virtual void AI_promoteHero(HeroTypes eHero) = 0;
+ // Sanguo Mod Hero, end
+
+ CvReplayInfo* getReplayInfo() const;
+ DllExport void setReplayInfo(CvReplayInfo* pReplay);
+ void saveReplay(PlayerTypes ePlayer);
+
+ bool hasSkippedSaveChecksum() const;
+
+ void addPlayer(PlayerTypes eNewPlayer, LeaderHeadTypes eLeader,
CivilizationTypes eCiv); // Exposed to Python
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD 8/1/08 jdog5000 */
+/** */
+/** Debug */
+/********************************************************************************/
+ void changeHumanPlayer( PlayerTypes eNewHuman );
+/********************************************************************************/
+/** BETTER_BTS_AI_MOD END */
+/********************************************************************************/
+
+ bool testVictory(VictoryTypes eVictory, TeamTypes eTeam, bool* pbEndScore
= NULL) const;
+
+ bool isCompetingCorporation(CorporationTypes eCorporation1,
CorporationTypes eCorporation2) const;
+
+ 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();
+
+ int getPlotExtraYield(int iX, int iY, YieldTypes eYield) const;
+ void setPlotExtraYield(int iX, int iY, YieldTypes eYield, int iCost);
// exposed to Python
+ void removePlotExtraYield(int iX, int iY);
+
+ int getPlotExtraCost(int iX, int iY) const;
+ void changePlotExtraCost(int iX, int iY, int iCost); // exposed to
Python
+ void removePlotExtraCost(int iX, int iY);
+
+ ReligionTypes getVoteSourceReligion(VoteSourceTypes eVoteSource)
const; // Exposed to Python
+ void setVoteSourceReligion(VoteSourceTypes eVoteSource, ReligionTypes
eReligion, bool bAnnounce = false); // Exposed to Python
+
+ bool isEventActive(EventTriggerTypes eTrigger) const; // exposed to
Python
+ DllExport void initEvents();
+
+ bool isCivEverActive(CivilizationTypes eCivilization) const; //
Exposed to Python
+ bool isLeaderEverActive(LeaderHeadTypes eLeader) const; // Exposed to
Python
+ bool isUnitEverActive(UnitTypes eUnit) const; // Exposed to Python
+ bool isBuildingEverActive(BuildingTypes eBuilding) const; // Exposed to
Python
+
+ void processBuilding(BuildingTypes eBuilding, int iChange);
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ int getHeroDebutStatus(HeroTypes eHero) const; // Exposed to Python
+ void setHeroDebutStatus(HeroTypes eHero, int iNewValue); //
Exposed to Python
+ void changeHeroDebutStatus(HeroTypes eHero, int iChange); //
Exposed to Python
+ int getCurrentDefaultCivilization(HeroTypes eHero) const; //
Exposed to Python
+ int getHeroUnitCombatLevel(HeroTypes eHero, UnitCombatTypes
eUnitCombat) const; // Exposed to Python
+ void setHeroUnitCombatLevel(HeroTypes eHero, UnitCombatTypes
eUnitCombat, int iNewValue); // Exposed to Python
+ void changeHeroUnitCombatLevel(HeroTypes eHero, UnitCombatTypes
eUnitCombat, int iChange); // Exposed to Python
+ int getHeroPromotionStatus(HeroTypes eHero, PromotionTypes ePromotion)
const; // Exposed to Python
+ void setHeroPromotionStatus(HeroTypes eHero, PromotionTypes
ePromotion, int iNewValue); // Exposed to Python
+ int getHeroUnitID(HeroTypes eHero) const; // Exposed to Python
+ void setHeroUnitID(HeroTypes eHero, int iID); // Exposed to Python
+ float getHeroExperience(HeroTypes eHero) const; // Exposed to
Python
+ void setHeroExperience(HeroTypes eHero, float fNewValue); //
Exposed to Python
+ void changeHeroExperience(HeroTypes eHero, float fChange); //
Exposed to Python
+ bool canPromoteHero(HeroTypes eHero, PromotionTypes ePromotion)
const; // Exposed to Python
+ void promoteHero(HeroTypes eHero, PromotionTypes ePromotion); //
Exposed to Python
+ bool canHeroAcquirePromotion(HeroTypes eHero, PromotionTypes
ePromotion, bool bNineTransformation = false, bool bRandom = false)
const; // Exposed to Python
+ bool isHeroPromotionReady(HeroTypes eHero) const; // Exposed to
Python
+ void setHeroPromotionReady(HeroTypes eHero, bool bNewValue); //
Exposed to Python
+ void testHeroPromotionReady(HeroTypes eHero); // Exposed to Python
+ bool canHeroAcquirePromotionAny(HeroTypes eHero) const; // Exposed
to Python
+ int heroExperienceNeeded(HeroTypes eHero) const;
+ int getHeroLevel(HeroTypes eHero) const; // Exposed to Python
+ void setHeroLevel(HeroTypes eHero, int iNewValue); // Exposed to
Python
+ void changeHeroLevel(HeroTypes eHero, int iChange); // Exposed to
Python
+ void changeCombatExperienceFromBarbarian(bool bWithdrawal, int
iExperience);
+ void removeGreatPersonBornName(const CvWString& szName);
+ CvUnit* getHeroUnit(HeroTypes eHero);
+ void decrementUnitCreatedCount(UnitTypes eIndex);
+ void decrementUnitClassCreatedCount(UnitClassTypes eIndex);
+ int getHeroVitality(HeroTypes eHero) const; // Exposed to Python
+ void setHeroVitality(HeroTypes eHero, int iNewValue);
+ void changeHeroVitality(HeroTypes eHero, int iChange); // Exposed
to Python
+ bool isHeroWounded(HeroTypes eHero) const; // Exposed to Python
+ void setHeroWounded(HeroTypes eHero, bool bNewValue); // Exposed
to Python
+ void doHeroWounded(HeroTypes eHero);
+ bool isLegionUnitMoved(HeroTypes eHero);
+ void setLegionUnitMoved(HeroTypes eHero, bool bNewValue);
+ void doNineTransformationPromotions(HeroTypes eHero, int iLevelChange);
+ PromotionTypes getHeroCurrentNineTransformationPromotion(HeroTypes eHero)
const; // Exposed to Python
+ void setHeroCurrentNineTransformationPromotion(HeroTypes eHero,
PromotionTypes ePromotion); // Exposed to Python
+ bool isHeroNineTransformationPromotion(HeroTypes eHero, PromotionTypes
ePromotion) const; // Exposed to Python
+
+ int getHeroLegionSize(HeroTypes eHero) const; // Exposed to Python
+ bool isHeroHasLegionMember(HeroTypes eHero, int iID) const; // Exposed
to Python
+ void addHeroLegionMember(HeroTypes eHero, int iUnitID); // Exposed to
Python
+ void deleteHeroLegionMember(HeroTypes eHero, int iUnitID); // Exposed
to Python
+ int getHeroCoreTroop(HeroTypes eHero) const; // Exposed to Python
+ void deleteHeroCoreTroop(HeroTypes eHero); // Exposed to Python
+ void addHeroCoreTroop(HeroTypes eHero, int iUnitID); // Exposed to
Python
+ int getHeroLegionMemberAt(HeroTypes eHero, int iIndex) const; //
Exposed to Python
+ void promoteAsHeroCoreTroop(HeroTypes eHero, int iUnitID); // Exposed
to Python
+ void clearHeroLegionMember(HeroTypes eHero); // Exposed to Python
+ int getHeroLegionBackUpSize(HeroTypes eHero) const; // Exposed to Python
+ int getHeroLegionBackUpMemberAt(HeroTypes eHero, int iIndex) const; //
Exposed to Python
+ void backUpHeroLegionMember(HeroTypes eHero); // Exposed to Python
+ bool isHeroHasBackUpMember(HeroTypes eHero, int iIndex) const;
+ int getHeroNextLegionMember(HeroTypes eHero, int iID) const; // Exposed
to Python
+ void tempRemoveHeroCoreTroop(HeroTypes eHero); // Exposed to Python
+ void clearHeroBackUpList(HeroTypes eHero); // Exposed to
Python
+
+ HeroTypes createRandomHero(PlayerTypes ePlayer, int iX, int iY, int
iLeadership = -1, int iMight = -1, int iLoyalty = -1, int iUnitCombat = -1,
PromotionTypes eFirstPromotion = NO_PROMOTION, PromotionTypes
eSecondPromotion = NO_PROMOTION, PromotionTypes eThirdPromotion =
NO_PROMOTION, bool bThreeRandomPromotions = false); // Exposed to Python
+
+ int getHeroSeeInvisibleCount(HeroTypes eHero, InvisibleTypes eInvisible);
+ PlayerTypes getHeroCapturePlayer(HeroTypes eHero) const; // Exposed to
Python
+ void setHeroCapturePlayer(HeroTypes eHero, PlayerTypes ePlayer);
+ bool willHeroJoinFaction(HeroTypes eHero, PlayerTypes ePlayer); //
Exposed to Python
+ int getHeroSurrenderRand(HeroTypes eHero) const;
+ void setHeroSurrenderRand(HeroTypes eHero, int iNewValue);
+
+ int getHeroLeadership(HeroTypes eHero, bool bOverwrite = false,
HeroTypes eOverwriteHero = NO_HERO) const; // Exposed to Python
+ int getHeroCapacity(HeroTypes eHero, bool bOverwrite = false,
HeroTypes eOverwriteHero = NO_HERO) const; // Exposed to Python
+ int getHeroExperienceNeededForNextCapacity(HeroTypes eHero)
const; // Exposed to Python
+ void swapHeroLegionList(HeroTypes eHero);
+ // Sanguo Mod Hero, end
+
+protected:
+
+ int m_iEndTurnMessagesSent;
+ int m_iElapsedGameTurns;
+ int m_iStartTurn;
+ int m_iStartYear;
+ int m_iEstimateEndTurn;
+ int m_iTurnSlice;
+ int m_iCutoffSlice;
+ int m_iNumGameTurnActive;
+ int m_iNumCities;
+ int m_iTotalPopulation;
+ int m_iTradeRoutes;
+ int m_iFreeTradeCount;
+ int m_iNoNukesCount;
+ int m_iNukesExploded;
+ int m_iMaxPopulation;
+ int m_iMaxLand;
+ int m_iMaxTech;
+ int m_iMaxWonders;
+ int m_iInitPopulation;
+ int m_iInitLand;
+ int m_iInitTech;
+ int m_iInitWonders;
+ int m_iAIAutoPlay;
+
+ unsigned int m_uiInitialTime;
+
+ bool m_bScoreDirty;
+ bool m_bCircumnavigated;
+ bool m_bDebugMode;
+ bool m_bDebugModeCache;
+ bool m_bFinalInitialized;
+ bool m_bPbemTurnSent;
+ bool m_bHotPbemBetweenTurns;
+ bool m_bPlayerOptionsSent;
+ bool m_bNukesValid;
+
+ HandicapTypes m_eHandicap;
+ PlayerTypes m_ePausePlayer;
+ UnitTypes m_eBestLandUnit;
+ TeamTypes m_eWinner;
+ VictoryTypes m_eVictory;
+ GameStateTypes m_eGameState;
+ PlayerTypes m_eEventPlayer;
+
+ CvString m_szScriptData;
+
+ int* m_aiEndTurnMessagesReceived;
+ int* m_aiRankPlayer; // Ordered by rank...
+ int* m_aiPlayerRank; // Ordered by player ID...
+ int* m_aiPlayerScore; // Ordered by player ID...
+ int* m_aiRankTeam; // Ordered by rank...
+ int* m_aiTeamRank; // Ordered by team ID...
+ int* m_aiTeamScore; // Ordered by team ID...
+
+ int* m_paiUnitCreatedCount;
+ int* m_paiUnitClassCreatedCount;
+ int* m_paiBuildingClassCreatedCount;
+ int* m_paiProjectCreatedCount;
+ int* m_paiForceCivicCount;
+ PlayerVoteTypes* m_paiVoteOutcome;
+ int* m_paiReligionGameTurnFounded;
+ int* m_paiCorporationGameTurnFounded;
+ int* m_aiSecretaryGeneralTimer;
+ int* m_aiVoteTimer;
+ int* m_aiDiploVote;
+
+ bool* m_pabSpecialUnitValid;
+ bool* m_pabSpecialBuildingValid;
+ bool* m_abReligionSlotTaken;
+
+ IDInfo* m_paHolyCity;
+ IDInfo* m_paHeadquarters;
+
+ int** m_apaiPlayerVote;
+
+ std::vector<CvWString> m_aszDestroyedCities;
+ std::vector<CvWString> m_aszGreatPeopleBorn;
+
+ FFreeListTrashArray<CvDeal> m_deals;
+ FFreeListTrashArray<VoteSelectionData> m_voteSelections;
+ FFreeListTrashArray<VoteTriggeredData> m_votesTriggered;
+
+ CvRandom m_mapRand;
+ CvRandom m_sorenRand;
+
+ ReplayMessageList m_listReplayMessages;
+ CvReplayInfo* m_pReplayInfo;
+
+ int m_iNumSessions;
+
+ std::vector<PlotExtraYield> m_aPlotExtraYields;
+ std::vector<PlotExtraCost> m_aPlotExtraCosts;
+ stdext::hash_map<VoteSourceTypes, ReligionTypes> m_mapVoteSourceReligions;
+ std::vector<EventTriggerTypes> m_aeInactiveTriggers;
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ std::vector<int*> m_ppaiHeroUnitCombatLevel;
+ std::vector<int*> m_ppaiHeroPromotionStatus;
+ CvHeroMap m_mapHeroes;
+ std::vector<CvHeroInfo*> m_paNewHeroes;
+ // Sanguo Mod Hero, end
+
+ // CACHE: cache frequently used values
+ int m_iShrineBuildingCount;
+ int* m_aiShrineBuilding;
+ int* m_aiShrineReligion;
+
+ int m_iNumCultureVictoryCities;
+ int m_eCultureVictoryCultureLevel;
+
+ void doTurn();
+ void doDeals();
+ void doGlobalWarming();
+ void doHolyCity();
+ void doHeadquarters();
+ void doDiploVote();
+ void doVoteResults();
+ void doVoteSelection();
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.04.09
+ void doHero();
+ // Sanguo Mod Hero, end
+
+ void createBarbarianCities();
+ void createBarbarianUnits();
+ void createAnimals();
+
+ void verifyCivics();
+
+ void updateWar();
+ void updateMoves();
+ void updateTimers();
+ void updateTurnTimer();
+
+ void testAlive();
+ void testVictory();
+
+ void processVote(const VoteTriggeredData& kData, int iChange);
+
+ int getTeamClosenessScore(int** aaiDistances, int* aiStartingLocs);
+ void normalizeStartingPlotLocations();
+ void normalizeAddRiver();
+ void normalizeRemovePeaks();
+ void normalizeAddLakes();
+ void normalizeRemoveBadFeatures();
+ void normalizeRemoveBadTerrain();
+ void normalizeAddFoodBonuses();
+ void normalizeAddGoodTerrain();
+ void normalizeAddExtras();
+
+ void showEndGameSequence();
+
+ CvPlot* normalizeFindLakePlot(PlayerTypes ePlayer);
+
+ void doUpdateCacheOnTurn();
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvGameAI.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,355 @@
+// gameAI.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvGameAI.h"
+#include "CvPlayerAI.h"
+#include "CvTeamAI.h"
+#include "CvGlobals.h"
+#include "CvInfos.h"
+
+// Public Functions...
+
+CvGameAI::CvGameAI()
+{
+ AI_reset();
+}
+
+
+CvGameAI::~CvGameAI()
+{
+ AI_uninit();
+}
+
+
+void CvGameAI::AI_init()
+{
+ AI_reset();
+
+ //--------------------------------
+ // Init other game data
+}
+
+
+void CvGameAI::AI_uninit()
+{
+}
+
+
+void CvGameAI::AI_reset()
+{
+ AI_uninit();
+
+ m_iPad = 0;
+}
+
+
+void CvGameAI::AI_makeAssignWorkDirty()
+{
+ int iI;
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ if (GET_PLAYER((PlayerTypes)iI).isAlive())
+ {
+ GET_PLAYER((PlayerTypes)iI).AI_makeAssignWorkDirty();
+ }
+ }
+}
+
+
+void CvGameAI::AI_updateAssignWork()
+{
+ int iI;
+
+ for (iI = 0; iI < MAX_PLAYERS; iI++)
+ {
+ CvPlayer& kLoopPlayer = GET_PLAYER((PlayerTypes)iI);
+ if (GET_TEAM(kLoopPlayer.getTeam()).isHuman() && kLoopPlayer.isAlive())
+ {
+ kLoopPlayer.AI_updateAssignWork();
+ }
+ }
+}
+
+
+bool CvGameAI::AI_isFirstTech(TechTypes eTech)
+{
+ int iI;
+
+ for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
+ {
+ if (GC.getReligionInfo((ReligionTypes)iI).getTechPrereq() == eTech)
+ {
+ if (!(GC.getGameINLINE().isReligionSlotTaken((ReligionTypes)iI)))
+ {
+ return true;
+ }
+ }
+ }
+
+ if (GC.getGameINLINE().countKnownTechNumTeams(eTech) == 0)
+ {
+ if ((GC.getTechInfo(eTech).getFirstFreeUnitClass() != NO_UNITCLASS) ||
+ (GC.getTechInfo(eTech).getFirstFreeTechs() > 0))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+int CvGameAI::AI_combatValue(UnitTypes eUnit)
+{
+ int iValue;
+
+ iValue = 100;
+
+ if (GC.getUnitInfo(eUnit).getDomainType() == DOMAIN_AIR)
+ {
+ iValue *= GC.getUnitInfo(eUnit).getAirCombat();
+ }
+ else
+ {
+ iValue *= GC.getUnitInfo(eUnit).getCombat();
+
+ iValue *= ((((GC.getUnitInfo(eUnit).getFirstStrikes() * 2) +
GC.getUnitInfo(eUnit).getChanceFirstStrikes()) *
(GC.getDefineINT("COMBAT_DAMAGE") / 5)) + 100);
+ iValue /= 100;
+ }
+
+ iValue /= getBestLandUnitCombat();
+
+ return iValue;
+}
+
+
+int CvGameAI::AI_turnsPercent(int iTurns, int iPercent)
+{
+ FAssert(iPercent > 0);
+ if (iTurns != MAX_INT)
+ {
+ iTurns *= (iPercent);
+ iTurns /= 100;
+ }
+
+ return std::max(1, iTurns);
+}
+
+
+void CvGameAI::read(FDataStreamBase* pStream)
+{
+ CvGame::read(pStream);
+
+ uint uiFlag=0;
+ pStream->Read(&uiFlag); // flags for expansion
+
+ pStream->Read(&m_iPad);
+}
+
+
+void CvGameAI::write(FDataStreamBase* pStream)
+{
+ CvGame::write(pStream);
+
+ uint uiFlag=0;
+ pStream->Write(uiFlag); // flag for expansion
+
+ pStream->Write(m_iPad);
+}
+
+// Sanguo Mod Hero, start, added by poyuzhe 02.10.09
+void CvGameAI::AI_promoteHero(HeroTypes eHero)
+{
+ PROFILE_FUNC();
+
+ PromotionTypes eBestPromotion;
+ int iValue;
+ int iBestValue;
+ int iI;
+
+ iBestValue = 0;
+ eBestPromotion = NO_PROMOTION;
+
+ for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
+ {
+ if (canPromoteHero(eHero, (PromotionTypes)iI))
+ {
+ iValue = AI_heroPromotionValue(eHero, (PromotionTypes)iI);
+
+ if (iValue > iBestValue)
+ {
+ iBestValue = iValue;
+ eBestPromotion = ((PromotionTypes)iI);
+ }
+ }
+ }
+
+ if (eBestPromotion != NO_PROMOTION)
+ {
+ promoteHero(eHero, eBestPromotion);
+ if (isHeroPromotionReady(eHero))
+ {
+ AI_promoteHero(eHero);
+ }
+ }
+}
+
+int CvGameAI::AI_heroPromotionValue(HeroTypes eHero, PromotionTypes
ePromotion, bool bNineTransformation)
+{
+ int iValue = getSorenRandNum(50, "Hero Promotion");
+
+ if (bNineTransformation)
+ {
+ iValue *= 2;
+ }
+
+ iValue += GC.getPromotionInfo(ePromotion).getMovesChange() * 50;
+ iValue += GC.getPromotionInfo(ePromotion).getWithdrawalChange() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getCollateralDamageChange() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getBombardRateChange() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getFirstStrikesChange() * 20;
+ iValue += GC.getPromotionInfo(ePromotion).getChanceFirstStrikesChange() *
10;
+ iValue += GC.getPromotionInfo(ePromotion).getEnemyHealChange() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getFriendlyHealChange();
+ iValue += GC.getPromotionInfo(ePromotion).getNeutralHealChange();
+ iValue += GC.getPromotionInfo(ePromotion).getSameTileHealChange() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getAdjacentTileHealChange() * 4;
+ iValue += GC.getPromotionInfo(ePromotion).getCombatPercent() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getCityAttackPercent() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getCityDefensePercent();
+ iValue += GC.getPromotionInfo(ePromotion).getHillsAttackPercent();
+ iValue += GC.getPromotionInfo(ePromotion).getHillsDefensePercent() / 2;
+ iValue += GC.getPromotionInfo(ePromotion).getCollateralDamageProtection()
/ 2;
+ iValue += GC.getPromotionInfo(ePromotion).getExperiencePercent() / 2;
+ iValue += GC.getPromotionInfo(ePromotion).isBlitz() ? 30 : 0;
+ iValue += GC.getPromotionInfo(ePromotion).isAmphib() ? 10: 0;
+ iValue += GC.getPromotionInfo(ePromotion).isEnemyRoute() ? 40 : 0;
+ iValue += GC.getPromotionInfo(ePromotion).isAlwaysHeal() ? 40 : 0;
+ iValue += GC.getPromotionInfo(ePromotion).isRiver() ? 30 : 0;
+ iValue += GC.getPromotionInfo(ePromotion).isForceDefensiveWithdrawal() ?
45 : 0;
+ iValue += GC.getPromotionInfo(ePromotion).isReckless() ? 70 : 0;
+
+ int iI;
+ for (iI = 0; iI < GC.getNumTerrainInfos(); iI++)
+ {
+ iValue += GC.getPromotionInfo(ePromotion).getTerrainAttackPercent(iI) /
2;
+ iValue += GC.getPromotionInfo(ePromotion).getTerrainDefensePercent(iI) /
4;
+ }
+ for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
+ {
+ iValue += GC.getPromotionInfo(ePromotion).getFeatureAttackPercent(iI) /
4;
+ iValue += GC.getPromotionInfo(ePromotion).getFeatureDefensePercent(iI) /
8;
+ }
+ for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
+ {
+ iValue +=
GC.getPromotionInfo(ePromotion).getUnitCombatModifierPercent(iI) / 8;
+ }
+
+ if (GC.getPromotionInfo(ePromotion).getStrengthIncrease() > 0)
+ {
+ iValue += 75;
+ }
+ iValue += 8 *
GC.getPromotionInfo(ePromotion).getSurroundingEnemyHealthChange();
+ if (GC.getPromotionInfo(ePromotion).isWarGod())
+ {
+ iValue += 100;
+ }
+ iValue += 2 *
GC.getPromotionInfo(ePromotion).getBetterStrengthEnemyModifier();
+ iValue += 3 *
GC.getPromotionInfo(ePromotion).getFlankingDamageIncreasePercent();
+ if (GC.getPromotionInfo(ePromotion).isSeaLord())
+ {
+ iValue += 100;
+ }
+ if (GC.getPromotionInfo(ePromotion).canScatterEnemyStack())
+ {
+ iValue += 100;
+ }
+ iValue += 5 *
GC.getPromotionInfo(ePromotion).getWinCombatRestoreHealthPercent();
+ iValue += 2 *
GC.getPromotionInfo(ePromotion).getEnemyAttackNullifyChance();
+ if (GC.getPromotionInfo(ePromotion).canDefendFromMarksman())
+ {
+ iValue += 75;
+ }
+ iValue += 2 *
GC.getPromotionInfo(ePromotion).getVersusEnemyCoreTroopStrengthModifier();
+ iValue += 4 *
GC.getPromotionInfo(ePromotion).getDefenseBuildingEffectModifier() / 3;
+ iValue +=
GC.getPromotionInfo(ePromotion).getUponDeathShareExperienceAmount() / 3;
+ iValue += 4 *
GC.getPromotionInfo(ePromotion).getBesideRiverStrengthModifier() / 3;
+ iValue += 2 *
GC.getPromotionInfo(ePromotion).getNonGoodReligionStrengthModifier();
+ iValue +=
GC.getPromotionInfo(ePromotion).getKillCoreTroopGoldenAgeChancePerLevel() *
getElapsedGameTurns() / 25;
+ iValue += 4 *
GC.getPromotionInfo(ePromotion).getMoveAttackStrengthModifier() / 3;
+ if (GC.getPromotionInfo(ePromotion).isNoEnemyWithdrawal())
+ {
+ iValue += 75;
+ }
+ if (GC.getPromotionInfo(ePromotion).isTargetCoreTroopFirst())
+ {
+ iValue += 75;
+ }
+ if (GC.getPromotionInfo(ePromotion).isTargetWeakestFirst())
+ {
+ iValue += 100;
+ }
+ if (GC.getPromotionInfo(ePromotion).isIgnoreDefenderTerrain())
+ {
+ iValue += 75;
+ }
+ iValue += GC.getPromotionInfo(ePromotion).getAttackedCityDefenseChange();
+ iValue +=
GC.getPromotionInfo(ePromotion).getSameTurnWinStrengthModifier();
+ if (GC.getPromotionInfo(ePromotion).canStealHeroPromotion())
+ {
+ iValue += 50;
+ }
+ iValue +=
GC.getPromotionInfo(ePromotion).getTerrifyAttackingEnemyChance() * 2;
+ iValue += GC.getPromotionInfo(ePromotion).getSecondAttackChance() * 4 / 3;
+ if (GC.getPromotionInfo(ePromotion).getInvisibleType() != -1)
+ {
+ iValue += 60;
+ }
+ for (iI = 0; iI < GC.getNumInvisibleInfos(); iI++)
+ {
+ if (GC.getPromotionInfo(ePromotion).isSeeInvisibles(iI))
+ {
+ iValue += 50;
+ }
+ }
+
+ if
(GC.getPromotionInfo((PromotionTypes)iI).getHeroUnitCombatLevelChange() > 0)
+ {
+ for (iI = 0; iI < GC.getNumUnitCombatInfos(); iI++)
+ {
+ if ((UnitCombatTypes)iI == UNITCOMBAT_HERO ||
(UnitCombatTypes)iI == UNITCOMBAT_RECON)
+ {
+ continue;
+ }
+ if (getHeroUnitCombatLevel(eHero, (UnitCombatTypes)iI) <
GC.getHeroInfo(eHero).getPotentialUnitCombatLevel((UnitCombatTypes)iI))
+ {
+ iValue += 15 * (getHeroUnitCombatLevel(eHero,
(UnitCombatTypes)iI) + 1);
+ }
+ }
+ }
+
+ for (iI = 0; iI < GC.getNumPromotionInfos(); iI++)
+ {
+ if (GC.getPromotionInfo((PromotionTypes)iI).getPrereqPromotion() ==
ePromotion ||
GC.getPromotionInfo((PromotionTypes)iI).getPrereqOrPromotion1() ==
ePromotion ||
GC.getPromotionInfo((PromotionTypes)iI).getPrereqOrPromotion2() ==
ePromotion)
+ {
+ if (GC.getHeroInfo(eHero).getUnitPromotionStatus(iI) == 3)
+ {
+ iValue += AI_heroPromotionValue(eHero, (PromotionTypes)iI) / 2;
+ }
+ }
+ }
+
+ if (GC.getPromotionInfo(ePromotion).getHeroPromotionStatus() == 2)
+ {
+ iValue *= (40 + 3 * getHeroLegionSize(eHero));
+ iValue /= 40;
+ }
+
+ return iValue;
+}
+// Sanguo Mod Hero, end
+
+// Protected Functions...
+
+// Private Functions...
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvGameAI.h Sat Sep 19 06:38:49 2009
@@ -0,0 +1,45 @@
+#pragma once
+
+// gameAI.h
+
+#ifndef CIV4_GAME_AI_H
+#define CIV4_GAME_AI_H
+
+#include "CvGame.h"
+
+class CvGameAI : public CvGame
+{
+
+public:
+
+ CvGameAI();
+ virtual ~CvGameAI();
+
+ void AI_init();
+ void AI_uninit();
+ void AI_reset();
+
+ void AI_makeAssignWorkDirty();
+ void AI_updateAssignWork();
+
+ bool AI_isFirstTech(TechTypes eTech);
+
+ int AI_combatValue(UnitTypes eUnit);
+
+ int AI_turnsPercent(int iTurns, int iPercent);
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.10.09
+ void AI_promoteHero(HeroTypes eHero);
+ int AI_heroPromotionValue(HeroTypes eHero, PromotionTypes ePromotion,
bool bNineTransformation = false);
+ // Sanguo Mod Hero, end
+
+ virtual void read(FDataStreamBase* pStream);
+ virtual void write(FDataStreamBase* pStream);
+
+protected:
+
+ int m_iPad;
+
+};
+
+#endif
=======================================
--- /dev/null
+++ /trunk/317DLL/CvGameCoreDLL/CvGameCoreDLL.cpp Sat Sep 19 06:38:49 2009
@@ -0,0 +1,136 @@
+#include "CvGameCoreDLL.h"
+
+#include "CvGameCoreDLLUndefNew.h"
+
+#include <new>
+
+#include "CvGlobals.h"
+#include "FProfiler.h"
+#include "CvDLLInterfaceIFaceBase.h"
+
+//
+// operator global new and delete override for gamecore DLL
+//
+void *__cdecl operator new(size_t size)
+{
+ if (gDLL)
+ {
+ return gDLL->newMem(size, __FILE__, __LINE__);
+ }
+ return malloc(size);
+}
+
+void __cdecl operator delete (void *p)
+{
+ if (gDLL)
+ {
+ gDLL->delMem(p, __FILE__, __LINE__);
+ }
+ else
+ {
+ free(p);
+ }
+}
+
+void* operator new[](size_t size)
+{
+ if (gDLL)
+ return gDLL->newMemArray(size, __FILE__, __LINE__);
+ return malloc(size);
+}
+
+void operator delete[](void* pvMem)
+{
+ if (gDLL)
+ {
+ gDLL->delMemArray(pvMem, __FILE__, __LINE__);
+ }
+ else
+ {
+ free(pvMem);
+ }
+}
+
+void *__cdecl operator new(size_t size, char* pcFile, int iLine)
+{
+ return gDLL->newMem(size, pcFile, iLine);
+}
+
+void *__cdecl operator new[](size_t size, char* pcFile, int iLine)
+{
+ return gDLL->newMem(size, pcFile, iLine);
+}
+
+void __cdecl operator delete(void* pvMem, char* pcFile, int iLine)
+{
+ gDLL->delMem(pvMem, pcFile, iLine);
+}
+
+void __cdecl operator delete[](void* pvMem, char* pcFile, int iLine)
+{
+ gDLL->delMem(pvMem, pcFile, iLine);
+}
+
+
+void* reallocMem(void* a, unsigned int uiBytes, const char* pcFile, int
iLine)
+{
+ return gDLL->reallocMem(a, uiBytes, pcFile, iLine);
+}
+
+unsigned int memSize(void* a)
+{
+ return gDLL->memSize(a);
+}
+
+BOOL APIENTRY DllMain(HANDLE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved)
+{
+ switch( ul_reason_for_call ) {
+ case DLL_PROCESS_ATTACH:
+ {
+ // The DLL is being loaded into the virtual address space of the current
process as a result of the process starting up
+ OutputDebugString("DLL_PROCESS_ATTACH\n");
+
+ // set timer precision
+ MMRESULT iTimeSet = timeBeginPeriod(1); // set timeGetTime and sleep
resolution to 1 ms, otherwise it's 10-16ms
+ FAssertMsg(iTimeSet==TIMERR_NOERROR, "failed setting timer resolution to
1 ms");
+ }
+ break;
+ case DLL_THREAD_ATTACH:
+ // OutputDebugString("DLL_THREAD_ATTACH\n");
+ break;
+ case DLL_THREAD_DETACH:
+ // OutputDebugString("DLL_THREAD_DETACH\n");
+ break;
+ case DLL_PROCESS_DETACH:
+ OutputDebugString("DLL_PROCESS_DETACH\n");
+ timeEndPeriod(1);
+ GC.setDLLIFace(NULL);
+ break;
+ }
+
+ return TRUE; // success
+}
+
+//
+// enable dll profiler if necessary, clear history
+//
+void startProfilingDLL()
+{
+ if (GC.isDLLProfilerEnabled())
+ {
+ gDLL->ProfilerBegin();
+ }
+}
+
+//
+// dump profile stats on-screen
+//
+void stopProfilingDLL()
+{
+ if (GC.isDLLProfilerEnabled())
+ {
+ gDLL->ProfilerEnd();
+ }
+}
=======================================
***Additional files exist in this changeset.***

Reply all
Reply to author
Forward
0 new messages