@@ -362,41 +362,43 @@ void creature_tracker::flood_fill_zone( const Creature &origin )
362
362
return ;
363
363
}
364
364
365
- map &map = get_map ();
365
+ map &here = get_map ();
366
366
ff::flood_fill_visit_10_connected ( origin.pos_bub (),
367
- [&map ]( const tripoint_bub_ms & loc, int direction ) {
367
+ [&here ]( const tripoint_bub_ms & loc, int direction ) {
368
368
if ( direction == 0 ) {
369
- return map .inbounds ( loc ) && ( map .is_transparent_wo_fields ( loc ) ||
370
- map .passable ( loc ) );
369
+ return here .inbounds ( loc ) && ( here .is_transparent_wo_fields ( loc ) ||
370
+ here .passable ( loc ) );
371
371
}
372
+
373
+ auto check_location_passable_down = [loc, &here]( const maptile & mt, const ter_t & ter ) {
374
+ return ( ( ter.movecost != 0 && mt.get_furn_t ().movecost >= 0 ) ||
375
+ here.is_transparent_wo_fields ( loc ) ) &&
376
+ ( ter.has_flag ( ter_furn_flag::TFLAG_NO_FLOOR ) ||
377
+ ter.has_flag ( ter_furn_flag::TFLAG_GOES_DOWN ) );
378
+ };
379
+
372
380
if ( direction == 1 ) {
373
- const maptile &up = map .maptile_at ( loc );
381
+ const maptile &up = here .maptile_at ( loc );
374
382
const ter_t &up_ter = up.get_ter_t ();
375
383
if ( up_ter.id .is_null () ) {
376
384
return false ;
377
385
}
378
- if ( ( ( up_ter.movecost != 0 && up.get_furn_t ().movecost >= 0 ) ||
379
- map.is_transparent_wo_fields ( loc ) ) &&
380
- ( up_ter.has_flag ( ter_furn_flag::TFLAG_NO_FLOOR ) ||
381
- up_ter.has_flag ( ter_furn_flag::TFLAG_GOES_DOWN ) ) ) {
386
+ if ( check_location_passable_down ( up, up_ter ) ) {
382
387
return true ;
383
388
}
384
389
}
385
390
if ( direction == -1 ) {
386
- const maptile &up = map .maptile_at ( loc + tripoint::above );
391
+ const maptile &up = here .maptile_at ( loc + tripoint::above );
387
392
const ter_t &up_ter = up.get_ter_t ();
388
393
if ( up_ter.id .is_null () ) {
389
394
return false ;
390
395
}
391
- const maptile &down = map .maptile_at ( loc );
396
+ const maptile &down = here .maptile_at ( loc );
392
397
const ter_t &down_ter = up.get_ter_t ();
393
398
if ( down_ter.id .is_null () ) {
394
399
return false ;
395
400
}
396
- if ( ( ( down_ter.movecost != 0 && down.get_furn_t ().movecost >= 0 ) ||
397
- map.is_transparent_wo_fields ( loc ) ) &&
398
- ( up_ter.has_flag ( ter_furn_flag::TFLAG_NO_FLOOR ) ||
399
- up_ter.has_flag ( ter_furn_flag::TFLAG_GOES_DOWN ) ) ) {
401
+ if ( check_location_passable_down ( down, down_ter ) ) {
400
402
return true ;
401
403
}
402
404
}
0 commit comments