Skip to content

Commit

Permalink
Merge pull request #77167 from Night-Pryanik/reading-stealing
Browse files Browse the repository at this point in the history
Added check for stealing prior to obtaining book to read
  • Loading branch information
Maleclypse authored Oct 21, 2024
2 parents 8dfcebb + aee939c commit 5762e89
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/handle_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1688,12 +1688,11 @@ static void read()
avatar &player_character = get_avatar();
// Can read items from inventory or within one tile (including in vehicles)
item_location loc = game_menus::inv::read( player_character );
item the_book = *loc.get_item();

if( loc ) {
if( loc && avatar_action::check_stealing( get_player_character(), the_book ) ) {
if( loc->type->can_use( "learn_spell" ) ) {
item spell_book = *loc.get_item();
spell_book.get_use( "learn_spell" )->call( &player_character, spell_book,
player_character.pos() );
the_book.get_use( "learn_spell" )->call( &player_character, the_book, player_character.pos() );
} else {
loc = loc.obtain( player_character );
player_character.read( loc );
Expand Down

0 comments on commit 5762e89

Please sign in to comment.