def changeCivHandler( playerID, netUserData, popupReturn ) : 'Handles changeCiv popup' if( popupReturn.getButtonClicked() == 0 ): # if you pressed cancel return playerIdx = popupReturn.getSelectedPullDownValue( 1 ) newCivType = popupReturn.getSelectedPullDownValue( 2 ) newLeaderType = popupReturn.getSelectedPullDownValue( 3 ) teamIdx = popupReturn.getSelectedPullDownValue( 4 ) if( LOG_DEBUG ) : CvUtil.pyPrint( " CP : You have selected player %d, the %s, on team %d"%(playerIdx, gc.getPlayer(playerIdx).getCivilizationDescription(0), gc.getPlayer(playerIdx).getTeam()) ) if( LOG_DEBUG ) : CvUtil.pyPrint( " CP : New team idx is %d"%(teamIdx) ) #player = gc.getPlayer(playerIdx) #game.changePlayer( playerIdx, newCivType, newLeaderType, teamIdx, player.isHuman(), True ) success = RevUtils.changeCiv( playerIdx, newCivType, newLeaderType, teamIdx ) if( success ) : CyInterface().addImmediateMessage("Player %d has been changed"%(playerIdx),"") if( LOG_DEBUG ) : CvUtil.pyPrint( " CP : Player change completed" ) else : CyInterface().addImmediateMessage("An error occured in changeCiv.","") if( LOG_DEBUG ) : CvUtil.pyPrint( " CP : Error on changeCiv" ) return popup = PyPopup.PyPopup(RevDefs.updateGraphicsPopup,contextType = EventContextTypes.EVENTCONTEXT_ALL) popup.setBodyString("If you see any unit flags or other graphics which have not updated to the new civ type, press Ctrl+Shift+U to update them. Note that this will end you turn and (in rare circumstances) flash other parts of the game map on the screen.\n\nYou can also do this now by clicking the top button below now.") popup.addButton( "Update now" )
def changeCivHandler(playerID, netUserData, popupReturn): 'Handles changeCiv popup' if (popupReturn.getButtonClicked() == 0): # if you pressed cancel return playerIdx = popupReturn.getSelectedPullDownValue(1) newCivType = popupReturn.getSelectedPullDownValue(2) newLeaderType = popupReturn.getSelectedPullDownValue(3) teamIdx = popupReturn.getSelectedPullDownValue(4) if ((iTeam >= 0) and (iTeam <= gc.getMAX_CIV_TEAMS())): playerI = gc.getPlayer(playerIdx) if (playerI.isAlive): if (LOG_DEBUG): CvUtil.pyPrint( " CP : You have selected player %d, the %s, on team %d" % (playerIdx, playerI.getCivilizationDescription(0), playerI.getTeam())) if ((iTeam >= 0) and (iTeam <= gc.getMAX_CIV_TEAMS())): teamI = gc.getTeam(teamIdx) if (LOG_DEBUG): CvUtil.pyPrint(" CP : New team idx is %d" % (teamIdx)) #player = gc.getPlayer(playerIdx) #game.changePlayer( playerIdx, newCivType, newLeaderType, teamIdx, player.isHuman(), True ) success = RevUtils.changeCiv(playerIdx, newCivType, newLeaderType, teamIdx) if (success): CyInterface().addImmediateMessage( "Player %d has been changed" % (playerIdx), "") if (LOG_DEBUG): CvUtil.pyPrint(" CP : Player change completed") else: CyInterface().addImmediateMessage("An error occured in changeCiv.", "") if (LOG_DEBUG): CvUtil.pyPrint(" CP : Error on changeCiv") return popup = PyPopup.PyPopup(RevDefs.updateGraphicsPopup, contextType=EventContextTypes.EVENTCONTEXT_ALL) popup.setBodyString( "If you see any unit flags or other graphics which have not updated to the new civ type, press Ctrl+Shift+U to update them. Note that this will end you turn and (in rare circumstances) flash other parts of the game map on the screen.\n\nYou can also do this now by clicking the top button below now." ) popup.addButton("Update now")
def changeCivHandler(playerID, netUserData, popupReturn): if not popupReturn.getButtonClicked(): # if you pressed cancel return iPlayer = popupReturn.getSelectedPullDownValue(1) newCivType = popupReturn.getSelectedPullDownValue(2) newLeaderType = popupReturn.getSelectedPullDownValue(3) iTeam = popupReturn.getSelectedPullDownValue(4) if iTeam > -1 and iTeam <= GC.getMAX_PC_TEAMS(): playerI = GC.getPlayer(iPlayer) if playerI.isAlive: print " CP: You have selected player %d, the %s, on team %d" % ( iPlayer, playerI.getCivilizationDescription(0), playerI.getTeam()) teamI = GC.getTeam(iTeam) print " CP: New team idx is %d" % iTeam #player = GC.getPlayer(iPlayer) #GAME.changePlayer(iPlayer, newCivType, newLeaderType, iTeam, player.isHuman(), True) success = RevUtils.changeCiv(iPlayer, newCivType, newLeaderType, iTeam) if success: CyInterface().addImmediateMessage( "Player %d has been changed" % (iPlayer), "") print " CP: Player change completed" else: CyInterface().addImmediateMessage("An error occured in changeCiv.", "") print " CP: Error on changeCiv" return popup = PyPopup.PyPopup(RevDefs.updateGraphicsPopup, contextType=EventContextTypes.EVENTCONTEXT_ALL) popup.setBodyString( "If you see any unit flags or other graphics which have not updated to the new civ type, press Ctrl+Shift+U to update them. Note that this will end you turn and (in rare circumstances) flash other parts of the game map on the screen.\n\nYou can also do this now by clicking the top button below now." ) popup.addButton("Update now")