diff options
| author | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-29 15:34:18 +0100 |
|---|---|---|
| committer | Reiner Herrmann <reiner@reiner-h.de> | 2011-01-29 15:34:18 +0100 |
| commit | 947669f063f3df9fc93a4afb2d7c9e6d3d13813a (patch) | |
| tree | 602170db40454cdd3ba5c526825f273b2af3380f /src/game.c | |
| parent | 8e8a8a44fb85addc8a235d763ad71825cf2d90de (diff) | |
added documentation
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 |
