diff --git a/game/src/net/net.cpp b/game/src/net/net.cpp index 8d852ac..e480809 100644 --- a/game/src/net/net.cpp +++ b/game/src/net/net.cpp @@ -386,9 +386,11 @@ void TcpSocket::bind(const char *address, uint16_t port) { sockaddr_in dst{ 0 }; dst.sin_family = AF_INET; - dst.sin_addr.s_addr = inet_addr(address); dst.sin_port = htons(port); + if (inet_pton(AF_INET, address, &dst.sin_addr.s_addr) != 1) + throw std::runtime_error(std::string("bind failed: invalid address")); + // https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-bind int r = ::bind(sock, (const sockaddr *)&dst, sizeof dst); diff --git a/game/src/ui/cache.cpp b/game/src/ui/cache.cpp index 40e0884..17ed1e7 100644 --- a/game/src/ui/cache.cpp +++ b/game/src/ui/cache.cpp @@ -55,6 +55,11 @@ void UICache::mouse_left_process() { return; } + // ignore selecting units when mouse is on bottom hud area + if (point_in_rect(io.MousePos.x, io.MousePos.y, gmb_bottom)) { + return; + } + bool select_area = multi_select; multi_select = select_started = false; diff --git a/game/tests/net.cpp b/game/tests/net.cpp index c5fadcf..1765c19 100644 --- a/game/tests/net.cpp +++ b/game/tests/net.cpp @@ -218,8 +218,7 @@ TEST(Tcp, BindDummy) { } catch (std::runtime_error&) {} } -// FIXME find out why a.b.c.d works on linux -TEST_F(NoUnixFixture, TcpBindBadAddress) { +TEST(Tcp, TcpBindBadAddress) { Net net; TcpSocket tcp; try {