Fixed if statement formatting in displayStats() and timer() in Application.cpp

This commit is contained in:
Mark Peng 2013-06-28 16:20:05 -07:00
parent 53543c26fe
commit be2e6518a1

View file

@ -849,9 +849,10 @@ void sendPingPackets() {
void Application::timer() { void Application::timer() {
gettimeofday(&_timerEnd, NULL); gettimeofday(&_timerEnd, NULL);
if (_testPing->isChecked()) if (_testPing->isChecked()) {
sendPingPackets(); sendPingPackets();
}
_fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f); _fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
_packetsPerSecond = (float)_packetCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f); _packetsPerSecond = (float)_packetCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
_bytesPerSecond = (float)_bytesCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f); _bytesPerSecond = (float)_bytesCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
@ -2306,12 +2307,9 @@ void Application::displayStats() {
Agent *avatarMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER); Agent *avatarMixerAgent = agentList->soloAgentOfType(AGENT_TYPE_AVATAR_MIXER);
Agent *voxelServerAgent = agentList->soloAgentOfType(AGENT_TYPE_VOXEL_SERVER); Agent *voxelServerAgent = agentList->soloAgentOfType(AGENT_TYPE_VOXEL_SERVER);
if (audioMixerAgent != NULL) pingAudio = audioMixerAgent ? audioMixerAgent->getPingMs() : 0;
pingAudio = audioMixerAgent->getPingMs(); pingAvatar = avatarMixerAgent ? avatarMixerAgent->getPingMs() : 0;
if (avatarMixerAgent != NULL) pingVoxel = voxelServerAgent ? voxelServerAgent->getPingMs() : 0;
pingAvatar = avatarMixerAgent->getPingMs();
if (voxelServerAgent != NULL)
pingVoxel = voxelServerAgent->getPingMs();
char pingStats[200]; char pingStats[200];
sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d ", pingAudio, pingAvatar, pingVoxel); sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d ", pingAudio, pingAvatar, pingVoxel);