Revision: 357
Author: wynymk
Date: Fri May 7 07:24:35 2010
Log: update: 319 -> 319cn
http://code.google.com/p/sanguoforciv4/source/detail?r=357
Added:
/trunk/319cnDifference
/trunk/319cnDifference/Assets
/trunk/319cnDifference/Assets/Art
/trunk/319cnDifference/Assets/Art/interface
/trunk/319cnDifference/Assets/Art/interface/Classical Main Menu
/trunk/319cnDifference/Assets/Art/interface/Classical Main
Menu/CIV4MainMenuBG.nif
/trunk/319cnDifference/Assets/Art/interface/Classical Main
Menu/CrossroadsOfTheWorld.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu
/trunk/319cnDifference/Assets/Art/interface/Main Menu/ArrowLEFT.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/ArrowRIGHT.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/AtmosOpacity3.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/CIV4MainMenuBG.nif
/trunk/319cnDifference/Assets/Art/interface/Main Menu/CivTitle.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/CivTitle2.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/Clouds2.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/DayNight.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/SolarGlare.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/Thumbs.db
/trunk/319cnDifference/Assets/Art/interface/Main Menu/citylight.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/earth.dds
/trunk/319cnDifference/Assets/Art/interface/Main Menu/stars.dds
/trunk/319cnDifference/Assets/Art/interface/screens
/trunk/319cnDifference/Assets/Art/interface/screens/loading
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBG.dds
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGBeyondtheSword.dds
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGClassical.dds
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGslideshowBeyondtheSword.dds
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGslideshowClassical.dds
/trunk/319cnDifference/Assets/Python
/trunk/319cnDifference/Assets/Python/CvEventManager.py
/trunk/319cnDifference/Assets/Python/CvUtil.py
/trunk/319cnDifference/Assets/Python/EntryPoints
/trunk/319cnDifference/Assets/Python/EntryPoints/CvAppInterface.py
/trunk/319cnDifference/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py
/trunk/319cnDifference/Assets/Python/pyWB
/trunk/319cnDifference/Assets/Python/pyWB/CvWBDesc.py
/trunk/319cnDifference/Assets/Res
/trunk/319cnDifference/Assets/Res/Fonts
/trunk/319cnDifference/Assets/Res/Fonts/GameFont.tga
/trunk/319cnDifference/Assets/Res/Fonts/GameFont_75.tga
/trunk/319cnDifference/Assets/XML
/trunk/319cnDifference/Assets/XML/Art
/trunk/319cnDifference/Assets/XML/Art/CIV4ArtDefines_Misc.xml
/trunk/319cnDifference/CvGameCoreDLL
/trunk/319cnDifference/CvGameCoreDLL/CvDLLInterfaceIFaceBase.h
/trunk/319cnDifference/CvGameCoreDLL/CvDefines.h
/trunk/319cnDifference/CvGameCoreDLL/CvGameCoreDLL.rc
/trunk/319cnDifference/CvGameCoreDLL/CvGameCoreDLL.vcproj
/trunk/319cnDifference/CvGameCoreDLL/CvGameTextMgr.cpp
/trunk/319cnDifference/CvGameCoreDLL/CvInitCore.cpp
/trunk/319cnDifference/CvGameCoreDLL/CvString.h
/trunk/319cnDifference/CvGameCoreDLL/Makefile
/trunk/319cnDifference/Resource
/trunk/319cnDifference/Resource/Themes
/trunk/319cnDifference/Resource/Themes/Civ4
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Button.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Common.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Edit.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_HUD.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Label.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Scroll.thm
/trunk/319cnDifference/Resource/Themes/Civ4/Civ4Theme_Window.thm
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Classical Main
Menu/CIV4MainMenuBG.nif Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Classical Main
Menu/CrossroadsOfTheWorld.dds Fri May 7 07:24:35 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/ArrowLEFT.dds Fri
May 7 07:24:35 2010
@@ -0,0 +1,7 @@
+DDS |
+
DXT3 @
+2¨!ªªê~ 2È)Ä €àz ! B2·¦þ½÷% UUÕ-2#§&Þ%¯ þÿ§)U}R\ 2!¥Rü ÷g!UUÕ-2¦¦ýýÿÿÿÞ÷Ä Õ- þÿÿÿÿïÿÏßÿ ¥ @n K ' % ¾ÿ‡)TVUU1Ø!S ! üÞÈ)%UUUÿÿÙÿSÚ!cÞ÷‡) %UÿßÿÿÿÿêÿÿÿóœÀ
& : ] Ÿ ï& UWV\ +2é)z€ !
+2F ~è€ së!s " ÚÞˆ!-ÕUUß%ë8„7"#þÿ¨)Xs}U 1!¦“þ<çÈ1UUÕ
+1F¶Kî)ß <çè1UmpPrì „ ! Þÿé1-ÕUUï ì:”[!Eþÿ*:XrmU v´]“m uXƈ!õËËõ
+
+ |-[ññÿÿ ¯sÐkþÿÿÿ
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/ArrowRIGHT.dds
Fri May 7 07:24:35 2010
@@ -0,0 +1,6 @@
+DDS |
+
DXT3 @ 2#bzRí1úþÿ‡)U}
+5 $ {#ïj½÷% UUWx # È)Ä
+2È)ÿ¯¯õ!æ ´ r R¾ÿg) •UUÿïÿÿþÿüÿž÷ ¥À j#ßjÿßÿÿÞ÷ä Wx€ # Z Ï% ÷‡!UUWx b £!Õ1ù ï% UÕ•5ýÿÿÿÿÿÿ®ÿÿÓ” `ÿÿÿ 56 ¾÷‡) €XU 5 üÞÈ)XUUURýƒ¾sH2"þÿ¨)%Í}U¾77 " úæ‡!xWUU +2G!µ«
+ +2ê1 d ´k’îQý]ç :Uy
+ j ï9<çÈ1UUWpaþ£ÎµIT ÿÿ*:% yUÎ'H Þÿé1xWUUg ÕKÖ9W Xƨ)_ãã_X X |
-[ôôÿÿ ¯sÐkþÿÿÿ
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/AtmosOpacity3.dds
Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main
Menu/CIV4MainMenuBG.nif Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/CivTitle.dds Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/CivTitle2.dds Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/Clouds2.dds Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/DayNight.dds Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/SolarGlare.dds
Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/Thumbs.db Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/citylight.dds Fri
May 7 07:24:35 2010
@@ -0,0 +1,2 @@
+DDS |
+ €
DXT1 @ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ ÿÿÿÿ
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/earth.dds Fri
May 7 07:24:35 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Art/interface/Main Menu/stars.dds Fri
May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBG.dds
Fri May 7 07:24:35 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGBeyondtheSword.dds
Fri May 7 07:24:35 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGClassical.dds
Fri May 7 07:24:35 2010
File is too large to display a diff.
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGslideshowBeyondtheSword.dds
Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Art/interface/screens/loading/LoadingScreenBGslideshowClassical.dds
Fri May 7 07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Python/CvEventManager.py Fri May 7
07:24:35 2010
@@ -0,0 +1,1175 @@
+## Sid Meier's Civilization 4
+## Copyright Firaxis Games 2006
+##
+## CvEventManager
+## This class is passed an argsList from CvAppInterface.onEvent
+## The argsList can contain anything from mouse location to key info
+## The EVENTLIST that are being notified can be found
+
+
+from CvPythonExtensions import *
+import CvUtil
+import CvScreensInterface
+import CvDebugTools
+import CvWBPopups
+import PyHelpers
+import Popup as PyPopup
+import CvCameraControls
+import CvTopCivs
+import sys
+import CvWorldBuilderScreen
+import CvAdvisorUtils
+import CvTechChooser
+
+gc = CyGlobalContext()
+localText = CyTranslator()
+PyPlayer = PyHelpers.PyPlayer
+PyInfo = PyHelpers.PyInfo
+
+
+# globals
+###################################################
+class CvEventManager:
+ def __init__(self):
+ #################### ON EVENT MAP ######################
+ #print "EVENTMANAGER INIT"
+
+ self.bCtrl = False
+ self.bShift = False
+ self.bAlt = False
+ self.bAllowCheats = False
+
+ # OnEvent Enums
+ self.EventLButtonDown=1
+ self.EventLcButtonDblClick=2
+ self.EventRButtonDown=3
+ self.EventBack=4
+ self.EventForward=5
+ self.EventKeyDown=6
+ self.EventKeyUp=7
+
+ self.__LOG_MOVEMENT = 0
+ self.__LOG_BUILDING = 0
+ self.__LOG_COMBAT = 0
+ self.__LOG_CONTACT = 0
+ self.__LOG_IMPROVEMENT =0
+ self.__LOG_CITYLOST = 0
+ self.__LOG_CITYBUILDING = 0
+ self.__LOG_TECH = 0
+ self.__LOG_UNITBUILD = 0
+ self.__LOG_UNITKILLED = 1
+ self.__LOG_UNITLOST = 0
+ self.__LOG_UNITPROMOTED = 0
+ self.__LOG_UNITSELECTED = 0
+ self.__LOG_UNITPILLAGE = 0
+ self.__LOG_GOODYRECEIVED = 0
+ self.__LOG_GREATPERSON = 0
+ self.__LOG_RELIGION = 0
+ self.__LOG_RELIGIONSPREAD = 0
+ self.__LOG_GOLDENAGE = 0
+ self.__LOG_ENDGOLDENAGE = 0
+ self.__LOG_WARPEACE = 0
+ self.__LOG_PUSH_MISSION = 0
+
+ ## EVENTLIST
+ self.EventHandlerMap = {
+ 'mouseEvent' : self.onMouseEvent,
+ 'kbdEvent' : self.onKbdEvent,
+ 'ModNetMessage' : self.onModNetMessage,
+ 'Init' : self.onInit,
+ 'Update' : self.onUpdate,
+ 'UnInit' : self.onUnInit,
+ 'OnSave' : self.onSaveGame,
+ 'OnPreSave' : self.onPreSave,
+ 'OnLoad' : self.onLoadGame,
+ 'GameStart' : self.onGameStart,
+ 'GameEnd' : self.onGameEnd,
+ 'plotRevealed' : self.onPlotRevealed,
+ 'plotFeatureRemoved' : self.onPlotFeatureRemoved,
+ 'plotPicked' : self.onPlotPicked,
+ 'nukeExplosion' : self.onNukeExplosion,
+ 'gotoPlotSet' : self.onGotoPlotSet,
+ 'BeginGameTurn' : self.onBeginGameTurn,
+ 'EndGameTurn' : self.onEndGameTurn,
+ 'BeginPlayerTurn' : self.onBeginPlayerTurn,
+ 'EndPlayerTurn' : self.onEndPlayerTurn,
+ 'endTurnReady' : self.onEndTurnReady,
+ 'combatResult' : self.onCombatResult,
+ 'combatLogCalc' : self.onCombatLogCalc,
+ 'combatLogHit' : self.onCombatLogHit,
+ 'improvementBuilt' : self.onImprovementBuilt,
+ 'improvementDestroyed' : self.onImprovementDestroyed,
+ 'routeBuilt' : self.onRouteBuilt,
+ 'firstContact' : self.onFirstContact,
+ 'cityBuilt' : self.onCityBuilt,
+ 'cityRazed' : self.onCityRazed,
+ 'cityAcquired' : self.onCityAcquired,
+ 'cityAcquiredAndKept' : self.onCityAcquiredAndKept,
+ 'cityLost' : self.onCityLost,
+ 'cultureExpansion' : self.onCultureExpansion,
+ 'cityGrowth' : self.onCityGrowth,
+ 'cityDoTurn' : self.onCityDoTurn,
+ 'cityBuildingUnit' : self.onCityBuildingUnit,
+ 'cityBuildingBuilding' : self.onCityBuildingBuilding,
+ 'cityRename' : self.onCityRename,
+ 'cityHurry' : self.onCityHurry,
+ 'selectionGroupPushMission' : self.onSelectionGroupPushMission,
+ 'unitMove' : self.onUnitMove,
+ 'unitSetXY' : self.onUnitSetXY,
+ 'unitCreated' : self.onUnitCreated,
+ 'unitBuilt' : self.onUnitBuilt,
+ 'unitKilled' : self.onUnitKilled,
+ 'unitLost' : self.onUnitLost,
+ 'unitPromoted' : self.onUnitPromoted,
+ 'unitSelected' : self.onUnitSelected,
+ 'UnitRename' : self.onUnitRename,
+ 'unitPillage' : self.onUnitPillage,
+ 'unitSpreadReligionAttempt' : self.onUnitSpreadReligionAttempt,
+ 'unitGifted' : self.onUnitGifted,
+ 'unitBuildImprovement' : self.onUnitBuildImprovement,
+ 'goodyReceived' : self.onGoodyReceived,
+ 'greatPersonBorn' : self.onGreatPersonBorn,
+ 'buildingBuilt' : self.onBuildingBuilt,
+ 'projectBuilt' : self.onProjectBuilt,
+ 'techAcquired' : self.onTechAcquired,
+ 'techSelected' : self.onTechSelected,
+ 'religionFounded' : self.onReligionFounded,
+ 'religionSpread' : self.onReligionSpread,
+ 'religionRemove' : self.onReligionRemove,
+ 'corporationFounded' : self.onCorporationFounded,
+ 'corporationSpread' : self.onCorporationSpread,
+ 'corporationRemove' : self.onCorporationRemove,
+ 'goldenAge' : self.onGoldenAge,
+ 'endGoldenAge' : self.onEndGoldenAge,
+ 'chat' : self.onChat,
+ 'victory' : self.onVictory,
+ 'vassalState' : self.onVassalState,
+ 'changeWar' : self.onChangeWar,
+ 'setPlayerAlive' : self.onSetPlayerAlive,
+ 'playerChangeStateReligion' : self.onPlayerChangeStateReligion,
+ 'playerGoldTrade' : self.onPlayerGoldTrade,
+ 'windowActivation' : self.onWindowActivation,
+ 'gameUpdate' : self.onGameUpdate, # sample generic event
+ }
+
+ ################## Events List ###############################
+ #
+ # Dictionary of Events, indexed by EventID (also used at popup context
id)
+ # entries have name, beginFunction, applyFunction [, randomization
weight...]
+ #
+ # Normal events first, random events after
+ #
+ ################## Events List ###############################
+ self.Events={
+ CvUtil.EventEditCityName : ('EditCityName',
self.__eventEditCityNameApply, self.__eventEditCityNameBegin),
+ CvUtil.EventEditCity : ('EditCity', self.__eventEditCityApply,
self.__eventEditCityBegin),
+ CvUtil.EventPlaceObject : ('PlaceObject', self.__eventPlaceObjectApply,
self.__eventPlaceObjectBegin),
+ CvUtil.EventAwardTechsAndGold: ('AwardTechsAndGold',
self.__eventAwardTechsAndGoldApply, self.__eventAwardTechsAndGoldBegin),
+ CvUtil.EventEditUnitName : ('EditUnitName',
self.__eventEditUnitNameApply, self.__eventEditUnitNameBegin),
+ CvUtil.EventWBAllPlotsPopup : ('WBAllPlotsPopup',
self.__eventWBAllPlotsPopupApply, self.__eventWBAllPlotsPopupBegin),
+ CvUtil.EventWBLandmarkPopup : ('WBLandmarkPopup',
self.__eventWBLandmarkPopupApply, self.__eventWBLandmarkPopupBegin),
+ CvUtil.EventWBScriptPopup : ('WBScriptPopup',
self.__eventWBScriptPopupApply, self.__eventWBScriptPopupBegin),
+ CvUtil.EventWBStartYearPopup : ('WBStartYearPopup',
self.__eventWBStartYearPopupApply, self.__eventWBStartYearPopupBegin),
+ CvUtil.EventShowWonder: ('ShowWonder', self.__eventShowWonderApply,
self.__eventShowWonderBegin),
+ }
+#################### EVENT STARTERS ######################
+ def handleEvent(self, argsList):
+ 'EventMgr entry point'
+ # extract the last 6 args in the list, the first arg has already been
consumed
+ self.origArgsList = argsList # point to original
+ tag = argsList[0] # event type string
+ idx = len(argsList)-6
+ bDummy = false
+ self.bDbg, bDummy, self.bAlt, self.bCtrl, self.bShift, self.bAllowCheats
= argsList[idx:]
+ ret = 0
+ if self.EventHandlerMap.has_key(tag):
+ fxn = self.EventHandlerMap[tag]
+ ret = fxn(argsList[1:idx])
+ return ret
+
+#################### EVENT APPLY ######################
+ def beginEvent( self, context, argsList=-1 ):
+ 'Begin Event'
+ entry = self.Events[context]
+ return entry[2]( argsList )
+
+ def applyEvent( self, argsList ):
+ 'Apply the effects of an event '
+ context, playerID, netUserData, popupReturn = argsList
+
+ if context == CvUtil.PopupTypeEffectViewer:
+ return CvDebugTools.g_CvDebugTools.applyEffectViewer( playerID,
netUserData, popupReturn )
+
+ entry = self.Events[context]
+
+ if ( context not in CvUtil.SilentEvents ):
+ self.reportEvent(entry, context, (playerID, netUserData, popupReturn) )
+ return entry[1]( playerID, netUserData, popupReturn ) # the apply
function
+
+ def reportEvent(self, entry, context, argsList):
+ 'Report an Event to Events.log '
+ if (gc.getGame().getActivePlayer() != -1):
+ message = "DEBUG Event: %s (%s)" %(entry[0],
gc.getActivePlayer().getName())
+ CyInterface().addImmediateMessage(message,"")
+ CvUtil.pyPrint(message)
+ return 0
+
+#################### ON EVENTS ######################
+ def onKbdEvent(self, argsList):
+ 'keypress handler - return 1 if the event was consumed'
+
+ eventType,key,mx,my,px,py = argsList
+ game = gc.getGame()
+
+ if (self.bAllowCheats):
+ # notify debug tools of input to allow it to override the control
+ argsList =
(eventType,key,self.bCtrl,self.bShift,self.bAlt,mx,my,px,py,gc.getGame().isNetworkMultiPlayer())
+ if ( CvDebugTools.g_CvDebugTools.notifyInput(argsList) ):
+ return 0
+
+ if ( eventType == self.EventKeyDown ):
+ theKey=int(key)
+
+ CvCameraControls.g_CameraControls.handleInput( theKey )
+
+ if (self.bAllowCheats):
+ # Shift - T (Debug - No MP)
+ if (theKey == int(InputTypes.KB_T)):
+ if ( self.bShift ):
+ self.beginEvent(CvUtil.EventAwardTechsAndGold)
+ #self.beginEvent(CvUtil.EventCameraControlPopup)
+ return 1
+
+ elif (theKey == int(InputTypes.KB_W)):
+ if ( self.bShift and self.bCtrl):
+ self.beginEvent(CvUtil.EventShowWonder)
+ return 1
+
+ # Shift - ] (Debug - currently mouse-overd unit, health += 10
+ elif (theKey == int(InputTypes.KB_LBRACKET) and self.bShift ):
+ unit = CyMap().plot(px, py).getUnit(0)
+ if ( not unit.isNone() ):
+ d = min( unit.maxHitPoints()-1, unit.getDamage() + 10 )
+ unit.setDamage( d, PlayerTypes.NO_PLAYER )
+
+ # Shift - [ (Debug - currently mouse-overd unit, health -= 10
+ elif (theKey == int(InputTypes.KB_RBRACKET) and self.bShift ):
+ unit = CyMap().plot(px, py).getUnit(0)
+ if ( not unit.isNone() ):
+ d = max( 0, unit.getDamage() - 10 )
+ unit.setDamage( d, PlayerTypes.NO_PLAYER )
+
+ elif (theKey == int(InputTypes.KB_F1)):
+ if ( self.bShift ):
+ CvScreensInterface.replayScreen.showScreen(False)
+ return 1
+ # don't return 1 unless you want the input consumed
+
+ elif (theKey == int(InputTypes.KB_F2)):
+ if ( self.bShift ):
+ import CvDebugInfoScreen
+ CvScreensInterface.showDebugInfoScreen()
+ return 1
+
+ elif (theKey == int(InputTypes.KB_F3)):
+ if ( self.bShift ):
+ CvScreensInterface.showDanQuayleScreen(())
+ return 1
+
+ elif (theKey == int(InputTypes.KB_F4)):
+ if ( self.bShift ):
+ CvScreensInterface.showUnVictoryScreen(())
+ return 1
+
+ return 0
+
+ def onModNetMessage(self, argsList):
+ 'Called whenever CyMessageControl().sendModNetMessage() is called - this
is all for you modders!'
+
+ iData1, iData2, iData3, iData4, iData5 = argsList
+
+ print("Modder's net message!")
+
+ CvUtil.pyPrint( 'onModNetMessage' )
+
+ def onInit(self, argsList):
+ 'Called when Civ starts up'
+ CvUtil.pyPrint( 'OnInit' )
+
+ def onUpdate(self, argsList):
+ 'Called every frame'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ fDeltaTime = argsList[0]
+
+ # allow camera to be updated
+ CvCameraControls.g_CameraControls.onUpdate( fDeltaTime )
+
+ def onWindowActivation(self, argsList):
+ 'Called when the game window activates or deactivates'
+ bActive = argsList[0]
+
+ def onUnInit(self, argsList):
+ 'Called when Civ shuts down'
+ CvUtil.pyPrint('OnUnInit')
+
+ def onPreSave(self, argsList):
+ "called before a game is actually saved"
+ CvUtil.pyPrint('OnPreSave')
+
+ def onSaveGame(self, argsList):
+ "return the string to be saved - Must be a string"
+ return ""
+
+ def onLoadGame(self, argsList):
+ CvAdvisorUtils.resetNoLiberateCities()
+ return 0
+
+ def onGameStart(self, argsList):
+ 'Called at the start of the game'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and
not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START)):
+ for iPlayer in range(gc.getMAX_PLAYERS()):
+ player = gc.getPlayer(iPlayer)
+ if (player.isAlive() and player.isHuman()):
+ popupInfo = CyPopupInfo()
+
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
+ popupInfo.setText(u"showDawnOfMan")
+ popupInfo.addPopup(iPlayer)
+ else:
+ CyInterface().setSoundSelectionReady(true)
+
+ if gc.getGame().isPbem():
+ for iPlayer in range(gc.getMAX_PLAYERS()):
+ player = gc.getPlayer(iPlayer)
+ if (player.isAlive() and player.isHuman()):
+ popupInfo = CyPopupInfo()
+ popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_DETAILS)
+ popupInfo.setOption1(true)
+ popupInfo.addPopup(iPlayer)
+
+ CvAdvisorUtils.resetNoLiberateCities()
+
+ def onGameEnd(self, argsList):
+ 'Called at the End of the game'
+ print("Game is ending")
+ return
+
+ def onBeginGameTurn(self, argsList):
+ 'Called at the beginning of the end of each turn'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iGameTurn = argsList[0]
+ CvTopCivs.CvTopCivs().turnChecker(iGameTurn)
+
+ def onEndGameTurn(self, argsList):
+ 'Called at the end of the end of each turn'
+ iGameTurn = argsList[0]
+
+ def onBeginPlayerTurn(self, argsList):
+ 'Called at the beginning of a players turn'
+ iGameTurn, iPlayer = argsList
+
+ def onEndPlayerTurn(self, argsList):
+ 'Called at the end of a players turn'
+ iGameTurn, iPlayer = argsList
+
+ if (gc.getGame().getElapsedGameTurns() == 1):
+ if (gc.getPlayer(iPlayer).isHuman()):
+ if (gc.getPlayer(iPlayer).canRevolution(0)):
+ popupInfo = CyPopupInfo()
+ popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_CHANGECIVIC)
+ popupInfo.addPopup(iPlayer)
+
+ CvAdvisorUtils.resetAdvisorNags()
+ CvAdvisorUtils.endTurnFeats(iPlayer)
+
+ def onEndTurnReady(self, argsList):
+ iGameTurn = argsList[0]
+
+ def onFirstContact(self, argsList):
+ 'Contact'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iTeamX,iHasMetTeamY = argsList
+ if (not self.__LOG_CONTACT):
+ return
+ CvUtil.pyPrint('Team %d has met Team %d' %(iTeamX, iHasMetTeamY))
+
+ def onCombatResult(self, argsList):
+ 'Combat Result'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pWinner,pLoser = argsList
+ playerX = PyPlayer(pWinner.getOwner())
+ unitX = PyInfo.UnitInfo(pWinner.getUnitType())
+ playerY = PyPlayer(pLoser.getOwner())
+ unitY = PyInfo.UnitInfo(pLoser.getUnitType())
+ if (not self.__LOG_COMBAT):
+ return
+ if playerX and playerX and unitX and playerY:
+ CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated
Player %d Civilization %s Unit %s'
+ %(playerX.getID(), playerX.getCivilizationName(),
unitX.getDescription(),
+ playerY.getID(), playerY.getCivilizationName(),
unitY.getDescription()))
+
+ def onCombatLogCalc(self, argsList):
+ 'Combat Result'
+ genericArgs = argsList[0][0]
+ cdAttacker = genericArgs[0]
+ cdDefender = genericArgs[1]
+ iCombatOdds = genericArgs[2]
+ CvUtil.combatMessageBuilder(cdAttacker, cdDefender, iCombatOdds)
+
+ def onCombatLogHit(self, argsList):
+ 'Combat Message'
+ global gCombatMessages, gCombatLog
+ genericArgs = argsList[0][0]
+ cdAttacker = genericArgs[0]
+ cdDefender = genericArgs[1]
+ iIsAttacker = genericArgs[2]
+ iDamage = genericArgs[3]
+
+ if cdDefender.eOwner == cdDefender.eVisualOwner:
+ szDefenderName = gc.getPlayer(cdDefender.eOwner).getNameKey()
+ else:
+ szDefenderName = localText.getText("TXT_KEY_TRAIT_PLAYER_UNKNOWN", ())
+ if cdAttacker.eOwner == cdAttacker.eVisualOwner:
+ szAttackerName = gc.getPlayer(cdAttacker.eOwner).getNameKey()
+ else:
+ szAttackerName = localText.getText("TXT_KEY_TRAIT_PLAYER_UNKNOWN", ())
+
+ if (iIsAttacker == 0):
+ combatMessage = localText.getText("TXT_KEY_COMBAT_MESSAGE_HIT",
(szDefenderName, cdDefender.sUnitName, iDamage, cdDefender.iCurrHitPoints,
cdDefender.iMaxHitPoints))
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+ if (cdDefender.iCurrHitPoints <= 0):
+ combatMessage = localText.getText("TXT_KEY_COMBAT_MESSAGE_DEFEATED",
(szAttackerName, cdAttacker.sUnitName, szDefenderName,
cdDefender.sUnitName))
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+ elif (iIsAttacker == 1):
+ combatMessage = localText.getText("TXT_KEY_COMBAT_MESSAGE_HIT",
(szAttackerName, cdAttacker.sUnitName, iDamage, cdAttacker.iCurrHitPoints,
cdAttacker.iMaxHitPoints))
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+ if (cdAttacker.iCurrHitPoints <= 0):
+ combatMessage = localText.getText("TXT_KEY_COMBAT_MESSAGE_DEFEATED",
(szDefenderName, cdDefender.sUnitName, szAttackerName,
cdAttacker.sUnitName))
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+
+ def onImprovementBuilt(self, argsList):
+ 'Improvement Built'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iImprovement, iX, iY = argsList
+ if (not self.__LOG_IMPROVEMENT):
+ return
+ CvUtil.pyPrint('Improvement %s was built at %d, %d'
+ %(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))
+
+ def onImprovementDestroyed(self, argsList):
+ 'Improvement Destroyed'
+ iImprovement, iOwner, iX, iY = argsList
+ if (not self.__LOG_IMPROVEMENT):
+ return
+ CvUtil.pyPrint('Improvement %s was Destroyed at %d, %d'
+ %(PyInfo.ImprovementInfo(iImprovement).getDescription(), iX, iY))
+
+ def onRouteBuilt(self, argsList):
+ 'Route Built'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iRoute, iX, iY = argsList
+ if (not self.__LOG_IMPROVEMENT):
+ return
+ CvUtil.pyPrint('Route %s was built at %d, %d'
+ %(gc.getRouteInfo(iRoute).getDescription(), iX, iY))
+
+ def onPlotRevealed(self, argsList):
+ 'Plot Revealed'
+ pPlot = argsList[0]
+ iTeam = argsList[1]
+
+ def onPlotFeatureRemoved(self, argsList):
+ 'Plot Revealed'
+ pPlot = argsList[0]
+ iFeatureType = argsList[1]
+ pCity = argsList[2] # This can be null
+
+ def onPlotPicked(self, argsList):
+ 'Plot Picked'
+ pPlot = argsList[0]
+ CvUtil.pyPrint('Plot was picked at %d, %d'
+ %(pPlot.getX(), pPlot.getY()))
+
+ def onNukeExplosion(self, argsList):
+ 'Nuke Explosion'
+ pPlot, pNukeUnit = argsList
+ CvUtil.pyPrint('Nuke detonated at %d, %d'
+ %(pPlot.getX(), pPlot.getY()))
+
+ def onGotoPlotSet(self, argsList):
+ 'Nuke Explosion'
+ pPlot, iPlayer = argsList
+
+ def onBuildingBuilt(self, argsList):
+ 'Building Completed'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pCity, iBuildingType = argsList
+ game = gc.getGame()
+ if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() ==
gc.getGame().getActivePlayer()) and
isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType())):
+ # If this is a wonder...
+ popupInfo = CyPopupInfo()
+ popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
+ popupInfo.setData1(iBuildingType)
+ popupInfo.setData2(pCity.getID())
+ popupInfo.setData3(0)
+ popupInfo.setText(u"showWonderMovie")
+ popupInfo.addPopup(pCity.getOwner())
+
+ CvAdvisorUtils.buildingBuiltFeats(pCity, iBuildingType)
+
+ if (not self.__LOG_BUILDING):
+ return
+ CvUtil.pyPrint('%s was finished by Player %d Civilization %s'
+ %(PyInfo.BuildingInfo(iBuildingType).getDescription(),
pCity.getOwner(),
gc.getPlayer(pCity.getOwner()).getCivilizationDescription(0)))
+
+ def onProjectBuilt(self, argsList):
+ 'Project Completed'
+ pCity, iProjectType = argsList
+ game = gc.getGame()
+ if ((not gc.getGame().isNetworkMultiPlayer()) and (pCity.getOwner() ==
gc.getGame().getActivePlayer())):
+ popupInfo = CyPopupInfo()
+ popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
+ popupInfo.setData1(iProjectType)
+ popupInfo.setData2(pCity.getID())
+ popupInfo.setData3(2)
+ popupInfo.setText(u"showWonderMovie")
+ popupInfo.addPopup(pCity.getOwner())
+
+ def onSelectionGroupPushMission(self, argsList):
+ 'selection group mission'
+ eOwner = argsList[0]
+ eMission = argsList[1]
+ iNumUnits = argsList[2]
+ listUnitIds = argsList[3]
+
+ if (not self.__LOG_PUSH_MISSION):
+ return
+ if pHeadUnit:
+ CvUtil.pyPrint("Selection Group pushed mission %d" %(eMission))
+
+ def onUnitMove(self, argsList):
+ 'unit move'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pPlot,pUnit,pOldPlot = argsList
+ player = PyPlayer(pUnit.getOwner())
+ unitInfo = PyInfo.UnitInfo(pUnit.getUnitType())
+ if (not self.__LOG_MOVEMENT):
+ return
+ if player and unitInfo:
+ CvUtil.pyPrint('Player %d Civilization %s unit %s is moving to %d, %d'
+ %(player.getID(), player.getCivilizationName(),
unitInfo.getDescription(),
+ pUnit.getX(), pUnit.getY()))
+
+ def onUnitSetXY(self, argsList):
+ 'units xy coords set manually'
+ pPlot,pUnit = argsList
+ player = PyPlayer(pUnit.getOwner())
+ unitInfo = PyInfo.UnitInfo(pUnit.getUnitType())
+ if (not self.__LOG_MOVEMENT):
+ return
+
+ def onUnitCreated(self, argsList):
+ 'Unit Completed'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ unit = argsList[0]
+ player = PyPlayer(unit.getOwner())
+ if (not self.__LOG_UNITBUILD):
+ return
+
+ def onUnitBuilt(self, argsList):
+ 'Unit Completed'
+ city = argsList[0]
+ unit = argsList[1]
+ player = PyPlayer(city.getOwner())
+
+ CvAdvisorUtils.unitBuiltFeats(city, unit)
+
+ if (not self.__LOG_UNITBUILD):
+ return
+ CvUtil.pyPrint('%s was finished by Player %d Civilization %s'
+ %(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(),
player.getCivilizationName()))
+
+ def onUnitKilled(self, argsList):
+ 'Unit Killed'
+ unit, iAttacker = argsList
+ player = PyPlayer(unit.getOwner())
+ attacker = PyPlayer(iAttacker)
+ if (not self.__LOG_UNITKILLED):
+ return
+ CvUtil.pyPrint('Player %d Civilization %s Unit %s was killed by
Player %d'
+ %(player.getID(), player.getCivilizationName(),
PyInfo.UnitInfo(unit.getUnitType()).getDescription(), attacker.getID()))
+
+ def onUnitLost(self, argsList):
+ 'Unit Lost'
+ unit = argsList[0]
+ player = PyPlayer(unit.getOwner())
+ if (not self.__LOG_UNITLOST):
+ return
+ CvUtil.pyPrint('%s was lost by Player %d Civilization %s'
+ %(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(),
player.getCivilizationName()))
+
+ def onUnitPromoted(self, argsList):
+ 'Unit Promoted'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pUnit, iPromotion = argsList
+ player = PyPlayer(pUnit.getOwner())
+ if (not self.__LOG_UNITPROMOTED):
+ return
+ CvUtil.pyPrint('Unit Promotion Event: %s
- %s' %(player.getCivilizationName(), pUnit.getName(),))
+
+ def onUnitSelected(self, argsList):
+ 'Unit Selected'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ unit = argsList[0]
+ player = PyPlayer(unit.getOwner())
+ if (not self.__LOG_UNITSELECTED):
+ return
+ CvUtil.pyPrint('%s was selected by Player %d Civilization %s'
+ %(PyInfo.UnitInfo(unit.getUnitType()).getDescription(), player.getID(),
player.getCivilizationName()))
+
+ def onUnitRename(self, argsList):
+ 'Unit is renamed'
+ pUnit = argsList[0]
+ if (pUnit.getOwner() == gc.getGame().getActivePlayer()):
+ self.__eventEditUnitNameBegin(pUnit)
+
+ def onUnitPillage(self, argsList):
+ 'Unit pillages a plot'
+ pUnit, iImprovement, iRoute, iOwner = argsList
+ iPlotX = pUnit.getX()
+ iPlotY = pUnit.getY()
+ pPlot = CyMap().plot(iPlotX, iPlotY)
+
+ if (not self.__LOG_UNITPILLAGE):
+ return
+ CvUtil.pyPrint("Player %d's %s pillaged improvement %d and route %d at
plot at (%d, %d)"
+ %(iOwner, PyInfo.UnitInfo(pUnit.getUnitType()).getDescription(),
iImprovement, iRoute, iPlotX, iPlotY))
+
+ def onUnitSpreadReligionAttempt(self, argsList):
+ 'Unit tries to spread religion to a city'
+ pUnit, iReligion, bSuccess = argsList
+
+ iX = pUnit.getX()
+ iY = pUnit.getY()
+ pPlot = CyMap().plot(iX, iY)
+ pCity = pPlot.getPlotCity()
+
+ def onUnitGifted(self, argsList):
+ 'Unit is gifted from one player to another'
+ pUnit, iGiftingPlayer, pPlotLocation = argsList
+
+ def onUnitBuildImprovement(self, argsList):
+ 'Unit begins enacting a Build (building an Improvement or Route)'
+ pUnit, iBuild, bFinished = argsList
+
+ def onGoodyReceived(self, argsList):
+ 'Goody received'
+ iPlayer, pPlot, pUnit, iGoodyType = argsList
+ if (not self.__LOG_GOODYRECEIVED):
+ return
+ CvUtil.pyPrint('%s received a
goody' %(gc.getPlayer(iPlayer).getCivilizationDescription(0)),)
+
+ def onGreatPersonBorn(self, argsList):
+ 'Unit Promoted'
+ pUnit, iPlayer, pCity = argsList
+ player = PyPlayer(iPlayer)
+ if pUnit.isNone() or pCity.isNone():
+ return
+ if (not self.__LOG_GREATPERSON):
+ return
+ CvUtil.pyPrint('A %s was born for %s in %s' %(pUnit.getName(),
player.getCivilizationName(), pCity.getName()))
+
+ def onTechAcquired(self, argsList):
+ 'Tech Acquired'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iTechType, iTeam, iPlayer, bAnnounce = argsList
+ # Note that iPlayer may be NULL (-1) and not a refer to a player object
+
+ # Show tech splash when applicable
+ if (iPlayer > -1 and bAnnounce and not CyInterface().noTechSplash()):
+ if (gc.getGame().isFinalInitialized() and not
gc.getGame().GetWorldBuilderMode()):
+ if ((not gc.getGame().isNetworkMultiPlayer()) and (iPlayer ==
gc.getGame().getActivePlayer())):
+ popupInfo = CyPopupInfo()
+
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
+ popupInfo.setData1(iTechType)
+ popupInfo.setText(u"showTechSplash")
+ popupInfo.addPopup(iPlayer)
+
+ if (not self.__LOG_TECH):
+ return
+ CvUtil.pyPrint('%s was finished by Team %d'
+ %(PyInfo.TechnologyInfo(iTechType).getDescription(), iTeam))
+
+ def onTechSelected(self, argsList):
+ 'Tech Selected'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iTechType, iPlayer = argsList
+ if (not self.__LOG_TECH):
+ return
+ CvUtil.pyPrint('%s was selected by
Player %d' %(PyInfo.TechnologyInfo(iTechType).getDescription(), iPlayer))
+
+ def onReligionFounded(self, argsList):
+ 'Religion Founded'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ iReligion, iFounder = argsList
+ player = PyPlayer(iFounder)
+
+ iCityId = gc.getGame().getHolyCity(iReligion).getID()
+ if (gc.getGame().isFinalInitialized() and not
gc.getGame().GetWorldBuilderMode()):
+ if ((not gc.getGame().isNetworkMultiPlayer()) and (iFounder ==
gc.getGame().getActivePlayer())):
+ popupInfo = CyPopupInfo()
+
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
+ popupInfo.setData1(iReligion)
+ popupInfo.setData2(iCityId)
+ popupInfo.setData3(1)
+ popupInfo.setText(u"showWonderMovie")
+ popupInfo.addPopup(iFounder)
+
+ if (not self.__LOG_RELIGION):
+ return
+ CvUtil.pyPrint('Player %d Civilization %s has founded %s'
+ %(iFounder, player.getCivilizationName(),
gc.getReligionInfo(iReligion).getDescription()))
+
+ def onReligionSpread(self, argsList):
+ 'Religion Has Spread to a City'
+ iReligion, iOwner, pSpreadCity = argsList
+ player = PyPlayer(iOwner)
+ if (not self.__LOG_RELIGIONSPREAD):
+ return
+ CvUtil.pyPrint('%s has spread to Player %d Civilization %s city of %s'
+ %(gc.getReligionInfo(iReligion).getDescription(), iOwner,
player.getCivilizationName(), pSpreadCity.getName()))
+
+ def onReligionRemove(self, argsList):
+ 'Religion Has been removed from a City'
+ iReligion, iOwner, pRemoveCity = argsList
+ player = PyPlayer(iOwner)
+ if (not self.__LOG_RELIGIONSPREAD):
+ return
+ CvUtil.pyPrint('%s has been removed from Player %d Civilization %s city
of %s'
+ %(gc.getReligionInfo(iReligion).getDescription(), iOwner,
player.getCivilizationName(), pRemoveCity.getName()))
+
+ def onCorporationFounded(self, argsList):
+ 'Corporation Founded'
+ iCorporation, iFounder = argsList
+ player = PyPlayer(iFounder)
+
+ if (not self.__LOG_RELIGION):
+ return
+ CvUtil.pyPrint('Player %d Civilization %s has founded %s'
+ %(iFounder, player.getCivilizationName(),
gc.getCorporationInfo(iCorporation).getDescription()))
+
+ def onCorporationSpread(self, argsList):
+ 'Corporation Has Spread to a City'
+ iCorporation, iOwner, pSpreadCity = argsList
+ player = PyPlayer(iOwner)
+ if (not self.__LOG_RELIGIONSPREAD):
+ return
+ CvUtil.pyPrint('%s has spread to Player %d Civilization %s city of %s'
+ %(gc.getCorporationInfo(iCorporation).getDescription(), iOwner,
player.getCivilizationName(), pSpreadCity.getName()))
+
+ def onCorporationRemove(self, argsList):
+ 'Corporation Has been removed from a City'
+ iCorporation, iOwner, pRemoveCity = argsList
+ player = PyPlayer(iOwner)
+ if (not self.__LOG_RELIGIONSPREAD):
+ return
+ CvUtil.pyPrint('%s has been removed from Player %d Civilization %s city
of %s'
+ %(gc.getReligionInfo(iReligion).getDescription(), iOwner,
player.getCivilizationName(), pRemoveCity.getName()))
+
+ def onGoldenAge(self, argsList):
+ 'Golden Age'
+ iPlayer = argsList[0]
+ player = PyPlayer(iPlayer)
+ if (not self.__LOG_GOLDENAGE):
+ return
+ CvUtil.pyPrint('Player %d Civilization %s has begun a golden age'
+ %(iPlayer, player.getCivilizationName()))
+
+ def onEndGoldenAge(self, argsList):
+ 'End Golden Age'
+ iPlayer = argsList[0]
+ player = PyPlayer(iPlayer)
+ if (not self.__LOG_ENDGOLDENAGE):
+ return
+ CvUtil.pyPrint('Player %d Civilization %s golden age has ended'
+ %(iPlayer, player.getCivilizationName()))
+
+ def onChangeWar(self, argsList):
+ 'War Status Changes'
+ bIsWar = argsList[0]
+ iTeam = argsList[1]
+ iRivalTeam = argsList[2]
+ if (not self.__LOG_WARPEACE):
+ return
+ if (bIsWar):
+ strStatus = "declared war"
+ else:
+ strStatus = "declared peace"
+ CvUtil.pyPrint('Team %d has %s on Team %d'
+ %(iTeam, strStatus, iRivalTeam))
+
+ def onChat(self, argsList):
+ 'Chat Message Event'
+ chatMessage = "%s" %(argsList[0],)
+
+ def onSetPlayerAlive(self, argsList):
+ 'Set Player Alive Event'
+ iPlayerID = argsList[0]
+ bNewValue = argsList[1]
+ CvUtil.pyPrint("Player %d's alive status set to: %d" %(iPlayerID,
int(bNewValue)))
+
+ def onPlayerChangeStateReligion(self, argsList):
+ 'Player changes his state religion'
+ iPlayer, iNewReligion, iOldReligion = argsList
+
+ def onPlayerGoldTrade(self, argsList):
+ 'Player Trades gold to another player'
+ iFromPlayer, iToPlayer, iGoldAmount = argsList
+
+ def onCityBuilt(self, argsList):
+ 'City Built'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ city = argsList[0]
+ if (city.getOwner() == gc.getGame().getActivePlayer()):
+ self.__eventEditCityNameBegin(city, False)
+ CvUtil.pyPrint('City Built Event: %s' %(city.getName()))
+
+ def onCityRazed(self, argsList):
+ 'City Razed'
+ city, iPlayer = argsList
+ iOwner = city.findHighestCulture()
+
+ # Partisans!
+ # if city.getPopulation > 1 and iOwner != -1 and iPlayer != -1:
+ # owner = gc.getPlayer(iOwner)
+ # if not owner.isBarbarian() and owner.getNumCities() > 0:
+ # if
gc.getTeam(owner.getTeam()).isAtWar(gc.getPlayer(iPlayer).getTeam()):
+ # if gc.getNumEventTriggerInfos() > 0: # prevents mods that don't
have events from getting an error
+ # iEvent = CvUtil.findInfoTypeNum(gc.getEventTriggerInfo,
gc.getNumEventTriggerInfos(),'EVENTTRIGGER_PARTISANS')
+ # if iEvent != -1 and gc.getGame().isEventActive(iEvent) and
owner.getEventTriggerWeight(iEvent) < 0:
+ # triggerData = owner.initTriggeredData(iEvent, true, -1,
city.getX(), city.getY(), iPlayer, city.getID(), -1, -1, -1, -1)
+
+ CvUtil.pyPrint("City Razed Event: %s" %(city.getName(),))
+
+ def onCityAcquired(self, argsList):
+ 'City Acquired'
+ iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
+ CvUtil.pyPrint('City Acquired Event: %s' %(pCity.getName()))
+
+ def onCityAcquiredAndKept(self, argsList):
+ 'City Acquired and Kept'
+ iOwner,pCity = argsList
+ CvUtil.pyPrint('City Acquired and Kept Event: %s' %(pCity.getName()))
+
+ def onCityLost(self, argsList):
+ 'City Lost'
+ city = argsList[0]
+ player = PyPlayer(city.getOwner())
+ if (not self.__LOG_CITYLOST):
+ return
+ CvUtil.pyPrint('City %s was lost by Player %d Civilization %s'
+ %(city.getName(), player.getID(), player.getCivilizationName()))
+
+ def onCultureExpansion(self, argsList):
+ 'City Culture Expansion'
+ pCity = argsList[0]
+ iPlayer = argsList[1]
+ CvUtil.pyPrint("City %s's culture has expanded" %(pCity.getName(),))
+
+ def onCityGrowth(self, argsList):
+ 'City Population Growth'
+ pCity = argsList[0]
+ iPlayer = argsList[1]
+ CvUtil.pyPrint("%s has grown" %(pCity.getName(),))
+
+ def onCityDoTurn(self, argsList):
+ 'City Production'
+ pCity = argsList[0]
+ iPlayer = argsList[1]
+
+ CvAdvisorUtils.cityAdvise(pCity, iPlayer)
+
+ def onCityBuildingUnit(self, argsList):
+ 'City begins building a unit'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pCity = argsList[0]
+ iUnitType = argsList[1]
+ if (not self.__LOG_CITYBUILDING):
+ return
+ CvUtil.pyPrint("%s has begun building
a %s" %(pCity.getName(),gc.getUnitInfo(iUnitType).getDescription()))
+
+ def onCityBuildingBuilding(self, argsList):
+ 'City begins building a Building'
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ if (gc.getGame().getTutorialID() != -1):
+ return 0
+ #### Sanguo Mod Tutorial, end
+
+ pCity = argsList[0]
+ iBuildingType = argsList[1]
+ if (not self.__LOG_CITYBUILDING):
+ return
+ CvUtil.pyPrint("%s has begun building
a %s" %(pCity.getName(),gc.getBuildingInfo(iBuildingType).getDescription()))
+
+ def onCityRename(self, argsList):
+ 'City is renamed'
+ pCity = argsList[0]
+ if (pCity.getOwner() == gc.getGame().getActivePlayer()):
+ self.__eventEditCityNameBegin(pCity, True)
+
+ def onCityHurry(self, argsList):
+ 'City is renamed'
+ pCity = argsList[0]
+ iHurryType = argsList[1]
+
+ def onVictory(self, argsList):
+ 'Victory'
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Python/CvUtil.py Fri May 7 07:24:35 2010
@@ -0,0 +1,485 @@
+## Sid Meier's Civilization 4
+## Copyright Firaxis Games 2005
+#
+# for error reporting
+import traceback
+
+# for file ops
+import os
+import sys
+
+# For Civ game code access
+from CvPythonExtensions import *
+
+# For exception handling
+SHOWEXCEPTIONS = 1
+
+# for C++ compatibility
+false=False
+true=True
+
+# globals
+gc = CyGlobalContext()
+FontIconMap = {}
+localText = CyTranslator()
+
+#
+# Popup context enums, values greater than 999 are reserved for events
+#
+
+# DEBUG TOOLS
+PopupTypeEntityEventTest = 4
+PopupTypeEffectViewer = 5
+
+# HELP SCREENS
+PopupTypeMilitaryAdvisor = 103
+PopupTypePlayerSelect = 104
+
+# WORLD BUILDER
+PopupTypeWBContextStart = 200
+PopupTypeWBEditCity = PopupTypeWBContextStart
+PopupTypeWBEditUnit = 201
+PopupTypeWBContextEnd = 299
+
+# EVENT ID VALUES (also used in popup contexts)
+EventGetEspionageTarget = 4999
+EventEditCityName = 5000
+EventEditCity = 5001
+EventPlaceObject = 5002
+EventAwardTechsAndGold = 5003
+EventEditUnitName = 5006
+EventCityWarning = 5007
+EventWBAllPlotsPopup = 5008
+EventWBLandmarkPopup = 5009
+EventWBScriptPopup = 5010
+EventWBStartYearPopup = 5011
+EventShowWonder = 5012
+
+EventLButtonDown=1
+EventLcButtonDblClick=2
+EventRButtonDown=3
+EventBack=4
+EventForward=5
+EventKeyDown=6
+EventKeyUp=7
+
+# List of unreported Events
+SilentEvents = [EventEditCityName, EventEditUnitName]
+
+# BUG - Core - start
+
+# Event IDs
+BUG_FIRST_EVENT = 5050
+g_nextEventID = BUG_FIRST_EVENT
+g_bugEvents = {}
+def getNewEventID(name=None, silent=True):
+ """
+ Defines a new event and returns its unique ID to be passed to
BugEventManager.beginEvent(id).
+ If name is given, it is stored in a map for lookup by ID later for
debugging.
+ """
+ global g_nextEventID
+ id = g_nextEventID
+ g_nextEventID += 1
+ if name:
+ g_bugEvents[id] = name
+ if silent:
+ addSilentEvent(id)
+ return id
+
+def getEventName(id):
+ return g_bugEvents[id]
+
+def addSilentEvent(id):
+ if id not in SilentEvents:
+ SilentEvents.append(id)
+
+# Screen IDs
+BUG_FIRST_SCREEN = 1000
+g_nextScreenID = BUG_FIRST_SCREEN
+def getNewScreenID():
+ """
+ Returns the next unique screen ID to be used with CyGInterfaceScreen.
+ """
+ global g_nextScreenID
+ id = g_nextScreenID
+ g_nextScreenID += 1
+ return id
+# BUG - Core - end
+
+# Popup defines (TODO: Expose these from C++)
+FONT_CENTER_JUSTIFY=1<<2
+FONT_RIGHT_JUSTIFY=1<<1
+FONT_LEFT_JUSTIFY=1<<0
+
+def convertToUnicode(s):
+ "if the string is non unicode, convert it to unicode by decoding it using
8859-1, latin_1"
+ if (isinstance(s, str)):
+# >>> CYBERFRONT // character code: codepage
+# return s.decode("latin_1")
+ return s.decode("utf-8","ignore")
+# <<< CYBERFRONT
+ return s
+
+def convertToStr(s):
+ "if the string is unicode, convert it to str by encoding it using 8859-1,
latin_1"
+ #### Sanguo Mod codec, start, added by poyuzhe 08.28.09
+ if CyGame().getCurrentLanguage() == 5:
+ return s
+ #### Sanguo Mod codec, end
+ if (isinstance(s, unicode)):
+# >>> CYBERFRONT // character code: codepage
+# return s.encode("latin_1")
+ return s.encode("utf-8","ignore")
+# <<< CYBERFRONT
+ return s
+
+class RedirectDebug:
+ """Send Debug Messages to Civ Engine"""
+ def __init__(self):
+ self.m_PythonMgr = CyPythonMgr()
+ def write(self, stuff):
+ # if str is non unicode and contains encoded unicode data, supply the
right encoder to encode it into a unicode object
+ if (isinstance(stuff, unicode)):
+ self.m_PythonMgr.debugMsgWide(stuff)
+ else:
+ self.m_PythonMgr.debugMsg(stuff)
+
+class RedirectError:
+ """Send Error Messages to Civ Engine"""
+ def __init__(self):
+ self.m_PythonMgr = CyPythonMgr()
+ def write(self, stuff):
+ # if str is non unicode and contains encoded unicode data, supply the
right encoder to encode it into a unicode object
+ if (isinstance(stuff, unicode)):
+ self.m_PythonMgr.errorMsgWide(stuff)
+ else:
+ self.m_PythonMgr.errorMsg(stuff)
+
+def myExceptHook(type, value, tb):
+ lines=traceback.format_exception(type, value, tb)
+ #pre= "---------------------Traceback lines-----------------------\n"
+ mid="\n".join(lines)
+ #post="-----------------------------------------------------------"
+ #total = pre+mid+post
+ total=mid
+ if SHOWEXCEPTIONS:
+ sys.stderr.write(total)
+ else:
+ sys.stdout.write(total)
+
+def pyPrint(stuff):
+ stuff = 'PY:' + stuff + "\n"
+ sys.stdout.write(stuff)
+
+def pyAssert(cond, msg):
+ if (cond==False):
+ sys.stderr.write(msg)
+ assert(cond, msg)
+
+def getScoreComponent(iRawScore, iInitial, iMax, iFactor, bExponential,
bFinal, bVictory):
+
+ if gc.getGame().getEstimateEndTurn() == 0:
+ return 0
+
+ if bFinal and bVictory:
+ fTurnRatio = float(gc.getGame().getGameTurn()) /
float(gc.getGame().getEstimateEndTurn())
+ if bExponential and (iInitial != 0):
+ fRatio = iMax / iInitial
+ iMax = iInitial * pow(fRatio, fTurnRatio)
+ else:
+ iMax = iInitial + fTurnRatio * (iMax - iInitial)
+
+ iFree = (gc.getDefineINT("SCORE_FREE_PERCENT") * iMax) / 100
+ if (iFree + iMax) != 0:
+ iScore = (iFactor * (iRawScore + iFree)) / (iFree + iMax)
+ else:
+ iScore = iFactor
+
+ if bVictory:
+ iScore = ((100 + gc.getDefineINT("SCORE_VICTORY_PERCENT")) * iScore) /
100
+
+ if bFinal:
+ iScore = ((100 + gc.getDefineINT("SCORE_HANDICAP_PERCENT_OFFSET") +
(gc.getGame().getHandicapType() *
gc.getDefineINT("SCORE_HANDICAP_PERCENT_PER"))) * iScore) / 100
+
+ return int(iScore)
+
+def getOppositeCardinalDirection(dir):
+ return (dir + 2) % CardinalDirectionTypes.NUM_CARDINALDIRECTION_TYPES
+
+def shuffle(num, rand):
+ "returns a tuple of size num of shuffled numbers"
+ piShuffle = [0]*num
+ shuffleList(num, rand, piShuffle) # implemented in C for speed
+ return piShuffle
+
+def spawnUnit(iUnit, pPlot, pPlayer):
+ pPlayer.initUnit(iUnit, pPlot.getX(), pPlot.getY(),
UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION)
+ return 1
+
+def findInfoTypeNum(infoGetter, numInfos, typeStr):
+ if (typeStr == 'NONE'):
+ return -1
+ idx = gc.getInfoTypeForString(typeStr)
+ pyAssert(idx != -1, "Can't find type enum for type tag %s" %(typeStr,))
+ return idx
+
+def getInfo(strInfoType, strInfoName): # returns info for InfoType
+ #set Type to lowercase
+ strInfoType = strInfoType.lower()
+ strInfoName = strInfoName.capitalize()
+
+ #get the appropriate dictionary item
+ infoDict = GlobalInfosMap.get(strInfoType)
+ #get the number of infos
+ numInfos = infoDict['NUM']()
+ #loop through each info
+ for i in range(numInfos):
+ loopInfo = infoDict['GET'](i)
+
+ if loopInfo.getDescription() == strInfoName:
+ #and return the one requested
+ return loopInfo
+
+def AdjustBuilding(add, all, BuildingIdx, pCity): # adds/removes buildings
from a city
+ "Function for toggling buildings in cities"
+ if (BuildingIdx!= -1):
+ if (all): #Add/Remove ALL
+ for i in range(BuildingIdx):
+ pCity.setNumRealBuildingIdx(i,add)
+ else:
+ pCity.setNumRealBuildingIdx(BuildingIdx,add)
+ return 0
+
+def getIcon(iconEntry): # returns Font Icons
+ global FontIconMap
+
+ iconEntry = iconEntry.lower()
+ if (FontIconMap.has_key(iconEntry)):
+ return FontIconMap.get(iconEntry)
+ else:
+ return (u"%c" %(191,))
+
+def combatDetailMessageBuilder(cdUnit, ePlayer, iChange):
+ if (cdUnit.iExtraCombatPercent != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_EXTRA_COMBAT_PERCENT",(cdUnit.iExtraCombatPercent
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAnimalCombatModifierTA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_ANIMAL_COMBAT",(cdUnit.iAnimalCombatModifierTA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAIAnimalCombatModifierTA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_AI_ANIMAL_COMBAT",(cdUnit.iAIAnimalCombatModifierTA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAnimalCombatModifierAA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_ANIMAL_COMBAT",(cdUnit.iAnimalCombatModifierAA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAIAnimalCombatModifierAA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_AI_ANIMAL_COMBAT",(cdUnit.iAIAnimalCombatModifierAA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iBarbarianCombatModifierTB != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_BARBARIAN_COMBAT",(cdUnit.iBarbarianCombatModifierTB
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAIBarbarianCombatModifierTB != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_BARBARIAN_AI_COMBAT",(cdUnit.iAIBarbarianCombatModifierTB
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iBarbarianCombatModifierAB != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_BARBARIAN_COMBAT",(cdUnit.iBarbarianCombatModifierAB
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAIBarbarianCombatModifierAB != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_BARBARIAN_AI_COMBAT",(cdUnit.iAIBarbarianCombatModifierAB
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iPlotDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_PLOT_DEFENSE",(cdUnit.iPlotDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iFortifyModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_FORTIFY",(cdUnit.iFortifyModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iCityDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CITY_DEFENSE",(cdUnit.iCityDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iHillsAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_HILLS_ATTACK",(cdUnit.iHillsAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iHillsDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_HILLS",(cdUnit.iHillsDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iFeatureAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_FEATURE_ATTACK",(cdUnit.iFeatureAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iFeatureDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_FEATURE",(cdUnit.iFeatureDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iTerrainAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_TERRAIN_ATTACK",(cdUnit.iTerrainAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iTerrainDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_TERRAIN",(cdUnit.iTerrainDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iCityAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CITY_ATTACK",(cdUnit.iCityAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iDomainDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CITY_DOMAIN_DEFENSE",(cdUnit.iDomainDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iCityBarbarianDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CITY_BARBARIAN_DEFENSE",(cdUnit.iCityBarbarianDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iClassDefenseModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_DEFENSE",(cdUnit.iClassDefenseModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iClassAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_ATTACK",(cdUnit.iClassAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iCombatModifierT != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_COMBAT",(cdUnit.iCombatModifierT
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iCombatModifierA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_COMBAT",(cdUnit.iCombatModifierA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iDomainModifierA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_DOMAIN",(cdUnit.iDomainModifierA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iDomainModifierT != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_DOMAIN",(cdUnit.iDomainModifierT
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAnimalCombatModifierA != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_ANIMAL_COMBAT",(cdUnit.iAnimalCombatModifierA
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAnimalCombatModifierT != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_ANIMAL_COMBAT",(cdUnit.iAnimalCombatModifierT
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iRiverAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_RIVER_ATTACK",(cdUnit.iRiverAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+ if (cdUnit.iAmphibAttackModifier != 0):
+
msg=localText.getText("TXT_KEY_COMBAT_MESSAGE_CLASS_AMPHIB_ATTACK",(cdUnit.iAmphibAttackModifier
* iChange,))
+ CyInterface().addCombatMessage(ePlayer,msg)
+
+def combatMessageBuilder(cdAttacker, cdDefender, iCombatOdds):
+ combatMessage = ""
+ if (cdAttacker.eOwner == cdAttacker.eVisualOwner):
+# >>> CYBERFRONT // message: combat
+# combatMessage += "%s's" %(gc.getPlayer(cdAttacker.eOwner).getName(),)
+ combatMessage
+= "%s%s" %(gc.getPlayer(cdAttacker.eOwner).getName(),localText.getText("TXT_KEY_APOSTROPHE_S",
()),)
+# <<< CYBERFRONT
+ combatMessage += " %s
(%.2f)" %(cdAttacker.sUnitName,cdAttacker.iCurrCombatStr/100.0,)
+ combatMessage += " " + localText.getText("TXT_KEY_COMBAT_MESSAGE_VS", ())
+ " "
+ if (cdDefender.eOwner == cdDefender.eVisualOwner):
+# >>> CYBERFRONT // message: combat
+# combatMessage += "%s's" %(gc.getPlayer(cdDefender.eOwner).getName(),)
+ combatMessage
+= "%s%s" %(gc.getPlayer(cdDefender.eOwner).getName(),localText.getText("TXT_KEY_APOSTROPHE_S",
()),)
+# <<< CYBERFRONT
+ combatMessage += "%s
(%.2f)" %(cdDefender.sUnitName,cdDefender.iCurrCombatStr/100.0,)
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+ combatMessage
= "%s %.1f%%" %(localText.getText("TXT_KEY_COMBAT_MESSAGE_ODDS",
()),iCombatOdds/10.0,)
+ CyInterface().addCombatMessage(cdAttacker.eOwner,combatMessage)
+ CyInterface().addCombatMessage(cdDefender.eOwner,combatMessage)
+ combatDetailMessageBuilder(cdAttacker,cdAttacker.eOwner,-1)
+ combatDetailMessageBuilder(cdDefender,cdAttacker.eOwner,1)
+ combatDetailMessageBuilder(cdAttacker,cdDefender.eOwner,-1)
+ combatDetailMessageBuilder(cdDefender,cdDefender.eOwner,1)
+
+def initDynamicFontIcons():
+ global FontIconMap
+
+ info = ""
+ desc = ""
+ # add Commerce Icons
+ for i in range(CommerceTypes.NUM_COMMERCE_TYPES):
+ info = gc.getCommerceInfo(i)
+ desc = info.getDescription().lower()
+ addIconToMap(info.getChar, desc)
+ # add Yield Icons
+ for i in range(YieldTypes.NUM_YIELD_TYPES):
+ info = gc.getYieldInfo(i)
+ desc = info.getDescription().lower()
+ addIconToMap(info.getChar, desc)
+ # add Religion & Holy City Icons
+ for i in range(gc.getNumReligionInfos()):
+ info = gc.getReligionInfo(i)
+ desc = info.getDescription().lower()
+ addIconToMap(info.getChar, desc)
+ addIconToMap(info.getHolyCityChar, desc)
+ for key in OtherFontIcons.keys():
+ #print key
+ FontIconMap[key] = (u"%c" %
CyGame().getSymbolID(OtherFontIcons.get(key)))
+
+ #print FontIconMap
+
+def addIconToMap(infoChar, desc):
+ global FontIconMap
+ desc = convertToStr(desc)
+ print "%s - %s" %(infoChar(), desc)
+ uc = infoChar()
+ if (uc>=0):
+ FontIconMap[desc] = u"%c" %(uc,)
+
+OtherFontIcons = { 'happy' : FontSymbols.HAPPY_CHAR,
+ 'unhappy' : FontSymbols.UNHAPPY_CHAR,
+ 'healthy' : FontSymbols.HEALTHY_CHAR,
+ 'unhealthy' : FontSymbols.UNHEALTHY_CHAR,
+ 'bullet' : FontSymbols.BULLET_CHAR,
+ 'strength' : FontSymbols.STRENGTH_CHAR,
+ 'moves' : FontSymbols.MOVES_CHAR,
+ 'religion' : FontSymbols.RELIGION_CHAR,
+ 'star' : FontSymbols.STAR_CHAR,
+ 'silver star' : FontSymbols.SILVER_STAR_CHAR,
+ 'trade' : FontSymbols.TRADE_CHAR,
+ 'defense' : FontSymbols.DEFENSE_CHAR,
+ 'greatpeople' : FontSymbols.GREAT_PEOPLE_CHAR,
+ 'badgold' : FontSymbols.BAD_GOLD_CHAR,
+ 'badfood' : FontSymbols.BAD_FOOD_CHAR,
+ 'eatenfood' : FontSymbols.EATEN_FOOD_CHAR,
+ 'goldenage' : FontSymbols.GOLDEN_AGE_CHAR,
+ 'angrypop' : FontSymbols.ANGRY_POP_CHAR,
+ 'openBorders' : FontSymbols.OPEN_BORDERS_CHAR,
+ 'defensivePact' : FontSymbols.DEFENSIVE_PACT_CHAR,
+ 'map' : FontSymbols.MAP_CHAR,
+ 'occupation' : FontSymbols.OCCUPATION_CHAR,
+ 'power' : FontSymbols.POWER_CHAR,
+ }
+
+GlobalInfosMap = { 'bonus': {'NUM': gc.getNumBonusInfos, 'GET':
gc.getBonusInfo},
+ 'improvement': {'NUM': gc.getNumImprovementInfos, 'GET':
gc.getImprovementInfo},
+ 'yield': {'NUM': YieldTypes.NUM_YIELD_TYPES, 'GET': gc.getYieldInfo},
+ 'religion': {'NUM': gc.getNumReligionInfos, 'GET':
gc.getReligionInfo},
+ 'tech': {'NUM': gc.getNumTechInfos, 'GET': gc.getTechInfo},
+ 'unit': {'NUM': gc.getNumUnitInfos, 'GET': gc.getUnitInfo},
+ 'civic': {'NUM': gc.getNumCivicInfos, 'GET': gc.getCivicInfo},
+ 'building': {'NUM': gc.getNumBuildingInfos, 'GET':
gc.getBuildingInfo},
+ 'terrain': {'NUM': gc.getNumTerrainInfos, 'GET': gc.getTerrainInfo},
+ 'trait': {'NUM': gc.getNumTraitInfos, 'GET': gc.getTraitInfo},
+ 'feature' : {'NUM': gc.getNumFeatureInfos, 'GET': gc.getFeatureInfo},
+ 'route': {'NUM': gc.getNumRouteInfos, 'GET': gc.getRouteInfo},
+ 'promotion': {'NUM':gc.getNumPromotionInfos, 'GET':
gc.getPromotionInfo},
+ }
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Python/EntryPoints/CvAppInterface.py Fri
May 7 07:24:35 2010
@@ -0,0 +1,318 @@
+# Sid Meier's Civilization 4
+# Copyright Firaxis Games 2005
+#
+# CvAppInterface.py
+#
+# These functions are App Entry Points from C++
+# WARNING: These function names should not be changed
+# WARNING: These functions can not be placed into a class
+#
+# No other modules should import this
+#
+# DONT ADD ANY MORE IMPORTS HERE - Moose
+import sys
+import os
+import CvUtil
+#
+
+from CvPythonExtensions import *
+
+# globals
+gc = CyGlobalContext()
+
+# don't make this an event - Moose
+def init():
+ # for PythonExtensions Help File
+ PythonHelp = 0 # doesn't work on systems which haven't installed Python
+
+ # dump Civ python module directory
+ if PythonHelp:
+ import CvPythonExtensions
+ helpFile=file("CvPythonExtensions.hlp.txt", "w")
+ sys.stdout=helpFile
+ import pydoc
+ pydoc.help(CvPythonExtensions)
+ helpFile.close()
+
+ sys.stderr=CvUtil.RedirectError()
+ sys.excepthook = CvUtil.myExceptHook
+ sys.stdout=CvUtil.RedirectDebug()
+
+def onSave():
+ 'Here is your chance to save data. This function should return a string'
+ import CvWBDesc
+ import pickle
+ import CvEventInterface
+ # if the tutorial is active, it will save out the Shown Messages list
+ saveDataStr = pickle.dumps( CvEventInterface.onEvent( ('OnSave',0,0,0,0,0
) ) )
+ return saveDataStr
+
+def onLoad(argsList):
+ 'Called when a file is loaded'
+ import pickle
+ import CvEventInterface
+ loadDataStr=argsList[0]
+ if len(loadDataStr):
+ CvEventInterface.onEvent( ('OnLoad',pickle.loads(loadDataStr),0,0,0,0,0
) )
+
+def preGameStart():
+ import CvScreensInterface
+
+# BUG - core - start
+ import CvEventInterface
+ CvEventInterface.getEventManager().fireEvent("PreGameStart")
+# BUG - core - end
+
+ if not CyGame().isPitbossHost():
+ NiTextOut("Initializing font icons")
+ # Load dynamic font icons into the icon map
+ CvUtil.initDynamicFontIcons()
+
+ if not CyGame().isPitbossHost():
+ # Preload the tech chooser..., only do this release builds, in debug
build we may not be raising the tech chooser
+ if (not gc.isDebugBuild()):
+ NiTextOut("Preloading tech chooser")
+ CvScreensInterface.showTechChooser()
+ CvScreensInterface.techChooser.hideScreen()
+
+ NiTextOut("Loading main interface...")
+ CvScreensInterface.showMainInterface()
+
+def onPbemSend(argsList):
+# >>> CYBERFRONT // pbem:
+# import sys, smtplib, MimeWriter, base64, StringIO
+ import sys, smtplib
+ from email import Encoders
+ from email.Header import Header
+ from email.MIMEText import MIMEText
+ from email.MIMEMultipart import MIMEMultipart
+ from email.MIMEBase import MIMEBase
+# <<< CYBERFRONT
+
+ szToAddr = argsList[0]
+ szFromAddr = argsList[1]
+ szSubject = argsList[2]
+ szPath = argsList[3]
+ szFilename = argsList[4]
+ szHost = argsList[5]
+ szUser = argsList[6]
+ szPassword = argsList[7]
+
+ print 'sending e-mail'
+ print 'To:', szToAddr
+ print 'From:', szFromAddr
+ print 'Subject:', szSubject
+ print 'Path:', szPath
+ print 'File:', szFilename
+ print 'Server:', szHost
+ print 'User:', szUser
+
+ if len(szFromAddr) == 0 or len(szHost) == 0:
+ print 'host or address empty'
+ return 1
+
+# >>> CYBERFRONT // pbem:
+# message = StringIO.StringIO()
+# writer = MimeWriter.MimeWriter(message)
+#
+# writer.addheader('To', szToAddr)
+# writer.addheader('From', szFromAddr)
+# writer.addheader('Subject', szSubject)
+# writer.addheader('MIME-Version', '1.0')
+# writer.startmultipartbody('mixed')
+#
+# part = writer.nextpart()
+# body = part.startbody('text/plain')
+# body.write('CIV4 PBEM save attached')
+#
+# part = writer.nextpart()
+# part.addheader('Content-Transfer-Encoding', 'base64')
+# szStartBody = "application/CivBeyondSwordSave; name=%s" % szFilename
+# body = part.startbody(szStartBody)
+# base64.encode(open(szPath+szFilename, 'rb'), body)
+#
+# # finish off
+# writer.lastpart()
+ msg = MIMEMultipart()
+ msg.set_charset('iso-2022-cn')
+ msg['To'] = szToAddr
+ msg['From'] = szFromAddr
+ h = Header(szSubject, 'iso-2022-cn')
+ msg['Subject'] = h
+ msg.epilogue = ''
+ part = MIMEText('CIV4 PBEM save attached', _charset='iso-2022-cn')
+ msg.attach(part)
+ part = MIMEBase('application', 'CivBeyondSwordSave')
+ part.set_payload(open(szPath+szFilename, 'rb').read())
+ Encoders.encode_base64(part)
+ f = Header(szFilename, 'iso-2022-cn')
+ part.add_header('Content-Disposition', 'attachment', filename="%s" % f)
+ msg.attach(part)
+# <<< CYBERFRONT
+
+ # send the mail
+ try:
+ smtp = smtplib.SMTP(szHost)
+ # trying to get TLS to work...
+ #smtp.set_debuglevel(1)
+ #smtp.ehlo()
+ #smtp.starttls()
+ #smtp.ehlo()
+ if len(szUser) > 0:
+ smtp.login(szUser, szPassword)
+# >>> CYBERFRONT // pbem:
+# smtp.sendmail(szFromAddr, szToAddr, message.getvalue())
+ smtp.sendmail(szFromAddr, szToAddr, msg.as_string())
+# <<< CYBERFRONT
+ smtp.quit()
+ except smtplib.SMTPAuthenticationError, e:
+ CyInterface().addImmediateMessage("Authentication Error: The server
didn't accept the username/password combination provided.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPHeloError, e:
+ CyInterface().addImmediateMessage("The server refused our HELO
reply.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPConnectError, e:
+ CyInterface().addImmediateMessage("Error establishing connection.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPDataError, e:
+ CyInterface().addImmediateMessage("The SMTP server didn't accept the
data.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPRecipientsRefused, e:
+ CyInterface().addImmediateMessage("All recipient addresses refused.", "")
+ return 1
+ except smtplib.SMTPSenderRefused, e:
+ CyInterface().addImmediateMessage("Sender address refused.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPResponseException, e:
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code,
e.smtp_error), "")
+ return 1
+ except smtplib.SMTPServerDisconnected:
+ CyInterface().addImmediateMessage("Not connected to any SMTP server", "")
+ return 1
+ except:
+ return 1
+ return 0
+
+#####################################33
+## INTERNAL USE ONLY
+#####################################33
+def normalizePath(argsList):
+ CvUtil.pyPrint("PathName in = %s" %(argsList[0],))
+ pathOut=os.path.normpath(argsList[0])
+ CvUtil.pyPrint("PathName out = %s" %(pathOut,))
+ return pathOut
+
+def getConsoleMacro(argsList):
+ 'return a string macro that is used by the in-game python console, fxnKey
goes from 1 to 10'
+ fxnKey = argsList[0]
+ if (fxnKey==1): return "player = gc.getPlayer(0)"
+ if (fxnKey==2): return "import CvCameraControls"
+ if (fxnKey==3):
return "CvCameraControls.g_CameraControls.resetCameraControls()"
+ if (fxnKey==4):
return "CvCameraControls.g_CameraControls.doRotateCamera(360, 45.0)"
+ if (fxnKey==5):
return "CvCameraControls.g_CameraControls.doZoomCamera(0.2, 0.5)"
+ if (fxnKey==6):
return "CvCameraControls.g_CameraControls.doZoomCamera(0.5, 0.15)"
+ if (fxnKey==7):
return "CvCameraControls.g_CameraControls.doPitchCamera(0.5, 0.5)"
+ return ""
+
+# BUG - DLL - start
+def isBug():
+ return True
+
+g_options = None
+def getOption(id):
+ global g_options
+ if g_options is None:
+ import BugOptions
+ g_options = BugOptions.g_options
+ if g_options is None:
+ import BugUtil
+ BugUtil.warn("Cannot access BUG options")
+ return None
+ return g_options.getOption(id)
+
+def getOptionBOOL(argsList):
+ #import BugUtil
+ id, default = argsList
+ #BugUtil.alert("checking option %s with default %s", id, bool(default))
+ try:
+ option = getOption(id)
+ return bool(option.getValue())
+ #val = bool(option.getValue())
+ #BugUtil.alert("value = %s", val)
+ #return val
+ except:
+ #BugUtil.alert("returning default %s", bool(default))
+ return default
+
+def getOptionINT(argsList):
+ #import BugUtil
+ id, default = argsList
+ #BugUtil.alert("checking option %s with default %d", id, int(default))
+ try:
+ option = getOption(id)
+ return int(option.getValue())
+ #val = int(option.getValue())
+ #BugUtil.alert("value = %s", val)
+ #return val
+ except:
+ #BugUtil.alert("returning default %d", int(default))
+ return default
+
+def getOptionFLOAT(argsList):
+ #import BugUtil
+ id, default = argsList
+ #BugUtil.alert("checking option %s with default %f", id, float(default))
+ try:
+ option = getOption(id)
+ return float(option.getValue())
+ #val = int(option.getValue())
+ #BugUtil.alert("value = %s", val)
+ #return val
+ except:
+ #BugUtil.alert("returning default %f", float(default))
+ return default
+
+def getOptionSTRING(argsList):
+ #import BugUtil
+ id, default = argsList
+ #BugUtil.alert("checking option %s with default %s", id, str(default))
+ try:
+ option = getOption(id)
+ return str(option.getValue())
+ #val = int(option.getValue())
+ #BugUtil.alert("value = %s", val)
+ #return val
+ except:
+ #BugUtil.alert("returning default %s", str(default))
+ return default
+
+g_nameAndVersion = None
+def getModNameAndVersion():
+ global g_nameAndVersion
+ if g_nameAndVersion is None:
+ import CvModName
+ g_nameAndVersion = CvModName.getNameAndVersion()
+ return g_nameAndVersion
+# BUG - DLL - end
+
+# BUG - AutoSave - start
+def gameStartSave():
+ # called when the map is generated
+ import AutoSave
+ AutoSave.saveGameStart()
+
+def gameEndSave():
+ # called when the game ends
+ import AutoSave
+ AutoSave.saveGameEnd()
+
+def gameExitSave():
+ # called when the game ends
+ import AutoSave
+ AutoSave.saveGameExit()
+# BUG - AutoSave - end
=======================================
--- /dev/null
+++
/trunk/319cnDifference/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py
Fri May 7 07:24:35 2010
@@ -0,0 +1,599 @@
+from CvPythonExtensions import *
+import CvScreensInterface
+import Popup as PyPopup
+import CvUtil
+import string
+
+localText = CyTranslator()
+UserProfile = CyUserProfile()
+
+# BUG - Options - start
+import BugOptions
+import BugOptionsScreen
+import BugHelp
+# BUG - Options - end
+
+# BUG - BugEventManager - start
+import CvEventInterface
+# BUG - BugEventManager - end
+
+#"""
+#OPTIONS SCREEN CALLBACK INTERFACE - Any time something is changed in the
Options Screen the result is determined here
+#"""
+
+def saveProfile():
+ if (UserProfile.getProfileName() != ""):
+ UserProfile.writeToFile(UserProfile.getProfileName())
+
+def getOptionsScreen():
+ return CvScreensInterface.optionsScreen
+
+def getTabControl():
+ return getOptionsScreen().getTabControl()
+
+def refresh():
+ getOptionsScreen().refreshScreen()
+
+def restartPopup(bForceShowing = false):
+
+ if (CyInterface().isInMainMenu() == false or bForceShowing == true):
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_NEED_TO_RESTART",
()))
+ popup.launch()
+
+def isNumber(s):
+
+ for l in s:
+ if l not in string.digits:
+ return False
+
+ return True
+
+def DummyCallback( argsList ):
+ "This is the callback function for controls which shouldn't do anything
when modified (editboxes, mainly)"
+ return
+
+######################################## GAME OPTIONS
########################################
+
+def handleGameOptionsClicked ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+
+ iGameOption = int(szName[szName.find("_")+1:])
+ CyMessageControl().sendPlayerOption(iGameOption, bValue)
+ return 1
+
+def handleLanguagesDropdownBoxInput ( argsList ):
+ "Handles Languages Dropdown Box input"
+ iValue, szName = argsList
+# >>> freesand
+ if (iValue == 0):
+ CyGame().setCurrentLanguage(0)
+ else:
+ CyGame().setCurrentLanguage(5)
+# <<< freesand
+
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+# >>> CYBERFRONT // language
+# popup.setBodyString(localText.getText("TXT_KEY_FEAT_ACCOMPLISHED_OK",
()))
+ popup.setBodyString(localText.getText("TXT_KEY_FEAT_CHANGE_LANGUAGE", ()))
+# <<< CYBERFRONT
+ popup.launch()
+
+# BUG - BugEventManager - start
+ CvEventInterface.getEventManager().fireEvent("LanguageChanged", iValue)
+# BUG - BugEventManager - end
+
+ return 1
+
+def handleGameReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_GAME)
+ refresh()
+ saveProfile()
+
+ return 1
+
+######################################## GRAPHIC OPTIONS
########################################
+
+def handleGraphicOptionsClicked ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+ iGraphicOption = int(szName[szName.find("_")+1:])
+
+ UserProfile.setGraphicOption(iGraphicOption, bValue)
+
+ if (iGraphicOption ==
GraphicOptionTypes.GRAPHICOPTION_SINGLE_UNIT_GRAPHICS or
+ iGraphicOption == GraphicOptionTypes.GRAPHICOPTION_FULLSCREEN):
+ restartPopup(true)
+
+ if (iGraphicOption == GraphicOptionTypes.GRAPHICOPTION_HIRES_TERRAIN):
+ restartPopup(false)
+
+ return 1
+
+def handleGraphicsLevelDropdownBoxInput ( argsList ):
+ "Handles Graphics Level Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setGraphicsLevel(iValue)
+ refresh()
+
+ restartPopup(true)
+ return 1
+
+def handleRenderQualityDropdownBoxInput ( argsList ):
+ "Handles Render Quality Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setRenderQualityLevel(iValue)
+
+ return 1
+
+def handleGlobeViewDropdownBoxInput ( argsList ):
+ "Handles Globe View Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setGlobeViewRenderLevel(iValue)
+
+ return 1
+
+def handleMovieDropdownBoxInput ( argsList ):
+ "Handles Movie Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setMovieQualityLevel(iValue)
+
+ return 1
+
+def handleMainMenuDropdownBoxInput ( argsList ):
+ "Handles Main Menu Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setMainMenu(iValue)
+ refresh()
+ saveProfile()
+
+ return 1
+
+def handleResolutionDropdownInput ( argsList ):
+ "Handles Resolution Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setResolution(iValue)
+
+# BUG - BugEventManager - start
+ CvEventInterface.getEventManager().fireEvent("ResolutionChanged", iValue)
+# BUG - BugEventManager - end
+
+ return 1
+
+def handleAntiAliasingDropdownInput ( argsList ):
+ "Handles Anti-Aliasing Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setAntiAliasing(iValue)
+ return 1
+
+def handleGraphicsReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_GRAPHICS)
+ refresh()
+ restartPopup()
+ saveProfile()
+
+ return 1
+
+######################################## AUDIO OPTIONS
########################################
+
+def handleVolumeSlidersInput ( argsList ):
+ "Handles Volume slider input"
+ iValue, szName = argsList
+ iVolumeType = int(szName[szName.find("_")+1:])
+
+ iMax = UserProfile.getVolumeStops()
+
+ if (iVolumeType == 0): # Master Volume
+ UserProfile.setMasterVolume(iMax - iValue)
+ elif (iVolumeType == 1): # Music Volume
+ UserProfile.setMusicVolume(iMax - iValue)
+ elif (iVolumeType == 2): # Sound Effects Volume
+ UserProfile.setSoundEffectsVolume(iMax - iValue)
+ elif (iVolumeType == 3): # Speech Volume
+ UserProfile.setSpeechVolume(iMax - iValue)
+ elif (iVolumeType == 4): # Ambience Volume
+ UserProfile.setAmbienceVolume(iMax - iValue)
+ elif (iVolumeType == 5): # Interface Volume
+ UserProfile.setInterfaceVolume(iMax - iValue)
+
+ return 1
+
+def handleVolumeCheckboxesInput ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+ iVolumeType = int(szName[szName.find("_")+1:])
+
+ if (iVolumeType == 0): # Master Volume
+ UserProfile.setMasterNoSound(bValue)
+ elif (iVolumeType == 1): # Music Volume
+ UserProfile.setMusicNoSound(bValue)
+ elif (iVolumeType == 2): # Sound Effects Volume
+ UserProfile.setSoundEffectsNoSound(bValue)
+ elif (iVolumeType == 3): # Speech Volume
+ UserProfile.setSpeechNoSound(bValue)
+ elif (iVolumeType == 4): # Ambience Volume
+ UserProfile.setAmbienceNoSound(bValue)
+ elif (iVolumeType == 5): # Interface Volume
+ UserProfile.setInterfaceNoSound(bValue)
+
+ return 1
+
+def handleCustomMusicPathCheckboxInput ( argsList ):
+ "Handles Custom Music Path text changed input"
+ bValue, szName = argsList
+
+# >>> CYBERFRONT // sound: music path
+# if (bValue):
+#
UserProfile.setMusicPath(CvUtil.convertToStr(getOptionsScreen().getMusicPath()))
+# else:
+# UserProfile.setMusicPath("")
+ if (bValue):
+
UserProfile.setMusicPath(CvUtil.convertToUnicode(getOptionsScreen().getMusicPath()))
+ else:
+ UserProfile.setMusicPath(u"")
+# <<< CYBERFRONT
+
+ return 1
+
+def handleCustomMusicPathButtonInput ( argsList ):
+ "Handles Custom Music Path Browse Button clicked input"
+ szName = argsList
+
+ UserProfile.musicPathDialogBox()
+ return 1
+
+def handleSpeakerConfigDropdownInput ( argsList ):
+ "Handles Speaker Config Dropdown Box input"
+ iValue, szName = argsList
+ szSpeakerConfigName = UserProfile.getSpeakerConfigFromList(iValue)
+
+ UserProfile.setSpeakerConfig(szSpeakerConfigName)
+ restartPopup(true)
+
+ return 1
+
+def handleVoiceCheckboxInput ( argsList ):
+ "Handles voice checkbox clicked input"
+ bValue, szName = argsList
+ UserProfile.setUseVoice(bValue)
+ return 1
+
+def handleCaptureDeviceDropdownInput ( argsList ):
+ "Handles Capture Device Config Dropdown Box input"
+ iValue, szName = argsList
+ UserProfile.setCaptureDevice(iValue)
+ return 1
+
+def handleCaptureVolumeSliderInput ( argsList ):
+ "Handles Capture Volume slider input"
+ iValue, szName = argsList
+ iMax = UserProfile.getMaxPlaybackVolume()
+
+ UserProfile.setCaptureVolume(iValue)
+ return 1
+
+def handlePlaybackDeviceDropdownInput ( argsList ):
+ "Handles Playback Device Dropdown Box input"
+ iValue, szName = argsList
+ UserProfile.setPlaybackDevice(iValue)
+ return 1
+
+def handlePlaybackVolumeSliderInput ( argsList ):
+ "Handles Playback Volume slider input"
+ iValue, szName = argsList
+ iMax = UserProfile.getMaxPlaybackVolume()
+
+# UserProfile.setPlaybackVolume(iMax - iValue)
+ UserProfile.setPlaybackVolume(iValue)
+ return 1
+
+def handleAudioReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_AUDIO)
+ refresh()
+ restartPopup(true)
+ saveProfile()
+
+ return 1
+
+######################################## NETWORK OPTIONS
########################################
+
+def handleBroadbandSelected ( argsList ):
+ "Handles bandwidth selection"
+ bSelected, szName = argsList
+ if (bSelected):
+ CyGame().setModem(false)
+ return 1
+
+def handleModemSelected ( argsList ):
+ "Handles bandwidth selection"
+ bSelected, szName = argsList
+ if (bSelected):
+ CyGame().setModem(true)
+ return 1
+
+######################################## CLOCK OPTIONS
########################################
+
+def handleClockOnCheckboxInput ( argsList ):
+ "Handles Clock On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ UserProfile.setClockOn(bValue)
+ return 1
+
+def handle24HourClockCheckboxInput ( argsList ):
+ "Handles 24 Hour Clock On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ UserProfile.set24Hours(bValue)
+ return 1
+
+def handleAlarmOnCheckboxInput ( argsList ):
+ "Handles Alarm On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ iHour = getOptionsScreen().getAlarmHour()
+ iMin = getOptionsScreen().getAlarmMin()
+
+ if (isNumber(iHour) and iHour != "" and isNumber(iMin) and iMin != "" ):
+
+ iHour = int(iHour)
+ iMin = int(iMin)
+
+ if (iHour > 0 or iMin > 0):
+ toggleAlarm(bValue, iHour, iMin)
+
+ return 1
+
+def handleOtherReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_CLOCK)
+ refresh()
+ saveProfile()
+
+ return 1
+
+######################################## PROFILES
########################################
+
+def handleProfilesDropdownInput ( argsList ):
+ "Handles Profiles tab dropdown box input"
+
+ iValue, szName = argsList
+ saveProfile()
+
+ # Load other file
+ szFilename = UserProfile.getProfileFileName(iValue)
+ szProfile = szFilename[szFilename.find("PROFILES\\")+9:-4]
+
+ bSuccess = loadProfile(szProfile)
+ return bSuccess
+
+def handleNewProfileButtonInput ( argsList ):
+ "Handles New Profile Button clicked input"
+ szName = argsList
+
+ szNewProfileName = getOptionsScreen().getProfileEditCtrlText()
+# >>> CYBERFRONT // character code: codepage
+# szNarrow = szNewProfileName.encode("latin_1")
+ szNarrow = szNewProfileName.encode("utf-8")
+# <<< CYBERFRONT
+ UserProfile.setProfileName(szNarrow)
+ UserProfile.writeToFile(szNarrow)
+
+ # Recalculate file info when new file is saved out
+ UserProfile.loadProfileFileNames()
+
+ saveProfile()
+
+ refresh()
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_SAVED_PROFILE",
(szNewProfileName, )))
+ popup.launch()
+
+ return 1
+
+def handleDeleteProfileButtonInput ( argsList ):
+ "Handles Delete Profile Button clicked input"
+ szName = argsList
+
+ szProfileName
=CvUtil.convertToStr(getOptionsScreen().getProfileEditCtrlText())
+
+ if (UserProfile.deleteProfileFile(szProfileName)): # Note that this
function automatically checks to see if the string passed is a valid file
to be deleted (it must have the proper file extension though)
+
+ # Recalculate list of stuff
+ UserProfile.loadProfileFileNames()
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+# >>> CYBERFRONT // profile:
+#
popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_DELETED_PROFILE",
(szProfileName, )))
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_DELETED_PROFILE",
(CvUtil.convertToUnicode(szProfileName), )))
+# <<< CYBERFRONT
+ popup.launch()
+
+ bSuccess = true
+
+ if (szProfileName == UserProfile.getProfileName()):
+
+ UserProfile.setProfileName("")
+
+ # Load other file
+ szFilename = UserProfile.getProfileFileName(0)
+ szProfile = szFilename[szFilename.find("PROFILES\\")+9:-4]
+
+ bSuccess = loadProfile(szProfile)
+
+ refresh()
+
+ return bSuccess
+
+ return 0
+
+def loadProfile(szProfile):
+
+# >>> CYBERFRONT // profile:
+# bReadSuccessful = UserProfile.readFromFile(szProfile)
+ bReadSuccessful = UserProfile.readFromFile(CvUtil.convertToStr(szProfile))
+# <<< CYBERFRONT
+
+ if (bReadSuccessful):
+ UserProfile.recalculateAudioSettings()
+
+ getOptionsScreen().setProfileEditCtrlText(szProfile)
+
+ ########### Now we have to update everything we loaded since nothing is
done except the serialization on load ###########
+
+ # Game Options
+ for iOptionLoop in range(PlayerOptionTypes.NUM_PLAYEROPTION_TYPES):
+ bValue = UserProfile.getPlayerOption(iOptionLoop)
+ CyMessageControl().sendPlayerOption(iOptionLoop, bValue)
+
+ # Graphics Options
+ for iOptionLoop in range(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):
+ bValue = UserProfile.getGraphicOption(iOptionLoop)
+ UserProfile.setGraphicOption(iOptionLoop, bValue)
+
+ # Beware! These guys aren't safe to change:
+ UserProfile.setAntiAliasing(UserProfile.getAntiAliasing())
+ UserProfile.setResolution(UserProfile.getResolution())
+
+ # Audio Options
+ UserProfile.setSpeakerConfig(UserProfile.getSpeakerConfig())
+ UserProfile.setMusicPath(UserProfile.getMusicPath())
+ UserProfile.setUseVoice(UserProfile.useVoice())
+ UserProfile.setCaptureDevice(UserProfile.getCaptureDeviceIndex())
+ UserProfile.setPlaybackDevice(UserProfile.getPlaybackDeviceIndex())
+ UserProfile.setCaptureVolume(UserProfile.getCaptureVolume())
+ UserProfile.setPlaybackVolume(UserProfile.getPlaybackVolume())
+
+ # Clock Options
+ UserProfile.setClockOn(UserProfile.isClockOn())
+
+ #################
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_LOADED_PROFILE",
(szProfile, )))
+ popup.launch()
+
+ # Refresh options screen with updated values
+ refresh()
+
+ return 1
+
+ # Load failed
+ else:
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+
popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_LOAD_PROFILE_FAIL",
()))
+ popup.launch()
+
+ return 0
+
+def handleExitButtonInput ( argsList ):
+ "Exits the screen"
+ szName = argsList
+
+ saveProfile()
+ getTabControl().destroy()
+
+ return 1
+
+# BUG - Options - start
+
+g_options = BugOptions.getOptions()
+
+def getBugOptionsScreen():
+ return BugOptionsScreen.getOptionsScreen()
+
+def handleBugExitButtonInput ( argsList ):
+ "Exits the screen after saving the options to disk"
+ szName = argsList[0]
+ getBugOptionsScreen().close()
+ return 1
+
+def handleBugHelpButtonInput ( argsList ):
+ "Opens the BUG help file"
+ szName = argsList[0]
+ BugHelp.launch()
+ return 1
+
+def handleBugCheckboxClicked ( argsList ):
+ bValue, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setValue(bValue)
+ return 1
+
+def handleBugTextEditChange ( argsList ):
+ szValue, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setValue(szValue)
+ return 1
+
+def handleBugDropdownChange ( argsList ):
+ iIndex, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setIndex(iIndex)
+ return 1
+
+def handleBugIntDropdownChange ( argsList ):
+ iIndex, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setIndex(iIndex)
+ return 1
+
+def handleBugFloatDropdownChange ( argsList ):
+ iIndex, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setIndex(iIndex)
+ return 1
+
+def handleBugColorDropdownChange ( argsList ):
+ iIndex, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setIndex(iIndex)
+ return 1
+
+def handleBugSliderChanged ( argsList ):
+ iValue, szName = argsList
+ option = g_options.getOption(szName)
+ if (option is not None):
+ option.setValue(iValue)
+ return 1
+
+# BUG - Options - end
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Python/pyWB/CvWBDesc.py Fri May 7
07:24:35 2010
@@ -0,0 +1,2303 @@
+## Sid Meier's Civilization 4
+## Copyright Firaxis Games 2005
+#
+# Code for saving and loading a high-level description of the world.
+# Used by WorldBuilder
+#
+# Author - Mustafa Thamer
+#
+
+from CvPythonExtensions import *
+import os
+import sys
+import CvUtil
+from array import *
+
+# globals
+gc = CyGlobalContext()
+version = 11
+fileencoding = "utf-8" # "latin-1" = "iso-8859-1"
+
+#############
+def getPlayer(idx):
+ "helper function which wraps get player in case of bad index"
+ if (gc.getPlayer(idx).isAlive()):
+ return gc.getPlayer(idx)
+ return None
+
+#############
+class CvWBParser:
+ "parser functions for WB desc"
+ def getTokens(self, line):
+ "return a list of (comma separated) tokens from the line. Strip
whitespace on each token"
+ if line==None:
+ return list()
+ toks=line.split(",")
+ toksOut=list()
+ for tok in toks:
+ toksOut.append(tok.strip())
+ return toksOut
+
+ def findToken(self, toks, item):
+ "return true if item exists in list of tokens"
+ for tok in toks:
+ if (tok==item):
+ return true
+ return false
+
+ def findTokenValue(self, toks, item):
+ "Search for a token of the form item=value in the list of toks, and
return value, or -1 if not found"
+ for tok in toks:
+ l=tok.split("=")
+ if (item==l[0]):
+ if (len(l)==1):
+ return item
+ return l[1]
+ return -1 # failed
+
+ def getNextLine(self, f):
+ "return the next line from the list of lines"
+ return f.readline()
+
+ def findNextToken(self, f, item):
+ "Find the next line that contains the token item, return false if not
found"
+ while True:
+ line = self.getNextLine(f)
+ if (not line):
+ return false # EOF
+ toks=self.getTokens(line)
+ if (self.findToken(toks, item)):
+ return true
+ return false
+
+ def findNextTokenValue(self, f, item):
+ "Find the next line that contains item=value, return value or -1 if not
found"
+ while True:
+ line = self.getNextLine(f)
+ if (not line):
+ return -1 # EOF
+ toks=self.getTokens(line)
+ val=self.findTokenValue(toks, item)
+ if (val != -1):
+ return val
+ return -1
+
+#############
+class CvGameDesc:
+ "class for serializing game data"
+ def __init__(self):
+ self.eraType = "NONE"
+ self.speedType = "NONE"
+ self.calendarType = "CALENDAR_DEFAULT"
+ self.options = ()
+ self.mpOptions = ()
+ self.forceControls = ()
+ self.victories = ()
+ self.gameTurn = 0
+ self.maxTurns = 0
+ self.maxCityElimination = 0
+ self.numAdvancedStartPoints = 0
+ self.targetScore = 0
+ self.iStartYear = -4000
+ self.szDescription = ""
+ self.szModPath = ""
+ self.iRandom = 0
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ self.iTutorialID = -1
+ #### Sanguo Mod Tutorial, end
+
+ def apply(self):
+ "after reading, apply the game data"
+ gc.getGame().setStartYear(self.iStartYear)
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ gc.getGame().setTutorialID(self.iTutorialID)
+ #### Sanguo Mod Tutorial, end
+
+ def write(self, f):
+ "write out game data"
+ f.write("BeginGame\n")
+
f.write("\tEra=%s\n" %(gc.getEraInfo(gc.getGame().getStartEra()).getType(),))
+
f.write("\tSpeed=%s\n" %(gc.getGameSpeedInfo(gc.getGame().getGameSpeedType()).getType(),))
+
f.write("\tCalendar=%s\n" %(gc.getCalendarInfo(gc.getGame().getCalendar()).getType(),))
+
+ # write options
+ for i in range(gc.getNumGameOptionInfos()):
+ if (gc.getGame().isOption(i)):
+ f.write("\tOption=%s\n" %(gc.getGameOptionInfo(i).getType()))
+
+ # write mp options
+ for i in range(gc.getNumMPOptionInfos()):
+ if (gc.getGame().isMPOption(i)):
+ f.write("\tMPOption=%s\n" %(gc.getMPOptionInfo(i).getType()))
+
+ # write force controls
+ for i in range(gc.getNumForceControlInfos()):
+ if (gc.getGame().isForcedControl(i)):
+ f.write("\tForceControl=%s\n" %(gc.getForceControlInfo(i).getType()))
+
+ # write victories
+ for i in range(gc.getNumVictoryInfos()):
+ if (gc.getGame().isVictoryValid(i)):
+ if (not gc.getVictoryInfo(i).isPermanent()):
+ f.write("\tVictory=%s\n" %(gc.getVictoryInfo(i).getType()))
+
+ f.write("\tGameTurn=%d\n" %(gc.getGame().getGameTurn(),))
+ f.write("\tMaxTurns=%d\n" %(gc.getGame().getMaxTurns(),))
+
f.write("\tMaxCityElimination=%d\n" %(gc.getGame().getMaxCityElimination(),))
+
f.write("\tNumAdvancedStartPoints=%d\n" %(gc.getGame().getNumAdvancedStartPoints(),))
+ f.write("\tTargetScore=%d\n" %(gc.getGame().getTargetScore(),))
+
+ f.write("\tStartYear=%d\n" %(gc.getGame().getStartYear(),))
+ f.write("\tDescription=%s\n" % (self.szDescription,))
+ f.write("\tModPath=%s\n" % (self.szModPath,))
+
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ f.write("\tTutorialID=%d\n" % (gc.getGame().getTutorialID(),))
+ #### Sanguo Mod Tutorial, end
+
+ f.write("EndGame\n")
+
+ def read(self, f):
+ "read in game data"
+ self.__init__()
+
+ parser = CvWBParser()
+ if (parser.findNextTokenValue(f, "BeginGame")!=-1):
+ while (true):
+ nextLine = parser.getNextLine(f)
+ toks = parser.getTokens(nextLine)
+ if (len(toks)==0):
+ break
+
+ v = parser.findTokenValue(toks, "Era")
+ if v!=-1:
+ self.eraType = v
+ continue
+
+ v = parser.findTokenValue(toks, "Speed")
+ if v!=-1:
+ self.speedType = v
+ continue
+
+ v = parser.findTokenValue(toks, "Calendar")
+ if v!=-1:
+ self.calendarType = v
+ continue
+
+ v = parser.findTokenValue(toks, "Option")
+ if v!=-1:
+ self.options = self.options + (v,)
+ continue
+
+ v = parser.findTokenValue(toks, "MPOption")
+ if v!=-1:
+ self.mpOptions = self.mpOptions + (v,)
+ continue
+
+ v = parser.findTokenValue(toks, "ForceControl")
+ if v!=-1:
+ self.forceControls = self.forceControls + (v,)
+ continue
+
+ v = parser.findTokenValue(toks, "Victory")
+ if v!=-1:
+ self.victories = self.victories + (v,)
+ continue
+
+ v = parser.findTokenValue(toks, "GameTurn")
+ if v!=-1:
+ self.gameTurn = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "MaxTurns")
+ if v!=-1:
+ self.maxTurns = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "MaxCityElimination")
+ if v!=-1:
+ self.maxCityElimination = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "NumAdvancedStartPoints")
+ if v!=-1:
+ self.numAdvancedStartPoints = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "TargetScore")
+ if v!=-1:
+ self.targetScore = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "StartYear")
+ if v!=-1:
+ self.iStartYear = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "Description")
+ if v!=-1:
+ self.szDescription = v
+ continue
+
+ v = parser.findTokenValue(toks, "ModPath")
+ if v!=-1:
+ self.szModPath = v
+ continue
+
+ v = parser.findTokenValue(toks, "Random")
+ if v!=-1:
+ self.iRandom = int(v)
+ continue
+
+ #### Sanguo Mod Tutorial, start, by poyuzhe 09.27.09
+ v =
parser.findTokenValue(toks, "TutorialID")
+ if v!=-1:
+ self.iTutorialID = int(v)
+ #### Sanguo Mod Tutorial, end
+
+ if parser.findTokenValue(toks, "EndGame") != -1:
+ break
+
+#############
+class CvTeamDesc:
+ def __init__(self):
+ self.techTypes = ()
+ self.aaiEspionageAgainstTeams = []
+ self.bContactWithTeamList = ()
+ self.bWarWithTeamList = ()
+ self.bPermanentWarPeaceList = ()
+ self.bOpenBordersWithTeamList = ()
+ self.bDefensivePactWithTeamList = ()
+ self.bVassalOfTeamList = ()
+ self.projectType = []
+ self.bRevealMap = 0
+ self.iMasterPower = 0
+ self.iVassalPower = 0
+ self.iEspionageEver = 0
+
+ def write(self, f, idx):
+ "write out team data"
+ f.write("BeginTeam\n")
+
+ # Team ID (to make things easier to mess with in the text)
+ f.write("\tTeamID=%d\n" %(idx))
+
+ # write techs
+ for i in range(gc.getNumTechInfos()):
+ if (gc.getTeam(idx).isHasTech(i)):
+ f.write("\tTech=%s\n" %(gc.getTechInfo(i).getType()))
+ if gc.getTechInfo(i).isRepeat():
+ for j in range(gc.getTeam(idx).getTechCount(i)):
+ f.write("\tTech=%s\n" %(gc.getTechInfo(i).getType()))
+
+ # write Espionage against other teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).getEspionagePointsAgainstTeam(i) > 0):
+ f.write("\tEspionageTeam=%d, EspionageAmount=%d\n" %(i,
gc.getTeam(idx).getEspionagePointsAgainstTeam(i)))
+
+ # write Espionage Ever against other teams
+ if (gc.getTeam(idx).getEspionagePointsEver() > 0):
+
f.write("\tEspionageEverAmount=%d\n" %(gc.getTeam(idx).getEspionagePointsEver()))
+
+ # write met other teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isHasMet(i)):
+ f.write("\tContactWithTeam=%d\n" %(i))
+
+ # write warring teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isAtWar(i)):
+ f.write("\tAtWar=%d\n" %(i))
+
+ # write permanent war/peace teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isPermanentWarPeace(i)):
+ f.write("\tPermanentWarPeace=%d\n" %(i))
+
+ # write open borders other teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isOpenBorders(i)):
+ f.write("\tOpenBordersWithTeam=%d\n" %(i))
+
+ # write defensive pact other teams
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isDefensivePact(i)):
+ f.write("\tDefensivePactWithTeam=%d\n" %(i))
+
+ # write vassal state
+ for i in range(gc.getMAX_CIV_TEAMS()):
+ if (gc.getTeam(idx).isVassal(i)):
+ f.write("\tVassalOfTeam=%d\n" %(i))
+
+ for i in range(gc.getNumProjectInfos()):
+ for j in range(gc.getTeam(idx).getProjectCount(i)):
+ f.write("\tProjectType=%s\n" %(gc.getProjectInfo(i).getType()))
+
+ f.write("\tRevealMap=%d\n" %(0))
+
+ if gc.getTeam(idx).getVassalPower() != 0:
+ f.write("\tVassalPower=%d\n" %(gc.getTeam(idx).getVassalPower()))
+ if gc.getTeam(idx).getMasterPower() != 0:
+ f.write("\tMasterPower=%d\n" %(gc.getTeam(idx).getMasterPower()))
+
+ f.write("EndTeam\n")
+
+ def read(self, f):
+ "read in team data"
+ self.__init__()
+
+ parser = CvWBParser()
+ if (parser.findNextTokenValue(f, "BeginTeam")!=-1):
+ while (true):
+ nextLine = parser.getNextLine(f)
+ toks = parser.getTokens(nextLine)
+ if (len(toks)==0):
+ break
+
+ v = parser.findTokenValue(toks, "Tech")
+ if v!=-1:
+ self.techTypes = self.techTypes + (v,)
+ continue
+
+ v = parser.findTokenValue(toks, "EspionageTeam")
+ if v!=-1:
+ iTeam = int(v)
+
+ iExtra = int(parser.findTokenValue(toks, "EspionageAmount"))
+ self.aaiEspionageAgainstTeams.append([iTeam,iExtra])
+ continue
+
+ v = parser.findTokenValue(toks, "EspionageEverAmount")
+ if v!=-1:
+ self.iEspionageEver = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "ContactWithTeam")
+ if v!=-1:
+ self.bContactWithTeamList = self.bContactWithTeamList + (int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "AtWar")
+ if v!=-1:
+ self.bWarWithTeamList = self.bWarWithTeamList + (int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "PermanentWarPeace")
+ if v!=-1:
+ self.bPermanentWarPeaceList = self.bPermanentWarPeaceList + (int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "OpenBordersWithTeam")
+ if v!=-1:
+ self.bOpenBordersWithTeamList = self.bOpenBordersWithTeamList +
(int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "DefensivePactWithTeam")
+ if v!=-1:
+ self.bDefensivePactWithTeamList = self.bDefensivePactWithTeamList +
(int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "VassalOfTeam")
+ if v!=-1:
+ self.bVassalOfTeamList = self.bVassalOfTeamList + (int(v),)
+ continue
+
+ v = parser.findTokenValue(toks, "ProjectType")
+ if v!=-1:
+ self.projectType.append(v)
+ continue
+
+ v = parser.findTokenValue(toks, "RevealMap")
+ if v!=-1:
+ self.bRevealMap = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "VassalPower")
+ if v!=-1:
+ self.iVassalPower = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "MasterPower")
+ if v!=-1:
+ self.iMasterPower = int(v)
+ continue
+
+ if parser.findTokenValue(toks, "EndTeam") != -1:
+ return true # completed successfully
+
+ return false # failed
+
+#############
+class CvPlayerDesc:
+ def __init__(self):
+ self.szCivDesc = ""
+ self.szCivShortDesc = ""
+ self.szLeaderName = ""
+ self.szCivAdjective = ""
+ self.szFlagDecal = ""
+ self.isWhiteFlag = 0
+
+ self.leaderType = "NONE"
+ self.civType = "NONE"
+ self.handicap =
gc.getHandicapInfo(gc.getDefineINT("STANDARD_HANDICAP")).getType()
+ self.team = -1 # team index
+ self.color = "NONE"
+ self.artStyle = "NONE"
+ self.isPlayableCiv = 1
+ self.isMinorNationCiv = 0
+ self.iStartingGold = 0
+ self.iStartingX = -1
+ self.iStartingY = -1
+ self.stateReligion = ""
+ self.szStartingEra = ""
+ self.bRandomStartLocation = "false"
+
+ self.aaiCivics = []
+ self.aaiAttitudeExtras = []
+ self.aszCityList = []
+
+ #### Sanguo Mod WB, initial unit, start, added by nk 08.08.09
+ self.bSpecialInitUnit = False
+ self.aiSpecialInitUnitTargetAI = []
+ #### Sanguo Mod WB, initial unit, end
+
+
+ def write(self, f, idx):
+ "write out player data"
+ f.write("BeginPlayer\n")
+
+ # write team
+ f.write("\tTeam=%d\n" %(int(gc.getPlayer(idx).getTeam())))
+
+ # write leader and Civ Description info
+ if (gc.getPlayer(idx).getLeaderType() == LeaderHeadTypes.NO_LEADER):
+ f.write("\tLeaderType=NONE\n")
+
+ else:
+
f.write("\tLeaderType=%s\n" %(gc.getLeaderHeadInfo(gc.getPlayer(idx).getLeaderType()).getType()))
+
+ # write civ, color, artStyle, isPlayableCiv, isMinorNation, StartingGold
and StateReligion
+ if (gc.getPlayer(idx).getCivilizationType() ==
CivilizationTypes.NO_CIVILIZATION):
+ f.write("\tCivType=NONE\n")
+ f.write("\tColor=NONE\n")
+ f.write("\tArtStyle=NONE\n")
+ else:
+
f.write("\tLeaderName=%s\n" %(gc.getPlayer(idx).getNameKey().encode(fileencoding)))
+
f.write("\tCivDesc=%s\n" %(gc.getPlayer(idx).getCivilizationDescriptionKey().encode(fileencoding)))
+
f.write("\tCivShortDesc=%s\n" %(gc.getPlayer(idx).getCivilizationShortDescriptionKey().encode(fileencoding)))
+
f.write("\tCivAdjective=%s\n" %(gc.getPlayer(idx).getCivilizationAdjectiveKey().encode(fileencoding)))
+
f.write("\tFlagDecal=%s\n" %(gc.getPlayer(idx).getFlagDecal().encode(fileencoding)))
+ f.write("\tWhiteFlag=%d\n" %(gc.getPlayer(idx).isWhiteFlag(),))
+
f.write("\tCivType=%s\n" %(gc.getCivilizationInfo(gc.getPlayer(idx).getCivilizationType()).getType()))
+
f.write("\tColor=%s\n" %(gc.getPlayerColorInfo(gc.getPlayer(idx).getPlayerColor()).getType()))
+
f.write("\tArtStyle=%s\n" %(gc.getArtStyleTypes(gc.getPlayer(idx).getArtStyleType())))
+ f.write("\tPlayableCiv=%d\n" %(int(gc.getPlayer(idx).isPlayable())))
+ f.write("\tMinorNationStatus=%d\n" %(gc.getPlayer(idx).isMinorCiv()))
+ f.write("\tStartingGold=%d\n" %(gc.getPlayer(idx).getGold()))
+
+ if gc.getPlayer(idx).isAlive():
+ pPlot = gc.getPlayer(idx).getStartingPlot()
+ if (not pPlot.isNone()):
+ f.write("\tStartingX=%d, StartingY=%d\n" %(pPlot.getX(),
pPlot.getY()))
+
+ pPlayerReligionInfo =
gc.getReligionInfo(gc.getPlayer(idx).getStateReligion())
+ if pPlayerReligionInfo:
+ f.write("\tStateReligion=%s\n" %(pPlayerReligionInfo.getType()))
+ else:
+ f.write("\tStateReligion=\n")
+
+
f.write("\tStartingEra=%s\n" %(gc.getEraInfo(gc.getPlayer(idx).getCurrentEra()).getType()))
+
+ f.write("\tRandomStartLocation=false\n")
+
+ # write Civics
+ for iCivicOptionLoop in range(gc.getNumCivicOptionInfos()):
+ for iCivicLoop in range(gc.getNumCivicInfos()):
+ iCivic = gc.getPlayer(idx).getCivics(iCivicOptionLoop)
+ if (iCivicLoop == iCivic):
+ f.write("\tCivicOption=%s,
Civic=%s\n" %(gc.getCivicOptionInfo(iCivicOptionLoop).getType(),
gc.getCivicInfo(iCivicLoop).getType()))
+
+ # write Attitude Extra
+ for i in range(gc.getMAX_CIV_PLAYERS()):
+ if (gc.getPlayer(idx).AI_getAttitudeExtra(i) != 0):
+ f.write("\tAttitudePlayer=%d, AttitudeExtra=%d\n" %(i,
gc.getPlayer(idx).AI_getAttitudeExtra(i)))
+
+ # write City List
+ for i in range(gc.getPlayer(idx).getNumCityNames()):
+ f.write("\tCityList=%s\n" %(gc.getPlayer(idx).getCityName(i)))
+
+ if (gc.getPlayer(idx).getHandicapType() == HandicapTypes.NO_HANDICAP):
+
f.write("\tHandicap=%s\n" %(gc.getHandicapInfo(gc.getDefineINT("STANDARD_HANDICAP")).getType()))
+ else:
+
f.write("\tHandicap=%s\n" %(gc.getHandicapInfo(gc.getPlayer(idx).getHandicapType()).getType()))
+
+ f.write("EndPlayer\n")
+
+ def read(self, f):
+ "read in player data"
+ self.__init__()
+ parser = CvWBParser()
+ if (parser.findNextTokenValue(f, "BeginPlayer")!=-1):
+ while (true):
+ nextLine = parser.getNextLine(f)
+ toks = parser.getTokens(nextLine)
+ if (len(toks)==0):
+ break
+
+ v = parser.findTokenValue(toks, "CivDesc")
+ if v!=-1:
+ self.szCivDesc = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "CivShortDesc")
+ if v!=-1:
+ self.szCivShortDesc = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "LeaderName")
+ if v!=-1:
+ self.szLeaderName = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "CivAdjective")
+ if v!=-1:
+ self.szCivAdjective = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "FlagDecal")
+ if v!=-1:
+ self.szFlagDecal = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "WhiteFlag")
+ if v!=-1:
+ self.isWhiteFlag = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "LeaderType")
+ if v!=-1:
+ self.leaderType = v
+ continue
+
+ v = parser.findTokenValue(toks, "CivType")
+ if v!=-1:
+ self.civType = v
+ continue
+
+ v = parser.findTokenValue(toks, "Team")
+ if v!=-1:
+ self.team = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "Handicap")
+ if v!=-1:
+ self.handicap = v
+ continue
+
+ v = parser.findTokenValue(toks, "Color")
+ if v!=-1:
+ self.color = v
+ continue
+
+ v = parser.findTokenValue(toks, "ArtStyle")
+ if v!=-1:
+ self.artStyle = v
+ continue
+
+ v = parser.findTokenValue(toks, "PlayableCiv")
+ if v!=-1:
+ self.isPlayableCiv = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "MinorNationStatus")
+ if v!=-1:
+ self.isMinorNationCiv = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "StartingGold")
+ if v!=-1:
+ self.iStartingGold = int(v)
+ continue
+
+ vX = parser.findTokenValue(toks, "StartingX")
+ vY = parser.findTokenValue(toks, "StartingY")
+ if vX!=-1 and vY!=-1:
+ self.iStartingX = int(vX)
+ self.iStartingY = int(vY)
+ continue
+
+ v = parser.findTokenValue(toks, "StateReligion")
+ if v!=-1:
+ self.stateReligion = v
+ continue
+
+ v = parser.findTokenValue(toks, "StartingEra")
+ if v!=-1:
+ self.szStartingEra = v
+ continue
+
+ v = parser.findTokenValue(toks, "RandomStartLocation")
+ if v!=-1:
+ self.bRandomStartLocation = v
+ continue
+
+ v = parser.findTokenValue(toks, "CivicOption")
+ if v!=-1:
+ iCivicOptionType = gc.getInfoTypeForString(v)
+
+ v = parser.findTokenValue(toks, "Civic")
+ if v!=-1:
+ iCivicType = gc.getInfoTypeForString(v)
+ self.aaiCivics.append([iCivicOptionType,iCivicType])
+ continue
+
+ v = parser.findTokenValue(toks, "AttitudePlayer")
+ if v!=-1:
+ iPlayer = int(v)
+
+ iExtra = int(parser.findTokenValue(toks, "AttitudeExtra"))
+ self.aaiAttitudeExtras.append([iPlayer,iExtra])
+ continue
+
+ v = parser.findTokenValue(toks, "CityList")
+ if v!=-1:
+ self.aszCityList.append(v)
+ continue
+
+ #### Sanguo Mod WB, initial unit, start, added by nk 08.08.09
+ v = parser.findTokenValue(toks, "SpecialInitUnit")
+ if v!=-1:
+ self.bSpecialInitUnit = int(v)
+ continue
+
+ v = parser.findTokenValue(toks, "SpecialInitUnitTargetAI")
+ if v!=-1:
+ self.aiSpecialInitUnitTargetAI.append(int(v))
+ continue
+ #### Sanguo Mod WB, initial unit, end
+
+ if parser.findTokenValue(toks, "EndPlayer") != -1:
+ #print("Civics:")
+ #print self.aaiCivics
+ #print("Attitudes:")
+ #print self.aaiAttitudeExtras
+ break
+
+#############
+class CvUnitDesc:
+ "unit WB serialization"
+ def __init__(self):
+ self.plotX = -1
+ self.plotY = -1
+ self.unitType = None
+ self.szName = None
+ self.leaderUnitType = None
+ self.owner =-1
+ self.damage = 0
+ self.level = -1
+ self.experience = -1
+ self.promotionType = []
+ self.facingDirection = DirectionTypes.NO_DIRECTION;
+ self.isSleep = False
+ self.isIntercept = False
+ self.isPatrol = False
+ self.isPlunder = False
+ self.szUnitAIType = "NO_UNITAI"
+ self.szScriptData = "NONE"
+#### Sanguo Mod WB, start, added by poyuzhe 07.16.09
+ self.iHeroType = -1
+ self.iLegionHero = -1
+## self.LegionMemberList = []
+#### Sanguo Mod WB, end
+
+ def apply(self):
+ "after reading, this will actually apply the data"
+ player = getPlayer(self.owner)
+ if (player):
+ # print ("unit apply %d %d" %(self.plotX, self.plotY))
+ CvUtil.pyAssert(self.plotX>=0 and self.plotY>=0, "invalid plot coords")
+ unitTypeNum = CvUtil.findInfoTypeNum(gc.getUnitInfo,
gc.getNumUnitInfos(), self.unitType)
+ if (unitTypeNum < 0):
+ unit = None
+ else:
+ if (self.szUnitAIType != "NO_UNITAI"):
+ eUnitAI = CvUtil.findInfoTypeNum(gc.getUnitAIInfo,
UnitAITypes.NUM_UNITAI_TYPES, self.szUnitAIType) #pUnitAI.getType()
+ else:
+ eUnitAI = UnitAITypes.NO_UNITAI
+
+ unit = player.initUnit(unitTypeNum, self.plotX, self.plotY,
UnitAITypes(eUnitAI), self.facingDirection)
+ if (unit):
+ if (self.szName != None):
+ unit.setName(self.szName)
+ #leader unit type
+ if(self.leaderUnitType != None):
+ leaderUnitTypeNum = CvUtil.findInfoTypeNum(gc.getUnitInfo,
gc.getNumUnitInfos(), self.leaderUnitType)
+ if leaderUnitTypeNum >= 0:
+ unit.setLeaderUnitType(leaderUnitTypeNum);
+
+ #other properties
+ if self.damage != 0:
+ unit.setDamage(self.damage, PlayerTypes.NO_PLAYER)
+ if self.level != -1:
+ unit.setLevel(self.level)
+ if self.experience != -1:
+ unit.setExperience(self.experience, -1)
+ for promo in self.promotionType:
+ promotionTypeNum = CvUtil.findInfoTypeNum(gc.getPromotionInfo,
gc.getNumPromotionInfos(), promo)
+ unit.setHasPromotion(promotionTypeNum, True)
+ if self.isSleep:
+ unit.getGroup().setActivityType(ActivityTypes.ACTIVITY_SLEEP)
+ elif self.isIntercept:
+ unit.getGroup().setActivityType(ActivityTypes.ACTIVITY_INTERCEPT)
+ elif self.isPatrol:
+ unit.getGroup().setActivityType(ActivityTypes.ACTIVITY_PATROL)
+ elif self.isPlunder:
+ unit.getGroup().setActivityType(ActivityTypes.ACTIVITY_PLUNDER)
+ if self.szScriptData != "NONE":
+ unit.setScriptData(self.szScriptData)
+
+ #### Sanguo Mod WB, start, added by poyuzhe 07.16.09
+ if self.iHeroType != -1:
+ iUnitType = gc.getHeroInfo(self.iHeroType).getUnitType()
+
+ if self.iLegionHero != -1:
+ unit.setLeaderUnitType(-1)
+ hero = player.initUnit(iUnitType, self.plotX, self.plotY,
UnitAITypes.UNITAI_HERO, self.facingDirection)
+ else:
+ hero = unit
+
+
+ hero.setHeroType(self.iHeroType)
+ if gc.getGame().getHeroDebutStatus(self.iHeroType) != self.owner:
+ gc.getGame().setHeroDebutStatus(self.iHeroType, self.owner)
+ player.changeHeroMaintenance(self.iHeroType, True, False, 0)
+ gc.getGame().setHeroUnitID(self.iHeroType, hero.getID())
+ elif gc.getUnitInfo(unitTypeNum).isHero():
+ listHeroType = []
+ for i in
range(gc.getNumHeroInfos()):
+ if gc.getHeroInfo(i).getUnitType() == unitTypeNum:
+ listHeroType.append(i)
+
+ if len(listHeroType) == 1:
+
unit.setHeroType(listHeroType[0])
+ if
gc.getGame().getHeroDebutStatus(listHeroType[0]) != self.owner:
+ gc.getGame().setHeroDebutStatus(listHeroType[0], self.owner)
+ player.changeHeroMaintenance(listHeroType[0], True, False, 0)
+ gc.getGame().setHeroUnitID(listHeroType[0], unit.getID())
+
+ # CyUnit() has no attribute 'setHeroType'
+ # if self.iHeroType != -1:
+ # unit.setHeroType(self.iHeroType)
+ # if self.iLegionHero != -1:
+ # unit.setLegionHero(self.iLegionHero)
+ #for iUnitID in self.LegionMemberList:
+ #unit.addLegionMember(iUnitID)
+ #### Sanguo Mod WB, end
+
+ def read(self, f, pX, pY):
+ "read in unit data - at this point the first line 'BeginUnit' has
already been read"
+ self.__init__()
+ self.plotX = pX
+ self.plotY = pY
+ CvUtil.pyAssert(self.plotX>=0 and self.plotY>=0, "invalid plot coords")
+
+ parser = CvWBParser()
+ while (true):
+ nextLine = parser.getNextLine(f)
+ toks = parser.getTokens(nextLine)
+ if (len(toks)==0):
+ break
+
+ v = parser.findTokenValue(toks, "UnitType")
+ vOwner = parser.findTokenValue(toks, "UnitOwner")
+ if (v!=-1 and vOwner != -1):
+ self.unitType = v
+ self.owner = int(vOwner)
+ continue
+
+ v = parser.findTokenValue(toks, "UnitName")
+ if (v != -1):
+ self.szName = v.decode(fileencoding)
+ continue
+
+ v = parser.findTokenValue(toks, "LeaderUnitType")
+ if (v != -1):
+ self.leaderUnitType = v
+ continue
+
+ v = parser.findTokenValue(toks, "Damage")
+ if (v != -1):
+ self.damage = (int(v))
+ continue
+
+ v = parser.findTokenValue(toks, "Level")
+ if (v != -1):
+ self.level = (int(v))
+ self.experience = int(parser.findTokenValue(toks, "Experience"))
+ continue
+
+ # Units - Promotions
+ v = parser.findTokenValue(toks, "PromotionType")
+ if v!=-1:
+ self.promotionType.append(v)
+ continue
+
+ v = parser.findTokenValue(toks, "FacingDirection")
+ if (v != -1):
+ self.facingDirection = (DirectionTypes(v))
+ continue
+
+ if (parser.findTokenValue(toks, "Sleep"))!=-1:
+ self.isSleep = True
+ continue
+
+ if (parser.findTokenValue(toks, "Intercept"))!=-1:
+ self.isIntercept = True
+ continue
+
+ if (parser.findTokenValue(toks, "Patrol"))!=-1:
+ self.isPatrol = True
+ continue
+
+ if (parser.findTokenValue(toks, "Plunder"))!=-1:
+ self.isPlunder = True
+ continue
+
+ v = parser.findTokenValue(toks, "UnitAIType")
+ if (v != -1):
+ self.szUnitAIType = v
+ continue
+
+ v = parser.findTokenValue(toks, "ScriptData")
+ if v!=-1:
+ print("found script data: %s" %(v))
+ self.szScriptData = v
+ continue
+
+ #### Sanguo Mod WB, start, added by poyuzhe 07.16.09
+ v = parser.findTokenValue(toks, "HeroType")
+ if v != -1:
+ self.iHeroType = (gc.getInfoTypeForString(v))
+ continue
+
+ v = parser.findTokenValue(toks, "LegionHero")
+ if v != -1:
+ self.iLegionHero = (gc.getInfoTypeForString(v))
+ continue
+
+## v = parser.findTokenValue(toks, "LegionMemberID")
+## if v != -1:
+## self.LegionMemberList.append(int(v))
+## continue
+ #### Sanguo Mod WB, end
+
+ if parser.findTokenValue(toks, "EndUnit") != -1:
+ break
+
+ def write(self, f, unit, plot):
+ "save unit desc to a file"
+ unitType = gc.getUnitInfo(unit.getUnitType()).getType()
+ unitOwner= unit.getOwner()
+ f.write("\tBeginUnit\n")
+ f.write("\t\tUnitType=%s, UnitOwner=%d\n" %(unitType,unitOwner))
+ if (len(unit.getNameNoDesc()) > 0):
+
f.write("\t\tUnitName=%s\n" %(unit.getNameNoDesc().encode(fileencoding),))
+ if unit.getLeaderUnitType() != -1:
+
f.write("\t\tLeaderUnitType=%s\n" %(gc.getUnitInfo(unit.getLeaderUnitType()).getType()))
+ f.write("\t\tDamage=%d\n" %(unit.getDamage(),))
+ f.write("\t\tLevel=%d, Experience=%d\n" %(unit.getLevel(),
unit.getExperience()))
+ for i in range(gc.getNumPromotionInfos()):
+
+ ## Sanguo Mod WB, start, added by nk 07.16.09
+ pInfo = gc.getPromotionInfo(i)
+
+ if pInfo.isHero():
+ continue
+
+ iUnitCombatType = pInfo.getPromotionUnitCombatType()
+ if iUnitCombatType != -1:
+ continue
+ ## Sanguo Mod WB, end
+
+ if unit.isHasPromotion(i):
+ f.write("\t\tPromotionType=%s\n" %(gc.getPromotionInfo(i).getType()))
+
+ f.write("\t\tFacingDirection=%d\n" %(unit.getFacingDirection(),))
+ if (unit.getGroup().getActivityType() == ActivityTypes.ACTIVITY_SLEEP):
+ f.write("\t\tSleep\n")
+ elif (unit.getGroup().getActivityType() ==
ActivityTypes.ACTIVITY_INTERCEPT):
+ f.write("\t\tIntercept\n")
+ elif (unit.getGroup().getActivityType() ==
ActivityTypes.ACTIVITY_PATROL):
+ f.write("\t\tPatrol\n")
+ elif (unit.getGroup().getActivityType() ==
ActivityTypes.ACTIVITY_PLUNDER):
+ f.write("\t\tPlunder\n")
+
f.write("\t\tUnitAIType=%s\n" %(gc.getUnitAIInfo(unit.getUnitAIType()).getType()))
+ if unit.getScriptData():
+ f.write("\t\tScriptData=%s\n" %unit.getScriptData() )
+
+ #### Sanguo Mod WB, start, added by poyuzhe 07.16.09
+ if unit.getHeroType() != -1:
+ f.write("\t\tHeroType=%s\n" %
(gc.getHeroInfo(unit.getHeroType()).getType()))
+ if unit.getLegionHero() != -1:
+ f.write("\t\tLegionHero=%s\n" %
(gc.getHeroInfo(unit.getLegionHero()).getType()))
+## for i in range(unit.getLegionSize()):
+## if unit.getLegionMemberAt(i) != -1:
+## f.write("\t\tLegionMemberID=%d\n" % (unit.getLegionMemberAt(i)))
+ #### Sanguo Mod WB, end
+
+ f.write("\tEndUnit\n")
+
+############
+class CvCityDesc:
+ "serializes city data"
+ def __init__(self):
+ self.city = None
+ self.owner = None
+
self.name = None
+ self.population = 0
+ self.productionUnit = "NONE"
+ self.productionBuilding = "NONE"
+ self.productionProject = "NONE"
+ self.productionProcess = "NONE"
+ self.culture = 0
+ self.bldgType = []
+ self.religions = []
+ self.holyCityReligions = []
+ self.corporations = []
+ self.headquarterCorporations = []
+ self.freeSpecialists = []
+ self.plotX=-1
+ self.plotY=-1
+ self.szScriptData = "NONE"
+ self.aiPlayerCulture = []
+ for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):
+ self.aiPlayerCulture.append(0)
+ #### Sanguo Mod WB, start, added by poyuzhe 07.17.09
+ self.cityPerks = []
+ #### Sanguo Mod WB, end
+
+ def apply(self):
+ "after reading, this will actually apply the data"
+ player = getPlayer(self.owner)
+ if (player):
+ self.city = player.initCity(self.plotX, self.plotY)
+
+ if (
self.name != None):
+ self.city.setName(
self.name, False)
+
+ if (self.population):
+ self.city.setPopulation(self.population)
+
+ if (self.culture):
+ self.city.setCulture(self.city.getOwner(), self.culture, True)
+
+ for bldg in (self.bldgType):
+ bldgTypeNum = CvUtil.findInfoTypeNum(gc.getBuildingInfo,
gc.getNumBuildingInfos(), bldg)
+ self.city.setNumRealBuilding(bldgTypeNum, 1)
+
+ for religion in (self.religions):
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Res/Fonts/GameFont.tga Fri May 7
07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/Res/Fonts/GameFont_75.tga Fri May 7
07:24:35 2010
Binary file, no diff available.
=======================================
--- /dev/null
+++ /trunk/319cnDifference/Assets/XML/Art/CIV4ArtDefines_Misc.xml Fri May
7 07:24:35 2010
@@ -0,0 +1,351 @@
+<?xml version="1.0"?>
+<!-- edited with XMLSPY v2004 rel. 2 U (
http://www.xmlspy.com) by Jesse
Smith (Firaxis Games) -->
+<!-- Sid Meier's Civilization 4 -->
+<!-- Copyright Firaxis Games 2005 -->
+<!-- -->
+<!-- Misc art path information -->
+<Civ4ArtDefines xmlns="x-schema:CIV4ArtDefinesSchema.xml">
+ <MiscArtInfos>
+ <MiscArtInfo>
+ <Type>ART_GREAT_WALL_POST</Type>
+ <Path>Art/Structures/Buildings/Great_Wall/Great_Wall_Tower.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GREAT_WALL_SEGMENT</Type>
+ <Path>Art/Structures/Buildings/Great_Wall/Great_Wall_1Unit.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GREAT_WALL_SHADOW_TEXTURE</Type>
+ <Path>Art/Structures/Buildings/Great_Wall/poopshadow.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_AQUEDUCT_ENDPIECE</Type>
+ <Path>Art/Structures/Buildings/Aqueduct/Aqueduct.nif::1x1_end</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_AQUEDUCT_SEGMENT</Type>
+ <Path>Art/Structures/Buildings/Aqueduct/Aqueduct.nif::1x1_std</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_AQUEDUCT_WELL</Type>
+ <Path>Art/Structures/Buildings/Aqueduct/Aqueduct.nif::1x1_well</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_DEFAULT_MAP_THUMBNAIL</Type>
+ <Path>Art/Interface/Main Menu/MM_MissingMapThumbnail.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_CLOUD_SHADOWS</Type>
+ <Path>Art/Terrain/Sky/Clouds01decal.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_CLOUDS</Type>
+ <Path>Art/Terrain/Sky/Clouds01.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_ICECAP_EAST</Type>
+ <Path>Art/Terrain/Features/WorldCap/WorldCapIce.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_ICECAP_NORTH</Type>
+ <Path>Art/Terrain/Features/WorldCap/WorldCapIce.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_ICECAP_SOUTH</Type>
+ <Path>Art/Terrain/Features/WorldCap/WorldCapIce.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_ICECAP_WEST</Type>
+ <Path>Art/Terrain/Features/WorldCap/WorldCapIce.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_NIGHTSKY</Type>
+ <Path>Art/Terrain/Features/WorldCap/NightSky.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_GLOBEVIEW_WORLD_CAP</Type>
+ <Path>Art/Terrain/Features/WorldCap/WorldCap.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_HILL_DECAL</Type>
+ <Path>Art/Terrain/Features/Hills/hill_all_01.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_MOTION_BLUR_ALPHA_TEXTURE</Type>
+ <Path>Art/Shared/MotionBlur_Alpha.bmp</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_PEAK_DECAL</Type>
+ <Path>Art/Terrain/Features/Peak/peak_all_01.dds</Path>
+ <fScale>2.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_POST_MASK</Type>
+ <Path>Art/Structures/Buildings/Walls/post01_%1.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_ABOVESELECTION</Type>
+ <Path>None</Path>
+ <fScale>1.3</fScale>
+ <NIF>Art/Units/Selection Effect/Selection_Above.nif</NIF>
+ <KFM>Art/Units/Selection Effect/Selection_Above.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_COIN</Type>
+ <Path>None</Path>
+ <fScale>1.0</fScale>
+ <NIF>Art/Units/Flag/Mediallion.nif</NIF>
+ <KFM>Art/Units/Flag/Medallions.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_FLAG_ANCIENT</Type>
+ <Path>None</Path>
+ <fScale>0.8</fScale>
+ <NIF>Art/Units/Flags/Ancient_Flag.nif</NIF>
+ <KFM>Art/Units/Flags/Ancient_Flag.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_FLAG_MEDIEVAL</Type>
+ <Path>None</Path>
+ <fScale>0.8</fScale>
+ <NIF>Art/Units/Flags/Medieval_Flag.nif</NIF>
+ <KFM>Art/Units/Flags/Medieval_Flag.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_FLAG_MODERN</Type>
+ <Path>None</Path>
+ <fScale>0.8</fScale>
+ <NIF>Art/Units/Flags/Modern_Flag.nif</NIF>
+ <KFM>Art/Units/Flags/Modern_Flag.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_FLAG_GLOW</Type>
+ <Path>None</Path>
+ <fScale>0.8</fScale>
+ <NIF>Art/Units/Flag/BehindFlagGlow.nif</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_GROUNDSELECTION</Type>
+ <Path>None</Path>
+ <fScale>1.3</fScale>
+ <NIF>Art/Units/Selection Effect/Selection_Ground.nif</NIF>
+ <KFM>Art/Units/Selection Effect/Selection_Ground.kfm</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_UNITGROUP_WAYPOINTSELECTION</Type>
+ <Path>None</Path>
+ <fScale>1.3</fScale>
+ <NIF>Art/Units/Selection Effect/Selection_Waypoint.nif</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_WALL_MASK</Type>
+ <Path>Art/Structures/Buildings/Walls/wall%1_%2.nif</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ART_WATER</Type>
+ <Path>Art/Terrain/Water/Water01.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>Art/Terrain/Water/Water.nif</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>GENERIC_BUILDING_DIR</Type>
+ <Path>Art/Structures/Cities/</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>PLOT_TEXTURE</Type>
+ <Path>Art/Terrain/PlotTextures/PlotTexture.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>AREA_BORDER_TEXTURE</Type>
+ <Path>Art/Terrain/PlotTextures/AreaBorder.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RAILROAD_NORMAL_MAP_TEXTURE</Type>
+ <Path>Art/Terrain/Routes/Railroads/Railroad_Normal.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RIVER_BASE_TEXTURE</Type>
+ <Path>Art/Terrain/Routes/Rivers/AllRiversSmaller.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RIVER_FLOOD_PLAIN_MASK_TEXTURE</Type>
+ <Path>Art/Terrain/Features/Floodplain/floodplainMASK.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RIVER_FLOOD_PLAIN_TEXTURE</Type>
+ <Path>Art/Terrain/Features/Floodplain/FloodPlain_baseALL.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RIVER_NORMAL_MAP_TEXTURE</Type>
+ <Path>Art/Terrain/Routes/Rivers/AllRiversNormal.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RIVER_NORMAL_MAP_MED_TEXTURE</Type>
+ <Path>Art/Terrain/Routes/Rivers/AllRiversNormalMed.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ROUTE_BRIDGE</Type>
+ <Path>Art/Terrain/Routes/Bridge/Bridge.nif</Path>
+ <fScale>0.8</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>RAILROAD_BRIDGE</Type>
+ <Path>Art/Terrain/Routes/Bridge/Bridge_RR.nif</Path>
+ <fScale>0.8</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>ROUTE_DOCK</Type>
+ <Path>Art/Terrain/Routes/Dock/Dock.nif</Path>
+ <fScale>0.6</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>WAYPOINT_BEAM_TEXTURE</Type>
+ <Path>Art/Shared/DashedLine_Vertical_NoCaps.dds</Path>
+ <fScale>1.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>CITY_BILLBOARDS</Type>
+ <Path>None</Path>
+ <!-- positive scale: city billboards use fonts from GameFont.tga -->
+ <!-- negative scale: GFC billboards (uses the interface font) -->
+<!-- >>> CYBERFRONT text: billboard -->
+<!-- <fScale>1.0</fScale> -->
+ <fScale>-1.0</fScale>
+<!-- <<< CYBERFRONT -->
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>SPACE_SHIP_BUTTON</Type>
+
<Path>,Art/Interface/Buttons/Buildings/ApolloProgram.dds,Art/Interface/Buttons/Buildings_Atlas.dds,3,1</Path>
+ <fScale>1.0</fScale>
+ <NIF/>
+ <KFM/>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>REPLACE_LEADER_BACKGROUND</Type>
+ <Path/>
+ <fScale>1</fScale>
+ <NIF></NIF>
+ <KFM></KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>REPLACE_LEADER_FORGROUND</Type>
+ <Path/>
+ <fScale>1</fScale>
+ <NIF></NIF>
+ <KFM></KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>DEFAULT_THEME_NAME</Type>
+ <Path>Mods/The History of Three Kingdoms/Resource/Civ4.thm</Path>
+ <fScale>0.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ <MiscArtInfo>
+ <Type>SOUND_BLASTER_LOGO</Type>
+ <Path>Art/Interface/Screens/Options/X-Fi_Logo_Sound Best_trans
On.dds</Path>
+ <fScale>0.0</fScale>
+ <NIF>None</NIF>
+ <KFM>None</KFM>
+ </MiscArtInfo>
+ </MiscArtInfos>
+</Civ4ArtDefines>
=======================================
--- /dev/null
+++ /trunk/319cnDifference/CvGameCoreDLL/CvDLLInterfaceIFaceBase.h Fri May
7 07:24:35 2010
@@ -0,0 +1,223 @@
+#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, bool bToggle = false) = 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 updatePythonScreens() = 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 InterfaceModeTypes getInterfaceMode() = 0;
+ virtual InterfaceVisibility getShowInterface() = 0;
+ virtual CvPlot* getMouseOverPlot() = 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;
+ virtual bool isExitingToMainMenu() = 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 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;
+
+ virtual void getInterfaceScreenIdsForInput(std::vector<int>& aIds) = 0;
+ virtual void doPing(int iX, int iY, PlayerTypes ePlayer) = 0;
+};
+
+
+#endif // CvDLLInterfaceIFaceBase_h
=======================================
--- /dev/null
+++ /trunk/319cnDifference/CvGameCoreDLL/CvDefines.h Fri May 7 07:24:35
2010
@@ -0,0 +1,144 @@
+#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)
+
+#ifdef CYBERFRONT // gamespy: lobby for jp
+#define CIV4_GUID "civ4btsjp"
+#define CIV4_PRODUCT_ID 11276
+#else
+#define CIV4_GUID "civ4bts"
+#define CIV4_PRODUCT_ID 11081
+#endif // CYBERFRONT
+#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 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/319cnDifference/CvGameCoreDLL/CvGameCoreDLL.rc Fri May 7
07:24:35 2010
@@ -0,0 +1,103 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 3,1,7,0
+ PRODUCTVERSION 3,1,7,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "The History of Three Kingdoms, 319cn"
+ VALUE "CompanyName", "Firaxis Games"
+ VALUE "FileDescription", "Game core DLL for Sid Meier's
Civilization 4 : Beyond The Sword"
+ VALUE "FileVersion", "3, 1, 7, 0"
+ VALUE "InternalName", "Sid Meier's Civilization 4 : Beyond The
Sword Game Core DLL"
+ VALUE "LegalCopyright", "Copyright (C) Firaxis Games. All
Rights Reserved."
+ VALUE "OriginalFilename", "CvGameCoreDLL.dll"
+ VALUE "ProductName", "Sid Meier's Civilization 4 : Beyond The
Sword"
+ VALUE "ProductVersion", "3, 1, 7, 0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
=======================================
--- /dev/null
+++ /trunk/319cnDifference/CvGameCoreDLL/CvGameCoreDLL.vcproj Fri May 7
07:24:35 2010
@@ -0,0 +1,1452 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="CvGameCoreDLL"
+ ProjectGUID="{E323AF8E-688B-4ED7-BA84-269D8F3AAE2D}"
+ RootNamespace="CvGameCoreDLL"
+ SccProjectName="Perforce Project"
+ SccAuxPath=""
+ SccLocalPath=".."
+ SccProvider="MSSCCI:Perforce SCM"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="3"
+
AdditionalIncludeDirectories=""Boost-1.32.0\include";Python24\include"
+
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CVGAMECOREDLL_EXPORTS;CYBERFRONT"
+ MinimalRebuild="FALSE"
+ ExceptionHandling="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ BufferSecurityCheck="FALSE"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="CvGameCoreDLL.h"
+ ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ ShowIncludes="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="boost_python-vc71-mt-gd-1_32.lib winmm.lib"
+ OutputFile="../Beyond the Sword(J)/Assets/CvGameCoreDLL_DEBUG.dll"
+ LinkIncremental="2"
+
AdditionalLibraryDirectories="Python24\libs;"boost-1.32.0\libs\""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/CvGameCoreDLL_DEBUG.pdb"
+ SubSystem="2"
+ LargeAddressAware="2"
+ ImportLibrary="$(OutDir)/CvGameCoreDLL.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ GlobalOptimizations="TRUE"
+ EnableIntrinsicFunctions="TRUE"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="3"
+
AdditionalIncludeDirectories=""Boost-1.32.0\include";Python24\include"
+
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CVGAMECOREDLL_EXPORTS;CYBERFRONT"
+ MinimalRebuild="FALSE"
+ ExceptionHandling="TRUE"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="FALSE"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="CvGameCoreDLL.h"
+ ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"
+ CallingConvention="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="boost_python-vc71-mt-1_32.lib winmm.lib"
+ OutputFile="../Beyond the Sword(J)/Assets/CvGameCoreDLL_RELEASE.dll"
+ LinkIncremental="1"
+
AdditionalLibraryDirectories="Python24\libs;"boost-1.32.0\libs\""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/CvGameCoreDLL_RELEASE.pdb"
+ SubSystem="2"
+ LargeAddressAware="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/CvGameCoreDLL.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Final Release|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ GlobalOptimizations="TRUE"
+ EnableIntrinsicFunctions="TRUE"
+ OmitFramePointers="TRUE"
+ OptimizeForProcessor="3"
+
AdditionalIncludeDirectories=""Boost-1.32.0\include";Python24\include"
+
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CVGAMECOREDLL_EXPORTS;FINAL_RELEASE;CYBERFRONT"
+ MinimalRebuild="FALSE"
+ ExceptionHandling="TRUE"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="FALSE"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="CvGameCoreDLL.h"
+ ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="3"
+ CallingConvention="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="boost_python-vc71-mt-1_32.lib winmm.lib"
+ OutputFile="../Beyond the Sword(J)/Assets/CvGameCoreDLL.dll"
+ LinkIncremental="1"
+
AdditionalLibraryDirectories="Python24\libs;"boost-1.32.0\libs\""
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/CvGameCoreDLL.pdb"
+ SubSystem="2"
+ LargeAddressAware="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ ImportLibrary="$(OutDir)/CvGameCoreDLL.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Final Debug|Win32"
+ OutputDirectory="$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="2"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ OptimizeForProcessor="3"
+
AdditionalIncludeDirectories=""Boost-1.32.0\include";Python24\include"
+
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CVGAMECOREDLL_EXPORTS;CYBERFRONT"
+ MinimalRebuild="FALSE"
+ ExceptionHandling="TRUE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="2"
+ BufferSecurityCheck="FALSE"
+ EnableFunctionLevelLinking="TRUE"
+ RuntimeTypeInfo="TRUE"
+ UsePrecompiledHeader="3"
+ PrecompiledHeaderThrough="CvGameCoreDLL.h"
+ ProgramDataBaseFileName="$(IntDir)/vc70.pdb"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="FALSE"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ ShowIncludes="FALSE"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="boost_python-vc71-mt-1_32.lib winmm.lib
msvcprt.lib"
+ OutputFile="../Beyond the Sword(J)/Assets/CvGameCoreDLL.dll"
+ LinkIncremental="2"
+
AdditionalLibraryDirectories="Python24\libs;"boost-1.32.0\libs\""
+ IgnoreDefaultLibraryNames="msvcprtd.lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/CvGameCoreDLL_DEBUG.pdb"
+ SubSystem="2"
+ LargeAddressAware="2"
+ ImportLibrary="$(OutDir)/CvGameCoreDLL.lib"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\_precompile.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvArea.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvArtFileMgr.cpp">
+ </File>
+ <File
+ RelativePath=".\CvCity.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvCityAI.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvDeal.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvDiploParameters.cpp">
+ </File>
+ <File
+ RelativePath=".\CvDLLButtonPopup.cpp">
+ </File>
+ <File
+ RelativePath=".\CvDLLEntity.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvDLLPython.cpp">
+ </File>
+ <File
+ RelativePath=".\CvDllPythonEvents.cpp">
+ </File>
+ <File
+ RelativePath=".\CvDllTranslator.cpp">
+ </File>
+ <File
+ RelativePath=".\CvDLLWidgetData.cpp">
+ </File>
+ <File
+ RelativePath=".\CvEventReporter.cpp">
+ </File>
+ <File
+ RelativePath=".\CvFractal.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvGame.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvGameAI.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvGameCoreDLL.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvGameCoreUtils.cpp">
+ </File>
+ <File
+ RelativePath=".\CvGameInterface.cpp">
+ </File>
+ <File
+ RelativePath=".\CvGameTextMgr.cpp">
+ </File>
+ <File
+ RelativePath=".\CvGlobals.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvHallOfFameInfo.cpp">
+ </File>
+ <File
+ RelativePath=".\CvInfos.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvInfoWater.cpp">
+ </File>
+ <File
+ RelativePath=".\CvInitCore.cpp">
+ </File>
+ <File
+ RelativePath=".\CvMap.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvMapGenerator.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvMessageControl.cpp">
+ </File>
+ <File
+ RelativePath=".\CvMessageData.cpp">
+ </File>
+ <File
+ RelativePath=".\CvPlayer.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvPlayerAI.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvPlot.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvPlotGroup.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvPopupInfo.cpp">
+ </File>
+ <File
+ RelativePath=".\CvPopupReturn.cpp">
+ </File>
+ <File
+ RelativePath=".\CvRandom.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvReplayInfo.cpp">
+ </File>
+ <File
+ RelativePath=".\CvReplayMessage.cpp">
+ </File>
+ <File
+ RelativePath=".\CvSelectionGroup.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvSelectionGroupAI.cpp">
+ </File>
+ <File
+ RelativePath=".\CvStatistics.cpp">
+ </File>
+ <File
+ RelativePath=".\CvStructs.cpp">
+ </File>
+ <File
+ RelativePath=".\CvTalkingHeadMessage.cpp">
+ </File>
+ <File
+ RelativePath=".\CvTeam.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvTeamAI.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvUnit.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\CvUnitAI.cpp">
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Final Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="3"/>
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/319cnDifference/CvGameCoreDLL/CvGameTextMgr.cpp Fri May 7
07:24:35 2010
@@ -0,0 +1,16209 @@
+//---------------------------------------------------------------------------------------
+//
+// ***************** Civilization IV ********************
+//
+// FILE: CvGameTextMgr.cpp
+//
+// PURPOSE: Interfaces with GameText XML Files to manage the paths of art
files
+//
+//---------------------------------------------------------------------------------------
+// Copyright (c) 2004 Firaxis Games, Inc. All rights reserved.
+//---------------------------------------------------------------------------------------
+
+#include "CvGameCoreDLL.h"
+#include "CvGameTextMgr.h"
+#include "CvGameCoreUtils.h"
+#include "CvDLLUtilityIFaceBase.h"
+#include "CvDLLInterfaceIFaceBase.h"
+#include "CvDLLSymbolIFaceBase.h"
+#include "CvInfos.h"
+#include "CvXMLLoadUtility.h"
+#include "CvCity.h"
+#include "CvPlayerAI.h"
+#include "CvTeamAI.h"
+#include "CvGameAI.h"
+#include "CvSelectionGroup.h"
+#include "CvMap.h"
+#include "CvArea.h"
+#include "CvPlot.h"
+#include "CvPopupInfo.h"
+#include "FProfiler.h"
+#include "CyArgsList.h"
+#include "CvDLLPythonIFaceBase.h"
+
+int shortenID(int iId)
+{
+ return iId;
+}
+
+// For displaying Asserts and error messages
+static char* szErrorMsg;
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: GetInstance()
+//
+// PURPOSE: Get the instance of this class.
+//
+//----------------------------------------------------------------------------
+CvGameTextMgr& CvGameTextMgr::GetInstance()
+{
+ static CvGameTextMgr gs_GameTextMgr;
+ return gs_GameTextMgr;
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: CvGameTextMgr()
+//
+// PURPOSE: Constructor
+//
+//----------------------------------------------------------------------------
+CvGameTextMgr::CvGameTextMgr()
+{
+
+}
+
+CvGameTextMgr::~CvGameTextMgr()
+{
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: Initialize()
+//
+// PURPOSE: Allocates memory
+//
+//----------------------------------------------------------------------------
+void CvGameTextMgr::Initialize()
+{
+
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: DeInitialize()
+//
+// PURPOSE: Clears memory
+//
+//----------------------------------------------------------------------------
+void CvGameTextMgr::DeInitialize()
+{
+ for(int i=0;i<(int)m_apbPromotion.size();i++)
+ {
+ delete [] m_apbPromotion[i];
+ }
+}
+
+//----------------------------------------------------------------------------
+//
+// FUNCTION: Reset()
+//
+// PURPOSE: Accesses CvXMLLoadUtility to clean global text memory and
+// reload the XML files
+//
+//----------------------------------------------------------------------------
+void CvGameTextMgr::Reset()
+{
+ CvXMLLoadUtility pXML;
+ pXML.LoadGlobalText();
+}
+
+
+// Returns the current language
+int CvGameTextMgr::getCurrentLanguage()
+{
+ return gDLL->getCurrentLanguage();
+}
+
+void CvGameTextMgr::setYearStr(CvWString& szString, int iGameTurn, bool
bSave, CalendarTypes eCalendar, int iStartYear, GameSpeedTypes eSpeed)
+{
+ int iTurnYear = getTurnYearForGame(iGameTurn, iStartYear, eCalendar,
eSpeed);
+
+ if (iTurnYear < 0)
+ {
+ if (bSave)
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_BC_SAVE",
CvWString::format(L"%04d", -iTurnYear).GetCString());
+ }
+ else
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_BC", -(iTurnYear));
+ }
+ }
+ else if (iTurnYear > 0)
+ {
+ if (bSave)
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_AD_SAVE",
CvWString::format(L"%04d", iTurnYear).GetCString());
+ }
+ else
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_AD", iTurnYear);
+ }
+ }
+ else
+ {
+ if (bSave)
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_AD_SAVE", L"0001");
+ }
+ else
+ {
+ szString = gDLL->getText("TXT_KEY_TIME_AD", 1);
+ }
+ }
+}
+
+
+void CvGameTextMgr::setDateStr(CvWString& szString, int iGameTurn, bool
bSave, CalendarTypes eCalendar, int iStartYear, GameSpeedTypes eSpeed)
+{
+ CvWString szYearBuffer;
+ CvWString szWeekBuffer;
+
+ setYearStr(szYearBuffer, iGameTurn, bSave, eCalendar, iStartYear, eSpeed);
+
+ switch (eCalendar)
+ {
+ case CALENDAR_DEFAULT:
+ if (0 == (getTurnMonthForGame(iGameTurn + 1, iStartYear, eCalendar,
eSpeed) - getTurnMonthForGame(iGameTurn, iStartYear, eCalendar, eSpeed)) %
GC.getNumMonthInfos())
+ {
+ szString = szYearBuffer;
+ }
+ else
+ {
+ int iMonth = getTurnMonthForGame(iGameTurn, iStartYear, eCalendar,
eSpeed);
+ if (bSave)
+ {
+ szString = (szYearBuffer + "-" + GC.getMonthInfo((MonthTypes)(iMonth %
GC.getNumMonthInfos())).getDescription());
+ }
+ else
+ {
+ szString = (GC.getMonthInfo((MonthTypes)(iMonth %
GC.getNumMonthInfos())).getDescription() + CvString(", ") + szYearBuffer);
+ }
+ }
+ break;
+ case CALENDAR_YEARS:
+ case CALENDAR_BI_YEARLY:
+ szString = szYearBuffer;
+ break;
+
+ case CALENDAR_TURNS:
+ szString = gDLL->getText("TXT_KEY_TIME_TURN", (iGameTurn + 1));
+ break;
+
+ case CALENDAR_SEASONS:
+ if (bSave)
+ {
+ szString = (szYearBuffer + "-" +
GC.getSeasonInfo((SeasonTypes)(iGameTurn %
GC.getNumSeasonInfos())).getDescription());
+ }
+ else
+ {
+#ifdef CYBERFRONT // text: date
+ if (getCurrentLanguage() == 5) // japanese
+ szString = (szYearBuffer + CvString(", ") +
GC.getSeasonInfo((SeasonTypes)(iGameTurn %
GC.getNumSeasonInfos())).getDescription());
+ else
+ szString = (GC.getSeasonInfo((SeasonTypes)(iGameTurn %
GC.getNumSeasonInfos())).getDescription() + CvString(", ") + szYearBuffer);
+#else
+ szString = (GC.getSeasonInfo((SeasonTypes)(iGameTurn %
GC.getNumSeasonInfos())).getDescription() + CvString(", ") + szYearBuffer);
+#endif // CYBERFRONT
+ }
+ break;
+
+ case CALENDAR_MONTHS:
+ if (bSave)
+ {
+ szString = (szYearBuffer + "-" +
GC.getMonthInfo((MonthTypes)(iGameTurn %
GC.getNumMonthInfos())).getDescription());
+ }
+ else
+ {
+#ifdef CYBERFRONT // text: date
+ if (getCurrentLanguage() == 5) // japanese
+ szString = (szYearBuffer + CvString(", ") +
GC.getMonthInfo((MonthTypes)(iGameTurn %
GC.getNumMonthInfos())).getDescription());
+ else
+ szString = (GC.getMonthInfo((MonthTypes)(iGameTurn %
GC.getNumMonthInfos())).getDescription() + CvString(", ") + szYearBuffer);
+#else
+ szString = (GC.getMonthInfo((MonthTypes)(iGameTurn %
GC.getNumMonthInfos())).getDescription() + CvString(", ") + szYearBuffer);
+#endif // CYBERFRONT
+ }
+ break;
+
+ case CALENDAR_WEEKS:
+ szWeekBuffer = gDLL->getText("TXT_KEY_TIME_WEEK", ((iGameTurn %
GC.getDefineINT("WEEKS_PER_MONTHS")) + 1));
+
+ if (bSave)
+ {
+ szString = (szYearBuffer + "-" +
GC.getMonthInfo((MonthTypes)((iGameTurn /
GC.getDefineINT("WEEKS_PER_MONTHS")) %
GC.getNumMonthInfos())).getDescription() + "-" + szWeekBuffer);
+ }
+ else
+ {
+#ifdef CYBERFRONT // text: date
+ if (getCurrentLanguage() == 5) // japanese
+ szString = (szYearBuffer + ", " +
GC.getMonthInfo((MonthTypes)((iGameTurn /
GC.getDefineINT("WEEKS_PER_MONTHS")) %
GC.getNumMonthInfos())).getDescription() + ", " + szWeekBuffer);
+ else
+ szString = (szWeekBuffer + ", " +
GC.getMonthInfo((MonthTypes)((iGameTurn /
GC.getDefineINT("WEEKS_PER_MONTHS")) %
GC.getNumMonthInfos())).getDescription() + ", " + szYearBuffer);
+#else
+ szString = (szWeekBuffer + ", " +
GC.getMonthInfo((MonthTypes)((iGameTurn /
GC.getDefineINT("WEEKS_PER_MONTHS")) %
GC.getNumMonthInfos())).getDescription() + ", " + szYearBuffer);
+#endif // CYBERFRONT
+ }
+ break;
+
+ default:
+ FAssert(false);
+ }
+}
+
+
+void CvGameTextMgr::setTimeStr(CvWString& szString, int iGameTurn, bool
bSave)
+{
+ setDateStr(szString, iGameTurn, bSave, GC.getGameINLINE().getCalendar(),
GC.getGameINLINE().getStartYear(), GC.getGameINLINE().getGameSpeedType());
+}
+
+
+void CvGameTextMgr::setInterfaceTime(CvWString& szString, PlayerTypes
ePlayer)
+{
+ CvWString szTempBuffer;
+
+ if (GET_PLAYER(ePlayer).isGoldenAge())
+ {
+ szString.Format(L"%c(%d) ", gDLL->getSymbolID(GOLDEN_AGE_CHAR),
GET_PLAYER(ePlayer).getGoldenAgeTurns());
+ }
+ else
+ {
+ szString.clear();
+ }
+
+ setTimeStr(szTempBuffer, GC.getGameINLINE().getGameTurn(), false);
+ szString += CvWString(szTempBuffer);
+}
+
+
+void CvGameTextMgr::setGoldStr(CvWString& szString, PlayerTypes ePlayer)
+{
+ if (GET_PLAYER(ePlayer).getGold() < 0)
+ {
+ szString.Format(L"%c: " SETCOLR L"%d" SETCOLR,
GC.getCommerceInfo(COMMERCE_GOLD).getChar(),
TEXT_COLOR("COLOR_NEGATIVE_TEXT"), GET_PLAYER(ePlayer).getGold());
+ }
+ else
+ {
+ szString.Format(L"%c: %d", GC.getCommerceInfo(COMMERCE_GOLD).getChar(),
GET_PLAYER(ePlayer).getGold());
+ }
+
+ int iGoldRate = GET_PLAYER(ePlayer).calculateGoldRate();
+ if (iGoldRate < 0)
+ {
+ szString += gDLL->getText("TXT_KEY_MISC_NEG_GOLD_PER_TURN", iGoldRate);
+ }
+ else if (iGoldRate > 0)
+ {
+ szString += gDLL->getText("TXT_KEY_MISC_POS_GOLD_PER_TURN", iGoldRate);
+ }
+
+ if (GET_PLAYER(ePlayer).isStrike())
+ {
+ szString += gDLL->getText("TXT_KEY_MISC_STRIKE");
+ }
+}
+
+
+void CvGameTextMgr::setResearchStr(CvWString& szString, PlayerTypes
ePlayer)
+{
+ CvWString szTempBuffer;
+
+ szString = gDLL->getText("TXT_KEY_MISC_RESEARCH_STRING",
GC.getTechInfo(GET_PLAYER(ePlayer).getCurrentResearch()).getTextKeyWide());
+
+ if
(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getTechCount(GET_PLAYER(ePlayer).getCurrentResearch())
> 0)
+ {
+ szTempBuffer.Format(L" %d",
(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getTechCount(GET_PLAYER(ePlayer).getCurrentResearch())
+ 1));
+ szString+=szTempBuffer;
+ }
+
+ szTempBuffer.Format(L" (%d)",
GET_PLAYER(ePlayer).getResearchTurnsLeft(GET_PLAYER(ePlayer).getCurrentResearch(),
true));
+ szString+=szTempBuffer;
+}
+
+
+void CvGameTextMgr::setOOSSeeds(CvWString& szString, PlayerTypes ePlayer)
+{
+ if (GET_PLAYER(ePlayer).isHuman())
+ {
+ int iNetID = GET_PLAYER(ePlayer).getNetID();
+ if (gDLL->isConnected(iNetID))
+ {
+ szString = gDLL->getText("TXT_KEY_PLAYER_OOS",
gDLL->GetSyncOOS(iNetID), gDLL->GetOptionsOOS(iNetID));
+ }
+ }
+}
+
+void CvGameTextMgr::setNetStats(CvWString& szString, PlayerTypes ePlayer)
+{
+ if (ePlayer != GC.getGameINLINE().getActivePlayer())
+ {
+ if (GET_PLAYER(ePlayer).isHuman())
+ {
+ if (gDLL->getInterfaceIFace()->isNetStatsVisible())
+ {
+ int iNetID = GET_PLAYER(ePlayer).getNetID();
+ if (gDLL->isConnected(iNetID))
+ {
+ szString = gDLL->getText("TXT_KEY_MISC_NUM_MS",
gDLL->GetLastPing(iNetID));
+ }
+ else
+ {
+ szString = gDLL->getText("TXT_KEY_MISC_DISCONNECTED");
+ }
+ }
+ }
+ else
+ {
+ szString = gDLL->getText("TXT_KEY_MISC_AI");
+ }
+ }
+}
+
+
+void CvGameTextMgr::setMinimizePopupHelp(CvWString& szString, const
CvPopupInfo & info)
+{
+ CvCity* pCity;
+ UnitTypes eTrainUnit;
+ BuildingTypes eConstructBuilding;
+ ProjectTypes eCreateProject;
+ ReligionTypes eReligion;
+ CivicTypes eCivic;
+
+ switch (info.getButtonPopupType())
+ {
+ case BUTTONPOPUP_CHOOSEPRODUCTION:
+ pCity =
GET_PLAYER(GC.getGameINLINE().getActivePlayer()).getCity(info.getData1());
+ if (pCity != NULL)
+ {
+ eTrainUnit = NO_UNIT;
+ eConstructBuilding = NO_BUILDING;
+ 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;
+ }
+
+ if (eTrainUnit != NO_UNIT)
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_UNIT",
GC.getUnitInfo(eTrainUnit).getTextKeyWide(), pCity->getNameKey());
+ }
+ else if (eConstructBuilding != NO_BUILDING)
+ {
+ szString +=
gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_BUILDING",
GC.getBuildingInfo(eConstructBuilding).getTextKeyWide(),
pCity->getNameKey());
+ }
+ else if (eCreateProject != NO_PROJECT)
+ {
+ szString +=
gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION_PROJECT",
GC.getProjectInfo(eCreateProject).getTextKeyWide(), pCity->getNameKey());
+ }
+ else
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_PRODUCTION",
pCity->getNameKey());
+ }
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGERELIGION:
+ eReligion = ((ReligionTypes)(info.getData1()));
+ if (eReligion != NO_RELIGION)
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHANGE_RELIGION",
GC.getReligionInfo(eReligion).getTextKeyWide());
+ }
+ break;
+
+ case BUTTONPOPUP_CHOOSETECH:
+ if (info.getData1() > 0)
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_TECH_FREE");
+ }
+ else
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHOOSE_TECH");
+ }
+ break;
+
+ case BUTTONPOPUP_CHANGECIVIC:
+ eCivic = ((CivicTypes)(info.getData2()));
+ if (eCivic != NO_CIVIC)
+ {
+ szString += gDLL->getText("TXT_KEY_MINIMIZED_CHANGE_CIVIC",
GC.getCivicInfo(eCivic).getTextKeyWide());
+ }
+ break;
+ }
+}
+
+void CvGameTextMgr::setEspionageMissionHelp(CvWStringBuffer &szBuffer,
const CvUnit* pUnit)
+{
+ if (pUnit->isSpy())
+ {
+ PlayerTypes eOwner = pUnit->plot()->getOwnerINLINE();
+ if (NO_PLAYER != eOwner && GET_PLAYER(eOwner).getTeam() !=
pUnit->getTeam())
+ {
+ if (!pUnit->canEspionage(pUnit->plot()))
+ {
+ szBuffer.append(NEWLINE);
+ szBuffer.append(gDLL->getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE"));
+
+ if (pUnit->hasMoved() || pUnit->isMadeAttack())
+ {
+
szBuffer.append(gDLL->getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE_REASON_MOVED"));
+ }
+ else if (!pUnit->isInvisible(GET_PLAYER(eOwner).getTeam(), false))
+ {
+
szBuffer.append(gDLL->getText("TXT_KEY_UNIT_HELP_NO_ESPIONAGE_REASON_VISIBLE",
GET_PLAYER(eOwner).getNameKey()));
+ }
+ }
+ else if (pUnit->getFortifyTurns() > 0)
+ {
+ int iModifier = -(pUnit->getFortifyTurns() *
GC.getDefineINT("ESPIONAGE_EACH_TURN_UNIT_COST_DECREASE"));
+ if (0 != iModifier)
+ {
+ szBuffer.append(NEWLINE);
+ szBuffer.append(gDLL->getText("TXT_KEY_ESPIONAGE_COST", iModifier));
+ }
+ }
+ }
+ }
+}
+
+
+void CvGameTextMgr::setUnitHelp(CvWStringBuffer &szString, const CvUnit*
pUnit, bool bOneLine, bool bShort)
+{
+ PROFILE_FUNC();
+
+ CvWString szTempBuffer;
+ BuildTypes eBuild;
+ int iCurrMoves;
+ int iI;
+ bool bFirst;
+ bool bShift = gDLL->shiftKey();
+ bool bAlt = gDLL->altKey();
+
+ szTempBuffer.Format(SETCOLR L"%s" ENDCOLR, TEXT_COLOR("COLOR_UNIT_TEXT"),
pUnit->getName().GetCString());
+ szString.append(szTempBuffer);
+
+ szString.append(L", ");
+
+ // Sanguo Mod Hero, start, added by poyuzhe 01.15.09
+ // test Legion member status
+ if (pUnit->getLegionHero() != NO_HERO)
+ {
+ szTempBuffer = (gDLL->getText("INTERFACE_PANE_LEGION_NAME",
GC.getHeroInfo(pUnit->getLegionHero()).getDescription()));
+ szString.append(szTempBuffer);
+
+ if (pUnit->getHeroType() != NO_HERO)
+ {
+ szTempBuffer = gDLL->getText("INTERFACE_PANE_CORE_TROOP");
+ szString.append(szTempBuffer);
+ }
+
+ if (pUnit->getLeaderHero() != NO_HERO)
+ {
+ szString.append(L", ");
+ szTempBuffer = gDLL->getText("INTERFACE_PANE_ARMY_NAME",
GC.getHeroInfo(pUnit->getLeaderHero()).getDescription());
+ szString.append(szTempBuffer);
+
+ if
(GC.getGameINLINE().getHeroCoreTroop(pUnit->getLeaderHero()) ==
pUnit->getID())
+ {
+ szTempBuffer =
gDLL->getText("INTERFACE_PANE_LEADER_TROOP");
+ szString.append(szTempBuffer);
+ }
+ }
+
+ szString.append(L", ");
+ }
+ // Sanguo Mod Hero, end
+
+ if (pUnit->getDomainType() == DOMAIN_AIR)
+ {
+ if (pUnit->airBaseCombatStr() > 0)
+ {
+ if (pUnit->isFighting())
+ {
+ szTempBuffer.Format(L"?/%d%c, ", pUnit->airBaseCombatStr(),
gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ else if (pUnit->isHurt())
+ {
+ szTempBuffer.Format(L"%.1f/%d%c, ",
(((float)(pUnit->airBaseCombatStr() * pUnit->currHitPoints())) /
((float)(pUnit->maxHitPoints()))), pUnit->airBaseCombatStr(),
gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ else
+ {
+ szTempBuffer.Format(L"%d%c, ", pUnit->airBaseCombatStr(),
gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ szString.append(szTempBuffer);
+ }
+ }
+ else
+ {
+ if (pUnit->canFight())
+ {
+ if (pUnit->isFighting())
+ {
+ szTempBuffer.Format(L"?/%d%c, ", pUnit->baseCombatStr(),
gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ else if (pUnit->isHurt())
+ {
+ szTempBuffer.Format(L"%.1f/%d%c, ", (((float)(pUnit->baseCombatStr() *
pUnit->currHitPoints())) / ((float)(pUnit->maxHitPoints()))),
pUnit->baseCombatStr(), gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ else
+ {
+ szTempBuffer.Format(L"%d%c, ", pUnit->baseCombatStr(),
gDLL->getSymbolID(STRENGTH_CHAR));
+ }
+ szString.append(szTempBuffer);
+ }
+ }
+
+ iCurrMoves = ((pUnit->movesLeft() / GC.getMOVE_DENOMINATOR()) +
(((pUnit->movesLeft() % GC.getMOVE_DENOMINATOR()) > 0) ? 1 : 0));
+ if ((pUnit->baseMoves() == iCurrMoves) || (pUnit->getTeam() !=
GC.getGameINLINE().getActiveTeam()))
+ {
+ szTempBuffer.Format(L"%d%c", pUnit->baseMoves(),
gDLL->getSymbolID(MOVES_CHAR));
+ }
+ else
+ {
+ szTempBuffer.Format(L"%d/%d%c", iCurrMoves, pUnit->baseMoves(),
gDLL->getSymbolID(MOVES_CHAR));
+ }
+ szString.append(szTempBuffer);
+
+ if (pUnit->airRange() > 0)
+ {
+ szString.append(gDLL->getText("TXT_KEY_UNIT_HELP_AIR_RANGE",
pUnit->airRange()));
+ }
+
+ eBuild = pUnit->getBuildType();
+
+ if (eBuild != NO_BUILD)
+ {
+ szString.append(L", ");
+ szTempBuffer.Format(L"%s (%d)",
GC.getBuildInfo(eBuild).getDescription(),
pUnit->plot()->getBuildTurnsLeft(eBuild, 0, 0));
+ szString.append(szTempBuffer);
+ }
+
+ if (pUnit->getImmobileTimer() > 0)
+ {
+ szString.append(L", ");
+ szString.append(gDLL->getText("TXT_KEY_UNIT_HELP_IMMOBILE",
pUnit->getImmobileTimer()));
+ }
+
+ /*if (!bOneLine)
+ {
+ if (pUnit->getUnitCombatType() != NO_UNITCOMBAT)
+ {
+ szTempBuffer.Format(L" (%s)",
GC.getUnitCombatInfo(pUnit->getUnitCombatType()).getDescription());
+ szString += szTempBuffer;
+ }
+ }*/
+
+ if (GC.getGameINLINE().isDebugMode() && !bAlt && !bShift)
+ {
+ FAssertMsg(pUnit->AI_getUnitAIType() != NO_UNITAI, "pUnit's AI type
expected to != NO_UNITAI");
+ szTempBuffer.Format(L" (%s)",
GC.getUnitAIInfo(pUnit->AI_getUnitAIType()).getDescription());
+ szString.append(szTempBuffer);
+ }
+
+ if ((pUnit->getTeam() == GC.getGameINLINE().getActiveTeam()) ||
GC.getGameINLINE().isDebugMode())
+ {
+ if ((pUnit->getExperience() > 0) && !(pUnit->isFighting()))
+ {
+ szString.append(gDLL->getText("TXT_KEY_UNIT_HELP_LEVEL",
pUnit->getExperience(), pUnit->experienceNeeded()));
+ }
+ }
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.05.09
+ // commented out 1 line
+// if (pUnit->getOwnerINLINE() != GC.getGameINLINE().getActivePlayer()
&& !pUnit->isAnimal() && !pUnit->getUnitInfo().isHiddenNationality())
+ if (pUnit->getOwnerINLINE() != GC.getGameINLINE().getActivePlayer()
&& !pUnit->isAnimal() && !pUnit->isHiddenNationality())
+ // Sanguo Mod Hero, end
+ {
+ szString.append(L", ");
+ szTempBuffer.Format(SETCOLR L"%s" ENDCOLR,
GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorR(),
GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorG(),
GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorB(),
GET_PLAYER(pUnit->getOwnerINLINE()).getPlayerTextColorA(),
GET_PLAYER(pUnit->getOwnerINLINE()).getName());
+ szString.append(szTempBuffer);
+ }
+
+ // Sanguo Mod Hero, start, added by poyuzhe 02.15.09
+ bool bHasLeadsToPro = false;
+
+ if (pUnit->getHeroType() != NO_HERO)
+ {
+ if ((pUnit->getTeam() == GC.getGameINLINE().getActiveTeam()) ||
GC.getGameINLINE().isDebugMode())
+ {
+ HeroTypes eHero = pUnit->getHeroType();
+
+ if (pUnit->getLegionHero() == NO_HERO &&
(GC.getGameINLINE().getHeroExperience(eHero) > 0) && !(pUnit->isFighting()))
+ {
+ szString.append(gDLL->getText("TXT_KEY_UNIT_HELP_LEVEL",
(int)GC.getGameINLINE().getHeroExperience(eHero),
GC.getGameINLINE().heroExperienceNeeded(eHero)));
+ }
+
+ szString.append(L", ");
+
+ int iLoopLevel = 0;
+ int iLastLevel = 0;
+ UnitCombatTypes eUnitCombat = NO_UNITCOMBAT;
+ for (iI = 0; iI < 5; ++iI)
+ {
+ if (iI == 0)
+ {
+ eUnitCombat = UNITCOMBAT_MELEE;
+ }
+ else if (iI == 1)
+ {
+ eUnitCombat = UNITCOMBAT_MOUNTED;
+ }
+ else if (iI == 2)
+ {
+ eUnitCombat = UNITCOMBAT_ARCHER;
+ }
+ else if (iI == 3)
+ {
+ eUnitCombat = UNITCOMBAT_SIEGE;
+ }
+ else if (iI == 4)
+ {
+ eUnitCombat = UNITCOMBAT_NAVAL;
+ }
+
+ iLoopLevel = GC.getGameINLINE().getHeroUnitCombatLevel(eHero,
eUnitCombat);
+ //szTempBuffer.Format(L"<img=%S size=16></img>",
GC.getUnitCombatInfo(eUnitCombat).getButton());
+ //szString.append(szTempBuffer);
+ if (iLoopLevel == 1)
+ {
+ szString.append(CvWString::format(L"D"));
+ }
+ else if (iLoopLevel == 2)
+ {
+ szString.append(CvWString::format(L"C"));
+ }
+ else if (iLoopLevel == 3)
+ {
+ szString.append(CvWString::format(L"B"));
+ }
+ else if (iLoopLevel == 4)
+ {
+ szString.append(CvWString::format(L"A"));
+ }
+ else if (iLoopLevel == 5)
+ {
+ szString.append(CvWString::format(L"S"));
+ }
+ else if (iLoopLevel <= 0)
+ {
+ if (iI == 0 || iLastLevel <= 0)
+ {
+ szString.append(CvWString::format(L"/ "));
+ }
+ else
+ {
+ szString.append(CvWString::format(L" / "));
+ }
+ }
+ iLastLevel = iLoopLevel;
+ }
+
+ szString.append(L", ");
+ if (pUnit->getLegionHero() == NO_HERO)
+ {
+ for (iI = 0; iI < GC.getNumPromotionInfos(); ++iI)
+ {
+ if (GC.getGameINLINE().getHeroPromotionStatus(eHero,
(PromotionTypes)iI) == 1 ||
GC.getGameINLINE().getHeroPromotionStatus(eHero, (PromotionTypes)iI) == 2)
+ {
+ bHasLeadsToPro = false;
+ for (int iJ = 0; iJ < GC.getNumPromotionInfos();
++iJ)
+ {
+ if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqPromotion() == iI)
+ {
+ if
(GC.getGameINLINE().getHeroPromotionStatus(eHero, (PromotionTypes)iJ) == 1 |
| GC.getGameINLINE().getHeroPromotionStatus(eHero, (PromotionTypes)iJ) == 2)
+ {
+ bHasLeadsToPro = true;
+ break;
+ }
+ }
+ }
+
+ if (!bHasLeadsToPro)
+ {
+ szTempBuffer.Format(L"<img=%S size=20></img>",
GC.getPromotionInfo((PromotionTypes)iI).getButton());
+ szString.append(szTempBuffer);
+ }
+ }
+ }
+ }
+ }
+ }
+ // Sanguo Mod Hero, end
+
+ for (iI = 0; iI < GC.getNumPromotionInfos(); ++iI)
+ {
+ if (pUnit->isHasPromotion((PromotionTypes)iI))
+ {
+ // Sanguo Mod Interface, start, by poyuzhe 09.18.09
+ bHasLeadsToPro = false;
+ for (int iJ = 0; iJ < GC.getNumPromotionInfos(); ++iJ)
+ {
+ if (pUnit->isHasPromotion((PromotionTypes)iJ))
+ {
+ if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqPromotion() == iI)
+ {
+ bHasLeadsToPro = true;
+ break;
+ }
+ else if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqOrPromotion1() == iI)
+ {
+ if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqOrPromotion2() == -1 &&
GC.getPromotionInfo((PromotionTypes)iJ).getPrereqPromotion() == -1)
+ {
+ bHasLeadsToPro = true;
+ break;
+ }
+ }
+ else if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqOrPromotion2() == iI)
+ {
+ if
(GC.getPromotionInfo((PromotionTypes)iJ).getPrereqOrPromotion1() == -1 &&
GC.getPromotionInfo((PromotionTypes)iJ).getPrereqOrPromotion1() == -1)
+ {
+ bHasLeadsToPro = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!bHasLeadsToPro)
+ {
+ szTempBuffer.Format(L"<img=%S size=20></img>",
GC.getPromotionInfo((PromotionTypes)iI).getButton());
+ szString.append(szTempBuffer);
+ }
+ // Sanguo Mod Interface, end
+ }
+ }
+ if (bAlt && (gDLL->getChtLvl() > 0))
+ {
+ CvSelectionGroup* eGroup = pUnit->getGroup();
+ if (eGroup != NULL)
+ {
+ if (pUnit->isGroupHead())
+ szString.append(CvWString::format(L"\nLeading "));
+ else
+ szString.append(L"\n");
+
+ szTempBuffer.Format(L"Group(%d), %d units", eGroup->getID(),
eGroup->getNumUnits());
+ szString.append(szTempBuffer);
+ }
+ }
+
+ if (!bOneLine)
+ {
+ setEspionageMissionHelp(szString, pUnit);
+
+ if (pUnit->cargoSpace() > 0)
+ {
+ if (pUnit->getTeam() == GC.getGameINLINE().getActiveTeam())
+ {
+ szTempBuffer = NEWLINE +
gDLL->getText("TXT_KEY_UNIT_HELP_CARGO_SPACE", pUnit->getCargo(),
pUnit->cargoSpace());
+ }
+ else
+ {
+ szTempBuffer = NEWLINE + gDLL->getText("TXT_KEY_UNIT_CARGO_SPACE",
pUnit->cargoSpace());
+ }
+ szString.append(szTempBuffer);
+
+ if (pUnit->specialCargo() != NO_SPECIALUNIT)
+ {
+ szString.append(gDLL->getText("TXT_KEY_UNIT_CARRIES",
GC.getSpecialUnitInfo(pUnit->specialCargo()).getTextKeyWide()));
+ }
+ }
+
+ if (pUnit->fortifyModifier() != 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_HELP_FORTIFY_BONUS",
pUnit->fortifyModifier()));
+ }
+
+ if (!bShort)
+ {
+ if (pUnit->nukeRange() >= 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_CAN_NUKE"));
+ }
+
+ if (pUnit->alwaysInvisible())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_INVISIBLE_ALL"));
+ }
+ else if (pUnit->getInvisibleType() != NO_INVISIBLE)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_INVISIBLE_MOST"));
+ }
+
+ for (iI = 0; iI < pUnit->getNumSeeInvisibleTypes(); ++iI)
+ {
+ if (pUnit->getSeeInvisibleType(iI) != pUnit->getInvisibleType())
+ {
+ // Sanguo Mod Hero, start, added by poyuzhe 08.16.09
+ if (pUnit->getSeeInvisibleType(iI) != NO_INVISIBLE)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_SEE_INVISIBLE",
GC.getInvisibleInfo(pUnit->getSeeInvisibleType(iI)).getTextKeyWide()));
+ }
+ // Sanguo Mod Hero, end
+ }
+ }
+
+ if (pUnit->canMoveImpassable())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_CAN_MOVE_IMPASSABLE"));
+ }
+ }
+
+ if (pUnit->maxFirstStrikes() > 0)
+ {
+ if (pUnit->firstStrikes() == pUnit->maxFirstStrikes())
+ {
+ if (pUnit->firstStrikes() == 1)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_ONE_FIRST_STRIKE"));
+ }
+ else
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_NUM_FIRST_STRIKES",
pUnit->firstStrikes()));
+ }
+ }
+ else
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_FIRST_STRIKE_CHANCES",
pUnit->firstStrikes(), pUnit->maxFirstStrikes()));
+ }
+ }
+
+ if (pUnit->immuneToFirstStrikes())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_IMMUNE_FIRST_STRIKES"));
+ }
+
+ if (!bShort)
+ {
+ if (pUnit->noDefensiveBonus())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_NO_DEFENSE_BONUSES"));
+ }
+
+ if (pUnit->flatMovementCost())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_FLAT_MOVEMENT"));
+ }
+
+ if (pUnit->ignoreTerrainCost())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_UNIT_IGNORE_TERRAIN"));
+ }
+
+ if (pUnit->isBlitz())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_BLITZ_TEXT"));
+ }
+
+ if (pUnit->isAmphib())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_AMPHIB_TEXT"));
+ }
+
+ if (pUnit->isRiver())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_RIVER_ATTACK_TEXT"));
+ }
+
+ if (pUnit->isEnemyRoute())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_ENEMY_ROADS_TEXT"));
+ }
+
+ if (pUnit->isAlwaysHeal())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_ALWAYS_HEAL_TEXT"));
+ }
+
+ if (pUnit->isHillsDoubleMove())
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_HILLS_MOVE_TEXT"));
+ }
+
+ for (iI = 0; iI < GC.getNumTerrainInfos(); ++iI)
+ {
+ if (pUnit->isTerrainDoubleMove((TerrainTypes)iI))
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT",
GC.getTerrainInfo((TerrainTypes) iI).getTextKeyWide()));
+ }
+ }
+
+ for (iI = 0; iI < GC.getNumFeatureInfos(); ++iI)
+ {
+ if (pUnit->isFeatureDoubleMove((FeatureTypes)iI))
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_DOUBLE_MOVE_TEXT",
GC.getFeatureInfo((FeatureTypes) iI).getTextKeyWide()));
+ }
+ }
+
+ if (pUnit->getExtraVisibilityRange() != 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_VISIBILITY_TEXT",
pUnit->getExtraVisibilityRange()));
+ }
+
+ if (pUnit->getExtraMoveDiscount() != 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_MOVE_DISCOUNT_TEXT",
-(pUnit->getExtraMoveDiscount())));
+ }
+
+ if (pUnit->getExtraEnemyHeal() != 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT",
pUnit->getExtraEnemyHeal()) +
gDLL->getText("TXT_KEY_PROMOTION_ENEMY_LANDS_TEXT"));
+ }
+
+ if (pUnit->getExtraNeutralHeal() != 0)
+ {
+ szString.append(NEWLINE);
+ szString.append(gDLL->getText("TXT_KEY_PROMOTION_HEALS_EXTRA_TEXT",
pUnit->getExtraNeutralHeal()) +
gDLL->getText("TXT_KEY_PROMOTION_NEUTRAL_LANDS_TEXT"));
+ }
+
+ if (pUnit->getExtraFriendlyHeal() != 0)
+ {
+ szString.append(NEWLINE);
***The diff for this file has been truncated for email.***
=======================================
--- /dev/null
+++ /trunk/319cnDifference/CvGameCoreDLL/CvInitCore.cpp Fri May 7 07:24:35
2010
@@ -0,0 +1,2073 @@
+// game.cpp
+
+#include "CvGameCoreDLL.h"
+#include "CvInitCore.h"
+#include "CvDLLPythonIFaceBase.h"
+#include "CyArgsList.h"
+#include "CvInfos.h"
+#include "CvGlobals.h"
+#include "CvDLLUtilityIFaceBase.h"
+#include "CvGameAI.h"
+#include "CvGameCoreUtils.h"
+
+// Public Functions...
+
+CvInitCore::CvInitCore()
+{
+ m_abOptions = new bool[NUM_GAMEOPTION_TYPES];
+ m_abMPOptions = new bool[NUM_MPOPTION_TYPES];
+ m_abForceControls = new bool[NUM_FORCECONTROL_TYPES];
+
+ m_aszLeaderName = new CvWString[MAX_PLAYERS];
+ m_aszCivDescription = new CvWString[MAX_PLAYERS];
+ m_aszCivShortDesc = new CvWString[MAX_PLAYERS];
+ m_aszCivAdjective = new CvWString[MAX_PLAYERS];
+ m_aszCivPassword = new CvWString[MAX_PLAYERS];
+ m_aszEmail = new CvString[MAX_PLAYERS];
+ m_aszSmtpHost = new CvString[MAX_PLAYERS];
+
+ m_abWhiteFlag = new bool[MAX_PLAYERS];
+ m_aszFlagDecal = new CvWString[MAX_PLAYERS];
+
+ m_aeCiv = new CivilizationTypes[MAX_PLAYERS];
+ m_aeLeader = new LeaderHeadTypes[MAX_PLAYERS];
+ m_aeTeam = new TeamTypes[MAX_PLAYERS];
+ m_aeHandicap = new HandicapTypes[MAX_PLAYERS];
+ m_aeColor = new PlayerColorTypes[MAX_PLAYERS];
+ m_aeArtStyle = new ArtStyleTypes[MAX_PLAYERS];
+
+ // Slot data
+ m_aeSlotStatus = new SlotStatus[MAX_PLAYERS];
+ m_aeSlotClaim = new SlotClaim[MAX_PLAYERS];
+
+ // Civ flags
+ m_abPlayableCiv = new bool[MAX_PLAYERS];
+ m_abMinorNationCiv = new bool[MAX_PLAYERS];
+
+ // Unsaved player data
+ m_aiNetID = new int[MAX_PLAYERS];
+ m_abReady = new bool[MAX_PLAYERS];
+
+ m_aszPythonCheck = new CvString[MAX_PLAYERS];
+ m_aszXMLCheck = new CvString[MAX_PLAYERS];
+
+ m_aeCustomMapOptions = NULL;
+ m_abVictories = NULL;
+
+ reset(NO_GAMEMODE);
+}
+
+
+CvInitCore::~CvInitCore()
+{
+ uninit();
+
+ SAFE_DELETE_ARRAY(m_abOptions);
+ SAFE_DELETE_ARRAY(m_abMPOptions);
+ SAFE_DELETE_ARRAY(m_abForceControls);
+ SAFE_DELETE_ARRAY(m_aszLeaderName);
+ SAFE_DELETE_ARRAY(m_aszCivDescription);
+ SAFE_DELETE_ARRAY(m_aszCivShortDesc);
+ SAFE_DELETE_ARRAY(m_aszCivAdjective);
+ SAFE_DELETE_ARRAY(m_aszCivPassword);
+ SAFE_DELETE_ARRAY(m_aszEmail);
+ SAFE_DELETE_ARRAY(m_aszSmtpHost);
+ SAFE_DELETE_ARRAY(m_abWhiteFlag);
+ SAFE_DELETE_ARRAY(m_aszFlagDecal);
+ SAFE_DELETE_ARRAY(m_aeCiv);
+ SAFE_DELETE_ARRAY(m_aeLeader);
+ SAFE_DELETE_ARRAY(m_aeTeam);
+ SAFE_DELETE_ARRAY(m_aeHandicap);
+ SAFE_DELETE_ARRAY(m_aeColor);
+ SAFE_DELETE_ARRAY(m_aeArtStyle);
+ SAFE_DELETE_ARRAY(m_aeSlotStatus);
+ SAFE_DELETE_ARRAY(m_aeSlotClaim);
+ SAFE_DELETE_ARRAY(m_abPlayableCiv);
+ SAFE_DELETE_ARRAY(m_abMinorNationCiv);
+ SAFE_DELETE_ARRAY(m_aiNetID);
+ SAFE_DELETE_ARRAY(m_abReady);
+ SAFE_DELETE_ARRAY(m_aszPythonCheck);
+ SAFE_DELETE_ARRAY(m_aszXMLCheck);
+}
+
+void CvInitCore::init(GameMode eMode)
+{
+ //--------------------------------
+ // Init saved data
+ reset(eMode);
+}
+
+void CvInitCore::uninit()
+{
+ clearCustomMapOptions();
+ clearVictories();
+}
+
+
+// FUNCTION: reset()
+// Initializes data members that are serialized.
+void CvInitCore::reset(GameMode eMode)
+{
+ //--------------------------------
+ // Uninit class
+ uninit();
+
+ resetGame();
+ resetPlayers();
+
+ setMode(eMode);
+
+ if (getMode() != NO_GAMEMODE)
+ {
+ setDefaults();
+ }
+}
+
+void CvInitCore::setDefaults()
+{
+ for (int i = 0; i < NUM_GAMEOPTION_TYPES; ++i)
+ {
+ m_abOptions[i] = GC.getGameOptionInfo((GameOptionTypes)i).getDefault();
+ }
+ for (int i = 0; i < NUM_MPOPTION_TYPES; ++i)
+ {
+ m_abMPOptions[i] =
GC.getMPOptionInfo((MultiplayerOptionTypes)i).getDefault();
+ }
+}
+
+
+bool CvInitCore::getHuman(PlayerTypes eID) const
+{
+ if (getSlotStatus(eID) == SS_TAKEN)
+ {
+ return true;
+ }
+ else if (getSlotStatus(eID) == SS_OPEN)
+ {
+ return ( gDLL->isGameActive() || getHotseat() || getPitboss() ||
getPbem());
+ }
+ else
+ {
+ return false;
+ }
+}
+
+int CvInitCore::getNumHumans() const
+{
+ int iNumHumans = 0;
+ for (int i = 0; i < MAX_CIV_PLAYERS; ++i)
+ {
+ if (getHuman((PlayerTypes)i))
+ {
+ ++iNumHumans;
+ }
+ }
+ return iNumHumans;
+}
+
+int CvInitCore::getNumDefinedPlayers() const
+{
+ int iCount = 0;
+ for (int i = 0; i < MAX_CIV_PLAYERS; ++i)
+ {
+ if ((getCiv((PlayerTypes)i) != NO_CIVILIZATION) &&
(getLeader((PlayerTypes)i) != NO_LEADER))
+ {
+ iCount++;
+ }
+ }
+ return iCount;
+}
+
+bool CvInitCore::getMultiplayer() const
+{
+ switch (getType())
+ {
+ case GAME_MP_NEW:
+ case GAME_MP_LOAD:
+ case GAME_MP_SCENARIO:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool CvInitCore::getNewGame() const
+{
+ switch (getType())
+ {
+ case GAME_SP_NEW:
+ case GAME_SP_SCENARIO:
+ case GAME_MP_NEW:
+ case GAME_MP_SCENARIO:
+ case GAME_HOTSEAT_NEW:
+ case GAME_HOTSEAT_SCENARIO:
+ case GAME_PBEM_NEW:
+ case GAME_PBEM_SCENARIO:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool CvInitCore::getSavedGame() const
+{
+ switch (getType())
+ {
+ case GAME_SP_LOAD:
+ case GAME_MP_LOAD:
+ case GAME_HOTSEAT_LOAD:
+ case GAME_PBEM_LOAD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool CvInitCore::getPitboss() const
+{
+ return (getMode() == GAMEMODE_PITBOSS);
+}
+
+bool CvInitCore::getHotseat() const
+{
+ return ( (getType() == GAME_HOTSEAT_NEW) || (getType() ==
GAME_HOTSEAT_SCENARIO) || (getType() == GAME_HOTSEAT_LOAD) );
+}
+
+
+bool CvInitCore::getPbem() const
+{
+ return ( (getType() == GAME_PBEM_NEW) || (getType() ==
GAME_PBEM_SCENARIO) || (getType() == GAME_PBEM_LOAD) );
+}
+
+
+bool CvInitCore::checkBounds( int iValue, int iLower, int iUpper ) const
+{
+ if (iValue >= iLower)
+ {
+ if (iValue < iUpper)
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+bool CvInitCore::getSlotVacant(PlayerTypes eID) const
+{
+ FASSERT_BOUNDS(0, MAX_CIV_PLAYERS, eID, "CvInitCore::getSlotVacant");
+
+ bool bRetVal = false;
+
+ if ( checkBounds(eID, 0, MAX_CIV_PLAYERS) )
+ {
+ bool bTakeoverAI = getMPOption(MPOPTION_TAKEOVER_AI);
+ SlotStatus eStatus = getSlotStatus(eID);
+
+ // Check the status of this slot
+ if ( (eStatus == SS_OPEN) || (bTakeoverAI && (eStatus == SS_COMPUTER)) )
+ {
+ bRetVal = ( getSlotClaim(eID) != SLOTCLAIM_ASSIGNED );
+ }
+ }
+
+ return bRetVal;
+}
+
+PlayerTypes CvInitCore::getAvailableSlot()
+{
+ int i;
+
+ // Get the next ID available ID
+ // First check for open slots only
+ for (i = 0; i < MAX_CIV_PLAYERS; ++i)
+ {
+ PlayerTypes eID = (PlayerTypes)i;
+ if ( (getSlotClaim(eID) == SLOTCLAIM_UNASSIGNED) && (getSlotStatus(eID)
== SS_OPEN) )
+ {
+ setSlotClaim(eID, SLOTCLAIM_ASSIGNED);
+ return eID;
+ }
+ }
+
+ // That didn't work, check to see if we can assign computer slots
+ if (getMPOption(MPOPTION_TAKEOVER_AI))
+ {
+ for (i = 0; i < MAX_CIV_PLAYERS; ++i)
+ {
+ PlayerTypes eID = (PlayerTypes)i;
+ if ( (getSlotClaim(eID) == SLOTCLAIM_UNASSIGNED) && (getSlotStatus(eID)
== SS_COMPUTER) )
+ {
+ setSlotClaim(eID, SLOTCLAIM_ASSIGNED);
+ return eID;
+ }
+ }
+ }
+
+ // None available at all...
+ return NO_PLAYER;
+}
+
+void CvInitCore::reassignPlayer(PlayerTypes eOldID, PlayerTypes eNewID)
+{
+ FASSERT_BOUNDS(0, MAX_CIV_PLAYERS, eOldID, "CvInitCore::reassignPlayer
(eOldID)");
+ FASSERT_BOUNDS(0, MAX_CIV_PLAYERS, eNewID, "CvInitCore::reassignPlayer
(eNewID)");
+
+ if ( checkBounds(eOldID, 0, MAX_CIV_PLAYERS) && checkBounds(eNewID, 0,
MAX_CIV_PLAYERS) )
+ {
+ // *** SAVE TARGET SLOT DETAILS TEMPORARILY
+ // Temp civ details
+ CvWString szLeaderName = m_aszLeaderName[eNewID];
+ CvWString szCivDescription = m_aszCivDescription[eNewID];
+ CvWString szCivShortDesc = m_aszCivShortDesc[eNewID];
+ CvWString szCivAdjective = m_aszCivAdjective[eNewID];
+ CvWString szCivPassword = m_aszCivPassword[eNewID];
+ CvString szEmail = m_aszEmail[eNewID];
+ CvString szSmtpHost = m_aszSmtpHost[eNewID];
+ bool bWhiteFlag = m_abWhiteFlag[eNewID];
+ CvWString szFlagDecal = m_aszFlagDecal[eNewID];
+ CivilizationTypes eCiv = m_aeCiv[eNewID];
+ LeaderHeadTypes eLeader = m_aeLeader[eNewID];
+ TeamTypes eTeam = m_aeTeam[eNewID];
+ HandicapTypes eHandicap = m_aeHandicap[eNewID];
+ PlayerColorTypes eColor = m_aeColor[eNewID];
+ ArtStyleTypes eArtStyle = m_aeArtStyle[eNewID];
+ // Temp slot data
+ SlotStatus eSlotStatus = m_aeSlotStatus[eNewID];
+ SlotClaim eSlotClaim = m_aeSlotClaim[eNewID];
+ // Temp civ flags
+ bool bPlayableCiv = m_abPlayableCiv[eNewID];
+ bool bMinorNationCiv = m_abMinorNationCiv[eNewID];
+ // Temp unsaved player data
+ int iNetID = m_aiNetID[eNewID];
+ bool bReady = m_abReady[eNewID];
+ CvString szPythonCheck = m_aszPythonCheck[eNewID];
+ CvString szXMLCheck = m_aszXMLCheck[eNewID];
+
+ // *** SAVE OLD SLOT DETAILS IN NEW SLOT
+ // New civ details
+ m_aszLeaderName[eNewID] = m_aszLeaderName[eOldID];
+ m_aszCivDescription[eNewID] = m_aszCivDescription[eOldID];
+ m_aszCivShortDesc[eNewID] = m_aszCivShortDesc[eOldID];
+ m_aszCivAdjective[eNewID] = m_aszCivAdjective[eOldID];
+ m_aszCivPassword[eNewID] = m_aszCivPassword[eOldID];
+ m_aszEmail[eNewID] = m_aszEmail[eOldID];
+ m_aszSmtpHost[eNewID] = m_aszSmtpHost[eOldID];
+ m_abWhiteFlag[eNewID] = m_abWhiteFlag[eOldID];
+ m_aszFlagDecal[eNewID] = m_aszFlagDecal[eOldID];
+ m_aeCiv[eNewID] = m_aeCiv[eOldID];
+ m_aeLeader[eNewID] = m_aeLeader[eOldID];
+ m_aeTeam[eNewID] = m_aeTeam[eOldID];
+ m_aeHandicap[eNewID] = m_aeHandicap[eOldID];
+ m_aeColor[eNewID] = m_aeColor[eOldID];
+ m_aeArtStyle[eNewID] = m_aeArtStyle[eOldID];
+ // New slot data
+ m_aeSlotStatus[eNewID] = m_aeSlotStatus[eOldID];
+ m_aeSlotClaim[eNewID] = m_aeSlotClaim[eOldID];
+ // New civ flags
+ m_abPlayableCiv[eNewID] = m_abPlayableCiv[eOldID];
+ m_abMinorNationCiv[eNewID] = m_abMinorNationCiv[eOldID];
+ // New unsaved player data
+ m_aiNetID[eNewID] = m_aiNetID[eOldID];
+ m_abReady[eNewID] = m_abReady[eOldID];
+ m_aszPythonCheck[eNewID] = m_aszPythonCheck[eOldID];
+ m_aszXMLCheck[eNewID] = m_aszXMLCheck[eOldID];
+
+ // *** SAVE TEMP DETAILS IN OLD SLOT
+ // New civ details
+ m_aszLeaderName[eOldID] = szLeaderName;
+ m_aszCivDescription[eOldID] = szCivDescription;
+ m_aszCivShortDesc[eOldID] = szCivShortDesc;
+ m_aszCivAdjective[eOldID] = szCivAdjective;
+ m_aszCivPassword[eOldID] = szCivPassword;
+ m_aszEmail[eOldID] = szEmail;
+ m_aszSmtpHost[eOldID] = szSmtpHost;
+ m_abWhiteFlag[eOldID] = bWhiteFlag;
+ m_aszFlagDecal[eOldID] = szFlagDecal;
+ m_aeCiv[eOldID] = eCiv;
+ m_aeLeader[eOldID] = eLeader;
+ m_aeTeam[eOldID] = eTeam;
+ m_aeHandicap[eOldID] = eHandicap;
+ m_aeColor[eOldID] = eColor;
+ m_aeArtStyle[eOldID] = eArtStyle;
+ // New slot data
+ m_aeSlotStatus[eOldID] = eSlotStatus;
+ m_aeSlotClaim[eOldID] = eSlotClaim;
+ // New civ flags
+ m_abPlayableCiv[eOldID] = bPlayableCiv;
+ m_abMinorNationCiv[eOldID] = bMinorNationCiv;
+ // New unsaved player data
+ m_aiNetID[eOldID] = iNetID;
+ m_abReady[eOldID] = bReady;
+ m_aszPythonCheck[eOldID] = szPythonCheck;
+ m_aszXMLCheck[eOldID] = szXMLCheck;
+
+ // We may have a new active player id...
+ if (getActivePlayer() == eOldID)
+ {
+ setActivePlayer(eNewID);
+ }
+ else if (getActivePlayer() == eNewID)
+ {
+ setActivePlayer(eOldID);
+ }
+
+ if(CvPlayerAI::areStaticsInitialized())
+ {
+ GET_PLAYER(eOldID).updateTeamType();
+ GET_PLAYER(eNewID).updateTeamType();
+ GET_PLAYER(eOldID).updateHuman();
+ GET_PLAYER(eNewID).updateHuman();
+ }
+ }
+}
+
+void CvInitCore::closeInactiveSlots()
+{
+ // Open inactive slots mean different things to different game modes and
types...
+ // Let's figure out what they mean for us
+
+ for (int i = 0; i < MAX_CIV_PLAYERS; i++)
+ {
+ PlayerTypes eID = (PlayerTypes)i;
+ if (getSlotStatus(eID) == SS_OPEN)
+ {
+ if (getPitboss() || getHotseat() || getPbem())
+ {
+ // Pitboss & hotseat - all "open" slots are non-present human players
+ setSlotStatus(eID, SS_TAKEN);
+ }
+ else if (getType() == GAME_MP_SCENARIO)
+ {
+ // Multiplayer scenario - all "open" slots should be filled with an AI
player
+ setSlotStatus(eID, SS_COMPUTER);
+ }
+ else
+ {
+ // If it's a normal game, all "open" slots should be closed.
+ setSlotStatus(eID, SS_CLOSED);
+ }
+ setSlotClaim(eID, SLOTCLAIM_UNASSIGNED);
+
+ gDLL->sendPlayerInfo(eID);
+ }
+ }
+}
+
+void CvInitCore::reopenInactiveSlots()
+{
+ // "Inactive" open slots will only be in Pitboss and Hotseat
+ if (getPitboss() || getHotseat() || getPbem())
+ {
+ for (int i = 0; i < MAX_CIV_PLAYERS; ++i)
+ {
+ PlayerTypes eID = (PlayerTypes)i;
+ // Reopen all slots that don't have active connections
+ if (getSlotStatus(eID) == SS_TAKEN)
+ {
+ if ( getSlotClaim(eID) != SLOTCLAIM_ASSIGNED )
+ {
+ setSlotStatus(eID, SS_OPEN);
+ }
+ }
+ }
+ }
+}
+
+void CvInitCore::resetGame()
+{
+ // Descriptive strings about game and map
+ m_eType = GAME_NONE;
+ m_szGameName.clear();
+ m_szGamePassword.clear();
+ m_szAdminPassword.clear();
+ m_szMapScriptName.clear();
+
+ m_bWBMapNoPlayers = false;
+
+ // Standard game parameters
+ m_eWorldSize = NO_WORLDSIZE; // STANDARD_ option?
+ m_eClimate = (ClimateTypes)GC.getDefineINT("STANDARD_CLIMATE"); // NO_
option?
+ m_eSeaLevel = (SeaLevelTypes)GC.getDefineINT("STANDARD_SEALEVEL"); //
NO_ option?
+ m_eEra = (EraTypes)GC.getDefineINT("STANDARD_ERA"); // NO_ option?
+ m_eGameSpeed = (GameSpeedTypes)GC.getDefineINT("STANDARD_GAMESPEED"); //
NO_ option?
+ m_eTurnTimer = (TurnTimerTypes)GC.getDefineINT("STANDARD_TURNTIMER"); //
NO_ option?
+ m_eCalendar = (CalendarTypes)GC.getDefineINT("STANDARD_CALENDAR"); //
NO_ option?
+
+ // Map-specific custom parameters
+ clearCustomMapOptions();
+
+ // Data-defined victory conditions
+ refreshVictories();
+
+
+ // Standard game options
+ int i;
+ for (i = 0; i < NUM_GAMEOPTION_TYPES; ++i)
+ {
+ m_abOptions[i] = false;
+ }
+ for (i = 0; i < NUM_MPOPTION_TYPES; ++i)
+ {
+ m_abMPOptions[i] = false;
+ }
+ m_bStatReporting = false;
+
+ for (i = 0; i < NUM_FORCECONTROL_TYPES; ++i)
+ {
+ m_abForceControls[i] = false;
+ }
+
+ // Game turn mgmt
+ m_iGameTurn = 0;
+ m_iMaxTurns = 0;
+ m_iPitbossTurnTime = 0;
+ m_iTargetScore = 0;
+
+ // City Elimination
+ m_iMaxCityElimination = 0;
+
+ m_iNumAdvancedStartPoints = 0;
+
+ // Unsaved game data
+ m_uiSyncRandSeed = 0;
+ m_uiMapRandSeed = 0;
+ m_eActivePlayer = NO_PLAYER;
+
+ // Temp vars
+ m_szTemp.clear();
+}
+
+void CvInitCore::resetGame(CvInitCore * pSource, bool bClear, bool
bSaveGameType)
+{
+ FAssertMsg(pSource, "Passed null pointer to CvInitCore::resetGame");
+ FAssertMsg(!bClear || !bSaveGameType, "Should not be clearing data while
trying to preserve gametype info in CvInitCore::resetGame");
+
+ if (bClear || !pSource)
+ {
+ resetGame();
+ }
+ if (pSource)
+ {
+ // Only copy over saved data
+
+ // Descriptive strings about game and map
+ if (!bSaveGameType || getGameMultiplayer() !=
pSource->getGameMultiplayer())
+ {
+ setType(pSource->getType());
+ }
+ setGameName(pSource->getGameName());
+ setGamePassword(pSource->getGamePassword());
+ setAdminPassword(pSource->getAdminPassword(), false);
+ setMapScriptName(pSource->getMapScriptName());
+
+ setWBMapNoPlayers(pSource->getWBMapNoPlayers());
+
+ // Standard game parameters
+ setWorldSize(pSource->getWorldSize());
+ setClimate(pSource->getClimate());
+ setSeaLevel(pSource->getSeaLevel());
+ setEra(pSource->getEra());
+ setGameSpeed(pSource->getGameSpeed());
+ setTurnTimer(pSource->getTurnTimer());
+ setCalendar(pSource->getCalendar());
+
+ // Map-specific custom parameters
+ setCustomMapOptions(pSource->getNumCustomMapOptions(),
pSource->getCustomMapOptions());
+ m_iNumHiddenCustomMapOptions = pSource->getNumHiddenCustomMapOptions();
+ setVictories(pSource->getNumVictories(), pSource->getVictories());
+
+ // Standard game options
+ int i;
+ for (i = 0; i < NUM_GAMEOPTION_TYPES; ++i)
+ {
+ setOption((GameOptionTypes)i, pSource->getOption((GameOptionTypes)i));
+ }
+
+ for (i = 0; i < NUM_MPOPTION_TYPES; ++i)
+ {
+ setMPOption((MultiplayerOptionTypes)i,
pSource->getMPOption((MultiplayerOptionTypes)i));
+ }
+ setStatReporting(pSource->getStatReporting());
+
+ // Game turn mgmt
+ setGameTurn(pSource->getGameTurn());
+ setMaxTurns(pSource->getMaxTurns());
+ setPitbossTurnTime(pSource->getPitbossTurnTime());
+ setTargetScore(pSource->getTargetScore());
+
+ // City Elimination
+ setMaxCityElimination(pSource->getMaxCityElimination());
+
+ setNumAdvancedStartPoints(pSource->getNumAdvancedStartPoints());
+
+ setSyncRandSeed(pSource->getSyncRandSeed());
+ setMapRandSeed(pSource->getMapRandSeed());
+ }
+}
+
+void CvInitCore::resetPlayers()
+{
+ for (int i = 0; i < MAX_PLAYERS; ++i)
+ {
+ resetPlayer((PlayerTypes)i);
+ }
+}
+
+void CvInitCore::resetPlayers(CvInitCore * pSource, bool bClear, bool
bSaveSlotInfo)
+{
+ for (int i = 0; i < MAX_PLAYERS; ++i)
+ {
+ resetPlayer((PlayerTypes)i, pSource, bClear, bSaveSlotInfo);
+ }
+}
+
+void CvInitCore::resetPlayer(PlayerTypes eID)
+{
+ FASSERT_BOUNDS(0, MAX_PLAYERS, eID, "CvInitCore::resetPlayer");
+
+ if ( checkBounds(eID, 0, MAX_PLAYERS) )
+ {
+ // Only copy over saved data
+
+ // Civ details
+ m_aszLeaderName[eID].clear();
+ m_aszCivDescription[eID].clear();
+ m_aszCivShortDesc[eID].clear();
+ m_aszCivAdjective[eID].clear();
+ m_aszCivPassword[eID].clear();
+ m_aszEmail[eID].clear();
+ m_aszSmtpHost[eID].clear();
+
+ m_abWhiteFlag[eID] = false;
+ m_aszFlagDecal[eID].clear();
+
+ m_aeCiv[eID] = NO_CIVILIZATION;
+ m_aeLeader[eID] = NO_LEADER;
+ m_aeTeam[eID] = (TeamTypes)eID;
+ m_aeHandicap[eID] = (HandicapTypes)GC.getDefineINT("STANDARD_HANDICAP");
+ m_aeColor[eID] = NO_PLAYERCOLOR;
+ m_aeArtStyle[eID] = NO_ARTSTYLE;
+
+
+ // Slot data
+ m_aeSlotStatus[eID] = SS_CLOSED;
+ m_aeSlotClaim[eID] = SLOTCLAIM_UNASSIGNED;
+
+ // Civ flags
+ m_abPlayableCiv[eID] = false;
+ m_abMinorNationCiv[eID] = false;
+
+ // Unsaved player data
+ m_aiNetID[eID] = -1;
+ m_abReady[eID] = false;
+ m_aszPythonCheck[eID].clear();
+ m_aszXMLCheck[eID].clear();
+
+ if(CvPlayerAI::areStaticsInitialized())
+ {
+ GET_PLAYER(eID).updateTeamType();
+ GET_PLAYER(eID).updateHuman();
+ }
+ }
+}
+
+void CvInitCore::resetPlayer(PlayerTypes eID, CvInitCore * pSource, bool
bClear, bool bSaveSlotInfo)
+{
+ FAssertMsg(pSource, "Passed null pointer to CvInitCore::resetPlayer");
+ FASSERT_BOUNDS(0, MAX_PLAYERS, eID, "CvInitCore::resetPlayer");
+
+ FAssertMsg(!bClear || !bSaveSlotInfo, "Should not be clearing data while
trying to preserve slot info in CvInitCore::resetPlayer");
+
+ if ( checkBounds(eID, 0, MAX_PLAYERS) )
+ {
+ if (bClear || !pSource)
+ {
+ resetPlayer(eID);
+ }
+ if (pSource)
+ {
+ // Civ details
+ setCivDescription(eID, pSource->getCivDescription(eID));
+ setCivShortDesc(eID, pSource->getCivShortDesc(eID));
+ setCivAdjective(eID, pSource->getCivAdjective(eID));
+
+ setCivPassword(eID, pSource->getCivPassword(eID), false);
+ setEmail(eID, pSource->getEmail(eID));
+ setSmtpHost(eID, pSource->getSmtpHost(eID));
+ setFlagDecal(eID, pSource->getFlagDecal(eID));
+ setWhiteFlag(eID, pSource->getWhiteFlag(eID));
+
+ setHandicap(eID, pSource->getHandicap(eID));
+ setCiv(eID, pSource->getCiv(eID));
+ setTeam(eID, pSource->getTeam(eID));
+ setLeader(eID, pSource->getLeader(eID));
+ setColor(eID, pSource->getColor(eID));
+ setArtStyle(eID, pSource->getArtStyle(eID));
+
+ setPlayableCiv(eID, pSource->getPlayableCiv(eID));
+ setMinorNationCiv(eID, pSource->getMinorNationCiv(eID));
+
+ // Slot data
+ if (!bSaveSlotInfo)
+ {
+ // We don't wanna reset the slot data if we are loading a game
+ // from init - we want to keep the changes we made during init
+ setLeaderName(eID, pSource->getLeaderName(eID));
+ setSlotStatus(eID, pSource->getSlotStatus(eID));
+ setSlotClaim(eID, pSource->getSlotClaim(eID));
+ }
+ }
+ }
+}
+
+
+CvWString CvInitCore::getMapScriptName() const
+{
+ if (gDLL->getTransferredMap())
+ {
+ if (!getWBMapScript())
+ {
+ // If it's a transferred Python file, we have to hack in the
transferred extension
+ return ( m_szMapScriptName + CvWString(MAP_TRANSFER_EXT) );
+ }
+ }
+ return m_szMapScriptName;
+}
+
+void CvInitCore::setMapScriptName(const CvWString & szMapScriptName)
+{
+ m_szMapScriptName = szMapScriptName;
+ refreshCustomMapOptions();
+}
+
+bool CvInitCore::getWBMapScript() const
+{
+#ifdef CYBERFRONT // text: map name
+ char name[MAX_PATH];
+ int length = WideCharToMultiByte(CP_ACP, 0, m_szMapScriptName, -1, NULL,
0, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, m_szMapScriptName, -1, name, length, NULL,
NULL);
+ return (gDLL->isDescFileName( name ));
+#else
+ return (gDLL->isDescFileName( CvString(m_szMapScriptName).GetCString() ));
+#endif // CYBERFRONT
+}
+
+
+void CvInitCore::setWorldSize(const CvWString & szWorldSize)
+{
+ for (int i = 0; i < GC.getNumWorldInfos(); i++)
+ {
+ if ( wcsicmp(szWorldSize.GetCString(),
CvWString(GC.getWorldInfo((WorldSizeTypes)i).getType()).GetCString()) == 0 )
+ {
+ setWorldSize((WorldSizeTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getWorldSizeKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getWorldSize(), 0, GC.getNumWorldInfos()) )
+ {
+ szBuffer = GC.getWorldInfo(getWorldSize()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_WORLDSIZE";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setClimate(const CvWString & szClimate)
+{
+ for (int i = 0; i < GC.getNumClimateInfos(); i++)
+ {
+ if ( wcsicmp(szClimate.GetCString(),
CvWString(GC.getClimateInfo((ClimateTypes)i).getType()).GetCString()) == 0 )
+ {
+ setClimate((ClimateTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getClimateKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getClimate(), 0, GC.getNumClimateInfos()) )
+ {
+ szBuffer = GC.getClimateInfo(getClimate()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_CLIMATE";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setSeaLevel(const CvWString & szSeaLevel)
+{
+ for (int i = 0; i < GC.getNumSeaLevelInfos(); i++)
+ {
+ if ( wcsicmp(szSeaLevel.GetCString(),
CvWString(GC.getSeaLevelInfo((SeaLevelTypes)i).getType()).GetCString()) ==
0 )
+ {
+ setSeaLevel((SeaLevelTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getSeaLevelKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getSeaLevel(), 0, GC.getNumSeaLevelInfos()) )
+ {
+ szBuffer = GC.getSeaLevelInfo(getSeaLevel()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_SEALEVEL";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setEra(const CvWString & szEra)
+{
+ for (int i = 0; i < GC.getNumEraInfos(); i++)
+ {
+ if ( wcsicmp(szEra.GetCString(),
CvWString(GC.getEraInfo((EraTypes)i).getType()).GetCString()) == 0 )
+ {
+ setEra((EraTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getEraKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getEra(), 0, GC.getNumEraInfos()) )
+ {
+ szBuffer = GC.getEraInfo(getEra()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_ERA";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setGameSpeed(const CvWString & szGameSpeed)
+{
+ for (int i = 0; i < GC.getNumGameSpeedInfos(); i++)
+ {
+ if ( wcsicmp(szGameSpeed.GetCString(),
CvWString(GC.getGameSpeedInfo((GameSpeedTypes)i).getType()).GetCString())
== 0 )
+ {
+ setGameSpeed((GameSpeedTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getGameSpeedKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getGameSpeed(), 0, GC.getNumGameSpeedInfos()) )
+ {
+ szBuffer = GC.getGameSpeedInfo(getGameSpeed()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_GAMESPEED";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setTurnTimer(const CvWString & szTurnTimer)
+{
+ for (int i = 0; i < GC.getNumTurnTimerInfos(); i++)
+ {
+ if ( wcsicmp(szTurnTimer.GetCString(),
CvWString(GC.getTurnTimerInfo((TurnTimerTypes)i).getType()).GetCString())
== 0 )
+ {
+ setTurnTimer((TurnTimerTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getTurnTimerKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getTurnTimer(), 0, GC.getNumTurnTimerInfos()) )
+ {
+ szBuffer = GC.getTurnTimerInfo(getTurnTimer()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_TURNTIMER";
+ return szBuffer;
+ }
+}
+
+void CvInitCore::setCalendar(const CvWString & szCalendar)
+{
+ for (int i = 0; i < GC.getNumCalendarInfos(); i++)
+ {
+ if ( wcsicmp(szCalendar.GetCString(),
CvWString(GC.getCalendarInfo((CalendarTypes)i).getType()).GetCString()) ==
0 )
+ {
+ setCalendar((CalendarTypes)i);
+ }
+ }
+}
+
+const CvWString & CvInitCore::getCalendarKey(CvWString & szBuffer) const
+{
+ if ( checkBounds(getCalendar(), 0, GC.getNumCalendarInfos()) )
+ {
+ szBuffer = GC.getCalendarInfo(getCalendar()).getType();
+ return szBuffer;
+ }
+ else
+ {
+ szBuffer = L"NO_CALENDAR";
+ return szBuffer;
+ }
+}
+
+
+void CvInitCore::clearCustomMapOptions()
+{
+ SAFE_DELETE_ARRAY(m_aeCustomMapOptions);
+ m_iNumCustomMapOptions = 0;
+}
+
+void CvInitCore::refreshCustomMapOptions()
+{
+ clearCustomMapOptions();
+
+ if ( !getWBMapScript() )
+ {
+ if ( gDLL->pythonMapExists(CvString(getMapScriptName()).GetCString()) )
+ {
+ bool bOK;
+ long iNumOptions = 0;
+
+
gDLL->getPythonIFace()->callFunction(CvString(getMapScriptName()).GetCString(), "getNumHiddenCustomMapOptions",
NULL, &iNumOptions);
+ m_iNumHiddenCustomMapOptions = iNumOptions;
+
+ bOK =
gDLL->getPythonIFace()->callFunction(CvString(getMapScriptName()).GetCString(), "getNumCustomMapOptions",
NULL, &iNumOptions);
+ if (bOK)
+ {
+ // Got number of custom map options - now get the option defaults
+ CustomMapOptionTypes *aeMapOptions = new
CustomMapOptionTypes[iNumOptions];
+ for (int i = 0; i < iNumOptions; ++i)
+ {
+ long iOptionDefault = 0;
+ CyArgsList argsList;
+ argsList.add(i);
+
+ bOK =
gDLL->getPythonIFace()->callFunction(CvString(getMapScriptName()).GetCString(), "getCustomMapOptionDefault",
argsList.makeFunctionArgs(), &iOptionDefault);
+ FAssertMsg(bOK, "Call to python fn \"getCustomMapOptionDefault\"
failed in CvInitCore::refreshCustomMapOptions");
+ if (bOK)
+ {
+ aeMapOptions[i] = (CustomMapOptionTypes)iOptionDefault;
+ }
+ else
+ {
+ aeMapOptions[i] = NO_CUSTOM_MAPOPTION;
+ }
+ }
+
+ setCustomMapOptions(iNumOptions, aeMapOptions);
+ SAFE_DELETE_ARRAY(aeMapOptions);
+ }
+ }
+ }
+}
+
+
+void CvInitCore::clearVictories()
+{
+ SAFE_DELETE_ARRAY(m_abVictories);
+ m_iNumVictories = 0;
+}
+
+void CvInitCore::refreshVictories()
+{
+ clearVictories();
+
+ m_iNumVictories = GC.getNumVictoryInfos();
+ if (m_iNumVictories > 0)
+ {
+ m_abVictories = new bool[m_iNumVictories];
+ for (int i = 0; i < m_iNumVictories; ++i)
***The diff for this file has been truncated for email.***
=======================================
***Additional files exist in this changeset.***
--
You received this message because you are subscribed to the Google Groups "HoTK Mod Developer Group" group.
To post to this group, send email to
sanguom...@googlegroups.com.
To unsubscribe from this group, send email to
sanguomodforc...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sanguomodforciv?hl=en.