diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/game.h | 7 | ||||
| -rw-r--r-- | include/network.h | 11 | ||||
| -rw-r--r-- | include/players.h | 4 |
3 files changed, 15 insertions, 7 deletions
diff --git a/include/game.h b/include/game.h index 03fbf11..869d64c 100644 --- a/include/game.h +++ b/include/game.h @@ -18,13 +18,6 @@ typedef enum t_game_state { GAMESTATE_PLAYING, } game_state; -typedef enum t_network_state { - CONNECTING, - WAITING_FOR_ID, - CONNECTED, - DISCONNECTED, -} network_state; - typedef struct t_game { game_state state; network_state network_state; diff --git a/include/network.h b/include/network.h new file mode 100644 index 0000000..2446342 --- /dev/null +++ b/include/network.h @@ -0,0 +1,11 @@ +#ifndef INCLUDE_NETWORK +#define INCLUDE_NETWORK + +typedef enum t_network_state { + CONNECTING, + WAITING_FOR_ID, + CONNECTED, + DISCONNECTED, +} network_state; + +#endif
\ No newline at end of file diff --git a/include/players.h b/include/players.h index 99b230f..0c7433e 100644 --- a/include/players.h +++ b/include/players.h @@ -9,6 +9,7 @@ #include "math_helper.h" #include "guns.h" #include "sprite.h" +#include "../include/players.h" #define MAX_PLAYERS 10 @@ -49,6 +50,7 @@ typedef struct t_player { u64 ping; sprite sprite; vec3f velocity; + network_state connection_state; } player; #include "protocol.h" @@ -68,5 +70,7 @@ float get_player_size(platform_window* window); void move_user(platform_window* window, u32 id, protocol_move_type move, float delta); void update_players_server(); void spawn_player(u32 id, network_client client); +bool player_has_old_session(u32 id); +void rejoin_player(u32 id, network_client client); #endif
\ No newline at end of file |
