mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
ff6dcfea82
commit
038da00e79
38 changed files with 84 additions and 94 deletions
|
@ -152,7 +152,7 @@ void Client::handleCommand_AuthAccept(NetworkPacket* pkt)
|
|||
language code (e.g. "de" for German). */
|
||||
std::string lang = gettext("LANG_CODE");
|
||||
if (lang == "LANG_CODE")
|
||||
lang = "";
|
||||
lang.clear();
|
||||
|
||||
NetworkPacket resp_pkt(TOSERVER_INIT2, sizeof(u16) + lang.size());
|
||||
resp_pkt << lang;
|
||||
|
|
|
@ -64,7 +64,7 @@ BufferedPacketPtr makePacket(Address &address, const SharedBuffer<u8> &data,
|
|||
{
|
||||
u32 packet_size = data.getSize() + BASE_HEADER_SIZE;
|
||||
|
||||
BufferedPacketPtr p(new BufferedPacket(packet_size));
|
||||
auto p = std::make_shared<BufferedPacket>(packet_size);
|
||||
p->address = address;
|
||||
|
||||
writeU32(&p->data[0], protocol_id);
|
||||
|
@ -492,10 +492,10 @@ SharedBuffer<u8> IncomingSplitBuffer::insert(BufferedPacketPtr &p_ptr, bool reli
|
|||
|
||||
void IncomingSplitBuffer::removeUnreliableTimedOuts(float dtime, float timeout)
|
||||
{
|
||||
std::deque<u16> remove_queue;
|
||||
std::vector<u16> remove_queue;
|
||||
{
|
||||
MutexAutoLock listlock(m_map_mutex);
|
||||
for (auto &i : m_buf) {
|
||||
for (const auto &i : m_buf) {
|
||||
IncomingSplitPacket *p = i.second;
|
||||
// Reliable ones are not removed by timeout
|
||||
if (p->reliable)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue