rename AGENT_TYPE_INTERFACE to AGENT_TYPE_AVATAR, more stubbing for eve

This commit is contained in:
Stephen Birarda 2013-04-22 11:54:24 -07:00
parent 38f8769ff6
commit c68ec079eb
6 changed files with 55 additions and 9 deletions

View file

@ -6,8 +6,54 @@
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
int main(int argc, char* argv[]) {
#include <AgentTypes.h>
#include <AgentList.h>
#include <PacketHeaders.h>
const int EVE_AGENT_LIST_PORT = 55441;
bool stopReceiveAgentDataThread;
void *receiveAgentData(void *args)
{
sockaddr senderAddress;
ssize_t bytesReceived;
unsigned char incomingPacket[MAX_PACKET_SIZE];
while (!::stopReceiveAgentDataThread) {
if (AgentList::getInstance()->getAgentSocket().receive(&senderAddress, incomingPacket, &bytesReceived)) {
// we're going to ignore any data that isn't the agent list from the domain server
// ex: the avatar mixer will be sending us the position of other agents
switch (incomingPacket[0]) {
case PACKET_HEADER_DOMAIN:
AgentList::getInstance()->processAgentData(&senderAddress, incomingPacket, bytesReceived);
break;
}
}
}
pthread_exit(0);
return NULL;
}
int main(int argc, char* argv[]) {
// create an AgentList instance to handle communication with other agents
AgentList *agentList = AgentList::createInstance(AGENT_TYPE_AVATAR, EVE_AGENT_LIST_PORT);
// start telling the domain server that we are alive
agentList->startDomainServerCheckInThread();
// start the agent list thread that will kill off agents when they stop talking
agentList->startSilentAgentRemovalThread();
// start the ping thread that hole punches to create an active connection to other agents
agentList->startPingUnknownAgentsThread();
// stop the agent list's threads
agentList->stopDomainServerCheckInThread();
agentList->stopPingUnknownAgentsThread();
agentList->stopSilentAgentRemovalThread();
}

View file

@ -331,7 +331,7 @@ void Head::simulate(float deltaTime) {
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin();
agent != agentList->getAgents().end();
agent++) {
if (( agent->getLinkedData() != NULL && ( agent->getType() == AGENT_TYPE_INTERFACE ) )) {
if (( agent->getLinkedData() != NULL && ( agent->getType() == AGENT_TYPE_AVATAR ) )) {
Head *otherAvatar = (Head *)agent->getLinkedData();
// when this is working, I will grab the position here...

View file

@ -1630,7 +1630,7 @@ int main(int argc, const char * argv[])
return EXIT_SUCCESS;
}
AgentList::createInstance(AGENT_TYPE_INTERFACE);
AgentList::createInstance(AGENT_TYPE_AVATAR);
gettimeofday(&applicationStartupTime, NULL);
const char* domainIP = getCmdOption(argc, argv, "--domain");

View file

@ -132,7 +132,7 @@ const char* Agent::getTypeName() const {
case AGENT_TYPE_VOXEL:
name = AGENT_TYPE_NAME_VOXEL;
break;
case AGENT_TYPE_INTERFACE:
case AGENT_TYPE_AVATAR:
name = AGENT_TYPE_NAME_INTERFACE;
break;
case AGENT_TYPE_AUDIO_MIXER:

View file

@ -20,7 +20,7 @@
// Agent Type Codes
const char AGENT_TYPE_DOMAIN = 'D';
const char AGENT_TYPE_VOXEL = 'V';
const char AGENT_TYPE_INTERFACE = 'I'; // could also be injector???
const char AGENT_TYPE_AVATAR = 'I'; // could also be injector???
const char AGENT_TYPE_AUDIO_MIXER = 'M';
const char AGENT_TYPE_AVATAR_MIXER = 'W';

View file

@ -345,7 +345,7 @@ int main(int argc, const char * argv[])
// Now send this to the connected agents so they know to delete
printf("rebroadcasting delete voxel message to connected agents... agentList.broadcastToAgents()\n");
agentList->broadcastToAgents(packetData,receivedBytes, &AGENT_TYPE_INTERFACE, 1);
agentList->broadcastToAgents(packetData,receivedBytes, &AGENT_TYPE_AVATAR, 1);
}
if (packetData[0] == PACKET_HEADER_Z_COMMAND) {
@ -373,14 +373,14 @@ int main(int argc, const char * argv[])
// Now send this to the connected agents so they can also process these messages
printf("rebroadcasting Z message to connected agents... agentList.broadcastToAgents()\n");
agentList->broadcastToAgents(packetData,receivedBytes, &AGENT_TYPE_INTERFACE, 1);
agentList->broadcastToAgents(packetData,receivedBytes, &AGENT_TYPE_AVATAR, 1);
}
// If we got a PACKET_HEADER_HEAD_DATA, then we're talking to an AGENT_TYPE_INTERFACE, and we
// If we got a PACKET_HEADER_HEAD_DATA, then we're talking to an AGENT_TYPE_AVATAR, and we
// need to make sure we have it in our agentList.
if (packetData[0] == PACKET_HEADER_HEAD_DATA) {
if (agentList->addOrUpdateAgent(&agentPublicAddress,
&agentPublicAddress,
AGENT_TYPE_INTERFACE,
AGENT_TYPE_AVATAR,
agentList->getLastAgentId())) {
agentList->increaseAgentId();
}