Skip to content

Commit

Permalink
Revert "[CR] Bashing furniture/terrain gradually gets easier" (#69209)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maleclypse authored Nov 9, 2023
1 parent b399fbb commit 286148d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 59 deletions.
41 changes: 1 addition & 40 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1890,36 +1890,6 @@ ter_id map::ter( const tripoint_bub_ms &p ) const
return ter( p.raw() );
}

int map::get_map_damage( const tripoint_bub_ms &p ) const
{
if( !inbounds( p ) ) {
return 0;
}

point_sm_ms l;
const submap *const current_submap = unsafe_get_submap_at( p, l );
if( current_submap == nullptr ) {
debugmsg( "Called get_map_damage for unloaded submap" );
return 0;
}
return current_submap->get_map_damage( l );
}

void map::set_map_damage( const tripoint_bub_ms &p, int dmg )
{
if( !inbounds( p ) ) {
return;
}

point_sm_ms l;
submap *const current_submap = unsafe_get_submap_at( p, l );
if( current_submap == nullptr ) {
debugmsg( "Called set_map_damage for unloaded submap" );
return;
}
return current_submap->set_map_damage( l, dmg );
}

uint8_t map::get_known_connections( const tripoint &p,
const std::bitset<NUM_TERCONN> &connect_group,
const std::map<tripoint, ter_id> &override ) const
Expand Down Expand Up @@ -4001,18 +3971,9 @@ void map::bash_ter_furn( const tripoint &p, bash_params &params )
}
// Linear interpolation from str_min to str_max
const int resistance = smin + ( params.roll * ( smax - smin ) );
// Semi-persistant map damage. Increment by one for each bash over smin
// Gradually makes hard bashes easier
int damage = get_map_damage( tripoint_bub_ms( p ) );
add_msg_debug( debugmode::DF_MAP, "Bashing diff. %d to %d, roll %g. Strength is %d + %d vs %d",
smin, smax, params.roll, params.strength, damage, resistance );
if( params.strength + damage >= resistance ) {
damage = 0;
if( params.strength >= resistance ) {
success = true;
} else if( params.strength >= smin ) {
damage += 1;
}
set_map_damage( tripoint_bub_ms( p ), damage );
}

if( smash_furn ) {
Expand Down
3 changes: 0 additions & 3 deletions src/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,6 @@ class map
return ter( tripoint( p, abs_sub.z() ) );
}

int get_map_damage( const tripoint_bub_ms &p ) const;
void set_map_damage( const tripoint_bub_ms &p, int dmg );

// Return a bitfield of the adjacent tiles which connect to the given
// connect_group. From least-significant bit the order is south, east,
// west, north (because that's what cata_tiles expects).
Expand Down
16 changes: 0 additions & 16 deletions src/submap.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,6 @@ class submap
ensure_nonuniform();
std::uninitialized_fill_n( &m->frn[0][0], elements, furn );
}
int get_map_damage( const point_sm_ms &p ) const {
auto it = ephemeral_data.find( p );
if( it != ephemeral_data.end() ) {
return it->second.damage;
}
return 0;
}

void set_map_damage( const point_sm_ms &p, int dmg ) {
ephemeral_data[p] = { dmg };
}

ter_id get_ter( const point &p ) const {
if( is_uniform() ) {
Expand Down Expand Up @@ -305,12 +294,7 @@ class submap
std::map<tripoint_sm_ms, partial_con> partial_constructions;
std::unique_ptr<basecamp> camp; // only allowing one basecamp per submap

struct tile_data {
int damage;
};

private:
std::map<point_sm_ms, tile_data> ephemeral_data;
std::map<point, computer> computers;
std::unique_ptr<computer> legacy_computer;
std::unique_ptr<maptile_soa> m;
Expand Down

0 comments on commit 286148d

Please sign in to comment.