Rik's Treehouse > Babbling in Binary > My Software > Orphanware > R2DToo > R2DToo Help > For the Programmer > forEachNbr

forEachNbr

Declaration
Parameters
Remarks
Revisions
Example
See Also

Declaration

void __stdcall forEachNbr(
	int x,                               // x-coordinate of agent
	int y,                               // y-coordinate of agent
	bool (*func)(pState,int,int,         // name of function
	             pState*,int,int)
);
Top of page

Parameters

x
X-coordinate of agent whose neighbours are to be processed (zero based).
y
Y-coordinate of agent whose neighbours are to be processed (zero based).
func
The name of a function to apply to each neighbour in turn. (See Remarks.)
Top of page

Remarks

This function is available through the API. It provides an efficient way to process every neighbour to the agent at (x,y) in turn. The details of this function are the same as that for
forEachAgent except that the iteration is only over the neighbours of a single agent. Top of page

Revisions

API v1.5
  • no longer passes param to func
Top of page

Example

void __stdcall onTick(double &time) { int x,y; int nbrCount; pState *nbr; pState state = anyAgent(NULL,x,y,nbr,nbrCount); forEachNbr(x,y,someOperation); }
Top of page

See Also

forEachAgent, forEachNbrVar.
Top of page
[Rik's Office Hours] [Contact Rik]
Last updated: Fri Apr 30 2004, 1:37pm