From cb9a40bc27478b6074bf1f3f102fe70018cf6a12 Mon Sep 17 00:00:00 2001 From: John Candlebury Date: Sat, 21 Sep 2019 19:58:42 -0600 Subject: [PATCH] Replace old teleporting code. --- src/map_field.cpp | 21 +-------------------- src/teleport.cpp | 1 - 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/map_field.cpp b/src/map_field.cpp index fa68f3104db07..3eb7de69b0f1e 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -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( 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 diff --git a/src/teleport.cpp b/src/teleport.cpp index 01a23057a6ce9..60c103e69a02a 100644 --- a/src/teleport.cpp +++ b/src/teleport.cpp @@ -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"