From bd33a66b080f55a2d388232bb3ac32dd3d5a7645 Mon Sep 17 00:00:00 2001 From: shmakota Date: Fri, 27 Dec 2024 18:09:08 -0600 Subject: [PATCH] condense if else statement back down --- src/vehicle_use.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/vehicle_use.cpp b/src/vehicle_use.cpp index 18bdc2b2920e..922e9180c103 100644 --- a/src/vehicle_use.cpp +++ b/src/vehicle_use.cpp @@ -912,7 +912,7 @@ bool vehicle::fold_up() add_msg( _( "You let go of %s as you fold it." ), name ); } - std::string itype_id = "folding_bicycle"; + std::string itype_id = "generic_folded_vehicle"; for( const auto &elem : tags ) { if( elem.compare( 0, 12, "convertible:" ) == 0 ) { itype_id = elem.substr( 12 ); @@ -920,17 +920,9 @@ bool vehicle::fold_up() } } - // Decide the spawn type based on item and folding state - // we're going to switch to using can_be_folded for this, as it has the same functionality and is less hard-coded - std::string spawn_type; - if( !can_be_folded ) { - spawn_type = itype_id; - } else { - spawn_type = "generic_folded_vehicle"; // Handle unexpected cases - } - // Create the item - detached_ptr folding_veh_item = item::spawn( spawn_type, calendar::turn ); + detached_ptr folding_veh_item = item::spawn( can_be_folded ? "generic_folded_vehicle" : + itype_id, calendar::turn ); // Drop stuff in containers on ground for( const vpart_reference &vp : get_any_parts( "CARGO" ) ) {