+bool MasterState::UpdateEntity(uint32_t entity_id, uint16_t seq) {
+ auto entry = update_status.find(entity_id);
+ if (entry == update_status.end()) {
+ update_status.emplace(entity_id, UpdateStatus{ seq, update_timer.Elapsed() });
+ return true;
+ }
+
+ int pack_diff = int16_t(seq) - int16_t(entry->second.last_packet);
+ int time_diff = update_timer.Elapsed() - entry->second.last_update;
+ entry->second.last_update = update_timer.Elapsed();
+
+ if (pack_diff > 0 || time_diff > 1500) {
+ entry->second.last_packet = seq;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void MasterState::ClearEntity(uint32_t entity_id) {
+ update_status.erase(entity_id);
+}
+