Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: BevapDin <[email protected]>
  • Loading branch information
John-Candlebury and BevapDin committed Sep 24, 2019
1 parent cb9a40b commit f26f024
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

const efftype_id effect_teleglow( "teleglow" );

bool teleport::teleport( Creature *const critter, int min_distance, int max_distance, bool safe,
bool teleport::teleport( Creature &critter, int min_distance, int max_distance, bool safe,
bool add_teleglow )
{
if( critter == nullptr || min_distance > max_distance ) {
debugmsg( "ERROR: Function teleport::teleport called with invalid arguments." );
return false;
}

bool c_is_u = ( critter == &g->u );
const bool c_is_u = &critter == &g->u;
player *const p = critter->as_player();
int tries = 0;
tripoint origin = critter->pos();
Expand All @@ -43,7 +43,7 @@ bool teleport::teleport( Creature *const critter, int min_distance, int max_dist
critter->apply_damage( nullptr, bp_torso, 9999 );
if( c_is_u ) {
g->events().send<event_type::teleports_into_wall>( p->getID(), g->m.obstacle_name( new_pos ) );
add_msg( m_bad, _( "You die after teleporting into a solid" ) );
add_msg( m_bad, _( "You die after teleporting into a solid." ) );
}
critter->check_dead_state();
}
Expand All @@ -52,7 +52,7 @@ bool teleport::teleport( Creature *const critter, int min_distance, int max_dist
if( Creature *const poor_soul = g->critter_at<Creature>( new_pos ) ) {
if( safe ) {
if( c_is_u ) {
add_msg( m_bad, _( "You cannot teleport safely" ) );
add_msg( m_bad, _( "You cannot teleport safely." ) );
}
return false;
} else {
Expand All @@ -68,7 +68,7 @@ bool teleport::teleport( Creature *const critter, int min_distance, int max_dist
poor_soul->disp_name() );
g->events().send<event_type::telefrags_creature>( p->getID(), poor_soul->get_name() );
} else {
if( g->u.sees( poor_soul->pos() ) ) {
if( g->u.sees( *poor_soul ) ) {
add_msg( m_good, _( "%1$s teleports into %2$s, killing them!" ),
critter->disp_name(), poor_soul->disp_name() );
}
Expand Down
2 changes: 1 addition & 1 deletion src/teleport.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef TELEPORT_H
#define TELEPORT_H

#include "creature.h"
class Creature;

namespace teleport
{
Expand Down

0 comments on commit f26f024

Please sign in to comment.