Starting agent count at 1 to allow for 0 to be non-id specifier and packing the id into boadcast packet

This commit is contained in:
Leonardo Murillo 2013-03-22 11:30:17 -06:00
parent a76f8a46cd
commit a1691f54a1

View file

@ -25,14 +25,14 @@ AgentList::AgentList() : agentSocket(AGENT_SOCKET_LISTEN_PORT) {
linkedDataCreateCallback = NULL;
audioMixerSocketUpdate = NULL;
voxelServerAddCallback = NULL;
lastAgentId = 0;
lastAgentId = 1;
}
AgentList::AgentList(int socketListenPort) : agentSocket(socketListenPort) {
linkedDataCreateCallback = NULL;
audioMixerSocketUpdate = NULL;
voxelServerAddCallback = NULL;
lastAgentId = 0;
lastAgentId = 1;
}
AgentList::~AgentList() {
@ -114,6 +114,11 @@ int AgentList::unpackAgentId(unsigned char *packedData, uint16_t *agentId) {
return sizeof(uint16_t);
}
int AgentList::packAgentId(unsigned char *packStore, uint16_t agentId) {
memcpy(&agentId, packStore, sizeof(uint16_t));
return sizeof(uint16_t);
}
int AgentList::updateList(unsigned char *packetData, size_t dataBytes) {
int readAgents = 0;