don't accept voxel packet if rendering is turned off, correct boolean for kill

This commit is contained in:
Stephen Birarda 2013-07-15 17:08:55 -07:00
parent 38d8041bfb
commit 9f9d8e59bd

View file

@ -1245,7 +1245,7 @@ void Application::setRenderWarnings(bool renderWarnings) {
} }
void Application::setRenderVoxels(bool voxelRender) { void Application::setRenderVoxels(bool voxelRender) {
if (voxelRender) { if (!voxelRender) {
doKillLocalVoxels(); doKillLocalVoxels();
} }
} }
@ -3224,7 +3224,7 @@ void* Application::networkReceive(void* args) {
if (app->_wantToKillLocalVoxels) { if (app->_wantToKillLocalVoxels) {
app->_voxels.killLocalVoxels(); app->_voxels.killLocalVoxels();
app->_wantToKillLocalVoxels = false; app->_wantToKillLocalVoxels = false;
} }
if (NodeList::getInstance()->getNodeSocket()->receive(&senderAddress, app->_incomingPacket, &bytesReceived)) { if (NodeList::getInstance()->getNodeSocket()->receive(&senderAddress, app->_incomingPacket, &bytesReceived)) {
app->_packetCount++; app->_packetCount++;
@ -3246,17 +3246,19 @@ void* Application::networkReceive(void* args) {
case PACKET_TYPE_Z_COMMAND: case PACKET_TYPE_Z_COMMAND:
case PACKET_TYPE_ERASE_VOXEL: case PACKET_TYPE_ERASE_VOXEL:
case PACKET_TYPE_ENVIRONMENT_DATA: { case PACKET_TYPE_ENVIRONMENT_DATA: {
Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); if (app->_renderVoxels->isChecked()) {
if (voxelServer) { Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
voxelServer->lock(); if (voxelServer) {
voxelServer->lock();
if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
app->_environment.parseData(&senderAddress, app->_incomingPacket, bytesReceived); if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
} else { app->_environment.parseData(&senderAddress, app->_incomingPacket, bytesReceived);
app->_voxels.parseData(app->_incomingPacket, bytesReceived); } else {
app->_voxels.parseData(app->_incomingPacket, bytesReceived);
}
voxelServer->unlock();
} }
voxelServer->unlock();
} }
break; break;
} }