Skip to content

Commit

Permalink
Fix freeze when player cannot contain mission reward
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong committed Feb 7, 2021
1 parent 4eb4e8f commit 29e4c2b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/npctalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,9 +1759,16 @@ void talk_effect_fun_t::set_u_buy_item( const itype_id &item_name, int cost, int
item container( container_name, calendar::turn );
container.put_in( item( item_name, calendar::turn, count ),
item_pocket::pocket_type::CONTAINER );
d.alpha->i_add( container );
//~ %1%s is the NPC name, %2$s is an item
popup( _( "%1$s gives you a %2$s." ), d.beta->disp_name(), container.tname() );
if( d.alpha->get_character()->can_stash( container ) ) {
//~ %1$s is the NPC name, %2$s is an item
popup( _( "%1$s gives you a %2$s." ), d.beta->disp_name(), container.tname() );
d.alpha->i_add( container );
} else {
//~ %1$s and %3$s are the NPC name, %2$s is an item
popup( _( "%1$s gives you a %2$s, but you don't have enough space to hold it! %3$s placed it on the ground for you." ),
d.beta->disp_name(), container.tname(), d.beta->disp_name() );
get_map().add_item( d.alpha->pos(), container );
}
}
};

Expand Down

0 comments on commit 29e4c2b

Please sign in to comment.