Skip to content

Commit

Permalink
Replace old teleporting code.
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Candlebury committed Sep 24, 2019
1 parent 6697f8f commit cb9a40b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
21 changes: 1 addition & 20 deletions src/map_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,27 +1926,8 @@ void map::monster_in_field( monster &z )
if( cur_field_type == fd_fatigue ) {
if( rng( 0, 2 ) < cur.get_field_intensity() ) {
dam += cur.get_field_intensity();
int tries = 0;
tripoint newpos = z.pos();
do {
newpos.x = rng( z.posx() - SEEX, z.posx() + SEEX );
newpos.y = rng( z.posy() - SEEY, z.posy() + SEEY );
tries++;
} while( impassable( newpos ) && tries != 10 );

if( tries == 10 ) {
z.die_in_explosion( nullptr );
} else if( monster *const other = g->critter_at<monster>( newpos ) ) {
if( g->u.sees( z ) ) {
add_msg( _( "The %1$s teleports into a %2$s, killing them both!" ),
z.name(), other->name() );
}
other->die_in_explosion( &z );
} else {
z.setpos( newpos );
}
teleport::teleport( &z );
}

}
if( cur_field_type == fd_incendiary ) {
// TODO: MATERIALS Use fire resistance
Expand Down
1 change: 0 additions & 1 deletion src/teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "avatar.h"
#include "creature.h"
#include "player.h"
#include "monster.h"
#include "game.h"
#include "map.h"
#include "messages.h"
Expand Down

0 comments on commit cb9a40b

Please sign in to comment.