Skip to content

Commit

Permalink
Merge pull request #79539 from ShnitzelX2/ignore-empty-browsed-edevices
Browse files Browse the repository at this point in the history
E-device selection ignores empty browsed devices when moving/copying
  • Loading branch information
Maleclypse authored Feb 7, 2025
2 parents 848ecd4 + 45af778 commit d311cbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion data/json/itemgroups/roof.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
{ "item": "matches", "prob": 60, "charges": [ 0, 20 ] },
[ "syringe", 8 ],
[ "hairpin", 1 ],
{ "group": "used_usb_drives", "prob": 5, "contents-item": "efiles_contraband" },
{ "group": "used_usb_drives", "prob": 5, "contents-group": "efiles_contraband" },
[ "news_regional", 8 ],
[ "jug_plastic", 10 ],
{ "item": "spray_can", "prob": 50, "charges": [ 0, 4 ] },
Expand Down
5 changes: 4 additions & 1 deletion src/game_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,8 @@ drop_locations game_menus::inv::edevice_select( Character &who, item_location &u
bool has_use_check = !unusable_only || !efile_activity_actor::edevice_has_use( loc.get_item() );
bool browsed_equal_check = browse_equals == loc->is_browsed();
bool fast_transfer = compat == efile_activity_actor::edevice_compatible::ECOMPAT_FAST;
bool no_files_check = !( action == EF_MOVE_ONTO_THIS || action == EF_COPY_ONTO_THIS )
|| ( loc->is_browsed() && !loc->efiles().empty() );
bool compatible_check = ( action == EF_BROWSE && browse_equals ) ||
//if browsing, no compatibility check
( action == EF_READ && fast_transfer ) || //if reading, only fast-compatible edevices
Expand All @@ -1684,7 +1686,8 @@ drop_locations game_menus::inv::edevice_select( Character &who, item_location &u
used_edevice_check &&
has_use_check &&
browsed_equal_check &&
compatible_check;
compatible_check &&
no_files_check;
if( preset_bool ) {
add_msg_debug( debugmode::DF_ACT_EBOOK, string_format( "found edevice %s", loc->display_name() ) );
}
Expand Down

0 comments on commit d311cbe

Please sign in to comment.