diff --git a/common/main/player.h b/common/main/player.h index e807a181d..6da0df86f 100644 --- a/common/main/player.h +++ b/common/main/player.h @@ -95,6 +95,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. struct callsign_t { + operator const void *() const = delete; typedef array array_t; array_t a; static char lower_predicate(char c) @@ -149,6 +150,10 @@ struct callsign_t { return a == r.a; } + bool operator!=(const callsign_t &r) const + { + return !(*this == r); + } }; static_assert(sizeof(callsign_t) == CALLSIGN_LEN + 1, "callsign_t too big"); diff --git a/similar/main/net_udp.cpp b/similar/main/net_udp.cpp index 4cf8fd7ba..01d9cbe5c 100644 --- a/similar/main/net_udp.cpp +++ b/similar/main/net_udp.cpp @@ -1030,7 +1030,7 @@ static void net_udp_send_sequence_packet(UDP_sequence_packet seq, struct _sockad len = 0; memset(buf, 0, sizeof(buf)); buf[0] = seq.type; len++; - memcpy(&buf[len], seq.player.callsign, CALLSIGN_LEN+1); len += CALLSIGN_LEN+1; + memcpy(&buf[len], seq.player.callsign.buffer(), CALLSIGN_LEN+1); len += CALLSIGN_LEN+1; buf[len] = seq.player.connected; len++; buf[len] = seq.player.rank; len++; @@ -2214,7 +2214,7 @@ void net_udp_send_game_info(struct _sockaddr sender_addr, ubyte info_upid) your_index = 0xcc; for (int i = 0; i < Netgame.players.size(); i++) { - memcpy(&buf[len], Netgame.players[i].callsign, CALLSIGN_LEN+1); len += CALLSIGN_LEN+1; + memcpy(&buf[len], Netgame.players[i].callsign.buffer(), CALLSIGN_LEN+1); len += CALLSIGN_LEN+1; buf[len] = Netgame.players[i].connected; len++; buf[len] = Netgame.players[i].rank; len++; if (!memcmp((struct _sockaddr *)&sender_addr, (struct _sockaddr *)&Netgame.players[i].protocol.udp.addr, sizeof(struct _sockaddr)))