History

CR

Atlante45 committed 9 years ago

Commit 3a30de71 parent 72ed1ad6 files · +9 −20Browse files

Showing the changes to assignment-client/src/scripts/EntityScriptServer.cpp (1 of 6 files). Show all

Unified · Split

assignment-client/src/scripts/EntityScriptServer.cpp+6−16
@@ -80,9 +80,8 @@ EntityScriptServer::EntityScriptServer(ReceivedMessage& message) : ThreadedAssig · 79 unmodified lines
8080 packetReceiver.registerListener(PacketType::EntityScriptGetStatus, this, "handleEntityScriptGetStatusPacket");
8181 packetReceiver.registerListener(PacketType::EntityServerScriptLog, this, "handleEntityServerScriptLogPacket");
8282
83− static const int LOG_INTERVAL = MSECS_PER_SECOND / 50;
83+ static const int LOG_INTERVAL = MSECS_PER_SECOND / 10;
8484 auto timer = new QTimer(this);
85− timer->setTimerType(Qt::PreciseTimer);
8685 timer->setInterval(LOG_INTERVAL);
8786 connect(timer, &QTimer::timeout, this, &EntityScriptServer::pushLogs);
8887 timer->start();
@@ -215,24 +214,15 @@ void EntityScriptServer::pushLogs() { · 126 unmodified lines
215214 return;
216215 }
217216
218− auto packet = NLPacket::create(PacketType::EntityServerScriptLog, buffer.size(), true);
219− packet->write(buffer.data(), buffer.size());
220−
221217 auto nodeList = DependencyManager::get<NodeList>();
222−
223− auto last = --std::end(_logListeners);
224− for (auto it = std::begin(_logListeners); it != last; ++it) {
225− auto node = nodeList->nodeWithUUID(*it);
218+ for (auto uuid : _logListeners) {
219+ auto node = nodeList->nodeWithUUID(uuid);
226220 if (node && node->getActiveSocket()) {
227− auto copy = NLPacket::createCopy(*packet);
228− nodeList->sendPacket(std::move(copy), *node);
221+ auto packet = NLPacketList::create(PacketType::EntityServerScriptLog, QByteArray(), true, true);
222+ packet->write(buffer.data(), buffer.size());
223+ nodeList->sendPacketList(std::move(packet), *node);
229224 }
230225 }
231−
232− auto node = nodeList->nodeWithUUID(*last);
233− if (node && node->getActiveSocket()) {
234− nodeList->sendPacket(std::move(packet), *node);
235− }
236226 }
237227
238228 void EntityScriptServer::run() {