fixed: Box destroition
This commit is contained in:
1 parent
78046e5e2d
commit
05a13a40e7
3 files changed
+20
-7
No files matched your search
+11
-2
@@ -176,9 +176,18 @@ private:
|
||||
std::lock_guard<std::mutex> lock(g_boxes_mutex);
|
||||
|
||||
std::string boxMsg = "BOXES:";
|
||||
bool first = true;
|
||||
|
||||
for (size_t i = 0; i < g_serverBoxes.size(); ++i) {
|
||||
const auto& box = g_serverBoxes[i];
|
||||
|
||||
if (box.destroyed) continue;
|
||||
|
||||
Eigen::Quaternionf q(box.rotation);
|
||||
|
||||
if (!first) boxMsg += "|";
|
||||
first = false;
|
||||
|
||||
boxMsg += std::to_string(i) + ":" +
|
||||
std::to_string(box.position.x()) + ":" +
|
||||
std::to_string(box.position.y()) + ":" +
|
||||
@@ -187,10 +196,10 @@ private:
|
||||
std::to_string(q.x()) + ":" +
|
||||
std::to_string(q.y()) + ":" +
|
||||
std::to_string(q.z()) + ":" +
|
||||
(std::to_string(box.destroyed ? 1 : 0)) + "|";
|
||||
"0";
|
||||
}
|
||||
if (!boxMsg.empty() && boxMsg.back() == '|') boxMsg.pop_back();
|
||||
|
||||
// Если все коробки уничтожены — отправится просто "BOXES:" (это нормально)
|
||||
send_message(boxMsg);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user