Pass player_info to allowed_to_fire_flare

This commit is contained in:
Kp 2016-12-10 17:51:10 +00:00
parent ad055dc60e
commit 7e6c9fb172
4 changed files with 5 additions and 10 deletions

View file

@ -84,6 +84,7 @@ struct player_rw;
struct player_info;
extern array<player, MAX_PLAYERS> Players; // Misc player info
void player_rw_swap(player_rw *p, int swap);
int allowed_to_fire_flare(player_info &);
#if defined(DXX_BUILD_DESCENT_II)
extern array<object *, MAX_PLAYERS> Guided_missile;
extern array<object_signature_t, MAX_PLAYERS> Guided_missile_sig;

View file

@ -352,11 +352,6 @@ window_event_result ReadControls(const d_event &event);
int cheats_enabled();
void game_disable_cheats();
int allowed_to_fire_laser(void);
#ifdef dsx
namespace dsx {
int allowed_to_fire_flare(void);
}
#endif
int allowed_to_fire_missile(void);
void check_rear_view(void);
int create_special_path(void);

View file

@ -859,15 +859,14 @@ int allowed_to_fire_laser(void)
}
namespace dsx {
int allowed_to_fire_flare(void)
int allowed_to_fire_flare(player_info &player_info)
{
auto &plrobj = get_local_plrobj();
auto &Next_flare_fire_time = plrobj.ctype.player_info.Next_flare_fire_time;
auto &Next_flare_fire_time = player_info.Next_flare_fire_time;
if (Next_flare_fire_time > GameTime64)
return 0;
#if defined(DXX_BUILD_DESCENT_II)
if (plrobj.ctype.player_info.energy < Weapon_info[weapon_id_type::FLARE_ID].energy_usage)
if (player_info.energy < Weapon_info[weapon_id_type::FLARE_ID].energy_usage)
#define FLARE_BIG_DELAY (F1_0*2)
Next_flare_fire_time = GameTime64 + FLARE_BIG_DELAY;
else

View file

@ -236,7 +236,7 @@ static void do_weapon_n_item_stuff()
if (Controls.state.fire_flare > 0)
{
Controls.state.fire_flare = 0;
if (allowed_to_fire_flare())
if (allowed_to_fire_flare(player_info))
Flare_create(vobjptridx(ConsoleObject));
}