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 );
Parameters
x
X-coordinate of agent (zero based).
y
Y-coordinate of agent (zero based).
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
.
Revisions
API v1.5
new!
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]; } //---------------------------------------------------------------------------
See Also
onAgentCreate
.
[Rik's Office Hours]
[Contact Rik]
Last updated: Fri Apr 30 2004, 1:42pm