View Full Version : odd Python mapscript error -- little help...?


LibertyGeis
Oct 28, 2006, 12:30 AM
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:

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:

106: def findStartingPlot(playerID, validFn = None):
107:
108: # global pointers
109: gc = CyGlobalContext()
110: map = CyMap()
111: player = gc.getPlayer(playerID)
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.

Denniz
Oct 29, 2006, 03:53 AM
The important bit is: ArgumentError: Python argument types in
CyGlobalContext.getPlayer(CyGlobalContext, tuple)
did not match C++ signature:
getPlayer(class CyGlobalContext {lvalue}, int)
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)