swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Remove Lrom List


From: Tomas Gudmundsson
Subject: Remove Lrom List
Date: Wed, 16 Oct 1996 10:31:29 +0000

Hi !

I have a problem with removing objects from a list, it causes a core dump.

I have a model class inherited from Swarm and an agent class inherited from 
SwarmObject. The model class has a list of agents.

An agent might decide (in its step method) to die and it should then be removed 
from the list. I am trying to do this as follows :

agent.m :
-step {
...
  if (decidedToDie)
    [model removeAgent: self];
...
}

model.m :
-removeAgent: (Agent*)a {
  [agentList remove: a];
  [a drop];                         // Should I call this ?
  return self;
}

Any help appreciated !

Thanks in advance !
Tomas Gudmundsson
Danish Hydraulic Institute


reply via email to

[Prev in Thread] Current Thread [Next in Thread]