Skip to content

Commit

Permalink
Fixed possible to read books stored discharged smarthpone. Fixes #77919
Browse files Browse the repository at this point in the history
…. The cause of the bug was that in the read menu it was not checked if the book was stored in smartphone with enough charge to read. This was fixed by checking if the book is stored in a smartphone with enough charge to read.
  • Loading branch information
SomeName42 committed Nov 27, 2024
1 parent 1ecb260 commit a8e2740
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,11 @@ class read_inventory_preset: public pickup_inventory_preset
}

bool is_shown( const item_location &loc ) const override {
return loc->is_book() || loc->type->can_use( "learn_spell" );
const item_location p_loc = loc.parent_item();

return ( loc->is_book() || loc->type->can_use( "learn_spell" ) ) &&
( p_loc.where() == item_location::type::invalid || !p_loc->is_ebook_storage() ||
p_loc->energy_remaining().value() >= 1000000 );
}

std::string get_denial( const item_location &loc ) const override {
Expand Down

0 comments on commit a8e2740

Please sign in to comment.