mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 02:53:43 +02:00
Merge pull request #712 from birarda/master
fix VS packet receipt on domain server switch
This commit is contained in:
commit
30be3f9a4e
4 changed files with 19 additions and 18 deletions
|
@ -1143,25 +1143,20 @@ void Application::editPreferences() {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
const char* newHostname = domainServerHostname->text().toLocal8Bit().data();
|
||||
|
||||
char newHostname[MAX_HOSTNAME_BYTES] = {};
|
||||
memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
|
||||
|
||||
// check if the domain server hostname is new
|
||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, sizeof(&newHostname)) != 0) {
|
||||
// if so we need to clear the nodelist and delete the local voxels
|
||||
Node *voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
|
||||
|
||||
if (voxelServer) {
|
||||
voxelServer->lock();
|
||||
}
|
||||
|
||||
_voxels.killLocalVoxels();
|
||||
|
||||
if (voxelServer) {
|
||||
voxelServer->unlock();
|
||||
}
|
||||
if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) {
|
||||
|
||||
NodeList::getInstance()->clear();
|
||||
|
||||
// kill the local voxels
|
||||
_voxels.killLocalVoxels();
|
||||
|
||||
// reset the environment to default
|
||||
_environment.resetToDefault();
|
||||
|
||||
NodeList::getInstance()->setDomainHostname(newHostname);
|
||||
}
|
||||
|
||||
|
@ -3352,7 +3347,7 @@ void* Application::networkReceive(void* args) {
|
|||
case PACKET_TYPE_ENVIRONMENT_DATA: {
|
||||
if (app->_renderVoxels->isChecked()) {
|
||||
Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
|
||||
if (voxelServer) {
|
||||
if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) {
|
||||
voxelServer->lock();
|
||||
|
||||
if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
|
||||
|
|
|
@ -47,6 +47,11 @@ void Environment::init() {
|
|||
_data[getZeroAddress()][0];
|
||||
}
|
||||
|
||||
void Environment::resetToDefault() {
|
||||
_data.clear();
|
||||
_data[getZeroAddress()][0];
|
||||
}
|
||||
|
||||
void Environment::renderAtmospheres(Camera& camera) {
|
||||
// get the lock for the duration of the call
|
||||
QMutexLocker locker(&_mutex);
|
||||
|
|
|
@ -24,6 +24,7 @@ class Environment {
|
|||
public:
|
||||
|
||||
void init();
|
||||
void resetToDefault();
|
||||
void renderAtmospheres(Camera& camera);
|
||||
|
||||
glm::vec3 getGravity (const glm::vec3& position);
|
||||
|
|
|
@ -32,7 +32,7 @@ const int DOMAIN_SERVER_CHECK_IN_USECS = 1 * 1000000;
|
|||
|
||||
extern const char SOLO_NODE_TYPES[3];
|
||||
|
||||
const int MAX_HOSTNAME_BYTES = 255;
|
||||
const int MAX_HOSTNAME_BYTES = 256;
|
||||
|
||||
extern const char DEFAULT_DOMAIN_HOSTNAME[MAX_HOSTNAME_BYTES];
|
||||
extern const char DEFAULT_DOMAIN_IP[INET_ADDRSTRLEN]; // IP Address will be re-set by lookup on startup
|
||||
|
|
Loading…
Reference in a new issue