変愚蛮怒のメインリポジトリです
Revision | 8d138f240f82feaaac605f3eb1e75bc29e81cea7 (tree) |
---|---|
Time | 2019-08-13 23:59:45 |
Author | deskull <deskull@user...> |
Commiter | deskull |
[Refactor] #38997 do_cmd_wield() に player_type * 引数を追加.
@@ -137,7 +137,7 @@ bool select_ring_slot = FALSE; | ||
137 | 137 | * @brief 装備するコマンドのメインルーチン / Wield or wear a single item from the pack or floor |
138 | 138 | * @return なし |
139 | 139 | */ |
140 | -void do_cmd_wield(void) | |
140 | +void do_cmd_wield(player_type *creature_ptr) | |
141 | 141 | { |
142 | 142 | OBJECT_IDX item, slot; |
143 | 143 | object_type forge; |
@@ -152,9 +152,9 @@ void do_cmd_wield(void) | ||
152 | 152 | |
153 | 153 | OBJECT_IDX need_switch_wielding = 0; |
154 | 154 | |
155 | - if (p_ptr->special_defense & KATA_MUSOU) | |
155 | + if (creature_ptr->special_defense & KATA_MUSOU) | |
156 | 156 | { |
157 | - set_action(p_ptr, ACTION_NONE); | |
157 | + set_action(creature_ptr, ACTION_NONE); | |
158 | 158 | } |
159 | 159 | |
160 | 160 | /* Restrict the choices */ |
@@ -176,7 +176,7 @@ void do_cmd_wield(void) | ||
176 | 176 | case TV_SHIELD: |
177 | 177 | case TV_CARD: |
178 | 178 | /* 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)) | |
180 | 180 | { |
181 | 181 | /* Restrict the choices */ |
182 | 182 | item_tester_hook = item_tester_hook_melee_weapon; |
@@ -188,11 +188,11 @@ void do_cmd_wield(void) | ||
188 | 188 | if (slot == INVEN_RARM) need_switch_wielding = INVEN_LARM; |
189 | 189 | } |
190 | 190 | |
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; | |
192 | 192 | |
193 | 193 | /* 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])) | |
196 | 196 | { |
197 | 197 | /* Restrict the choices */ |
198 | 198 | item_tester_hook = item_tester_hook_mochikae; |
@@ -215,13 +215,13 @@ void do_cmd_wield(void) | ||
215 | 215 | if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_RARM; |
216 | 216 | } |
217 | 217 | |
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)) | |
219 | 219 | { |
220 | 220 | if (!get_check(_("二刀流で戦いますか?", "Dual wielding? "))) slot = INVEN_LARM; |
221 | 221 | } |
222 | 222 | |
223 | 223 | /* 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) | |
225 | 225 | { |
226 | 226 | /* Restrict the choices */ |
227 | 227 | item_tester_hook = item_tester_hook_mochikae; |
@@ -231,7 +231,7 @@ void do_cmd_wield(void) | ||
231 | 231 | s = _("おっと。", "Oops."); |
232 | 232 | |
233 | 233 | 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)) | |
235 | 235 | need_switch_wielding = INVEN_RARM; |
236 | 236 | } |
237 | 237 | break; |
@@ -239,7 +239,7 @@ void do_cmd_wield(void) | ||
239 | 239 | /* Rings */ |
240 | 240 | case TV_RING: |
241 | 241 | /* 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) | |
243 | 243 | { |
244 | 244 | q = _("どちらの指輪と取り替えますか?", "Replace which ring? "); |
245 | 245 | } |
@@ -262,9 +262,9 @@ void do_cmd_wield(void) | ||
262 | 262 | } |
263 | 263 | |
264 | 264 | /* 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])) | |
266 | 266 | { |
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)); | |
268 | 268 | #ifdef JP |
269 | 269 | msg_format("%s%sは呪われているようだ。", describe_use(slot) , o_name ); |
270 | 270 | #else |
@@ -286,7 +286,7 @@ void do_cmd_wield(void) | ||
286 | 286 | if (!get_check(dummy)) return; |
287 | 287 | } |
288 | 288 | |
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)) | |
290 | 290 | { |
291 | 291 | char dummy[MAX_NLEN+100]; |
292 | 292 |
@@ -298,10 +298,10 @@ void do_cmd_wield(void) | ||
298 | 298 | if (!get_check(dummy)) return; |
299 | 299 | } |
300 | 300 | |
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])) | |
302 | 302 | { |
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]; | |
305 | 305 | object_type object_tmp; |
306 | 306 | object_type *otmp_ptr = &object_tmp; |
307 | 307 | GAME_TEXT switch_name[MAX_NLEN]; |
@@ -320,7 +320,7 @@ void do_cmd_wield(void) | ||
320 | 320 | |
321 | 321 | check_find_art_quest_completion(o_ptr); |
322 | 322 | |
323 | - if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN) | |
323 | + if (creature_ptr->pseikaku == SEIKAKU_MUNCHKIN) | |
324 | 324 | { |
325 | 325 | identify_item(o_ptr); |
326 | 326 |
@@ -328,7 +328,7 @@ void do_cmd_wield(void) | ||
328 | 328 | autopick_alter_item(item, FALSE); |
329 | 329 | } |
330 | 330 | |
331 | - take_turn(p_ptr, 100); | |
331 | + take_turn(creature_ptr, 100); | |
332 | 332 | q_ptr = &forge; |
333 | 333 | |
334 | 334 | /* Obtain local object */ |
@@ -352,7 +352,7 @@ void do_cmd_wield(void) | ||
352 | 352 | } |
353 | 353 | |
354 | 354 | /* Access the wield slot */ |
355 | - o_ptr = &p_ptr->inventory_list[slot]; | |
355 | + o_ptr = &creature_ptr->inventory_list[slot]; | |
356 | 356 | |
357 | 357 | /* Take off existing item */ |
358 | 358 | if (o_ptr->k_idx) |
@@ -366,10 +366,10 @@ void do_cmd_wield(void) | ||
366 | 366 | |
367 | 367 | o_ptr->marked |= OM_TOUCHED; |
368 | 368 | |
369 | - p_ptr->total_weight += q_ptr->weight; | |
369 | + creature_ptr->total_weight += q_ptr->weight; | |
370 | 370 | |
371 | 371 | /* Increment the equip counter by hand */ |
372 | - p_ptr->equip_cnt++; | |
372 | + creature_ptr->equip_cnt++; | |
373 | 373 | |
374 | 374 | #define STR_WIELD_RARM _("%s(%c)を右手に装備した。", "You are wielding %s (%c) in your right hand.") |
375 | 375 | #define STR_WIELD_LARM _("%s(%c)を左手に装備した。", "You are wielding %s (%c) in your left hand.") |
@@ -379,14 +379,14 @@ void do_cmd_wield(void) | ||
379 | 379 | switch (slot) |
380 | 380 | { |
381 | 381 | 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()) | |
383 | 383 | act = STR_WIELD_ARMS; |
384 | 384 | else |
385 | 385 | act = (left_hander ? STR_WIELD_LARM : STR_WIELD_RARM); |
386 | 386 | break; |
387 | 387 | |
388 | 388 | 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()) | |
390 | 390 | act = STR_WIELD_ARMS; |
391 | 391 | else |
392 | 392 | act = (left_hander ? STR_WIELD_RARM : STR_WIELD_LARM); |
@@ -412,24 +412,24 @@ void do_cmd_wield(void) | ||
412 | 412 | if (object_is_cursed(o_ptr)) |
413 | 413 | { |
414 | 414 | msg_print(_("うわ! すさまじく冷たい!", "Oops! It feels deathly cold!")); |
415 | - chg_virtue(p_ptr, V_HARMONY, -1); | |
415 | + chg_virtue(creature_ptr, V_HARMONY, -1); | |
416 | 416 | |
417 | 417 | /* Note the curse */ |
418 | 418 | o_ptr->ident |= (IDENT_SENSE); |
419 | 419 | } |
420 | 420 | |
421 | 421 | /* 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)) | |
423 | 423 | { |
424 | 424 | /* Turn into a vampire */ |
425 | - change_race(p_ptr, RACE_VAMPIRE, ""); | |
425 | + change_race(creature_ptr, RACE_VAMPIRE, ""); | |
426 | 426 | } |
427 | 427 | |
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); | |
431 | 431 | |
432 | - calc_android_exp(p_ptr); | |
432 | + calc_android_exp(creature_ptr); | |
433 | 433 | } |
434 | 434 | |
435 | 435 | /*! |
@@ -2,7 +2,7 @@ | ||
2 | 2 | |
3 | 3 | extern void do_cmd_inven(void); |
4 | 4 | extern void do_cmd_equip(void); |
5 | -extern void do_cmd_wield(void); | |
5 | +extern void do_cmd_wield(player_type *creature_ptr); | |
6 | 6 | extern void do_cmd_takeoff(void); |
7 | 7 | extern void do_cmd_drop(void); |
8 | 8 | extern void do_cmd_destroy(void); |
@@ -3585,7 +3585,7 @@ static void process_command(void) | ||
3585 | 3585 | /* Wear/wield equipment */ |
3586 | 3586 | case 'w': |
3587 | 3587 | { |
3588 | - if (!p_ptr->wild_mode) do_cmd_wield(); | |
3588 | + if (!p_ptr->wild_mode) do_cmd_wield(p_ptr); | |
3589 | 3589 | break; |
3590 | 3590 | } |
3591 | 3591 |
@@ -5441,7 +5441,7 @@ static void store_process_command(void) | ||
5441 | 5441 | /* Wear/wield equipment */ |
5442 | 5442 | case 'w': |
5443 | 5443 | { |
5444 | - do_cmd_wield(); | |
5444 | + do_cmd_wield(p_ptr); | |
5445 | 5445 | break; |
5446 | 5446 | } |
5447 | 5447 |