1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-19 04:29:09 +00:00

Codechange: replace x.size() == 0 with x.empty()

This commit is contained in:
Rubidium
2023-10-20 20:09:58 +02:00
committed by rubidium42
parent f06b3e9846
commit c9276c2959
42 changed files with 58 additions and 58 deletions

View File

@@ -203,7 +203,7 @@ void TCPConnecter::OnResolved(addrinfo *ai)
}
if (_debug_net_level >= 6) {
if (this->addresses.size() == 0) {
if (this->addresses.empty()) {
Debug(net, 6, "{} did not resolve", this->connection_string);
} else {
Debug(net, 6, "{} resolved in:", this->connection_string);

View File

@@ -142,7 +142,7 @@ public:
*/
static bool Listen(uint16_t port)
{
assert(sockets.size() == 0);
assert(sockets.empty());
NetworkAddressList addresses;
GetBindAddresses(&addresses, port);
@@ -151,7 +151,7 @@ public:
address.Listen(SOCK_STREAM, &sockets);
}
if (sockets.size() == 0) {
if (sockets.empty()) {
Debug(net, 0, "Could not start network: could not create listening socket");
ShowNetworkError(STR_NETWORK_ERROR_SERVER_START);
return false;

View File

@@ -73,7 +73,7 @@ void NetworkUDPSocketHandler::CloseSocket()
*/
void NetworkUDPSocketHandler::SendPacket(Packet *p, NetworkAddress *recv, bool all, bool broadcast)
{
if (this->sockets.size() == 0) this->Listen();
if (this->sockets.empty()) this->Listen();
for (auto &s : this->sockets) {
/* Make a local copy because if we resolve it we cannot

View File

@@ -703,7 +703,7 @@ void GetBindAddresses(NetworkAddressList *addresses, uint16_t port)
}
/* No address, so bind to everything. */
if (addresses->size() == 0) {
if (addresses->empty()) {
addresses->emplace_back("", port);
}
}

View File

@@ -899,7 +899,7 @@ public:
}
}
if (this->content.size() == 0) {
if (this->content.empty()) {
if (this->UpdateFilterState()) {
this->content.ForceRebuild();
this->InvalidateData();