Merge pull request #1043 from birarda/master

fix domain jumping with goToUser, remove planet environments
This commit is contained in:
Philip Rosedale 2013-10-10 17:25:43 -07:00
commit bf3f507301
7 changed files with 40 additions and 46 deletions

View file

@ -3524,6 +3524,9 @@ void Application::domainChanged(QString domain) {
// update the user's last domain in their Profile (which will propagate to data-server)
_profile.updateDomain(domain);
// reset the environment so that we don't erroneously end up with multiple
_environment.resetToDefault();
}
void Application::nodeAdded(Node* node) {

View file

@ -730,20 +730,8 @@ void updateDSHostname(const QString& domainServerHostname) {
newHostname = domainServerHostname;
}
// check if the domain server hostname is new
if (NodeList::getInstance()->getDomainHostname() != newHostname) {
NodeList::getInstance()->clear();
// kill the local voxels
Application::getInstance()->getVoxels()->killLocalVoxels();
// reset the environment to default
Application::getInstance()->getEnvironment()->resetToDefault();
// set the new hostname
NodeList::getInstance()->setDomainHostname(newHostname);
}
// give our nodeList the new domain-server hostname
NodeList::getInstance()->setDomainHostname(newHostname);
}
const int QLINE_MINIMUM_WIDTH = 400;

View file

@ -109,6 +109,9 @@ Avatar::Avatar(Node* owningNode) :
_maxArmLength(0.0f),
_pelvisStandingHeight(0.0f)
{
// we may have been created in the network thread, but we live in the main thread
moveToThread(Application::getInstance()->thread());
// give the pointer to our head to inherited _headData variable from AvatarData
_headData = &_head;
_handData = &_hand;

View file

@ -61,7 +61,11 @@ Node::Node(sockaddr* publicSocket, sockaddr* localSocket, char type, uint16_t no
Node::~Node() {
delete _publicSocket;
delete _localSocket;
delete _linkedData;
if (_linkedData) {
_linkedData->deleteLater();
}
delete _bytesReceivedMovingAverage;
pthread_mutex_destroy(&_mutex);

View file

@ -14,4 +14,6 @@ NodeData::NodeData(Node* owningNode) :
}
NodeData::~NodeData() {}
NodeData::~NodeData() {
}

View file

@ -88,28 +88,35 @@ NodeList::~NodeList() {
void NodeList::setDomainHostname(const QString& domainHostname) {
int colonIndex = domainHostname.indexOf(':');
if (colonIndex > 0) {
// the user has included a custom DS port with the hostname
if (domainHostname != _domainHostname) {
int colonIndex = domainHostname.indexOf(':');
// the new hostname is everything up to the colon
_domainHostname = domainHostname.left(colonIndex);
if (colonIndex > 0) {
// the user has included a custom DS port with the hostname
// the new hostname is everything up to the colon
_domainHostname = domainHostname.left(colonIndex);
// grab the port by reading the string after the colon
_domainPort = atoi(domainHostname.mid(colonIndex + 1, domainHostname.size()).toLocal8Bit().constData());
qDebug() << "Updated hostname to" << _domainHostname << "and port to" << _domainPort << "\n";
} else {
// no port included with the hostname, simply set the member variable and reset the domain server port to default
_domainHostname = domainHostname;
_domainPort = DEFAULT_DOMAIN_SERVER_PORT;
}
// grab the port by reading the string after the colon
_domainPort = atoi(domainHostname.mid(colonIndex + 1, domainHostname.size()).toLocal8Bit().constData());
// clear the NodeList so nodes from this domain are killed
clear();
qDebug() << "Updated hostname to" << _domainHostname << "and port to" << _domainPort << "\n";
} else {
// no port included with the hostname, simply set the member variable and reset the domain server port to default
_domainHostname = domainHostname;
_domainPort = DEFAULT_DOMAIN_SERVER_PORT;
// reset our _domainIP to the null address so that a lookup happens on next check in
_domainIP.clear();
notifyDomainChanged();
}
// reset our _domainIP to the null address so that a lookup happens on next check in
_domainIP.clear();
notifyDomainChanged();
}
void NodeList::timePingReply(sockaddr *nodeAddress, unsigned char *packetData) {

View file

@ -295,19 +295,6 @@ void VoxelServer::run() {
}
qDebug("packetsPerSecond=%s PACKETS_PER_CLIENT_PER_INTERVAL=%d\n", packetsPerSecond, _packetsPerClientPerInterval);
}
// for now, initialize the environments with fixed values
_environmentData[1].setID(1);
_environmentData[1].setGravity(1.0f);
_environmentData[1].setAtmosphereCenter(glm::vec3(0.5, 0.5, (0.25 - 0.06125)) * (float)TREE_SCALE);
_environmentData[1].setAtmosphereInnerRadius(0.030625f * TREE_SCALE);
_environmentData[1].setAtmosphereOuterRadius(0.030625f * TREE_SCALE * 1.05f);
_environmentData[2].setID(2);
_environmentData[2].setGravity(1.0f);
_environmentData[2].setAtmosphereCenter(glm::vec3(0.5f, 0.5f, 0.5f) * (float)TREE_SCALE);
_environmentData[2].setAtmosphereInnerRadius(0.1875f * TREE_SCALE);
_environmentData[2].setAtmosphereOuterRadius(0.1875f * TREE_SCALE * 1.05f);
_environmentData[2].setScatteringWavelengths(glm::vec3(0.475f, 0.570f, 0.650f)); // swaps red and blue
sockaddr senderAddress;