Domain IP is used if static, else looked up.

This commit is contained in:
Philip Rosedale 2013-02-14 13:20:06 -08:00
parent 10ff074e38
commit c360fabd96
2 changed files with 13 additions and 14 deletions

View file

@ -63,7 +63,7 @@ void render_agents(int renderSelf, float * myLocation) {
glPushMatrix(); glPushMatrix();
if (!agents[i].isSelf || renderSelf) { if (!agents[i].isSelf || renderSelf) {
glTranslatef(-pos.x, -pos.y, -pos.z); glTranslatef(-pos.x, -pos.y, -pos.z);
agents[i].head.render(0); agents[i].head.render(0, myLocation);
} }
glPopMatrix(); glPopMatrix();
} }

View file

@ -58,7 +58,7 @@ int simulate_on = 1;
const int MAX_PACKET_SIZE = 1500; const int MAX_PACKET_SIZE = 1500;
char DOMAIN_HOSTNAME[] = "highfidelity.below92.com"; char DOMAIN_HOSTNAME[] = "highfidelity.below92.com";
char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be re-set by lookup on startup char DOMAIN_IP[100] = "192.168.1.47"; // IP Address will be used first if not empty string
const int DOMAINSERVER_PORT = 40102; const int DOMAINSERVER_PORT = 40102;
UDPSocket agentSocket(AGENT_UDP_PORT); UDPSocket agentSocket(AGENT_UDP_PORT);
@ -929,19 +929,18 @@ int main(int argc, char** argv)
incomingPacket = new char[MAX_PACKET_SIZE]; incomingPacket = new char[MAX_PACKET_SIZE];
// Lookup the IP address of things we have hostnames // Lookup the IP address of things we have hostnames
/* if (atoi(DOMAIN_IP) == 0) {
printf("need to look this one up\n"); struct hostent* pHostInfo;
struct hostent* pHostInfo; if ((pHostInfo = gethostbyname(DOMAIN_HOSTNAME)) != NULL) {
if ((pHostInfo = gethostbyname(DOMAIN_HOSTNAME)) != NULL) { sockaddr_in tempAddress;
sockaddr_in tempAddress; memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length);
memcpy(&tempAddress.sin_addr, pHostInfo->h_addr_list[0], pHostInfo->h_length); strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr));
strcpy(DOMAIN_IP, inet_ntoa(tempAddress.sin_addr)); printf("Domain server %s: %s\n", DOMAIN_HOSTNAME, DOMAIN_IP);
printf("Domain server found: %s\n", DOMAIN_IP);
} else { } else {
printf("Failed lookup domain server\n"); printf("Failed lookup domainserver\n");
} }
*/ } else printf("Using static domainserver IP: %s\n", DOMAIN_IP);
//std::cout << "Test address: " << inet_ntoa(testAddress.sin_addr) << "\n"; //std::cout << "Test address: " << inet_ntoa(testAddress.sin_addr) << "\n";