func
func is the name of a function with the following declaration:
bool func(
pState state, // array of agent state variables
int x, // X-coordinate of agent
int y, // Y-coordinate of agent
pState *nbr, // array of neighbours
int nbrCount, // size of nbr array, nbr[0..nbrCount-1]
int feaMode // calling mode, one of feaBegin, feaContinue or feaEnd
);
The parameters param, state, x, y, nbr, and nbrCount are passed into the function with the appropriate values to enable processing of each agent. The function is called first with parameter feaMode=feaBegin (and an arbitrary agent), then once for each agent with feaMode=feaContinue and finally, once more with feaMode=feaEnd (and the last agent again). See forEachAgentVarfor an example of how to use feaMode.
The function must return a boolean value. The return value is ignored when feaMode is not feaContinue. When feaMode=feaContinue a return value of true indicates that the next agent in the sequence should be processed, false tells forEachAgent to prematurely abort processing of the agents. In this case, func will only be called one more time with the same agent and feaMode=feaEnd.