OSDN Git Service

Merge remote-tracking branch 'remotes/origin/feature/Fix-saved-floor-exceed' into...
[hengband/hengband.git] / src / inventory / pack-overflow.c
1 #include "inventory/pack-overflow.h"
2 #include "core/disturbance.h"
3 #include "core/stuff-handler.h"
4 #include "flavor/flavor-describer.h"
5 #include "floor/floor-object.h"
6 #include "inventory/inventory-object.h"
7 #include "inventory/inventory-slot-types.h"
8 #include "object/object-info.h"
9 #include "view/display-messages.h"
10
11 /*!
12  * @brief アイテムの所持種類数が超えた場合にアイテムを床に落とす処理
13  * @return なし
14  */
15 void pack_overflow(player_type *owner_ptr)
16 {
17     if (owner_ptr->inventory_list[INVEN_PACK].k_idx == 0)
18         return;
19
20     GAME_TEXT o_name[MAX_NLEN];
21     object_type *o_ptr;
22     update_creature(owner_ptr);
23     if (!owner_ptr->inventory_list[INVEN_PACK].k_idx)
24         return;
25
26     o_ptr = &owner_ptr->inventory_list[INVEN_PACK];
27     disturb(owner_ptr, FALSE, TRUE);
28     msg_print(_("ザックからアイテムがあふれた!", "Your pack overflows!"));
29
30     describe_flavor(owner_ptr, o_name, o_ptr, 0);
31     msg_format(_("%s(%c)を落とした。", "You drop %s (%c)."), o_name, index_to_label(INVEN_PACK));
32     (void)drop_near(owner_ptr, o_ptr, 0, owner_ptr->y, owner_ptr->x);
33
34     vary_item(owner_ptr, INVEN_PACK, -255);
35     handle_stuff(owner_ptr);
36 }