diff options
| author | Mario Kilies <MarioKilies@GMX.net> | 2011-01-29 15:50:58 +0100 |
|---|---|---|
| committer | Mario Kilies <MarioKilies@GMX.net> | 2011-01-29 15:50:58 +0100 |
| commit | 4a3e066c4c9885396893afcd2a13aa599ac4bd0e (patch) | |
| tree | 753ba8320b71e7031e1bc4b1f59b011669ce8114 /src/game.c | |
| parent | 4980a92f245cf4f313d99f8c31dc61218696e98c (diff) | |
| parent | 947669f063f3df9fc93a4afb2d7c9e6d3d13813a (diff) | |
Merge branch 'master' of ssh://git@wg.reiner-h.de:22003/~git/oxen
Diffstat (limited to 'src/game.c')
| -rw-r--r-- | src/game.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -17,6 +17,11 @@ #include "game_states.h" #include "main_stack.h" +/** + * Game loop for clients. + * Runs from game start to its end + * @param[in] sock Socket with connection to server + */ static void main_loop_client(int sock) { bool running = true; @@ -56,6 +61,11 @@ static void main_loop_client(int sock) } } +/** + * Game loop for server. + * Runs from game start to its end + * @param[in] client_socks Sockets with connection to connected clients + */ static void main_loop_server(socket_list_t* client_socks) { bool running = true; @@ -93,6 +103,14 @@ static void main_loop_server(socket_list_t* client_socks) } } +/** + * Prepares the start of a game. Clients connect to server and in servermode a server + * is started which accepts connections + * @param[in] servermode True if a server should be started to where the local client will connect + * @param[in] addr Hostname/address where a client should try to connect (if NULL, default is "localhost"); in servermode address to which server will bind + * @param[in] port Port to connect to / listen on + * @param[in] num_players Only required on server; number of connections that are accepted before game is starting + */ void start_game(const bool servermode, const char* addr, const char* port, const uint8_t num_players) { assert(port != NULL); // addr can be NULL for server -> listen on every address |
