From 04709f279809125e24c3652f182eac0e56c1d90f Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 23 Jan 2009 22:18:06 +0000 Subject: (svn r15242) -Feature: allow moving clients between companies/spectators by the server and the clients themselves (dihedral) --- src/network/network.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/network/network.cpp') diff --git a/src/network/network.cpp b/src/network/network.cpp index 4fbad7535..237dbd57a 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -75,6 +75,7 @@ bool _network_first_time; bool _network_udp_server; uint16 _network_udp_broadcast; uint8 _network_advertise_retries; +CompanyMask _network_company_passworded; ///< Bitmask of the password status of all companies. /* Check whether NETWORK_NUM_LANDSCAPES is still in sync with NUM_LANDSCAPE */ assert_compile((int)NETWORK_NUM_LANDSCAPES == (int)NUM_LANDSCAPE); @@ -182,6 +183,16 @@ byte NetworkSpectatorCount() return count; } +/** + * Check if the company we want to join requires a password. + * @param company_id id of the company we want to check the 'passworded' flag for. + * @return true if the company requires a password. + */ +bool NetworkCompanyIsPassworded(CompanyID company_id) +{ + return HasBit(_network_company_passworded, company_id); +} + // This puts a text-message to the console, or in the future, the chat-box, // (to keep it all a bit more general) // If 'self_send' is true, this is the client who is sending the message @@ -199,6 +210,18 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_sen color = CC_DEFAULT; data = STR_NETWORK_SERVER_MESSAGE_GAME_PAUSED_PLAYERS + data; break; + case NETWORK_ACTION_COMPANY_SPECTATOR: + color = CC_DEFAULT; + strid = STR_NETWORK_CLIENT_COMPANY_SPECTATE; + break; + case NETWORK_ACTION_COMPANY_JOIN: + color = CC_DEFAULT; + strid = STR_NETWORK_CLIENT_COMPANY_JOIN; + break; + case NETWORK_ACTION_COMPANY_NEW: + color = CC_DEFAULT; + strid = STR_NETWORK_CLIENT_COMPANY_NEW; + break; case NETWORK_ACTION_JOIN: strid = STR_NETWORK_CLIENT_JOINED; break; case NETWORK_ACTION_LEAVE: strid = STR_NETWORK_CLIENT_LEFT; break; case NETWORK_ACTION_NAME_CHANGE: strid = STR_NETWORK_NAME_CHANGE; break; -- cgit v1.2.3-70-g09d2