@DH:
I'm reviewing the python for adjustments for Neanderthal NPCS and anything else I may have missed previously. We also now have new leaders for animals and may have a different one for neanderthals and there are references in the python specifically to the barbarian leader to control certain things that needs to get sorted out but it's a bit above my python skill grade to do so. Example:
Code:
def placeLeaders(self):
screen = self.getScreen()
# Create and place a tech pane
list = self.getSortedList( gc.getNumLeaderHeadInfos(), gc.getLeaderHeadInfo )
listCopy = list[:]
for item in listCopy:
if item[1] == gc.getDefineINT("BARBARIAN_LEADER"):
list.remove(item)
elif gc.getDefineINT("CIVILOPEDIA_SHOW_ACTIVE_CIVS_ONLY") and gc.getGame().isFinalInitialized():
if not gc.getGame().isLeaderEverActive(item[1]):
list.remove(item)
This is in CvPediaMain.py.
I'm not sure how to get the filter check for BARBARIAN_LEADER to include any potential NPC leader. Can you help with that?
As I go through I'll point out other spots I'm unsure about as there are probably more than a few to come.
EDIT:
Another one I'm not sure about:
Code:
def onEndPlayerTurn( argsList ) :
iGameTurn, iPlayer = argsList
bDoLaunchRev = False
iNextPlayer = iPlayer + 1
while( iNextPlayer <= gc.getBARBARIAN_PLAYER() ) :
if( not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
else :
break
if( iNextPlayer > gc.getBARBARIAN_PLAYER() ) :
iGameTurn += 1
iNextPlayer = 0
while( iNextPlayer < iPlayer ) :
if( not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
else :
break
# Stuff before next players turn
#CvUtil.pyPrint("Rev - Recording civics for player %d"%(iNextPlayer))
recordCivics( iNextPlayer )
This is in RevEvents.py. I'm not sure this one matters much but there are numerous places in python that have this sort of filtering that assumes the barbarian player is the last player in the list and I wonder if it should be changed to NPC1_PLAYER or not.
Just above that code is:
Code:
def onBeginPlayerTurn( argsList ) :
iGameTurn, iPlayer = argsList
#if( iPlayer == game.getActivePlayer() ) :
# CvUtil.pyPrint("Rev - Recording civics for active player")
iNextPlayer = iPlayer + 1
while( iNextPlayer <= gc.getBARBARIAN_PLAYER() and not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
if( iNextPlayer > gc.getBARBARIAN_PLAYER() ) :
iNextPlayer = 0
while( iNextPlayer < iPlayer and not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
Which doesn't seem to be actually doing anything so I find it very odd in the first place.
In RevDefs.py we have another interesting situation:
Code:
# Players
# List of player numbers that BarbarianCiv will never turn into a full civ. Allows minor civs in scenarios to keep minor status.
alwaysMinorList = [] #[0,1,2]
I'm THINKING that we need to add all other NPC civilizations into this empty list BUT I'm not sure how that's supposed to be done here.
Another spot in StartAsMinors.py that I'm not sure what it's actually doing but I suspect it may need to be adjusted to not assume that barbs are the last player:
Code:
########################## Turn-based events ###############################
def onEndPlayerTurn( argsList ) :
iGameTurn, iPlayer = argsList
bDoLaunchRev = False
iNextPlayer = iPlayer + 1
while( iNextPlayer <= gc.getBARBARIAN_PLAYER() ) :
if( not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
else :
break
if( iNextPlayer > gc.getBARBARIAN_PLAYER() ) :
iGameTurn += 1
iNextPlayer = 0
while( iNextPlayer < iPlayer ) :
if( not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
else :
break
In Revolution.py we have an interesting case that you may be able to decipher better:
Code:
# Don't incarnate as either of these
iMinor = CvUtil.findInfoTypeNum(gc.getCivilizationInfo,gc.getNumCivilizationInfos(),RevDefs.sXMLMinor)
iBarbarian = CvUtil.findInfoTypeNum(gc.getCivilizationInfo,gc.getNumCivilizationInfos(),RevDefs.sXMLBarbarian)
# Civs not currently in the game
availableCivs = list()
# Civs with similar style to cultOwner, if they exist
similarStyleCivs = list()
similarOwnerStyleCivs = list()
for civType in range(0,gc.getNumCivilizationInfos()) :
if( not civType == iBarbarian ) :
if( not civType == iMinor ) :
taken = False
for i in range(0,gc.getMAX_CIV_PLAYERS()) :
if( civType == gc.getPlayer(i).getCivilizationType() ) :
# Switch in preparation for defining regions of the world for different rebel civ types
#if( gc.getPlayer(i).isAlive() or gc.getPlayer(i).isFoundedFirstCity() or gc.getPlayer(i).getCitiesLost() > 0 ) :
if( gc.getPlayer(i).isEverAlive() or RevData.revObjectExists(gc.getPlayer(i)) ) :
taken = True
break
if( not taken ) :
availableCivs.append(civType)
if( not cultPlayer == None ) :
if( gc.getCivilizationInfo( cultPlayer.getCivilizationType() ).getArtStyleType() == gc.getCivilizationInfo(civType).getArtStyleType() ) :
#if( self.LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Potential similar style civ from culture: %s (%d)"%(gc.getCivilizationInfo(civType).getShortDescription(0),civType))
similarStyleCivs.append(civType)
if( gc.getCivilizationInfo( owner.getCivilizationType() ).getArtStyleType() == gc.getCivilizationInfo(civType).getArtStyleType() ) :
#if( self.LOG_DEBUG ) : CvUtil.pyPrint(" Revolt - Potential similar style civ from owner: %s (%d)"%(gc.getCivilizationInfo(civType).getShortDescription(0),civType))
similarOwnerStyleCivs.append(civType)
It appears to me that we may need to widen the barbarian reference here to any NPC player. I'm not 100% sure though, nor would I be safely able to change it since it goes after such specific to barbarian data to define that.
This, at the beginning of Revolutions.py:
Code:
def onBeginPlayerTurn( self, argsList ) :
iGameTurn, iPlayer = argsList
# Stuff at end of previous players turn
iPrevPlayer = iPlayer - 1
while( iPrevPlayer >= 0 and not gc.getPlayer(iPrevPlayer).isAlive() ) :
iPrevPlayer -= 1
if( iPrevPlayer < 0 ) :
iPrevPlayer = gc.getBARBARIAN_PLAYER()
if( iPrevPlayer >= 0 and iPrevPlayer < gc.getBARBARIAN_PLAYER() ) :
self.checkForRevReinforcement( iPrevPlayer )
self.checkCivics( iPrevPlayer )
iNextPlayer = iPlayer + 1
while( iNextPlayer <= gc.getBARBARIAN_PLAYER() and not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
if( iNextPlayer > gc.getBARBARIAN_PLAYER() ) :
iNextPlayer = 0
while( iNextPlayer < iPlayer and not gc.getPlayer(iNextPlayer).isAlive() ) :
iNextPlayer += 1
is another situation where I'm not sure if we're incorrectly assuming the Barbarian is the last potential player or not.
In CvPediaMain.py:
Code:
def placeLeaders(self):
self.list = self.getLeaderList()
list = self.list
listCopy = list[:]
for item in listCopy:
if item[1] == gc.getDefineINT("BARBARIAN_LEADER"):
list.remove(item)
elif gc.getDefineINT("CIVILOPEDIA_SHOW_ACTIVE_CIVS_ONLY") and gc.getGame().isFinalInitialized():
if not gc.getGame().isLeaderEverActive(item[1]):
list.remove(item)
self.list = list
self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, gc.getLeaderHeadInfo)
Again, perhaps too specific to the barb leader?
Ok, I think that about sums it up.