Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -1145,25 +1145,20 @@ void Application::editPreferences() { · 1144 unmodified lines | |||
| 1145 | return; | 1145 | return; |
| 1146 | } | 1146 | } |
| 1147 | 1147 | ||
| 1148 | 1148 | char newHostname[MAX_HOSTNAME_BYTES] = {}; | |
| 1149 | const char* newHostname = domainServerHostname->text().toLocal8Bit().data(); | 1149 | memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size()); |
| 1150 | 1150 | ||
| 1151 | // check if the domain server hostname is new | 1151 | // check if the domain server hostname is new |
| 1152 | if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, sizeof(&newHostname)) != 0) { | 1152 | if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) { |
| 1153 | // if so we need to clear the nodelist and delete the local voxels | ||
| 1154 | Node *voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | ||
| 1155 | 1153 | ||
| 1156 | if (voxelServer) { | 1154 | NodeList::getInstance()->clear(); |
| 1157 | voxelServer->lock(); | ||
| 1158 | } | ||
| 1159 | 1155 | ||
| 1156 | // kill the local voxels | ||
| 1160 | _voxels.killLocalVoxels(); | 1157 | _voxels.killLocalVoxels(); |
| 1161 | 1158 | ||
| 1162 | if (voxelServer) { | 1159 | // reset the environment to default |
| 1163 | voxelServer->unlock(); | 1160 | _environment.resetToDefault(); |
| 1164 | } | ||
| 1165 | 1161 | ||
| 1166 | NodeList::getInstance()->clear(); | ||
| 1167 | NodeList::getInstance()->setDomainHostname(newHostname); | 1162 | NodeList::getInstance()->setDomainHostname(newHostname); |
| 1168 | } | 1163 | } |
| 1169 | 1164 | ||
| @@ -3379,7 +3374,7 @@ void* Application::networkReceive(void* args) { · 2209 unmodified lines | |||
| 3379 | case PACKET_TYPE_ENVIRONMENT_DATA: { | 3374 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 3380 | if (app->_renderVoxels->isChecked()) { | 3375 | if (app->_renderVoxels->isChecked()) { |
| 3381 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | 3376 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); |
| 3382 | if (voxelServer) { | 3377 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { |
| 3383 | voxelServer->lock(); | 3378 | voxelServer->lock(); |
| 3384 | 3379 | ||
| 3385 | if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) { | 3380 | if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) { |