Browse Source

🎨 push_back -> emplace_back

pull/1638/head
Anders Jenbo 5 years ago
parent
commit
7c054bc005
  1. 4
      Source/dvlnet/base.cpp
  2. 2
      Source/dvlnet/protocol_zt.cpp
  3. 6
      Source/init.cpp

4
Source/dvlnet/base.cpp

@ -69,7 +69,7 @@ void base::recv_local(packet &pkt)
}
switch (pkt.type()) {
case PT_MESSAGE:
message_queue.push_back(message_t(pkt.src(), pkt.message()));
message_queue.emplace_back(pkt.src(), pkt.message());
break;
case PT_TURN:
turn_queue[pkt.src()].push_back(pkt.turn());
@ -126,7 +126,7 @@ bool base::SNetSendMessage(int playerID, void *data, unsigned int size)
auto raw_message = reinterpret_cast<unsigned char *>(data);
buffer_t message(raw_message, raw_message + size);
if (playerID == plr_self || playerID == SNPLAYER_ALL)
message_queue.push_back(message_t(plr_self, message));
message_queue.emplace_back(plr_self, message);
plr_t dest;
if (playerID == SNPLAYER_ALL || playerID == SNPLAYER_OTHERS)
dest = PLR_BROADCAST;

2
Source/dvlnet/protocol_zt.cpp

@ -192,7 +192,7 @@ bool protocol_zt::recv_from_udp()
buffer_t data(buf, buf + len);
endpoint ep;
std::copy(in6.sin6_addr.s6_addr, in6.sin6_addr.s6_addr + 16, ep.addr.begin());
oob_recv_queue.push_back(std::make_pair(ep, std::move(data)));
oob_recv_queue.emplace_back(ep, std::move(data));
return true;
}

6
Source/init.cpp

@ -156,11 +156,11 @@ void init_archives()
paths.pop_back();
#ifdef __linux__
paths.push_back("/usr/share/diasurgical/devilutionx/");
paths.push_back("/usr/local/share/diasurgical/devilutionx/");
paths.emplace_back("/usr/share/diasurgical/devilutionx/");
paths.emplace_back("/usr/local/share/diasurgical/devilutionx/");
#endif
paths.push_back(""); // PWD
paths.emplace_back(""); // PWD
if (SDL_LOG_PRIORITY_VERBOSE >= SDL_LogGetPriority(SDL_LOG_CATEGORY_APPLICATION)) {
std::string message;

Loading…
Cancel
Save