mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +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;
|
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) {
|
void AgentList::setAgentTypesOfInterest(const char* agentTypesOfInterest, int numAgentTypesOfInterest) {
|
||||||
delete _agentTypesOfInterest;
|
delete _agentTypesOfInterest;
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
void(*linkedDataCreateCallback)(Agent *);
|
void(*linkedDataCreateCallback)(Agent *);
|
||||||
|
|
||||||
int size() { return _numAgents; }
|
int size() { return _numAgents; }
|
||||||
|
int numAliveAgents() const;
|
||||||
|
|
||||||
void lock() { pthread_mutex_lock(&mutex); }
|
void lock() { pthread_mutex_lock(&mutex); }
|
||||||
void unlock() { pthread_mutex_unlock(&mutex); }
|
void unlock() { pthread_mutex_unlock(&mutex); }
|
||||||
|
|
Loading…
Reference in a new issue