Cancel Open Borders

platyping

Sleeping Dragon
Joined
Oct 22, 2010
Messages
4,626
Location
Emerald Dreams
Code:
for i in range(CyGame().getNumDeals()):
	pDeal = CyGame().getDeal(i)
	for j in range(pDeal.getLengthFirstTrades()):
		[COLOR="Red"]if pDeal.getFirstTrade(j).ItemType == 5: #== gc.getInfoTypeForString("TRADE_OPEN_BORDERS"):[/COLOR]
			iTeam1 = gc.getPlayer(pDeal.getFirstPlayer()).getTeam()
			iTeam2 = gc.getPlayer(pDeal.getSecondPlayer()).getTeam()
			if (iTeam1 == self.m_iOtherTeam and iTeam2 == self.m_iCurrentTeam) or (iTeam2 == self.m_iOtherTeam and iTeam1 == self.m_iCurrentTeam):
				pDeal.kill()

Hmm, trying to find a way to cancel an existing open borders.
So far this works, but only because I use the exact integer which represents Open Borders in default BTS.
The gc.getInfoTypeForString method in this case didn't work (The commented part)
Is there any other better way so that it will work in generic mods?
 
Back
Top Bottom