Skip to content

Commit

Permalink
Fix savegame loading (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
VDuchauffour authored May 8, 2024
1 parent be253bd commit 4e62419
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Assets/Python/CvEventManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class CvEventManager:

def __init__(self):
#################### ON EVENT MAP ######################
balance.setProvinceTypes()
balance.postAreas()
balance.setBalanceParameters()

self.bCtrl = False
self.bShift = False
Expand Down Expand Up @@ -415,6 +414,7 @@ def onLoadGame(self, argsList):
CvAdvisorUtils.resetNoLiberateCities()
# Absinthe: separate visualization function for spawn and respawn areas
# set it to 1 in the GlobalDefines_Alt.xml if you want to enable it
balance.setTechTimelineDate()
gc.setCoreToPlot(
gc.getDefineINT("ENABLE_SPAWN_AREA_DISPLAY")
) # hold down the shift key, and hover over the map
Expand All @@ -425,8 +425,7 @@ def onLoadGame(self, argsList):

def onGameStart(self, argsList):
"Called at the start of the game"

balance.setBalanceParameters()
balance.setTechTimelineDate()
# Absinthe: separate visualization function for spawn and respawn areas
# set it to 1 in the GlobalDefines_Alt.xml if you want to enable it
gc.setCoreToPlot(
Expand Down
8 changes: 6 additions & 2 deletions Assets/Python/components/GameBalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@

class GameBalance:
def setBalanceParameters(self):
self.setProvinceTypes()
self.setModifiers()
self.setDiplomacyModifier()
self.setTechTimeline()
self.setTechTimelineModifier()
self.setInitialBuilding()
self.setBuildingPreferences()
self.setUniquePowers()
Expand All @@ -50,6 +51,7 @@ def setBalanceParameters(self):
self.setHistoricalEnemies()
self.setProvinceTypeParameters()
self.setOtherParameters()
self.postAreas()
self.set_starting_workers()

def setModifiers(self):
Expand Down Expand Up @@ -130,13 +132,15 @@ def setDiplomacyModifier(self):
for civ1, civ2, value in DIPLOMACY_MODIFIERS:
gc.setDiplomacyModifiers(civ1.value, civ2.value, value)

def setTechTimeline(self):
def setTechTimelineModifier(self):
gc.setTimelineTechModifiers(
9, 25, -50, 1, 100, 50
) # go between 10 times slower and 4 times faster
# formula is: iAhistoric = iCurrentTurn - iHistoricTurn, capped at ( iTPCap, iTBCap )
# iCost *= 100 + topPenalty * iHistoric * iAhistoric / BotPenalty, iCost /= 100
# iCost *= 100 - topBuff * iHistoric * iAhistoric / BotBuff, iCost /= 100

def setTechTimelineDate(self):
for tech, turn in TIMELINE_TECH_MODIFIER:
gc.setTimelineTechDateForTech(tech.value, year(turn))

Expand Down

0 comments on commit 4e62419

Please sign in to comment.