fix domain-server to use new AgentList iterator

This commit is contained in:
Stephen Birarda 2013-04-25 15:24:36 -07:00
parent ef6593eb89
commit 88eca95020

View file

@ -49,7 +49,7 @@ const int LOGOFF_CHECK_INTERVAL = 5000;
int lastActiveCount = 0;
unsigned char * addAgentToBroadcastPacket(unsigned char *currentPosition, Agent *agentToAdd) {
unsigned char* addAgentToBroadcastPacket(unsigned char* currentPosition, Agent* agentToAdd) {
*currentPosition++ = agentToAdd->getType();
currentPosition += packAgentId(currentPosition, agentToAdd->getAgentId());
@ -127,30 +127,30 @@ int main(int argc, const char * argv[])
currentBufferPos = broadcastPacket + 1;
startPointer = currentBufferPos;
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin();
agent != agentList->getAgents().end();
for(AgentList::iterator agent = agentList->begin();
agent != agentList->end();
agent++) {
if (DEBUG_TO_SELF ||
!agent->matches((sockaddr *)&agentPublicAddress, (sockaddr *)&agentLocalAddress, agentType)) {
if (memchr(SOLO_AGENT_TYPES, agent->getType(), sizeof(SOLO_AGENT_TYPES)) == NULL) {
!(*agent).matches((sockaddr *)&agentPublicAddress, (sockaddr *)&agentLocalAddress, agentType)) {
if (memchr(SOLO_AGENT_TYPES, (*agent).getType(), sizeof(SOLO_AGENT_TYPES)) == NULL) {
// this is an agent of which there can be multiple, just add them to the packet
// don't send avatar agents to other avatars, that will come from avatar mixer
if (agentType != AGENT_TYPE_AVATAR || agent->getType() != AGENT_TYPE_AVATAR) {
if (agentType != AGENT_TYPE_AVATAR || (*agent).getType() != AGENT_TYPE_AVATAR) {
currentBufferPos = addAgentToBroadcastPacket(currentBufferPos, &(*agent));
}
} else {
// solo agent, we need to only send newest
if (newestSoloAgents[agent->getType()] == NULL ||
newestSoloAgents[agent->getType()]->getFirstRecvTimeUsecs() < agent->getFirstRecvTimeUsecs()) {
if (newestSoloAgents[(*agent).getType()] == NULL ||
newestSoloAgents[(*agent).getType()]->getFirstRecvTimeUsecs() < (*agent).getFirstRecvTimeUsecs()) {
// we have to set the newer solo agent to add it to the broadcast later
newestSoloAgents[agent->getType()] = &(*agent);
newestSoloAgents[(*agent).getType()] = &(*agent);
}
}
} else {
// this is the agent, just update last receive to now
agent->setLastRecvTimeUsecs(usecTimestampNow());
(*agent).setLastRecvTimeUsecs(usecTimestampNow());
}
}