OOS with getBuildingCostMod

Alrik2002

Warlord
Joined
May 24, 2012
Messages
214
Location
Berlin, Germany
Hi,

I have added one of Platypings wonders to my mod. It works fine but in a pitboss game, I´ve the problem that the pitboss doesn´t use the discount. Every Player in the game has the same gamestats only the pitboss differs.

I´ve no idea how to fix this. Here is the code:

Code:
	def getBuildingCostMod(self, argsList):
		iPlayer, iCityID, iBuilding = argsList
		pPlayer = gc.getPlayer(iPlayer)
		pCity = pPlayer.getCity(iCityID)
		pTeam = gc.getTeam(pPlayer.getTeam())
		iCostMod = -1 # Any value > 0 will be used

		Discount = 0
## Apadana Palace Start ##
		if pTeam.getBuildingClassCount(gc.getInfoTypeForString("BUILDINGCLASS_APADANA_PALACE")) == 1:
			obsoleteTech = gc.getBuildingInfo(gc.getInfoTypeForString("BUILDING_APADANA_PALACE")).getObsoleteTech()
			if gc.getTeam(pPlayer.getTeam()).isHasTech(obsoleteTech) == false or obsoleteTech == -1:
				capital = pPlayer.getCapitalCity()
				if capital.getNumActiveBuilding(iBuilding) == 1 and not pCity.isCapital():
					return 80
## Platyping Wonders End ##
		return iCostMod

Thank you very much for your help.

EDIT: I´ve tested the code on standard BtS with only this change. There it works fine even in pitboss games. Since I use K-Mod which is based on BUG it seems, that the changes BUG made with the gameUtils are causing my problems. I testes the code in SP and MP DirectIP (without pitboss). Even there it works perfect. Only the pitboss seems to have the problems.
 
Problems with Pitboss usually indicate that some piece of code can't deal with a player ID of -1 which the Pitboss himself has and passes to some calls.
 
Problems with Pitboss usually indicate that some piece of code can't deal with a player ID of -1 which the Pitboss himself has and passes to some calls.

In such a case, I would suggest adding the following line to the beginning of the function:

Code:
if not (iPlayer == PlayerTypes.NO_PLAYER):
 
Top Bottom