MPMGRD.H (2622B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 #ifndef mpmgr_h 17 #define mpmgr_h 18 19 #include "connmgr.h" 20 21 // maximum number of connections 22 #define CONNECT_MAX 7 23 #define MAX_NAME_LEN 128 24 25 class MPlayerManClass : public ConnManClass { 26 public: 27 MPlayerManClass(void); 28 29 // queues up incoming packets appropriately 30 int Service(void); 31 32 // initialization 33 int Init(void); 34 int Find_Num_Connections(void); 35 void Flush_All(void); 36 37 // send/receive data 38 int Send_Private_Message(void *buf, int buflen, int ack_req = 1, int conn_id = CONNECTION_NONE); 39 int Get_Private_Message(void *buf, int *buflen, int *conn_id); 40 41 int Send_Global_Message(void *buf, int buflen, int ack_req = 0, int address = 0); 42 int Get_Global_Message(void *buf, int *buflen, int *address = 0); 43 44 // manage connections 45 int Num_Connections(void); 46 int Connection_ID(int index); 47 int Connection_Index(int id); 48 int Create_Connection(int id, char *name, int address); 49 int Delete_Connection(int id); 50 char *Connection_Name(int id); 51 int Connection_Address(int id); 52 53 // queueing routines 54 55 int Global_Num_Send(void); 56 int Global_Num_Receive(void); 57 int Private_Num_Send(int id = CONNECTION_NONE); 58 int Private_Num_Receive(int id = CONNECTION_NONE); 59 60 // timing magnagement 61 void Reset_Response_Time(void); 62 unsigned long Response_Time(void); 63 void Set_Timing(unsigned long retrydelta, unsigned long maxretries, unsigned long timeout); 64 65 // debug 66 void Configure_Debug(int index, int type_offset, int type_size, char **names, int namestart, 67 int namecount); 68 void Mono_Debug_Print(int index, int refresh); 69 70 private: 71 int _myAddr; 72 int _Connections[CONNECT_MAX]; 73 int _ID[CONNECT_MAX]; 74 char _Names[CONNECT_MAX][MAX_NAME_LEN]; 75 int _nConnections; 76 }; 77 78 #endif // mpmgr_h 79 80