fixed: Box destroition
This commit is contained in:
parent
78046e5e2d
commit
05a13a40e7
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -350,6 +350,10 @@ namespace ZL
|
||||
}
|
||||
|
||||
boxAlive.resize(boxCoordsArr.size(), true);
|
||||
#ifdef NETWORK
|
||||
std::fill(boxAlive.begin(), boxAlive.end(), false);
|
||||
serverBoxesApplied = false;
|
||||
#endif
|
||||
ZL::CheckGlError();
|
||||
boxLabels.clear();
|
||||
boxLabels.reserve(boxCoordsArr.size());
|
||||
@ -662,10 +666,10 @@ namespace ZL
|
||||
boxRenderArr[i].RefreshVBO();
|
||||
}
|
||||
boxAlive.assign(boxCoordsArr.size(), true);
|
||||
if (destroyedFlags.size() == boxAlive.size()) {
|
||||
for (size_t i = 0; i < boxAlive.size(); ++i) {
|
||||
if (destroyedFlags[i]) boxAlive[i] = false;
|
||||
}
|
||||
|
||||
size_t n = (std::min)(destroyedFlags.size(), boxAlive.size());
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
if (destroyedFlags[i]) boxAlive[i] = false; // destroyed => не рисуем
|
||||
}
|
||||
serverBoxesApplied = true;
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ namespace ZL {
|
||||
|
||||
if (msg.rfind("PROJECTILE:", 0) == 0) {
|
||||
//auto parts = split(msg, ':');
|
||||
if (parts.size() >= 10) {
|
||||
if (parts.size() >= 11) {
|
||||
try {
|
||||
ProjectileInfo pi;
|
||||
pi.shooterId = std::stoi(parts[1]);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user