remove unused timestamp

This commit is contained in:
J. Nick Koston
2025-06-06 19:28:36 +01:00
parent 051aee5228
commit efe3ffe1da
2 changed files with 5 additions and 6 deletions

View File

@@ -1707,17 +1707,17 @@ void APIConnection::on_fatal_error() {
void APIConnection::DeferredBatch::add_item(EntityBase *entity, MessageCreator creator, uint16_t message_type) {
// Check if we already have a message of this type for this entity
// This provides deduplication per entity/message_type combination
// O(n) but optimized for RAM and not performance.
for (auto &item : items) {
if (item.entity == entity && item.message_type == message_type) {
// Update the existing item with the new creator and timestamp
// Update the existing item with the new creator
item.creator = std::move(creator);
item.timestamp = App.get_loop_component_start_time();
return;
}
}
// No existing item found, add new one
items.emplace_back(entity, std::move(creator), App.get_loop_component_start_time(), message_type);
items.emplace_back(entity, std::move(creator), message_type);
}
bool APIConnection::schedule_batch_() {

View File

@@ -488,14 +488,13 @@ class APIConnection : public APIServerConnection {
struct BatchItem {
EntityBase *entity; // Entity pointer
MessageCreator creator; // Function that creates the message when needed
uint32_t timestamp; // When this update was queued
uint16_t message_type; // Message type for overhead calculation
// Constructor for creating BatchItem
BatchItem(EntityBase *entity,
std::function<EncodedMessage(EntityBase *, APIConnection *, uint32_t, bool)> creator,
uint32_t timestamp, uint16_t message_type)
: entity(entity), creator(std::move(creator)), timestamp(timestamp), message_type(message_type) {}
uint16_t message_type)
: entity(entity), creator(std::move(creator)), message_type(message_type) {}
};
std::vector<BatchItem> items;