Fixed issues with scale up and erasing over network

This commit is contained in:
Yousef Khadadeh 2026-05-30 16:28:22 +03:00
parent 09f29c6329
commit 015e9bc5df
9 changed files with 62 additions and 20 deletions

View file

@ -22,13 +22,14 @@
namespace NetworkingObjects {
void DelayUpdateSerializedClassManager::update(NetworkingObjects::NetObjManager& netObjMan) {
for(auto& [objID, updatingObj] : updatingObjs) {
if(updatingObj.lastTemporaryUpdateTimePoint.has_value() && (std::chrono::steady_clock::now() - updatingObj.lastTemporaryUpdateTimePoint.value()) >= std::chrono::milliseconds(300)) {
if(!updatingObj.updateLock && updatingObj.lastTemporaryUpdateTimePoint.has_value() && (std::chrono::steady_clock::now() - updatingObj.lastTemporaryUpdateTimePoint.value()) >= std::chrono::milliseconds(300)) {
updatingObj.sendFinalUpdate();
updatingObj.lastTemporaryUpdateTimePoint = std::nullopt;
}
}
std::erase_if(updatingObjs, [](auto& updatingPair) {
if((std::chrono::steady_clock::now() - updatingPair.second.lastUpdateTimePoint) >= std::chrono::seconds(3) && !updatingPair.second.lastTemporaryUpdateTimePoint.has_value()) {
constexpr auto TIME_TO_DISPLAY_NETWORK_UPDATES = std::chrono::seconds(5);
if((std::chrono::steady_clock::now() - updatingPair.second.lastUpdateTimePoint) >= TIME_TO_DISPLAY_NETWORK_UPDATES && !updatingPair.second.lastTemporaryUpdateTimePoint.has_value() && !updatingPair.second.updateLock) {
updatingPair.second.setDataAfterTimeout();
return true;
}