Merge branch 'master' into jgrpp

# Conflicts:
#	.gitignore
#	src/network/network_server.cpp
#	src/vehicle_gui.cpp
This commit is contained in:
Jonathan G Rennison
2020-07-12 12:26:17 +01:00
38 changed files with 66 additions and 120 deletions

View File

@@ -148,11 +148,12 @@ struct PacketWriter : SaveFilter {
this->packets.push_back(std::move(this->current));
}
void PrependQueue(std::unique_ptr<Packet> p)
/** Prepend the current packet to the queue. */
void PrependQueue()
{
if (p == nullptr) return;
if (this->current == nullptr) return;
this->packets.push_front(std::move(p));
this->packets.push_front(std::move(this->current));
}
void Write(byte *buf, size_t size) override
@@ -195,9 +196,9 @@ struct PacketWriter : SaveFilter {
this->AppendQueue();
/* Fast-track the size to the client. */
std::unique_ptr<Packet> p(new Packet(PACKET_SERVER_MAP_SIZE));
p->Send_uint32((uint32)this->total_size);
this->PrependQueue(std::move(p));
this->current.reset(new Packet(PACKET_SERVER_MAP_SIZE));
this->current->Send_uint32((uint32)this->total_size);
this->PrependQueue();
}
};