diff options
Diffstat (limited to 'src/network/room.h')
-rw-r--r-- | src/network/room.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/network/room.h b/src/network/room.h index 54cccf0ae..8285a4d0c 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -7,6 +7,7 @@ #include <array> #include <memory> #include <string> +#include <vector> #include "common/common_types.h" namespace Network { @@ -21,10 +22,15 @@ struct RoomInformation { u32 member_slots; ///< Maximum number of members in this room }; +struct GameInfo { + std::string name{""}; + u64 id{0}; +}; + using MacAddress = std::array<u8, 6>; /// A special MAC address that tells the room we're joining to assign us a MAC address /// automatically. -const MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; +constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // 802.11 broadcast MAC address constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; @@ -34,7 +40,7 @@ enum RoomMessageTypes : u8 { IdJoinRequest = 1, IdJoinSuccess, IdRoomInformation, - IdSetGameName, + IdSetGameInfo, IdWifiPacket, IdChatMessage, IdNameCollision, @@ -51,6 +57,12 @@ public: Closed, ///< The room is not opened and can not accept connections. }; + struct Member { + std::string nickname; ///< The nickname of the member. + GameInfo game_info; ///< The current game of the member + MacAddress mac_address; ///< The assigned mac address of the member. + }; + Room(); ~Room(); @@ -65,6 +77,11 @@ public: const RoomInformation& GetRoomInformation() const; /** + * Gets a list of the mbmers connected to the room. + */ + std::vector<Member> GetRoomMemberList() const; + + /** * Creates the socket for this room. Will bind to default address if * server is empty string. */ |