Mysterious code in CvEventManager.py

xooll

Chieftain
Joined
Jun 3, 2011
Messages
77
I was merging two of my own mods, each of which I have tested independently and found working, when I got a bunch of Python exceptions relating to code I didn't write. I loaded the two CvEventManager files from the newly-added mod and the merging mod into WinMerge together and found some big chunks of code that were different that I didn't add:
Code:
	def onLoadGame(self, argsList):
		[COLOR="Red"]CvAdvisorUtils.resetNoLiberateCities()[/COLOR]
		return 0
Code:
		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))
All of these were found in the merged file, which, until I started adding mod #2 in, was an exact copy of CvEventManager from mod #1.
The funny thing is, I THOUGHT I had copied the same file to start out with. I did make mod#2 on a new computer, so if there are some configurations that change the file, that might be it.
Copying mod#2's file and adding the stuff from mod #1 seems to have fixed the problem, but I'm still perplexed. What are these chunks of code supposed to do? Why are they not in both files? Where did the discrepancy come from?
 
that... might be. Come to think of it, I don't think I patched it since installing on the new computer...
 
Top Bottom