From 061b3dd2442d0241e0baa66d0ee6da411024ea15 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:34:03 +0100 Subject: [PATCH 01/14] Remove obsolete iuse::hammer --- data/json/item_actions.json | 6 ------ src/item_factory.cpp | 1 - src/iuse.cpp | 8 +------- src/iuse.h | 1 - 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/data/json/item_actions.json b/data/json/item_actions.json index 898950c73ecdb..6906ebf861182 100644 --- a/data/json/item_actions.json +++ b/data/json/item_actions.json @@ -19,12 +19,6 @@ "id": "firestarter", "name": { "str": "Start a fire quickly" } }, - { - "//": "Remove after 0.G.", - "type": "item_action", - "id": "HAMMER", - "name": { "str": "Pry crate, window, door or nails" } - }, { "type": "item_action", "id": "PICK_LOCK", diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 7c883c125bd64..29c830e31e1b7 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -1796,7 +1796,6 @@ void Item_factory::init() add_iuse( "GUNMOD_ATTACH", &iuse::gunmod_attach ); add_iuse( "TOOLMOD_ATTACH", &iuse::toolmod_attach ); add_iuse( "HACKSAW", &iuse::hacksaw ); - add_iuse( "HAMMER", &iuse::hammer ); add_iuse( "HEATPACK", &iuse::heatpack ); add_iuse( "HEAT_FOOD", &iuse::heat_food ); add_iuse( "HONEYCOMB", &iuse::honeycomb ); diff --git a/src/iuse.cpp b/src/iuse.cpp index 9bf93e7c4ba4a..c160cc465c066 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -2706,12 +2706,7 @@ std::optional iuse::ma_manual( Character *p, item *it, const tripoint & ) return 1; } -// Remove after 0.G -std::optional iuse::hammer( Character *p, item *it, const tripoint &pos ) -{ - return iuse::crowbar( p, it, pos ); -} - +// Why this still exist? std::optional iuse::crowbar_weak( Character *p, item *it, const tripoint &pos ) { return iuse::crowbar( p, it, pos ); @@ -2766,7 +2761,6 @@ std::optional iuse::crowbar( Character *p, item *it, const tripoint &pos ) return std::nullopt; } - // previously iuse::hammer if( prying->prying_nails ) { p->assign_activity( prying_activity_actor( pnt, item_location{*p, it} ) ); return std::nullopt; diff --git a/src/iuse.h b/src/iuse.h index 1cd316bfe8f21..b5af518ab3bc0 100644 --- a/src/iuse.h +++ b/src/iuse.h @@ -126,7 +126,6 @@ std::optional gun_repair( Character *, item *, const tripoint & ); std::optional gunmod_attach( Character *, item *, const tripoint & ); std::optional hacksaw( Character *, item *, const tripoint &it_pnt ); std::optional hairkit( Character *, item *, const tripoint & ); -std::optional hammer( Character *, item *, const tripoint & ); std::optional hand_crank( Character *, item *, const tripoint & ); std::optional heat_food( Character *, item *, const tripoint & ); std::optional heatpack( Character *, item *, const tripoint & ); From 588f682bdb5a1857df036a7c3816797849d31b4e Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:35:15 +0100 Subject: [PATCH 02/14] Remove legacy inventory system handling --- src/character.cpp | 24 ------------------------ src/character.h | 3 --- src/game.cpp | 2 -- 3 files changed, 29 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index d909f258d3955..cc4ed05d7e1ea 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -2309,7 +2309,6 @@ void Character::process_turn() { // Has to happen before reset_stats clear_miss_reasons(); - migrate_items_to_storage( false ); for( bionic &i : *my_bionics ) { if( i.incapacitated_time > 0_turns ) { @@ -9082,29 +9081,6 @@ void Character::fall_asleep( const time_duration &duration ) get_event_bus().send( getID(), to_seconds( duration ) ); } -void Character::migrate_items_to_storage( bool disintegrate ) -{ - inv->visit_items( [&]( const item * it, item * ) { - if( disintegrate ) { - if( try_add( *it, /*avoid=*/nullptr, it ) == item_location::nowhere ) { - std::string profession_id = prof->ident().str(); - debugmsg( "ERROR: Could not put %s (%s) into inventory. Check if the " - "profession (%s) has enough space.", - it->tname(), it->typeId().str(), profession_id ); - return VisitResponse::ABORT; - } - } else { - item_location added = i_add( *it, true, /*avoid=*/nullptr, - it, /*allow_drop=*/false, /*allow_wield=*/!has_wield_conflicts( *it ) ); - if( added == item_location::nowhere ) { - put_into_vehicle_or_drop( *this, item_drop_reason::tumbling, { *it } ); - } - } - return VisitResponse::SKIP; - } ); - inv->clear(); -} - std::string Character::is_snuggling() const { map &here = get_map(); diff --git a/src/character.h b/src/character.h index 892a63ab069ce..d7cdc3dcf767a 100644 --- a/src/character.h +++ b/src/character.h @@ -1500,9 +1500,6 @@ class Character : public Creature, public visitable int calc_spell_training_cost( bool knows, int difficulty, int level ) const; - /** used for profession spawning and save migration for nested containers. remove after 0.F */ - void migrate_items_to_storage( bool disintegrate ); - /** * Displays menu with body part hp, optionally with hp estimation after healing. * Returns selected part. diff --git a/src/game.cpp b/src/game.cpp index 5c362bf943639..63dfd02f1ab68 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -874,8 +874,6 @@ bool game::start_game() // Make sure the items are added after the calendar is started u.add_profession_items(); - // Move items from the inventory. eventually the inventory should not contain items at all. - u.migrate_items_to_storage( true ); const start_location &start_loc = u.random_start_location ? scen->random_start_location().obj() : u.start_location.obj(); From f1b5e94175141baeec021d71f2b1a3f844460bd4 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:35:34 +0100 Subject: [PATCH 03/14] Remove legacy DT_TRUE handling --- src/damage.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/damage.cpp b/src/damage.cpp index e6c5a569019d7..010119be717a7 100644 --- a/src/damage.cpp +++ b/src/damage.cpp @@ -864,12 +864,7 @@ void damage_over_time_data::serialize( JsonOut &jsout ) const void damage_over_time_data::deserialize( const JsonObject &jo ) { - std::string tmp_string = jo.get_string( "damage_type" ); - // Remove after 0.F, migrating DT_TRUE to DT_PURE - if( tmp_string == "true" ) { - tmp_string = "pure"; - } - type = damage_type_id( tmp_string ); + jo.read( "damage_type", type ); jo.read( "amount", amount ); jo.read( "duration", duration ); jo.read( "bodyparts", bps ); From c72132390825e2576fdeb123745354f83737c3b8 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:35:47 +0100 Subject: [PATCH 04/14] Remove legacy bodypart handling --- src/effect.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/effect.cpp b/src/effect.cpp index 7c6e71de6bb5b..8fcd43e4f2359 100644 --- a/src/effect.cpp +++ b/src/effect.cpp @@ -1697,14 +1697,7 @@ void effect::deserialize( const JsonObject &jo ) jo.read( "eff_type", id ); eff_type = &id.obj(); jo.read( "duration", duration ); - - // TEMPORARY until 0.F - if( jo.has_int( "bp" ) ) { - bp = convert_bp( static_cast( jo.get_int( "bp" ) ) ); - } else { - jo.read( "bp", bp ); - } - + jo.read( "bp", bp ); jo.read( "permanent", permanent ); jo.read( "intensity", intensity ); start_time = calendar::turn_zero; From 4c420bb7aeecc2892552e8c5464fb96ad7e16d2b Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:36:11 +0100 Subject: [PATCH 05/14] Remove legacy trade migration --- src/trade_ui.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/trade_ui.cpp b/src/trade_ui.cpp index c1916ec16fd28..999eb412ace33 100644 --- a/src/trade_ui.cpp +++ b/src/trade_ui.cpp @@ -121,21 +121,12 @@ trade_ui::trade_ui( party_t &you, npc &trader, currency_t cost, std::string titl zone_manager &zmgr = zone_manager::get_manager(); - // FIXME: migration for traders in old saves - remove after 0.G - zone_data const *const fallback = - zmgr.get_zone_at( trader.get_location(), true, trader.get_fac_id() ); - bool const legacy = fallback != nullptr && fallback->get_name() == fallback_name; + std::unordered_set const src = + zmgr.get_point_set_loot( trader.get_location(), PICKUP_RANGE, trader.get_fac_id() ); - if( legacy ) { - _panes[_trader]->add_nearby_items( PICKUP_RANGE ); - } else { - std::unordered_set const src = - zmgr.get_point_set_loot( trader.get_location(), PICKUP_RANGE, trader.get_fac_id() ); - - for( tripoint const &pt : src ) { - _panes[_trader]->add_map_items( pt ); - _panes[_trader]->add_vehicle_items( pt ); - } + for( tripoint const &pt : src ) { + _panes[_trader]->add_map_items( pt ); + _panes[_trader]->add_vehicle_items( pt ); } } else if( !trader.is_player_ally() ) { _panes[_trader]->add_nearby_items( 1 ); From abfe66c7e450db188ad558eebf6b80d28facc816 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:36:35 +0100 Subject: [PATCH 06/14] Remove legacy unit handling --- src/units.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/units.cpp b/src/units.cpp index 404c24c21642f..bb2451460907d 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -50,11 +50,6 @@ void specific_energy::serialize( JsonOut &jsout ) const template<> void specific_energy::deserialize( const JsonValue &jv ) { - if( jv.test_int() ) { - // Compatibility with old 0.F saves - *this = units::from_joule_per_gram( jv.get_int() ); - return; - } *this = units::from_joule_per_gram( std::stof( jv.get_string() ) ); } @@ -67,11 +62,6 @@ void temperature::serialize( JsonOut &jsout ) const template<> void temperature::deserialize( const JsonValue &jv ) { - if( jv.test_int() ) { - // Compatibility with old 0.F saves - *this = from_kelvin( jv.get_int() ); - return; - } *this = from_kelvin( std::stof( jv.get_string() ) ); } @@ -108,11 +98,6 @@ void power::serialize( JsonOut &jsout ) const template<> void power::deserialize( const JsonValue &jv ) { - if( jv.test_int() ) { - // Compatibility with old 0.F saves - *this = from_watt( static_cast( jv.get_int() ) ); - return; - } *this = read_from_json_string( jv, units::power_units ); } From 656445e95534d3e13950eaf47757e5e73f17eddb Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:38:14 +0100 Subject: [PATCH 07/14] Remove legacy batch_size charge migration --- src/savegame_json.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index cf3820a4b6366..713da102fe71a 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -3125,12 +3125,6 @@ void item::deserialize( const JsonObject &data ) contents = item_contents( type->pockets ); } - // FIXME: batch_size migration from charges - remove after 0.G - if( is_craft() && craft_data_->batch_size <= 0 ) { - craft_data_->batch_size = clamp( charges, 1, charges ); - charges = 0; - } - if( !has_itype_variant( false ) && can_have_itype_variant() ) { if( possible_itype_variant( typeId().str() ) ) { set_itype_variant( typeId().str() ); From 42c12347e6dee07642ce5b7c12732acd0b055120 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:38:52 +0100 Subject: [PATCH 08/14] Remove reactor_plut/tank_plut obsoletion --- src/savegame_json.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 713da102fe71a..1aa708b8d98a2 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -1626,15 +1626,6 @@ void avatar::load( const JsonObject &data ) kill_xp = g->get_kill_tracker().legacy_kill_xp(); } - // Remove after 0.F - // Exists to prevent failed to visit member errors - if( data.has_member( "reactor_plut" ) ) { - data.get_int( "reactor_plut" ); - } - if( data.has_member( "tank_plut" ) ) { - data.get_int( "tank_plut" ); - } - std::string prof_ident = "(null)"; if( data.read( "profession", prof_ident ) && string_id( prof_ident ).is_valid() ) { prof = &string_id( prof_ident ).obj(); @@ -2088,15 +2079,6 @@ void npc::load( const JsonObject &data ) time_point companion_mission_t_r = calendar::turn_zero; std::string act_id; - // Remove after 0.F - // Exists to prevent failed to visit member errors - if( data.has_member( "reactor_plut" ) ) { - data.get_int( "reactor_plut" ); - } - if( data.has_member( "tank_plut" ) ) { - data.get_int( "tank_plut" ); - } - data.read( "marked_for_death", marked_for_death ); data.read( "dead", dead ); data.read( "patience", patience ); From 6e30848ff552b48a18104f33b0bd11ace7867dfc Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:39:47 +0100 Subject: [PATCH 09/14] Remove legacy "weary" -> "activity_history" handling --- src/savegame_json.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 1aa708b8d98a2..f7d24682ac74c 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -673,8 +673,6 @@ void Character::load( const JsonObject &data ) data.read( "hunger", hunger ); data.read( "sleepiness", sleepiness ); data.read( "cardio_acc", cardio_acc ); - // Legacy read, remove after 0.F - data.read( "weary", activity_history ); data.read( "activity_history", activity_history ); data.read( "sleep_deprivation", sleep_deprivation ); data.read( "stored_calories", stored_calories ); From 05d5f0775e1cf17cbce6a83a3c4a404db6b521a1 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:40:46 +0100 Subject: [PATCH 10/14] Remove legacy avatar::load location handling --- src/savegame_json.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index f7d24682ac74c..cbafa850495c4 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -1614,11 +1614,6 @@ void avatar::load( const JsonObject &data ) { Character::load( data ); - // TEMPORARY until 0.G - if( !data.has_member( "location" ) ) { - set_location( get_map().getglobal( read_legacy_creature_pos( data ) ) ); - } - // TEMPORARY until 0.G if( !data.has_member( "kill_xp" ) ) { kill_xp = g->get_kill_tracker().legacy_kill_xp(); From d4d9904687a1dc5e9dfa65bc4363c8f2026cc3f4 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:40:57 +0100 Subject: [PATCH 11/14] Remove legacy avatar::load kill_xp handling --- src/savegame_json.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index cbafa850495c4..35ebec767ce50 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -1614,11 +1614,6 @@ void avatar::load( const JsonObject &data ) { Character::load( data ); - // TEMPORARY until 0.G - if( !data.has_member( "kill_xp" ) ) { - kill_xp = g->get_kill_tracker().legacy_kill_xp(); - } - std::string prof_ident = "(null)"; if( data.read( "profession", prof_ident ) && string_id( prof_ident ).is_valid() ) { prof = &string_id( prof_ident ).obj(); From cf13539bfeb8c954a100c0525d2e3264ab3bd0a7 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:41:23 +0100 Subject: [PATCH 12/14] Remove legacy Character::trait_data charge handling --- src/savegame_json.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/savegame_json.cpp b/src/savegame_json.cpp index 35ebec767ce50..d06f8606aa7a6 100644 --- a/src/savegame_json.cpp +++ b/src/savegame_json.cpp @@ -550,13 +550,7 @@ void Character::trait_data::deserialize( const JsonObject &data ) { data.allow_omitted_members(); data.read( "key", key ); - - //Remove after 0.G - if( data.has_int( "charge" ) ) { - charge = time_duration::from_turns( data.get_int( "charge" ) ); - } else { - data.read( "charge", charge ); - } + data.read( "charge", charge ); data.read( "powered", powered ); data.read( "show_sprite", show_sprite ); if( data.has_member( "variant-parent" ) ) { From c25193e87990dda1012333880a24fd1c861bd9f6 Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:57:30 +0100 Subject: [PATCH 13/14] Update src/iuse.cpp --- src/iuse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iuse.cpp b/src/iuse.cpp index c160cc465c066..430c68e7fb188 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -2706,7 +2706,7 @@ std::optional iuse::ma_manual( Character *p, item *it, const tripoint & ) return 1; } -// Why this still exist? +// TODO: Why does this exist? std::optional iuse::crowbar_weak( Character *p, item *it, const tripoint &pos ) { return iuse::crowbar( p, it, pos ); From 717d14ba316f0b3f880966dc52df489f122cefbc Mon Sep 17 00:00:00 2001 From: Procyonae <45432782+Procyonae@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:40:04 +0100 Subject: [PATCH 14/14] /test line I missed in 588f682bdb --- tests/new_character_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/new_character_test.cpp b/tests/new_character_test.cpp index 9c76504c013d7..63be23a7a8c66 100644 --- a/tests/new_character_test.cpp +++ b/tests/new_character_test.cpp @@ -172,7 +172,6 @@ TEST_CASE( "starting_items", "[slow]" ) const int num_items_pre_migration = get_item_count( items_visited ); items_visited.clear(); - player_character.migrate_items_to_storage( true ); player_character.visit_items( visitable_counter ); const int num_items_post_migration = get_item_count( items_visited ); items_visited.clear();