diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-14 20:43:26 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2022-12-14 20:43:26 +0100 |
| commit | 23d2cc231e5b4c015a8471d3035dc07802de23d5 (patch) | |
| tree | 4b307a81e5fc566a5d1af9a0659b19534cff11b6 /src/players.c | |
| parent | ee4906ef5fc89f3f10cd6aaf95845a0ae9b2f47e (diff) | |
leaderboard, network syncing
Diffstat (limited to 'src/players.c')
| -rw-r--r-- | src/players.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/players.c b/src/players.c index 1b86944..c4b7bb0 100644 --- a/src/players.c +++ b/src/players.c @@ -17,7 +17,16 @@ float get_player_size(platform_window* window) { int player_size = get_tile_width(window) * get_player_size_in_tile(); } -void spawn_player(int id) { +int get_player_count() { + int count = 0; + for (int i = 0; i < max_players; i++) { + if (!players[i].active) continue; + count++; + } + return count; +} + +void spawn_player(int id, network_client client) { for (int i = 0; i < max_players; i++) { if (players[i].active) continue; players[i].active = true; @@ -29,6 +38,7 @@ void spawn_player(int id) { players[i].gun_height = 0.0f; players[i].id = id; players[i].guntype = GUN_MP5; + players[i].client = client; gun g = get_gun_by_type(players[i].guntype); players[i].total_ammo = g.max_ammunition; |
