Skip to content

Commit

Permalink
Restock flag: use bool
Browse files Browse the repository at this point in the history
  • Loading branch information
xtreme8000 committed Jun 20, 2022
1 parent 779896b commit f83760e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void init() {
chunk_init();
grenade_init();

weapon_set(0);
weapon_set(false);

rpc_init();
}
Expand Down
6 changes: 3 additions & 3 deletions src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void read_PacketStateData(void* data, int len) {
local_player_health = 100;
local_player_blocks = 50;
local_player_grenades = 3;
weapon_set(0);
weapon_set(false);

players[local_player_id].block.red = 111;
players[local_player_id].block.green = 111;
Expand Down Expand Up @@ -395,7 +395,7 @@ void read_PacketCreatePlayer(void* data, int len) {
local_player_blocks = 50;
local_player_grenades = 3;
local_player_lasttool = TOOL_GUN;
weapon_set(0);
weapon_set(false);
}
}
}
Expand Down Expand Up @@ -645,7 +645,7 @@ void read_PacketRestock(void* data, int len) {
local_player_health = 100;
local_player_blocks = 50;
local_player_grenades = 3;
weapon_set(1);
weapon_set(true);
sound_create(SOUND_LOCAL, &sound_switch, 0.0F, 0.0F, 0.0F);
}

Expand Down
7 changes: 3 additions & 4 deletions src/weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,10 @@ struct kv6_t* weapon_casing(int gun) {
}
}

void weapon_set(int restock) {
// players[local_player_id].weapon = WEAPON_SHOTGUN;
if (restock == 0) {
void weapon_set(bool restock) {
if(!restock)
local_player_ammo = weapon_ammo(players[local_player_id].weapon);
}

local_player_ammo_reserved = weapon_ammo_reserved(players[local_player_id].weapon);
weapon_reload_inprogress = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/weapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "model.h"

void weapon_update(void);
void weapon_set(int restock);
void weapon_set(bool restock);
void weapon_reload(void);
int weapon_reloading(void);
int weapon_can_reload(void);
Expand Down

0 comments on commit f83760e

Please sign in to comment.