1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

CvMainInterface.py - help needed

Discussion in 'Civ4 - BTS Unaltered Gameplay (BUG, BAT and BULL)' started by stefanhu, May 10, 2016.

  1. stefanhu

    stefanhu Chieftain

    Joined:
    Jan 6, 2014
    Messages:
    13
    Hey guys,

    I'd like to merge platypings migrating GP into the BUG mod.
    Well it works, there is just one problem: the xml-text is not shown in the city interface ingame.

    Code:
    	<TEXT>
    		<Tag>TXT_KEY_EVACUATE_GP</Tag>
    		<English>[COLOR_HIGHLIGHT_TEXT][NEWLINE]Click to evacuate %s1[COLOR_WARNING_TEXT][NEWLINE]Requires %d2 Gold[COLOR_REVERT]</English>
    	</TEXT>
    
    I have tried to add platypings code into the CvMainInterface.py, but it does not work.
    That's the code:

    Code:
    	# Will handle the input for this screen...
    	def handleInput (self, inputClass):
    [B]## Migrating GP ##
    		if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName().find("FreeSpecialist") == 0:
    			pCity = CyInterface().getHeadSelectedCity()
    			CyMessageControl().sendModNetMessage(9413, inputClass.getData1(), pCity.getOwner(), pCity.getID(), -1)
    ## Migrating GP ##[/B]
    		return 0
    	
    	def update(self, fDelta):
    		return
    
    The BUG-Mod Team has already added several tags in this field so i am not sure how to merge platypings code.

    Code:
    	# Will handle the input for this screen...
    	def handleInput (self, inputClass):
    		#BugUtil.debugInput(inputClass)
    # BUG - PLE - start
    		if  (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON) or \
    			(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF) or \
    			(inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
    			if (self.MainInterfaceInputMap.has_key(inputClass.getFunctionName())):	
    				return self.MainInterfaceInputMap.get(inputClass.getFunctionName())(inputClass)
    			if (self.MainInterfaceInputMap.has_key(inputClass.getFunctionName() + "1")):	
    				return self.MainInterfaceInputMap.get(inputClass.getFunctionName() + "1")(inputClass)
    # BUG - PLE - end
    
    ## Migrating GP ##
    		if inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName().find("FreeSpecialist") == 0:
    			pCity = CyInterface().getHeadSelectedCity()
    			CyMessageControl().sendModNetMessage(9413, inputClass.getData1(), pCity.getOwner(), pCity.getID(), -1)
    ## Migrating GP ##
    
    # BUG - Raw Yields - start
    		if (inputClass.getFunctionName().startswith("RawYields")):
    			return self.handleRawYieldsButtons(inputClass)
    # BUG - Raw Yields - end
    
    # BUG - Great Person Bar - start
    		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED and inputClass.getFunctionName().startswith("GreatPersonBar")):
    			# Zoom to next GP city
    			iCity = inputClass.getData1()
    			if (iCity == -1):
    				pCity, _ = GPUtil.findNextCity()
    			else:
    				pCity = gc.getActivePlayer().getCity(iCity)
    			if pCity and not pCity.isNone():
    				CyInterface().selectCity(pCity, False)
    			return 1
    # BUG - Great Person Bar - end
    
    # BUG - field of view slider - start
    		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_SLIDER_NEWSTOP):
    			if (inputClass.getFunctionName() == self.szSliderId):
    				screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
    				self.iField_View = inputClass.getData() + 1
    				self.setFieldofView(screen, False)
    				self.setFieldofView_Text(screen)
    				MainOpt.setFieldOfView(self.iField_View)
    # BUG - field of view slider - end
    
    		return 0
    	
    # BUG - Raw Yields - start
    	def handleRawYieldsButtons(self, inputClass):
    		iButton = inputClass.getID()
    		if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON):
    			self.PLE.displayHelpHover(RAW_YIELD_HELP[iButton])
    		elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF):
    			self.PLE.hideInfoPane()
    		elif (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED):
    			global g_bYieldView
    			global g_iYieldType
    			global g_iYieldTiles
    			if iButton == 0:
    				g_bYieldView = False
    			elif iButton in (1, 2, 3):
    				g_bYieldView = True
    				g_iYieldType = RawYields.YIELDS[iButton - 1]
    			elif iButton in (4, 5, 6):
    				g_bYieldView = True
    				g_iYieldTiles = RawYields.TILES[iButton - 4]
    			else:
    				return 0
    			CyInterface().setDirty(InterfaceDirtyBits.CityScreen_DIRTY_BIT, True)
    			return 1
    		return 0
    # BUG - Raw Yields - end
    	
    	def update(self, fDelta):
    		return
    
    Any ideas how to merge the code?
     

Share This Page