MagisterCultuum
Great Sage
This says that somebody is trying to read from an address they aren't meant to. Normally, I'd assume this is due to an invalid eTeam parameter (e.g., NO_TEAM), but then I'd assume the error would show up in the getTeam() call inside getTeamNonInl(). Anyway, there's no way for me to solve this without access to the full stacktrace. If you want, I can debug this for you, but you'd need to upload the mod and a savegame, of course. Also I probably won't get to it the next 1-2 weeks.
That's unsurprising, since I didn't release a new version since your last report.
I'll quote myself:
You mean it's already glowing blue, and stays that way despite losing XP?
There are almost 900 references in python to gc.getTeam so I have not checked many of them, but the very first one to show when I use Find All looks the most suspicious to me
in Blizzards.py
Code:
def isDeepening(self):
iDeepening = gc.getInfoTypeForString('PROJECT_THE_DEEPENING')
for i in range(CyGame().countCivTeamsAlive()-1):
pTeam = gc.getTeam(i)
if pTeam.getProjectCount(iDeepening) > 0:
return true
return false
Do you think it could fix the bug if I changed that code to this:
Code:
def isDeepening(self):
iDeepening = gc.getInfoTypeForString('PROJECT_THE_DEEPENING')
for iLoopTeam in xrange(gc.getMAX_TEAMS()):
pTeam = gc.getTeam(iLoopTeam)
if pTeam.isAlive():
if pTeam.getProjectCount(iDeepening) > 0:
return True
return False
edit. It didn't stop a getTeamNonInl() related crash though.
When I went to change "%s1" to "a city," I noticed what that I think is the real problem.
pCity is a parameter of playerCityLost, but that parameter does not get used at the end of the function because the pCity variable was just reassigned multiple times in the previous loop. That means that the name would never be from the city that is lost but rather from whatever city appears last in PyPlayer(iPlayer).getCityList().
I have not tested this yet, but suspect that the bug could be easily fixed by using loopCity instead of pCity within that loop.
Edit: It didn't stop the
Code:
def playerCityLost( player, pCity, bConquest = True ) :
if( player.getNumCities() < 1 or player.isBarbarian() ) :
return
iPlayer = player.getID()
capital = player.getCapitalCity()
if not capital.isNone():
capitalArea = capital.area().getID()
else:
capitalArea = -1
iRevIdxChange = 0
if( game.getGameTurn() - pCity.getGameTurnAcquired() < 2 ) :
iRevIdxChange = 0
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: very recently acquired, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( game.getGameTurn() - pCity.getGameTurnAcquired() < 20 ) :
iRevIdxChange = 50
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: recently acquired, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.isCapital() ) :
iRevIdxChange = 400
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: capital, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.getHighestPopulation() < 4 ) :
iRevIdxChange = 50
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: small city, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.plot().calculateCulturePercent(iPlayer) > 60 and pCity.countTotalCultureTimes100() > 100*100 ) :
iRevIdxChange = 150
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: majority nationality, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.getOriginalOwner() == iPlayer ) :
iRevIdxChange = 125
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: original founder, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
else :
iRevIdxChange = 100
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: default, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
if( not pCity.area().getID() == capitalArea and iRevIdxChange > 25 ) :
iRevIdxChange -= 25
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - %s is a colony, reducing effect to %d"%(pCity.getName(),iRevIdxChange))
if( not bConquest ) :
if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Not conquest, reducing rev index increase from %d"%(iRevIdxChange))
iRevIdxChange = iRevIdxChange/3.0
iRevIdxChange = int(math.floor( cityLostModifier*iRevIdxChange + .5))
if( player.isRebel() ) :
iRevIdxChange /= 2
if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s (%d bConq): %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),bConquest,iRevIdxChange))
for city in PyPlayer(iPlayer).getCityList() :
pCity = city.GetCy()
pCity.changeRevolutionIndex( iRevIdxChange )
revIdxHist = RevData.getCityVal(pCity,'RevIdxHistory')
revIdxHist['Events'][0] += iRevIdxChange
RevData.updateCityVal( pCity, 'RevIdxHistory', revIdxHist )
# REVOLUTION_ALERTS 03/2021 lfgr
if iRevIdxChange != 0 :
InterfaceUtils.addMessage( iPlayer, PyHelpers.getText(
"[COLOR_NEGATIVE_TEXT]The loss of %s1 has increased revolutionary sentiment throughout your empire[COLOR_REVERT]",
pCity.getName() ) ) # LFGR_TODO: Translate
Code:
def playerCityLost( player, pCity, bConquest = True ) :
if( player.getNumCities() < 1 or player.isBarbarian() ) :
return
iPlayer = player.getID()
capital = player.getCapitalCity()
if not capital.isNone():
capitalArea = capital.area().getID()
else:
capitalArea = -1
iRevIdxChange = 0
if( game.getGameTurn() - pCity.getGameTurnAcquired() < 2 ) :
iRevIdxChange = 0
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: very recently acquired, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( game.getGameTurn() - pCity.getGameTurnAcquired() < 20 ) :
iRevIdxChange = 50
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: recently acquired, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.isCapital() ) :
iRevIdxChange = 400
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: capital, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.getHighestPopulation() < 4 ) :
iRevIdxChange = 50
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: small city, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.plot().calculateCulturePercent(iPlayer) > 60 and pCity.countTotalCultureTimes100() > 100*100 ) :
iRevIdxChange = 150
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: majority nationality, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
elif( pCity.getOriginalOwner() == iPlayer ) :
iRevIdxChange = 125
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: original founder, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
else :
iRevIdxChange = 100
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s: default, %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),iRevIdxChange))
if( not pCity.area().getID() == capitalArea and iRevIdxChange > 25 ) :
iRevIdxChange -= 25
#if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - %s is a colony, reducing effect to %d"%(pCity.getName(),iRevIdxChange))
if( not bConquest ) :
if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Not conquest, reducing rev index increase from %d"%(iRevIdxChange))
iRevIdxChange = iRevIdxChange/3.0
iRevIdxChange = int(math.floor( cityLostModifier*iRevIdxChange + .5))
if( player.isRebel() ) :
iRevIdxChange /= 2
if( LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Loss of %s by %s (%d bConq): %d rev idx change"%(pCity.getName(),player.getCivilizationDescription(0),bConquest,iRevIdxChange))
for city in PyPlayer(iPlayer).getCityList() :
loopCity = city.GetCy()
loopCity.changeRevolutionIndex( iRevIdxChange )
revIdxHist = RevData.getCityVal(loopCity,'RevIdxHistory')
revIdxHist['Events'][0] += iRevIdxChange
RevData.updateCityVal( loopCity, 'RevIdxHistory', revIdxHist )
# REVOLUTION_ALERTS 03/2021 lfgr
if iRevIdxChange != 0 :
InterfaceUtils.addMessage( iPlayer, PyHelpers.getText(
"[COLOR_NEGATIVE_TEXT]The loss of %s1 has increased revolutionary sentiment throughout your empire[COLOR_REVERT]",
pCity.getName() ) ) # LFGR_TODO: Translate
Edit: I just analyzed another dump file where the memory issues does not seem to be in the same function
Code:
Microsoft (R) Windows Debugger Version 10.0.22415.1002 X86
Copyright (c) Microsoft Corporation. All rights reserved.
Loading Dump File [C:\Users\jonmi_r2m\AppData\Local\Temp\Civ4BeyondSword.exe.dmp]
User Mini Dump File with Full Memory: Only application data is available
************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
Windows 8 Version 9200 MP (4 procs) Free x86 compatible
Product: WinNt, suite: SingleUserTS Personal
Machine Name:
Debug session time: Tue Aug 10 09:39:13.000 2021 (UTC - 4:00)
System Uptime: 2 days 1:59:51.197
Process Uptime: 0 days 0:57:35.000
................................................................
........................................
Loading unloaded module list
..........................
This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(1c5c.29c8): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
eax=00000000 ebx=7d807ad8 ecx=00000000 edx=00ae9654 esi=7d807ab0 edi=7d807b08
eip=77c238dc esp=0019e850 ebp=0019e85c iopl=0 nv up ei pl nz ac pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000216
ntdll!NtGetContextThread+0xc:
77c238dc c20800 ret 8
0:000> !analyze -v
*******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
*** WARNING: Unable to verify checksum for Mss32.dll
KEY_VALUES_STRING: 1
Key : AV.Dereference
Value: NullPtr
Key : AV.Fault
Value: Read
Key : Analysis.CPU.mSec
Value: 4077
Key : Analysis.DebugAnalysisManager
Value: Create
Key : Analysis.Elapsed.mSec
Value: 16183
Key : Analysis.Init.CPU.mSec
Value: 859
Key : Analysis.Init.Elapsed.mSec
Value: 32622
Key : Analysis.Memory.CommitPeak.Mb
Value: 79
Key : Timeline.OS.Boot.DeltaSec
Value: 179991
Key : Timeline.Process.Start.DeltaSec
Value: 3455
Key : WER.Process.Version
Value: 3.1.9.0
NTGLOBALFLAG: 0
PROCESS_BAM_CURRENT_THROTTLED: 0
PROCESS_BAM_PREVIOUS_THROTTLED: 0
APPLICATION_VERIFIER_FLAGS: 0
CONTEXT: (.ecxr)
eax=00be6274 ebx=00000000 ecx=00000000 edx=00ae9654 esi=00000000 edi=00000000
eip=004d7dd4 esp=0019f9fc ebp=5c76dd28 iopl=0 nv up ei pl nz na po nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202
Civ4BeyondSword+0xd7dd4:
004d7dd4 8b01 mov eax,dword ptr [ecx] ds:002b:00000000=????????
Resetting default scope
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 004d7dd4 (Civ4BeyondSword+0x000d7dd4)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 00000000
Attempt to read from address 00000000
PROCESS_NAME: Civ4BeyondSword.exe
READ_ADDRESS: 00000000
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.
EXCEPTION_CODE_STR: c0000005
EXCEPTION_PARAMETER1: 00000000
EXCEPTION_PARAMETER2: 00000000
STACK_TEXT:
WARNING: Stack unwind information not available. Following frames may be wrong.
0019f9f8 04642387 00000000 00000000 00000000 Civ4BeyondSword+0xd7dd4
00000000 00000000 00000000 00000000 00000000 CvGameCoreDLL!CvUnit::plot+0x4b7
SYMBOL_NAME: Civ4BeyondSword+d7dd4
MODULE_NAME: Civ4BeyondSword
IMAGE_NAME: Civ4BeyondSword.exe
STACK_COMMAND: ~0s ; .ecxr ; kb
FAILURE_BUCKET_ID: NULL_POINTER_READ_c0000005_Civ4BeyondSword.exe!Unknown
OSPLATFORM_TYPE: x86
OSNAME: Windows 8
IMAGE_VERSION: 3.1.9.0
FAILURE_ID_HASH: {72026eb1-068b-3165-ce81-b11615a37d19}
Followup: MachineOwner
---------
Last edited: