• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision8d138f240f82feaaac605f3eb1e75bc29e81cea7 (tree)
Time2019-08-13 23:59:45
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 do_cmd_wield() に player_type * 引数を追加.

Change Summary

Incremental Difference

--- a/src/cmd-item.c
+++ b/src/cmd-item.c
@@ -137,7 +137,7 @@ bool select_ring_slot = FALSE;
137137 * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor
138138 * @return なし
139139 */
140-void do_cmd_wield(void)
140+void do_cmd_wield(player_type *creature_ptr)
141141 {
142142 OBJECT_IDX item, slot;
143143 object_type forge;
@@ -152,9 +152,9 @@ void do_cmd_wield(void)
152152
153153 OBJECT_IDX need_switch_wielding = 0;
154154
155- if (p_ptr->special_defense & KATA_MUSOU)
155+ if (creature_ptr->special_defense & KATA_MUSOU)
156156 {
157- set_action(p_ptr, ACTION_NONE);
157+ set_action(creature_ptr, ACTION_NONE);
158158 }
159159
160160 /* Restrict the choices */
@@ -176,7 +176,7 @@ void do_cmd_wield(void)
176176 case TV_SHIELD:
177177 case TV_CARD:
178178 /* Dual wielding */
179- if (has_melee_weapon(p_ptr, INVEN_RARM) && has_melee_weapon(p_ptr, INVEN_LARM))
179+ if (has_melee_weapon(creature_ptr, INVEN_RARM) && has_melee_weapon(creature_ptr, INVEN_LARM))
180180 {
181181 /* Restrict the choices */
182182 item_tester_hook = item_tester_hook_melee_weapon;
@@ -188,11 +188,11 @@ void do_cmd_wield(void)
188188 if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM;
189189 }
190190
191- else if (has_melee_weapon(p_ptr, INVEN_LARM)) slot = INVEN_RARM;
191+ else if (has_melee_weapon(creature_ptr, INVEN_LARM)) slot = INVEN_RARM;
192192
193193 /* Both arms are already used by non-weapon */
194- else if (p_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_RARM]) &&
195- p_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&p_ptr->inventory_list[INVEN_LARM]))
194+ else if (creature_ptr->inventory_list[INVEN_RARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_RARM]) &&
195+ creature_ptr->inventory_list[INVEN_LARM].k_idx && !object_is_melee_weapon(&creature_ptr->inventory_list[INVEN_LARM]))
196196 {
197197 /* Restrict the choices */
198198 item_tester_hook = item_tester_hook_mochikae;
@@ -215,13 +215,13 @@ void do_cmd_wield(void)
215215 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM;
216216 }
217217
218- else if (!p_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(p_ptr, INVEN_LARM))
218+ else if (!creature_ptr->inventory_list[INVEN_RARM].k_idx && has_melee_weapon(creature_ptr, INVEN_LARM))
219219 {
220220 if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM;
221221 }
222222
223223 /* Both arms are already used */
224- else if (p_ptr->inventory_list[INVEN_LARM].k_idx && p_ptr->inventory_list[INVEN_RARM].k_idx)
224+ else if (creature_ptr->inventory_list[INVEN_LARM].k_idx && creature_ptr->inventory_list[INVEN_RARM].k_idx)
225225 {
226226 /* Restrict the choices */
227227 item_tester_hook = item_tester_hook_mochikae;
@@ -231,7 +231,7 @@ void do_cmd_wield(void)
231231 s = _("おっと。", "Oops.");
232232
233233 if (!choose_object(&slot, q, s, (USE_EQUIP), 0)) return;
234- if ((slot == INVEN_LARM) && !has_melee_weapon(p_ptr, INVEN_RARM))
234+ if ((slot == INVEN_LARM) && !has_melee_weapon(creature_ptr, INVEN_RARM))
235235 need_switch_wielding = INVEN_RARM;
236236 }
237237 break;
@@ -239,7 +239,7 @@ void do_cmd_wield(void)
239239 /* Rings */
240240 case TV_RING:
241241 /* Choose a ring slot */
242- if (p_ptr->inventory_list[INVEN_LEFT].k_idx && p_ptr->inventory_list[INVEN_RIGHT].k_idx)
242+ if (creature_ptr->inventory_list[INVEN_LEFT].k_idx && creature_ptr->inventory_list[INVEN_RIGHT].k_idx)
243243 {
244244 q = _("どちらの指輪と取り替えますか?", "Replace which ring? ");
245245 }
@@ -262,9 +262,9 @@ void do_cmd_wield(void)
262262 }
263263
264264 /* Prevent wielding into a cursed slot */
265- if (object_is_cursed(&p_ptr->inventory_list[slot]))
265+ if (object_is_cursed(&creature_ptr->inventory_list[slot]))
266266 {
267- object_desc(o_name, &p_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
267+ object_desc(o_name, &creature_ptr->inventory_list[slot], (OD_OMIT_PREFIX | OD_NAME_ONLY));
268268 #ifdef JP
269269 msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name );
270270 #else
@@ -286,7 +286,7 @@ void do_cmd_wield(void)
286286 if (!get_check(dummy)) return;
287287 }
288288
289- if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
289+ if ((o_ptr->name1 == ART_STONEMASK) && object_is_known(o_ptr) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
290290 {
291291 char dummy[MAX_NLEN+100];
292292
@@ -298,10 +298,10 @@ void do_cmd_wield(void)
298298 if (!get_check(dummy)) return;
299299 }
300300
301- if (need_switch_wielding && !object_is_cursed(&p_ptr->inventory_list[need_switch_wielding]))
301+ if (need_switch_wielding && !object_is_cursed(&creature_ptr->inventory_list[need_switch_wielding]))
302302 {
303- object_type *slot_o_ptr = &p_ptr->inventory_list[slot];
304- object_type *switch_o_ptr = &p_ptr->inventory_list[need_switch_wielding];
303+ object_type *slot_o_ptr = &creature_ptr->inventory_list[slot];
304+ object_type *switch_o_ptr = &creature_ptr->inventory_list[need_switch_wielding];
305305 object_type object_tmp;
306306 object_type *otmp_ptr = &object_tmp;
307307 GAME_TEXT switch_name[MAX_NLEN];
@@ -320,7 +320,7 @@ void do_cmd_wield(void)
320320
321321 check_find_art_quest_completion(o_ptr);
322322
323- if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
323+ if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN)
324324 {
325325 identify_item(o_ptr);
326326
@@ -328,7 +328,7 @@ void do_cmd_wield(void)
328328 autopick_alter_item(item, FALSE);
329329 }
330330
331- take_turn(p_ptr, 100);
331+ take_turn(creature_ptr, 100);
332332 q_ptr = &forge;
333333
334334 /* Obtain local object */
@@ -352,7 +352,7 @@ void do_cmd_wield(void)
352352 }
353353
354354 /* Access the wield slot */
355- o_ptr = &p_ptr->inventory_list[slot];
355+ o_ptr = &creature_ptr->inventory_list[slot];
356356
357357 /* Take off existing item */
358358 if (o_ptr->k_idx)
@@ -366,10 +366,10 @@ void do_cmd_wield(void)
366366
367367 o_ptr->marked |= OM_TOUCHED;
368368
369- p_ptr->total_weight += q_ptr->weight;
369+ creature_ptr->total_weight += q_ptr->weight;
370370
371371 /* Increment the equip counter by hand */
372- p_ptr->equip_cnt++;
372+ creature_ptr->equip_cnt++;
373373
374374 #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.")
375375 #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.")
@@ -379,14 +379,14 @@ void do_cmd_wield(void)
379379 switch (slot)
380380 {
381381 case INVEN_RARM:
382- if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(p_ptr, FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
382+ if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM) && CAN_TWO_HANDS_WIELDING())
383383 act = STR_WIELD_ARMS;
384384 else
385385 act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM);
386386 break;
387387
388388 case INVEN_LARM:
389- if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(p_ptr, FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
389+ if (object_allow_two_hands_wielding(o_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM) && CAN_TWO_HANDS_WIELDING())
390390 act = STR_WIELD_ARMS;
391391 else
392392 act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM);
@@ -412,24 +412,24 @@ void do_cmd_wield(void)
412412 if (object_is_cursed(o_ptr))
413413 {
414414 msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!"));
415- chg_virtue(p_ptr, V_HARMONY, -1);
415+ chg_virtue(creature_ptr, V_HARMONY, -1);
416416
417417 /* Note the curse */
418418 o_ptr->ident |= (IDENT_SENSE);
419419 }
420420
421421 /* The Stone Mask make the player current_world_ptr->game_turn into a vampire! */
422- if ((o_ptr->name1 == ART_STONEMASK) && (p_ptr->prace != RACE_VAMPIRE) && (p_ptr->prace != RACE_ANDROID))
422+ if ((o_ptr->name1 == ART_STONEMASK) && (creature_ptr->prace != RACE_VAMPIRE) && (creature_ptr->prace != RACE_ANDROID))
423423 {
424424 /* Turn into a vampire */
425- change_race(p_ptr, RACE_VAMPIRE, "");
425+ change_race(creature_ptr, RACE_VAMPIRE, "");
426426 }
427427
428- p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
429- p_ptr->redraw |= (PR_EQUIPPY);
430- p_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
428+ creature_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
429+ creature_ptr->redraw |= (PR_EQUIPPY);
430+ creature_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
431431
432- calc_android_exp(p_ptr);
432+ calc_android_exp(creature_ptr);
433433 }
434434
435435 /*!
--- a/src/cmd-item.h
+++ b/src/cmd-item.h
@@ -2,7 +2,7 @@
22
33 extern void do_cmd_inven(void);
44 extern void do_cmd_equip(void);
5-extern void do_cmd_wield(void);
5+extern void do_cmd_wield(player_type *creature_ptr);
66 extern void do_cmd_takeoff(void);
77 extern void do_cmd_drop(void);
88 extern void do_cmd_destroy(void);
--- a/src/core.c
+++ b/src/core.c
@@ -3585,7 +3585,7 @@ static void process_command(void)
35853585 /* Wear/wield equipment */
35863586 case 'w':
35873587 {
3588- if (!p_ptr->wild_mode) do_cmd_wield();
3588+ if (!p_ptr->wild_mode) do_cmd_wield(p_ptr);
35893589 break;
35903590 }
35913591
--- a/src/store.c
+++ b/src/store.c
@@ -5441,7 +5441,7 @@ static void store_process_command(void)
54415441 /* Wear/wield equipment */
54425442 case 'w':
54435443 {
5444- do_cmd_wield();
5444+ do_cmd_wield(p_ptr);
54455445 break;
54465446 }
54475447
Show on old repository browser