mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 18:13:29 +02:00
add return of number of alive agents from AgentList
This commit is contained in:
parent
ef8c48245e
commit
2a4d9c98ee
2 changed files with 13 additions and 0 deletions
|
@ -191,6 +191,18 @@ Agent* AgentList::agentWithID(uint16_t agentID) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int AgentList::numAliveAgents() const {
|
||||
int numAliveAgents = 0;
|
||||
|
||||
for (AgentList::iterator agent = begin(); agent != end(); agent++) {
|
||||
if (agent->isAlive()) {
|
||||
++numAliveAgents;
|
||||
}
|
||||
}
|
||||
|
||||
return numAliveAgents;
|
||||
}
|
||||
|
||||
void AgentList::setAgentTypesOfInterest(const char* agentTypesOfInterest, int numAgentTypesOfInterest) {
|
||||
delete _agentTypesOfInterest;
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
void(*linkedDataCreateCallback)(Agent *);
|
||||
|
||||
int size() { return _numAgents; }
|
||||
int numAliveAgents() const;
|
||||
|
||||
void lock() { pthread_mutex_lock(&mutex); }
|
||||
void unlock() { pthread_mutex_unlock(&mutex); }
|
||||
|
|
Loading…
Reference in a new issue