Skip to content

Commit

Permalink
refactor: use map from outer closure
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 committed Oct 1, 2023
1 parent 5358ecf commit 5d95803
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/construction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,11 +977,10 @@ bool can_construct( const construction &con, const tripoint &p )
place_okay &= has_pre_terrain( con, p );
// see if the flags check out
place_okay &= std::all_of( con.pre_flags.begin(), con.pre_flags.end(),
[&p]( const std::string & flag ) {
map &m = get_map();
furn_id f = m.furn( p );
ter_id t = m.ter( p );
return f == f_null ? t->has_flag( flag ) : f->has_flag( flag );
[&p, &here]( const std::string & flag ) -> bool {
const furn_id &furn = here.furn( p );
const ter_id &ter = here.ter( p );
return furn == f_null ? ter->has_flag( flag ) : furn->has_flag( flag );
} );
// make sure the construction would actually do something
if( !con.post_terrain.is_empty() ) {
Expand Down

0 comments on commit 5d95803

Please sign in to comment.