1 /*************************************************************************** 2 * Mechanized Assault and Exploration Reloaded Projectfile * 3 * * 4 * This program is free software; you can redistribute it and/or modify * 5 * it under the terms of the GNU General Public License as published by * 6 * the Free Software Foundation; either version 2 of the License, or * 7 * (at your option) any later version. * 8 * * 9 * This program is distributed in the hope that it will be useful, * 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 * GNU General Public License for more details. * 13 * * 14 * You should have received a copy of the GNU General Public License * 15 * along with this program; if not, write to the * 16 * Free Software Foundation, Inc., * 17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 ***************************************************************************/ 19 #ifndef menueventsH 20 #define menueventsH 21 22 #include <string> 23 #include <vector> 24 25 #include "game/logic/landingpositionstate.h" 26 #include "network.h" 27 28 class cTCP; 29 class cStaticMap; 30 class cPlayerBasicData; 31 class cGameSettings; 32 class cPosition; 33 34 enum eMenuMessages 35 { 36 MU_MSG_CHAT = FIRST_MENU_MESSAGE, // simple text message 37 // Note: Do not change the values of MU_MSG_REQ_IDENTIFIKATION and MU_MSG_IDENTIFIKATION. 38 // Otherwise the game version and compatibility check when connecting to a server doesn't work anymore 39 MU_MSG_REQ_IDENTIFIKATION, // host requests a identification of this player 40 MU_MSG_IDENTIFIKATION, // player send his identification 41 42 MU_MSG_PLAYER_NUMBER, // host assigns a new player number to a player 43 MU_MSG_PLAYERLIST, // a list with all players and their data 44 MU_MSG_OPTINS, // all options selected by the host 45 // Map down/up-load 46 MU_MSG_START_MAP_DOWNLOAD, // the host start a map upload to the client 47 MU_MSG_MAP_DOWNLOAD_DATA, // the host sends map data to the client 48 MU_MSG_CANCELED_MAP_DOWNLOAD, // the host canceled the map upload to the client 49 MU_MSG_FINISHED_MAP_DOWNLOAD, // the host finished uploading the map 50 MU_MSG_REQUEST_MAP, // a player wants to download a map from the server 51 // Game Preparation 52 MU_MSG_GO, // host wants to start the game/preparation 53 MU_MSG_LANDING_STATE, // informs a client about the state of the landing position selection he is currently in 54 MU_MSG_LANDING_POSITION, // landing position during landing position selection 55 MU_MSG_ALL_LANDED, // all players have selected there landing points and clients can start game 56 MU_MSG_IN_LANDING_POSITION_SELECTION_STATUS, 57 MU_MSG_PLAYER_HAS_SELECTED_LANDING_POSITION, 58 MU_MSG_PLAYER_HAS_ABORTED_GAME_PREPARATION 59 }; 60 61 void sendMenuChatMessage (cTCP& network, const std::string& chatMsg, const cPlayerBasicData* player = nullptr, int fromPlayerNr = -1, bool translationText = false); 62 63 void sendRequestIdentification (cTCP& network, const cPlayerBasicData& player); 64 65 void sendPlayerNumber (cTCP& network, const cPlayerBasicData& player); 66 67 void sendPlayerList (cTCP& network, const std::vector<std::shared_ptr<cPlayerBasicData>>& players); 68 69 void sendGameData (cTCP& network, const cStaticMap* map, const cGameSettings* settings, const std::vector<cPlayerBasicData>& savePlayers, const std::string& saveGameName, const cPlayerBasicData* player = nullptr); 70 71 void sendIdentification (cTCP& network, const cPlayerBasicData& player); 72 73 void sendGameIdentification (cTCP& network, const cPlayerBasicData& player, int socket); 74 75 void sendRequestMap (cTCP& network, const std::string& mapName, int playerNr); 76 77 void sendGo (cTCP& network); 78 79 void sendLandingState (cTCP& network, eLandingPositionState state, const cPlayerBasicData& player); 80 81 void sendAllLanded (cTCP& network); 82 83 void sendLandingPosition (cTCP& network, const cPosition& position, const cPlayerBasicData& player); 84 85 void sendInLandingPositionSelectionStatus (cTCP& network, const cPlayerBasicData& player, bool isIn, const cPlayerBasicData* receiver); 86 87 void sendPlayerHasSelectedLandingPosition (cTCP& network, const cPlayerBasicData& player, const cPlayerBasicData* receiver); 88 89 void sendPlayerHasAbortedGamePreparation(cTCP& network, const cPlayerBasicData& player, const cPlayerBasicData* receiver = nullptr); 90 91 #endif // menueventsH 92