I have at the moment a problem with one of my modcomps, or more with a merge of it.
Smeagolheart tries to merge one of my modcomps (this) into his mod.
The mod comp should add messages to the game, when a city with a wonder is conquered, and which wonders are conquered (or if the city is razed, which are destroyed.
Code:
There's nearly the same code after onCityRazed.
Now, smeagolheart gets every message twice, and with some additional debugging messages, i've nailed the problem down to this here:
The logs say, that in the example case the "if ThisTeam.isHasMet" check is passed two times, for player #0 and #6. But the messages still appear twice for the human player (#0, i assume).
I could add more messages, but...well...this is just a simple if then else check, i don't see what could be going wrong here (to note: No teams involved, which could be a reason for a bug, i know).
So does anyone see, how here could be a problem?
I must be incredibly stupid, i can't see it
.
Smeagolheart tries to merge one of my modcomps (this) into his mod.
The mod comp should add messages to the game, when a city with a wonder is conquered, and which wonders are conquered (or if the city is razed, which are destroyed.
Code:
Spoiler :
PHP:
def onCityAcquiredAndKept(self, argsList):
'City Acquired and Kept'
iOwner,pCity = argsList
#### messages - wonder captured start ####
NumWonders = pCity.getNumWorldWonders
if NumWonders ()>0:
Counter = 0
for i in range(gc.getNumBuildingInfos ()):
thisbuilding = gc.getBuildingInfo (i)
if pCity.getNumBuilding(i)>0:
iBuildingClass = thisbuilding.getBuildingClassType ()
thisbuildingclass = gc.getBuildingClassInfo (iBuildingClass)
if thisbuildingclass.getMaxGlobalInstances ()==1:
ConquerPlayer = gc.getPlayer(pCity.getOwner())
iConquerTeam = ConquerPlayer.getTeam()
ConquerName = ConquerPlayer.getName ()
WonderName = thisbuilding.getDescription ()
iX = pCity.getX()
iY = pCity.getY()
for iPlayer in range (gc.getMAX_CIV_PLAYERS ()):
ThisPlayer = gc.getPlayer(iPlayer)
iThisTeam = ThisPlayer.getTeam()
ThisTeam = gc.getTeam(iThisTeam)
if ThisTeam.isHasMet(iConquerTeam):
if iPlayer == pCity.getOwner():
CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_YOU_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
else:
CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), iX, iY, True,True)
#### messages - wonder captured end ####
There's nearly the same code after onCityRazed.
Now, smeagolheart gets every message twice, and with some additional debugging messages, i've nailed the problem down to this here:
PHP:
if ThisTeam.isHasMet(iConquerTeam):
CyInterface().addMessage(0,False,15,CyTranslator().getText("passed has met check",()),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
print "passed has met check: iPlayer = "+str(iPlayer)
if iPlayer == pCity.getOwner():
CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_YOU_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/happy_person.dds',ColorTypes(gc.getInfoTypeForString("COLOR_GREEN")), iX, iY, True,True)
else:
CyInterface().addMessage(iPlayer,False,15,CyTranslator().getText("TXT_KEY_CAPTURED_WONDER",(ConquerName,WonderName)),'',0,'Art/Interface/Buttons/General/warning_popup.dds',ColorTypes(gc.getInfoTypeForString("COLOR_RED")), iX, iY, True,True)
#### messages - wonder captured end ####
The logs say, that in the example case the "if ThisTeam.isHasMet" check is passed two times, for player #0 and #6. But the messages still appear twice for the human player (#0, i assume).
I could add more messages, but...well...this is just a simple if then else check, i don't see what could be going wrong here (to note: No teams involved, which could be a reason for a bug, i know).
So does anyone see, how here could be a problem?
I must be incredibly stupid, i can't see it
