• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision7dfbe2a0f8e605feadb575ce89808b878dc40bb6 (tree)
Time2019-06-13 23:50:13
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 player-inventory.c に display_inven() を移動.

Change Summary

Incremental Difference

--- a/src/object1.c
+++ b/src/object1.c
@@ -1597,70 +1597,6 @@ bool item_tester_okay(object_type *o_ptr)
15971597 return (TRUE);
15981598 }
15991599
1600-
1601-/*!
1602- * @brief 所持アイテム一覧を表示する /
1603- * Choice window "shadow" of the "show_inven()" function
1604- * @return なし
1605- */
1606-void display_inven(void)
1607-{
1608- register int i, n, z = 0;
1609- object_type *o_ptr;
1610- TERM_COLOR attr = TERM_WHITE;
1611- char tmp_val[80];
1612- GAME_TEXT o_name[MAX_NLEN];
1613- TERM_LEN wid, hgt;
1614-
1615- Term_get_size(&wid, &hgt);
1616-
1617- for (i = 0; i < INVEN_PACK; i++)
1618- {
1619- o_ptr = &p_ptr->inventory_list[i];
1620- if (!o_ptr->k_idx) continue;
1621- z = i + 1;
1622- }
1623-
1624- for (i = 0; i < z; i++)
1625- {
1626- o_ptr = &p_ptr->inventory_list[i];
1627- tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
1628- if (item_tester_okay(o_ptr))
1629- {
1630- tmp_val[0] = index_to_label(i);
1631- tmp_val[1] = ')';
1632- }
1633-
1634- Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
1635- object_desc(o_name, o_ptr, 0);
1636- n = strlen(o_name);
1637- attr = tval_to_attr[o_ptr->tval % 128];
1638- if (o_ptr->timeout)
1639- {
1640- attr = TERM_L_DARK;
1641- }
1642-
1643- Term_putstr(3, i, n, attr, o_name);
1644- Term_erase(3+n, i, 255);
1645-
1646- if (show_weights)
1647- {
1648- int wgt = o_ptr->weight * o_ptr->number;
1649-#ifdef JP
1650- sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
1651-#else
1652- sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
1653-#endif
1654- prt(tmp_val, i, wid - 9);
1655- }
1656- }
1657-
1658- for (i = z; i < hgt; i++)
1659- {
1660- Term_erase(0, i, 255);
1661- }
1662-}
1663-
16641600 /*!
16651601 * @brief 矢弾を射撃した場合の破損確率を返す /
16661602 * Determines the odds of an object breaking when thrown at a monster
--- a/src/player-inventory.c
+++ b/src/player-inventory.c
@@ -3336,3 +3336,67 @@ void py_pickup_floor(bool pickup)
33363336 }
33373337 }
33383338
3339+
3340+
3341+/*!
3342+ * @brief 所持アイテム一覧を表示する /
3343+ * Choice window "shadow" of the "show_inven()" function
3344+ * @return なし
3345+ */
3346+void display_inven(void)
3347+{
3348+ register int i, n, z = 0;
3349+ object_type *o_ptr;
3350+ TERM_COLOR attr = TERM_WHITE;
3351+ char tmp_val[80];
3352+ GAME_TEXT o_name[MAX_NLEN];
3353+ TERM_LEN wid, hgt;
3354+
3355+ Term_get_size(&wid, &hgt);
3356+
3357+ for (i = 0; i < INVEN_PACK; i++)
3358+ {
3359+ o_ptr = &p_ptr->inventory_list[i];
3360+ if (!o_ptr->k_idx) continue;
3361+ z = i + 1;
3362+ }
3363+
3364+ for (i = 0; i < z; i++)
3365+ {
3366+ o_ptr = &p_ptr->inventory_list[i];
3367+ tmp_val[0] = tmp_val[1] = tmp_val[2] = ' ';
3368+ if (item_tester_okay(o_ptr))
3369+ {
3370+ tmp_val[0] = index_to_label(i);
3371+ tmp_val[1] = ')';
3372+ }
3373+
3374+ Term_putstr(0, i, 3, TERM_WHITE, tmp_val);
3375+ object_desc(o_name, o_ptr, 0);
3376+ n = strlen(o_name);
3377+ attr = tval_to_attr[o_ptr->tval % 128];
3378+ if (o_ptr->timeout)
3379+ {
3380+ attr = TERM_L_DARK;
3381+ }
3382+
3383+ Term_putstr(3, i, n, attr, o_name);
3384+ Term_erase(3 + n, i, 255);
3385+
3386+ if (show_weights)
3387+ {
3388+ int wgt = o_ptr->weight * o_ptr->number;
3389+#ifdef JP
3390+ sprintf(tmp_val, "%3d.%1d kg", lbtokg1(wgt), lbtokg2(wgt));
3391+#else
3392+ sprintf(tmp_val, "%3d.%1d lb", wgt / 10, wgt % 10);
3393+#endif
3394+ prt(tmp_val, i, wid - 9);
3395+ }
3396+ }
3397+
3398+ for (i = z; i < hgt; i++)
3399+ {
3400+ Term_erase(0, i, 255);
3401+ }
3402+}
Show on old repository browser