Skip to content

Commit

Permalink
Removed player class from veh and wish (CleverRaven#50634)
Browse files Browse the repository at this point in the history
* Removed player from veh and wish
  • Loading branch information
Ramza13 authored and satheon49 committed Aug 14, 2021
1 parent 6196757 commit 19dd6cf
Show file tree
Hide file tree
Showing 13 changed files with 198 additions and 203 deletions.
11 changes: 5 additions & 6 deletions src/debug_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class optional;
} // namespace cata

class Character;
class player;

namespace debug_menu
{
Expand Down Expand Up @@ -101,12 +100,12 @@ void teleport_overmap( bool specific_coordinates = false );

void spawn_nested_mapgen();
void character_edit_menu();
void wishitem( player *p = nullptr );
void wishitem( player *p, const tripoint & );
void wishitem( Character *you = nullptr );
void wishitem( Character *you, const tripoint & );
void wishmonster( const cata::optional<tripoint> &p );
void wishmutate( player *p );
void wishskill( player *p );
void wishproficiency( player *p );
void wishmutate( Character *you );
void wishskill( Character *you );
void wishproficiency( Character *you );
void mutation_wish();
void draw_benchmark( int max_difference );

Expand Down
6 changes: 3 additions & 3 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ std::unique_ptr<vehicle> map::detach_vehicle( vehicle *veh )

// Unboard all passengers before detaching
for( auto const &part : veh->get_avail_parts( VPFLAG_BOARDABLE ) ) {
player *passenger = part.get_passenger();
Character *passenger = part.get_passenger();
if( passenger ) {
unboard_vehicle( part, passenger );
}
Expand Down Expand Up @@ -1001,7 +1001,7 @@ void map::board_vehicle( const tripoint &pos, Character *p )
return;
}
if( vp->part().has_flag( vehicle_part::passenger_flag ) ) {
player *psg = vp->vehicle().get_passenger( vp->part_index() );
Character *psg = vp->vehicle().get_passenger( vp->part_index() );
debugmsg( "map::board_vehicle: passenger (%s) is already there",
psg ? psg->name : "<null>" );
unboard_vehicle( pos );
Expand Down Expand Up @@ -1040,7 +1040,7 @@ void map::unboard_vehicle( const vpart_reference &vp, Character *passenger, bool
void map::unboard_vehicle( const tripoint &p, bool dead_passenger )
{
const cata::optional<vpart_reference> vp = veh_at( p ).part_with_feature( VPFLAG_BOARDABLE, false );
player *passenger = nullptr;
Character *passenger = nullptr;
if( !vp ) {
debugmsg( "map::unboard_vehicle: vehicle not found" );
// Try and force unboard the player anyway.
Expand Down
2 changes: 1 addition & 1 deletion src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ void npc::execute_action( npc_action action )
int my_spot = -1;
std::vector<std::pair<int, int> > seats;
for( const vpart_reference &vp : veh->get_avail_parts( VPFLAG_BOARDABLE ) ) {
const player *passenger = veh->get_passenger( vp.part_index() );
const Character *passenger = veh->get_passenger( vp.part_index() );
if( passenger != this && passenger != nullptr ) {
continue;
}
Expand Down
15 changes: 7 additions & 8 deletions src/turret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include "itype.h"
#include "messages.h"
#include "npc.h"
#include "player.h"
#include "projectile.h"
#include "ranged.h"
#include "string_formatter.h"
Expand Down Expand Up @@ -257,14 +256,14 @@ turret_data::status turret_data::query() const
return status::ready;
}

void turret_data::prepare_fire( player &p )
void turret_data::prepare_fire( Character &you )
{
// prevent turrets from shooting their own vehicles
p.add_effect( effect_on_roof, 1_turns );
you.add_effect( effect_on_roof, 1_turns );

// turrets are subject only to recoil_vehicle()
cached_recoil = p.recoil;
p.recoil = 0;
cached_recoil = you.recoil;
you.recoil = 0;

// set fuel tank fluid as ammo, if appropriate
if( part->info().has_flag( "USE_TANKS" ) ) {
Expand All @@ -275,11 +274,11 @@ void turret_data::prepare_fire( player &p )
}
}

void turret_data::post_fire( player &p, int shots )
void turret_data::post_fire( Character &you, int shots )
{
// remove any temporary recoil adjustments
p.remove_effect( effect_on_roof );
p.recoil = cached_recoil;
you.remove_effect( effect_on_roof );
you.recoil = cached_recoil;

gun_mode mode = base()->gun_current_mode();

Expand Down
Loading

0 comments on commit 19dd6cf

Please sign in to comment.