• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionbca6c85f60c72dd4a61368a914a720e954d0df47 (tree)
Time2019-08-17 00:04:21
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/cmd/cmd-magiceat.c
+++ b/src/cmd/cmd-magiceat.c
@@ -73,7 +73,7 @@
7373 * @param only_browse 閲覧するだけならばTRUE
7474 * @return 選択した魔力のID、キャンセルならば-1を返す
7575 */
76-static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
76+static OBJECT_SUBTYPE_VALUE select_magic_eater(player_type *creature_ptr, bool only_browse)
7777 {
7878 OBJECT_SUBTYPE_VALUE ext = 0;
7979 char choice;
@@ -89,15 +89,15 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
8989 if (repeat_pull(&sn))
9090 {
9191 /* Verify the spell */
92- if (sn >= EATER_EXT*2 && !(p_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, sn-EATER_EXT*2)].pval * (p_ptr->magic_num2[sn] - 1) * EATER_ROD_CHARGE))
92+ if (sn >= EATER_EXT*2 && !(creature_ptr->magic_num1[sn] > k_info[lookup_kind(TV_ROD, sn-EATER_EXT*2)].pval * (creature_ptr->magic_num2[sn] - 1) * EATER_ROD_CHARGE))
9393 return sn;
94- else if (sn < EATER_EXT*2 && !(p_ptr->magic_num1[sn] < EATER_CHARGE))
94+ else if (sn < EATER_EXT*2 && !(creature_ptr->magic_num1[sn] < EATER_CHARGE))
9595 return sn;
9696 }
9797
9898 for (i = 0; i < 108; i++)
9999 {
100- if (p_ptr->magic_num2[i]) break;
100+ if (creature_ptr->magic_num2[i]) break;
101101 }
102102 if (i == 108)
103103 {
@@ -185,7 +185,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
185185 }
186186 for (i = ext; i < ext + EATER_EXT; i++)
187187 {
188- if (p_ptr->magic_num2[i])
188+ if (creature_ptr->magic_num2[i])
189189 {
190190 if (use_menu) menu_line = i-ext+1;
191191 break;
@@ -239,7 +239,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
239239 /* Print list */
240240 for (ctr = 0; ctr < EATER_EXT; ctr++)
241241 {
242- if (!p_ptr->magic_num2[ctr+ext]) continue;
242+ if (!creature_ptr->magic_num2[ctr+ext]) continue;
243243
244244 k_idx = lookup_kind(tval, ctr);
245245
@@ -264,17 +264,17 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
264264 y1 = ((ctr < EATER_EXT/2) ? y + ctr : y + ctr - EATER_EXT/2);
265265 level = (tval == TV_ROD ? k_info[k_idx].level * 5 / 6 - 5 : k_info[k_idx].level);
266266 chance = level * 4 / 5 + 20;
267- chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
267+ chance -= 3 * (adj_mag_stat[creature_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
268268 level /= 2;
269- if (p_ptr->lev > level)
269+ if (creature_ptr->lev > level)
270270 {
271- chance -= 3 * (p_ptr->lev - level);
271+ chance -= 3 * (creature_ptr->lev - level);
272272 }
273273 chance = mod_spell_chance_1(chance);
274- chance = MAX(chance, adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]]);
274+ chance = MAX(chance, adj_mag_fail[creature_ptr->stat_ind[mp_ptr->spell_stat]]);
275275 /* Stunning makes spells harder */
276- if (p_ptr->stun > 50) chance += 25;
277- else if (p_ptr->stun) chance += 15;
276+ if (creature_ptr->stun > 50) chance += 25;
277+ else if (creature_ptr->stun) chance += 15;
278278
279279 if (chance > 95) chance = 95;
280280
@@ -289,15 +289,15 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
289289 strcat(dummy, format(
290290 _(" %-22.22s 充填:%2d/%2d%3d%%", " %-22.22s (%2d/%2d) %3d%%"),
291291 k_name + k_info[k_idx].name,
292- p_ptr->magic_num1[ctr+ext] ?
293- (p_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
294- p_ptr->magic_num2[ctr+ext], chance));
295- if (p_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (p_ptr->magic_num2[ctr+ext]-1) * EATER_ROD_CHARGE) col = TERM_RED;
292+ creature_ptr->magic_num1[ctr+ext] ?
293+ (creature_ptr->magic_num1[ctr+ext] - 1) / (EATER_ROD_CHARGE * k_info[k_idx].pval) +1 : 0,
294+ creature_ptr->magic_num2[ctr+ext], chance));
295+ if (creature_ptr->magic_num1[ctr+ext] > k_info[k_idx].pval * (creature_ptr->magic_num2[ctr+ext]-1) * EATER_ROD_CHARGE) col = TERM_RED;
296296 }
297297 else
298298 {
299- strcat(dummy, format(" %-22.22s %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(p_ptr->magic_num1[ctr+ext]/EATER_CHARGE), p_ptr->magic_num2[ctr+ext], chance));
300- if (p_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
299+ strcat(dummy, format(" %-22.22s %2d/%2d %3d%%", k_name + k_info[k_idx].name, (s16b)(creature_ptr->magic_num1[ctr+ext]/EATER_CHARGE), creature_ptr->magic_num2[ctr+ext], chance));
300+ if (creature_ptr->magic_num1[ctr+ext] < EATER_CHARGE) col = TERM_RED;
301301 }
302302 }
303303 else
@@ -326,7 +326,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
326326 {
327327 menu_line += EATER_EXT - 1;
328328 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
329- } while(!p_ptr->magic_num2[menu_line+ext-1]);
329+ } while(!creature_ptr->magic_num2[menu_line+ext-1]);
330330 break;
331331 }
332332
@@ -338,7 +338,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
338338 {
339339 menu_line++;
340340 if (menu_line > EATER_EXT) menu_line -= EATER_EXT;
341- } while(!p_ptr->magic_num2[menu_line+ext-1]);
341+ } while(!creature_ptr->magic_num2[menu_line+ext-1]);
342342 break;
343343 }
344344
@@ -357,7 +357,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
357357 reverse = TRUE;
358358 }
359359 else menu_line+=EATER_EXT/2;
360- while(!p_ptr->magic_num2[menu_line+ext-1])
360+ while(!creature_ptr->magic_num2[menu_line+ext-1])
361361 {
362362 if (reverse)
363363 {
@@ -427,7 +427,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
427427 }
428428
429429 /* Totally Illegal */
430- if ((i < 0) || (i > EATER_EXT) || !p_ptr->magic_num2[i+ext])
430+ if ((i < 0) || (i > EATER_EXT) || !creature_ptr->magic_num2[i+ext])
431431 {
432432 bell();
433433 continue;
@@ -448,7 +448,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
448448 }
449449 if (tval == TV_ROD)
450450 {
451- if (p_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (p_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
451+ if (creature_ptr->magic_num1[ext+i] > k_info[lookup_kind(tval, i)].pval * (creature_ptr->magic_num2[ext+i] - 1) * EATER_ROD_CHARGE)
452452 {
453453 msg_print(_("その魔法はまだ充填している最中だ。", "The magic are still charging."));
454454 msg_print(NULL);
@@ -458,7 +458,7 @@ static OBJECT_SUBTYPE_VALUE select_magic_eater(bool only_browse)
458458 }
459459 else
460460 {
461- if (p_ptr->magic_num1[ext+i] < EATER_CHARGE)
461+ if (creature_ptr->magic_num1[ext+i] < EATER_CHARGE)
462462 {
463463 msg_print(_("その魔法は使用回数が切れている。", "The magic has no charges left."));
464464 msg_print(NULL);
@@ -521,7 +521,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
521521
522522 if (cmd_limit_confused(p_ptr)) return FALSE;
523523
524- item = select_magic_eater(only_browse);
524+ item = select_magic_eater(p_ptr, only_browse);
525525 if (item == -1)
526526 {
527527 free_turn(p_ptr);
Show on old repository browser