You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
992 B
C++
28 lines
992 B
C++
10 months ago
|
#ifndef _CHECK_INPUT_H
|
||
|
#define _CHECK_INPUT_H
|
||
|
|
||
|
#include "includes/sock.hpp"
|
||
|
|
||
|
typedef enum {M_SINGLE, M_CLIENT, M_SERVER} Mode;
|
||
|
|
||
|
/* This struct contains a Mode enum, which indicates the type of game we are
|
||
|
playing (Single player, client mode or server mode). The netsock parameter is
|
||
|
a 'Sock' object - Client and Server classes inherit from this object, so this
|
||
|
parameter can be instantiated to either a client or server, depending on the
|
||
|
game type. */
|
||
|
typedef struct {
|
||
|
Mode mode;
|
||
|
Sock* netsock;
|
||
|
} GameType;
|
||
|
|
||
|
/* This function checks the IP address and port passed to it, and returns a struct,
|
||
|
that contains information about the game mode, and contains the server socket.
|
||
|
TODO - Add better error checking. */
|
||
|
GameType check_server(char* ip_text, char* port_text);
|
||
|
|
||
|
/* NOT IMPLEMENTED YET - This function checks the code given to it, and returns a struct
|
||
|
that contains information about the game mode, and contains the client socket. */
|
||
|
GameType check_client(char* code);
|
||
|
|
||
|
#endif
|