odd Python mapscript error -- little help...?

LibertyGeis

Chieftain
Joined
Jun 22, 2006
Messages
46
Hey all.

I'm taking a stab at reworking the findStartingPlots function used to score tiles for initial placement. I've more or less finished the preliminary code and have entered the debug phase, but now that it's test-worthy a CTD-caliber bug has surfaced.

Here's the message from my python debug file:

Code:
  File "FractalMkII", line 111, in findStartingPlot

ArgumentError: Python argument types in
    CyGlobalContext.getPlayer(CyGlobalContext, tuple)
did not match C++ signature:
    getPlayer(class CyGlobalContext {lvalue}, int)
ERR: Python function findStartingPlot failed, module FractalMkII

The thing that baffles me is that this line 111 in question was lifted directly from the CvMapGeneratorUtil.py file -- it's no more than a pointer assigned to the current player being placed. Here's the section of my file:

Code:
106: def findStartingPlot(playerID, validFn = None):
107: 	
108: 	# global pointers
109: 	gc = CyGlobalContext()
110: 	map = CyMap()
[B]111: 	player = gc.getPlayer(playerID)[/B]
112: 	dice = gc.getGame().getMapRand()
113: 	
114: 	# not sure what this is, maybe it helps the AI weigh their settling locations?
115: 	player.AI_updateFoundValues(True)
. . . .

Anyone have some idea what I've done wrong here? I'm stumped and have no idea why so simple a line, completely untouched from my template map script, can crash me to desktop.

Any help would be much appreciated.
 
The important bit is:
Code:
ArgumentError: Python argument types in
    CyGlobalContext.getPlayer(CyGlobalContext, [B][COLOR="Red"]tuple[/COLOR][/B])
did not match C++ signature:
    getPlayer(class CyGlobalContext {lvalue}, [B][COLOR="red"]int[/COLOR][/B])
Your PlayerID is not a integer. You have a tuple. You are probably passing a Player object instead of a Player number.

You probably do not need: player = gc.getPlayer(playerID).

Try: playerID.AI_updateFoundValues(True)
 
Back
Top Bottom