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

onAgentDestroy

Declaration
Parameters
Remarks
Revisions
Example
See Also

Declaration

void __stdcall onAgentDestroy(
	int x,       	// x-coordinate of agent
	int y       	// y-coordinate of agent
);
Top of page

Parameters

x
X-coordinate of agent (zero based).
y
Y-coordinate of agent (zero based).
Top of page

Remarks

This optional function may be provided by the model. It is called by the simulation just before each agent is destroyed at the end of a simulation. This is a good place to clean up any memory allocated with
onAgentCreate. Top of page

Revisions

API v1.5
  • new!
Top of page

Example

double *extraData[256][256]; //--------------------------------------------------------------------------- void __stdcall onAgentCreate(int x, int y) { setStateCount(x,y, 2); // pos index name initial value assignState(x,y, 0, "alive", flip(*getParamRef("Initial Population")); assignState(x,y, 1, "alive nbrs", 0); // allocate some extra storage for agent (x,y) extraData[x][y] = new double[10]; } //--------------------------------------------------------------------------- void __stdcall onAgentDestroy(int x, int y) { delete [] extraData[x][y]; } //--------------------------------------------------------------------------- Top of page

See Also

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