diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 71850418f2f17..572aed9e32ce7 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -4811,11 +4811,7 @@ void submap::store( JsonOut &jsout ) const } jsout.end_array(); - if( legacy_computer ) { - // it's possible that no access to computers has been made and legacy_computer - // is not cleared - jsout.member( "computers", *legacy_computer ); - } else if( !computers.empty() ) { + if( !computers.empty() ) { jsout.member( "computers" ); jsout.start_array(); for( const auto &elem : computers ) { @@ -5105,11 +5101,6 @@ void submap::load( const JsonValue &jv, const std::string &member_name, int vers tripoint_zero ) ).first; computers_json.next_value().read( new_comp_it->second ); } - } else { - // only load legacy data here, but do not update to std::map, since - // the terrain may not have been loaded yet. - legacy_computer = std::make_unique( "BUGGED_COMPUTER", -100, tripoint_zero ); - legacy_computer->deserialize( jv ); } } else if( member_name == "camp" ) { camp = std::make_unique(); diff --git a/src/submap.cpp b/src/submap.cpp index 21124576852b6..20514695a0c94 100644 --- a/src/submap.cpp +++ b/src/submap.cpp @@ -140,24 +140,9 @@ void submap::delete_signage( const point &p ) } } -void submap::update_legacy_computer() -{ - if( !is_uniform() && legacy_computer ) { - for( int x = 0; x < SEEX; ++x ) { - for( int y = 0; y < SEEY; ++y ) { - if( m->frn[x][y] == furn_f_console ) { - computers.emplace( point( x, y ), *legacy_computer ); - } - } - } - legacy_computer.reset(); - } -} - bool submap::has_computer( const point &p ) const { - return !is_uniform() && ( computers.find( p ) != computers.end() || - ( legacy_computer && m->frn[p.x][p.y] == furn_f_console ) ); + return !is_uniform() && computers.find( p ) != computers.end(); } const computer *submap::get_computer( const point &p ) const @@ -168,17 +153,11 @@ const computer *submap::get_computer( const point &p ) const if( it != computers.end() ) { return &it->second; } - if( !is_uniform() && legacy_computer && m->frn[p.x][p.y] == furn_f_console ) { - return legacy_computer.get(); - } return nullptr; } computer *submap::get_computer( const point &p ) { - // need to update to std::map first so modifications to the returned object - // only affects the exact point p - //update_legacy_computer(); const auto it = computers.find( p ); if( it != computers.end() ) { return &it->second; @@ -188,7 +167,6 @@ computer *submap::get_computer( const point &p ) void submap::set_computer( const point &p, const computer &c ) { - //update_legacy_computer(); const auto it = computers.find( p ); if( it != computers.end() ) { it->second = c; @@ -199,7 +177,6 @@ void submap::set_computer( const point &p, const computer &c ) void submap::delete_computer( const point &p ) { - update_legacy_computer(); computers.erase( p ); } diff --git a/src/submap.h b/src/submap.h index 05926c1b7c315..8e1df5df03b0b 100644 --- a/src/submap.h +++ b/src/submap.h @@ -313,13 +313,10 @@ class submap private: std::map ephemeral_data; std::map computers; - std::unique_ptr legacy_computer; std::unique_ptr m; ter_id uniform_ter = t_null; int temperature_mod = 0; // delta in F - void update_legacy_computer(); - static constexpr size_t elements = SEEX * SEEY; };