pSkipCity parameter in CyMap.findCity()

Baldyr

"Hit It"
Joined
Dec 5, 2009
Messages
5,530
Location
Sweden
I'm having a problem with CyMap.findCity():
CyCity findCity (INT iX, INT iY, PlayerType eOwner, TeamType eTeam, BOOL bSameArea, BOOL bCoastalOnly, TeamType eTeamAtWarWith, DirectionType eDirection, CyCity pSkipCity)
The last parameter is pSkipCity and it has to be a valid CyCity instance. But it should really be valid to not add this parameter - if you don't wanna skip any city. In CvMap.cpp the value NULL is referenced in this context but the Python method isn't accepting a -1 or a None value.

NULL of course doesn't work either, even if the API actually suggests it:
CyCity* (int iX, int iY, int (PlayerTypes) eOwner = NO_PLAYER, int (TeamTypes) eTeam = NO_TEAM, bool bSameArea = true, bool bCoastalOnly = false, int (TeamTypes) eTeamAtWarWith = NO_TEAM, int (DirectionTypes) eDirection = NO_DIRECTION, CvCity* pSkipCity = NULL) - finds city
The only think I could get working is to find some nonsensical CyCity object, totally out of context, to skip and use that. But there really should be a better way.
 
The only Python file I have anywhere that uses this is QuotCapitaEventManager.py (which is, not too surprisingly, part of the Quot Capita mod).

It uses "CyCity()" for the last parameter:
Code:
			iCity = gc.getMap().findCity(pWinner.getX(), pWinner.getY(), pWinner.getOwner(), TeamTypes.NO_TEAM, True, False, TeamTypes.NO_TEAM, DirectionTypes.NO_DIRECTION, CyCity())
So it creates a whole new CyCity object that is not a reference to any actual city in the game every time it calls this.
 
:lol: Thats great! :D Thanks a lot!
 
Top Bottom