More refactoring by pulling code out of client and server files

This commit is contained in:
mdiluzio 2015-01-04 11:08:35 +00:00
parent 43d688a728
commit 5c8666d4fb
4 changed files with 86 additions and 61 deletions

View file

@ -26,12 +26,18 @@ struct ClientInfo
player_t player;
};
int WaitForOrdersFromClient(const ClientInfo info, std::mutex &mut, CTTRTSGame &game);
void WaitForOrdersFromClient(const ClientInfo info, std::mutex &mut, CTTRTSGame &game);
void GetOrdersFromClients(std::vector<ClientInfo> &myClients, CTTRTSGame &game, std::mutex &gameMutex);
void SendGameInfoToClients(std::vector<ClientInfo> &myClients, const CTTRTSGame &game, std::mutex &gameMutex);
void TryBindSocket(int sockfd, sockaddr_in &serv_addr);
void PerformServerHandshakeWithClient(const ClientInfo &client, const CTTRTSGame &game);
void PerformClientHandshake(int sockfd, unsigned int &player, std::string &gameNameString);
inline void fatal_error(const char *msg)
{
std::cerr<<msg<<std::endl;