Merge pull request #1009 from birarda/assignment

changes to assignment flow, fix for restart hold behavior
This commit is contained in:
ZappoMan 2013-10-02 15:00:45 -07:00
commit 3635f448b3
4 changed files with 11 additions and 7 deletions

View file

@ -138,7 +138,9 @@ void Agent::run() {
hasVoxelServer = true;
}
}
} else {
}
if (hasVoxelServer) {
// allow the scripter's call back to setup visual data
emit willSendVisualDataCallback();
@ -147,6 +149,8 @@ void Agent::run() {
qDebug() << "Uncaught exception at line" << line << ":" << engine.uncaughtException().toString() << "\n";
}
// flush the queue of packets and then process them so they are all sent off
voxelScripter.getVoxelPacketSender()->flushQueue();
voxelScripter.getVoxelPacketSender()->processWithoutSleep();
}

View file

@ -9,7 +9,7 @@
#include "VoxelScriptingInterface.h"
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
_voxelPacketSender.sendVoxelEditMessage(addPacketType, addVoxelDetails);
_voxelPacketSender.queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
}
void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float scale, uchar red, uchar green, uchar blue) {
@ -34,5 +34,5 @@ void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float
// setup a VoxelDetail struct with data
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
_voxelPacketSender.sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, deleteVoxelDetail);
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
}

View file

@ -2,14 +2,14 @@
// The following is an example of Conway's Game of Life (http://en.wikipedia.org/wiki/Conway's_Game_of_Life)
var NUMBER_OF_CELLS_EACH_DIMENSION = 32;
var NUMBER_OF_CELLS_EACH_DIMENSION = 64;
var NUMBER_OF_CELLS = NUMBER_OF_CELLS_EACH_DIMENSION * NUMBER_OF_CELLS_EACH_DIMENSION;
var currentCells = [];
var nextCells = [];
var METER_LENGTH = 1 / TREE_SCALE;
var cellScale = (8 * METER_LENGTH) / NUMBER_OF_CELLS_EACH_DIMENSION;
var cellScale = (NUMBER_OF_CELLS_EACH_DIMENSION * METER_LENGTH) / NUMBER_OF_CELLS_EACH_DIMENSION;
print("TREE_SCALE = " + TREE_SCALE + "\n");

View file

@ -345,7 +345,7 @@ void DomainServer::possiblyAddStaticAssignmentsBackToQueueAfterRestart(timeval*
// throw into the assignment queue
const uint64_t RESTART_HOLD_TIME_USECS = 5 * 1000 * 1000;
if (usecTimestampNow() - usecTimestamp(startTime) > RESTART_HOLD_TIME_USECS) {
if (!_hasCompletedRestartHold && usecTimestampNow() - usecTimestamp(startTime) > RESTART_HOLD_TIME_USECS) {
_hasCompletedRestartHold = true;
// pull anything in the static assignment file that isn't spoken for and add to the assignment queue
@ -530,7 +530,7 @@ int DomainServer::run() {
qDebug("Received a request for assignment.\n");
if (_hasCompletedRestartHold) {
if (!_hasCompletedRestartHold) {
possiblyAddStaticAssignmentsBackToQueueAfterRestart(&startTime);
}