• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionc2c8211441b487f8eeb9b5b29bc47585fb9cd87f (tree)
Time2019-06-26 00:12:03
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

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

Change Summary

Incremental Difference

--- a/src/bldg.c
+++ b/src/bldg.c
@@ -2016,7 +2016,7 @@ static bool inn_comm(int cmd)
20162016 return FALSE;
20172017 }
20182018 msg_print(_("バーテンはいくらかの食べ物とビールをくれた。", "The barkeep gives you some gruel and a beer."));
2019- (void)set_food(PY_FOOD_MAX - 1);
2019+ (void)set_food(p_ptr, PY_FOOD_MAX - 1);
20202020 break;
20212021
20222022 case BACT_REST: /* Rest for the night */
--- a/src/cmd-activate.c
+++ b/src/cmd-activate.c
@@ -1500,7 +1500,7 @@ bool activate_artifact(object_type *o_ptr)
15001500
15011501 case ACT_SATIATE:
15021502 {
1503- (void)set_food(PY_FOOD_MAX - 1);
1503+ (void)set_food(p_ptr, PY_FOOD_MAX - 1);
15041504 break;
15051505 }
15061506
--- a/src/cmd-eat.c
+++ b/src/cmd-eat.c
@@ -338,7 +338,7 @@ void exe_eat_food(INVENTORY_IDX item)
338338 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
339339 {
340340 /* Reduced nutritional benefit */
341- (void)set_food(p_ptr->food + (o_ptr->pval / 10));
341+ (void)set_food(p_ptr, p_ptr->food + (o_ptr->pval / 10));
342342 msg_print(_("あなたのような者にとって食糧など僅かな栄養にしかならない。",
343343 "Mere victuals hold scant sustenance for a being such as yourself."));
344344
@@ -378,7 +378,7 @@ void exe_eat_food(INVENTORY_IDX item)
378378 o_ptr->pval--;
379379
380380 /* Eat a charge */
381- set_food(p_ptr->food + 5000);
381+ set_food(p_ptr, p_ptr->food + 5000);
382382
383383 /* XXX Hack -- unstack if necessary */
384384 if (o_ptr->tval == TV_STAFF &&
@@ -429,7 +429,7 @@ void exe_eat_food(INVENTORY_IDX item)
429429 GAME_TEXT o_name[MAX_NLEN];
430430 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
431431 msg_format(_("%sは燃え上り灰になった。精力を吸収した気がする。", "%^s is burnt to ashes. You absorb its vitality!"), o_name);
432- (void)set_food(PY_FOOD_MAX - 1);
432+ (void)set_food(p_ptr, PY_FOOD_MAX - 1);
433433 }
434434 else if (PRACE_IS_(p_ptr, RACE_SKELETON))
435435 {
@@ -438,7 +438,7 @@ void exe_eat_food(INVENTORY_IDX item)
438438 (o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_SKELETON))
439439 {
440440 msg_print(_("あなたは骨で自分の体を補った。", "Your body absorbs the bone."));
441- set_food(p_ptr->food + 5000);
441+ set_food(p_ptr, p_ptr->food + 5000);
442442 }
443443 else
444444 #endif
@@ -469,17 +469,17 @@ void exe_eat_food(INVENTORY_IDX item)
469469 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING))
470470 {
471471 msg_print(_("生者の食物はあなたにとってほとんど栄養にならない。", "The food of mortals is poor sustenance for you."));
472- set_food(p_ptr->food + ((o_ptr->pval) / 20));
472+ set_food(p_ptr, p_ptr->food + ((o_ptr->pval) / 20));
473473 }
474474 else if (o_ptr->tval == TV_FOOD && o_ptr->sval == SV_FOOD_WAYBREAD)
475475 {
476476 /* Waybread is always fully satisfying. */
477- set_food(MAX(p_ptr->food, PY_FOOD_MAX - 1));
477+ set_food(p_ptr, MAX(p_ptr->food, PY_FOOD_MAX - 1));
478478 }
479479 else
480480 {
481481 /* Food can feed the player */
482- (void)set_food(p_ptr->food + o_ptr->pval);
482+ (void)set_food(p_ptr, p_ptr->food + o_ptr->pval);
483483 }
484484
485485 /* Destroy a food in the pack */
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -142,7 +142,7 @@ void exe_quaff_potion(INVENTORY_IDX item)
142142 (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)))
143143 {
144144 /* Only living creatures get thirsty */
145- (void)set_food(PY_FOOD_STARVE - 1);
145+ (void)set_food(p_ptr, PY_FOOD_STARVE - 1);
146146 }
147147
148148 (void)set_poisoned(p_ptr, 0);
@@ -545,7 +545,7 @@ void exe_quaff_potion(INVENTORY_IDX item)
545545 switch (p_ptr->prace)
546546 {
547547 case RACE_VAMPIRE:
548- (void)set_food(p_ptr->food + (q_ptr->pval / 10));
548+ (void)set_food(p_ptr, p_ptr->food + (q_ptr->pval / 10));
549549 break;
550550 case RACE_SKELETON:
551551 /* Do nothing */
@@ -554,37 +554,37 @@ void exe_quaff_potion(INVENTORY_IDX item)
554554 case RACE_ZOMBIE:
555555 case RACE_DEMON:
556556 case RACE_SPECTRE:
557- set_food(p_ptr->food + ((q_ptr->pval) / 20));
557+ set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
558558 break;
559559 case RACE_ANDROID:
560560 if (q_ptr->tval == TV_FLASK)
561561 {
562562 msg_print(_("オイルを補給した。", "You replenish yourself with the oil."));
563- set_food(p_ptr->food + 5000);
563+ set_food(p_ptr, p_ptr->food + 5000);
564564 }
565565 else
566566 {
567- set_food(p_ptr->food + ((q_ptr->pval) / 20));
567+ set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
568568 }
569569 break;
570570 case RACE_ENT:
571571 msg_print(_("水分を取り込んだ。", "You are moistened."));
572- set_food(MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
572+ set_food(p_ptr, MIN(p_ptr->food + q_ptr->pval + MAX(0, q_ptr->pval * 10) + 2000, PY_FOOD_MAX - 1));
573573 break;
574574 default:
575- (void)set_food(p_ptr->food + q_ptr->pval);
575+ (void)set_food(p_ptr, p_ptr->food + q_ptr->pval);
576576 break;
577577 }
578578 break;
579579 case MIMIC_DEMON:
580580 case MIMIC_DEMON_LORD:
581- set_food(p_ptr->food + ((q_ptr->pval) / 20));
581+ set_food(p_ptr, p_ptr->food + ((q_ptr->pval) / 20));
582582 break;
583583 case MIMIC_VAMPIRE:
584- (void)set_food(p_ptr->food + (q_ptr->pval / 10));
584+ (void)set_food(p_ptr, p_ptr->food + (q_ptr->pval / 10));
585585 break;
586586 default:
587- (void)set_food(p_ptr->food + q_ptr->pval);
587+ (void)set_food(p_ptr, p_ptr->food + q_ptr->pval);
588588 break;
589589 }
590590 }
--- a/src/cmd-read.c
+++ b/src/cmd-read.c
@@ -333,7 +333,7 @@ void exe_read(INVENTORY_IDX item, bool known)
333333
334334 case SV_SCROLL_SATISFY_HUNGER:
335335 {
336- if (set_food(PY_FOOD_MAX - 1)) ident = TRUE;
336+ if (set_food(p_ptr, PY_FOOD_MAX - 1)) ident = TRUE;
337337 break;
338338 }
339339
--- a/src/core.c
+++ b/src/core.c
@@ -1272,7 +1272,7 @@ static void process_world_aux_digestion(void)
12721272 if (p_ptr->food >= PY_FOOD_MAX)
12731273 {
12741274 /* Digest a lot of food */
1275- (void)set_food(p_ptr->food - 100);
1275+ (void)set_food(p_ptr, p_ptr->food - 100);
12761276 }
12771277
12781278 /* Digest normally -- Every 50 game turns */
@@ -1299,7 +1299,7 @@ static void process_world_aux_digestion(void)
12991299 if (digestion > 100) digestion = 100;
13001300
13011301 /* Digest some food */
1302- (void)set_food(p_ptr->food - digestion);
1302+ (void)set_food(p_ptr, p_ptr->food - digestion);
13031303 }
13041304
13051305
@@ -2473,7 +2473,7 @@ static void process_world_aux_mutation(void)
24732473 disturb(FALSE, TRUE);
24742474 msg_print(_("胃が痙攣し、食事を失った!", "Your stomach roils, and you lose your lunch!"));
24752475 msg_print(NULL);
2476- set_food(PY_FOOD_WEAK);
2476+ set_food(p_ptr, PY_FOOD_WEAK);
24772477 if (music_singing_any()) stop_singing(p_ptr);
24782478 if (hex_spelling_any()) stop_hex_spell_all();
24792479 }
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -3038,7 +3038,7 @@ bool set_cut(player_type *creature_ptr, TIME_EFFECT v)
30383038 * game turns, or 500/(100/5) = 25 player turns (if nothing else is
30393039 * affecting the player speed).\n
30403040 */
3041-bool set_food(TIME_EFFECT v)
3041+bool set_food(player_type *creature_ptr, TIME_EFFECT v)
30423042 {
30433043 int old_aux, new_aux;
30443044
@@ -3046,31 +3046,31 @@ bool set_food(TIME_EFFECT v)
30463046 v = (v > 20000) ? 20000 : (v < 0) ? 0 : v;
30473047
30483048 /* Fainting / Starving */
3049- if (p_ptr->food < PY_FOOD_FAINT)
3049+ if (creature_ptr->food < PY_FOOD_FAINT)
30503050 {
30513051 old_aux = 0;
30523052 }
30533053
30543054 /* Weak */
3055- else if (p_ptr->food < PY_FOOD_WEAK)
3055+ else if (creature_ptr->food < PY_FOOD_WEAK)
30563056 {
30573057 old_aux = 1;
30583058 }
30593059
30603060 /* Hungry */
3061- else if (p_ptr->food < PY_FOOD_ALERT)
3061+ else if (creature_ptr->food < PY_FOOD_ALERT)
30623062 {
30633063 old_aux = 2;
30643064 }
30653065
30663066 /* Normal */
3067- else if (p_ptr->food < PY_FOOD_FULL)
3067+ else if (creature_ptr->food < PY_FOOD_FULL)
30683068 {
30693069 old_aux = 3;
30703070 }
30713071
30723072 /* Full */
3073- else if (p_ptr->food < PY_FOOD_MAX)
3073+ else if (creature_ptr->food < PY_FOOD_MAX)
30743074 {
30753075 old_aux = 4;
30763076 }
@@ -3180,7 +3180,7 @@ bool set_food(TIME_EFFECT v)
31803180 case 4: msg_print(_("やっとお腹がきつくなくなった。", "You are no longer gorged.")); break;
31813181 }
31823182
3183- if (p_ptr->wild_mode && (new_aux < 2))
3183+ if (creature_ptr->wild_mode && (new_aux < 2))
31843184 {
31853185 change_wild_mode(FALSE);
31863186 }
@@ -3190,16 +3190,16 @@ bool set_food(TIME_EFFECT v)
31903190 }
31913191
31923192 /* Use the value */
3193- p_ptr->food = v;
3193+ creature_ptr->food = v;
31943194
31953195 /* Nothing to notice */
31963196 if (!notice) return (FALSE);
31973197
31983198 if (disturb_state) disturb(FALSE, FALSE);
3199- p_ptr->update |= (PU_BONUS);
3199+ creature_ptr->update |= (PU_BONUS);
32003200
32013201 /* Redraw hunger */
3202- p_ptr->redraw |= (PR_HUNGER);
3202+ creature_ptr->redraw |= (PR_HUNGER);
32033203 handle_stuff();
32043204 return (TRUE);
32053205 }
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -56,7 +56,7 @@ extern bool set_oppose_cold(player_type *creature_ptr, TIME_EFFECT v, bool do_de
5656 extern bool set_oppose_pois(player_type *creature_ptr, TIME_EFFECT v, bool do_dec);
5757 extern bool set_stun(player_type *creature_ptr, TIME_EFFECT v);
5858 extern bool set_cut(player_type *creature_ptr, TIME_EFFECT v);
59-extern bool set_food(TIME_EFFECT v);
59+extern bool set_food(player_type *creature_ptr, TIME_EFFECT v);
6060 extern bool inc_stat(player_type *creature_ptr, int stat);
6161 extern bool dec_stat(player_type *creature_ptr, int stat, int amount, int permanent);
6262 extern bool res_stat(player_type *creature_ptr, int stat);
--- a/src/player-status.c
+++ b/src/player-status.c
@@ -5843,7 +5843,7 @@ void cheat_death(player_type *creature_ptr)
58435843 creature_ptr->is_dead = FALSE;
58445844
58455845 /* Hack -- Prevent starvation */
5846- (void)set_food(PY_FOOD_MAX - 1);
5846+ (void)set_food(p_ptr, PY_FOOD_MAX - 1);
58475847
58485848 current_floor_ptr->dun_level = 0;
58495849 creature_ptr->inside_arena = FALSE;
--- a/src/realm-arcane.c
+++ b/src/realm-arcane.c
@@ -403,7 +403,7 @@ concptr do_arcane_spell(SPELL_IDX spell, BIT_FLAGS mode)
403403 {
404404 if (cast)
405405 {
406- set_food(PY_FOOD_MAX - 1);
406+ set_food(p_ptr, PY_FOOD_MAX - 1);
407407 }
408408 }
409409 break;
--- a/src/realm-craft.c
+++ b/src/realm-craft.c
@@ -69,7 +69,7 @@ concptr do_craft_spell(SPELL_IDX spell, BIT_FLAGS mode)
6969 {
7070 if (cast)
7171 {
72- set_food(PY_FOOD_MAX - 1);
72+ set_food(p_ptr, PY_FOOD_MAX - 1);
7373 }
7474 }
7575 break;
--- a/src/realm-death.c
+++ b/src/realm-death.c
@@ -330,7 +330,7 @@ concptr do_death_spell(SPELL_IDX spell, BIT_FLAGS mode)
330330
331331 /* Not gorged already */
332332 if (p_ptr->food < PY_FOOD_MAX)
333- set_food(dam >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dam);
333+ set_food(p_ptr, dam >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dam);
334334 }
335335 }
336336 }
--- a/src/realm-life.c
+++ b/src/realm-life.c
@@ -132,7 +132,7 @@ concptr do_life_spell(SPELL_IDX spell, BIT_FLAGS mode)
132132 {
133133 if (cast)
134134 {
135- set_food(PY_FOOD_MAX - 1);
135+ set_food(p_ptr, PY_FOOD_MAX - 1);
136136 }
137137 }
138138 break;
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -3893,7 +3893,7 @@ bool_hack vampirism(void)
38933893 /* But if we ARE Gorged, it won't cure us */
38943894 dummy = p_ptr->food + MIN(5000, 100 * dummy);
38953895 if (p_ptr->food < PY_FOOD_MAX) /* Not gorged already */
3896- (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
3896+ (void)set_food(p_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
38973897 }
38983898 else
38993899 msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
--- a/src/spells3.c
+++ b/src/spells3.c
@@ -3342,16 +3342,16 @@ bool eat_lock(void)
33423342 }
33433343 else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG))
33443344 {
3345- (void)set_food(p_ptr->food + 3000);
3345+ (void)set_food(p_ptr, p_ptr->food + 3000);
33463346 }
33473347 else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD))
33483348 {
3349- (void)set_food(p_ptr->food + 5000);
3349+ (void)set_food(p_ptr, p_ptr->food + 5000);
33503350 }
33513351 else
33523352 {
33533353 msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name);
3354- (void)set_food(p_ptr->food + 10000);
3354+ (void)set_food(p_ptr, p_ptr->food + 10000);
33553355 }
33563356
33573357 /* Destroy the wall */
--- a/src/wizard2.c
+++ b/src/wizard2.c
@@ -1293,7 +1293,7 @@ static void do_cmd_wiz_cure_all(void)
12931293 {
12941294 (void)life_stream(FALSE, FALSE);
12951295 (void)restore_mana(TRUE);
1296- (void)set_food(PY_FOOD_MAX - 1);
1296+ (void)set_food(p_ptr, PY_FOOD_MAX - 1);
12971297 }
12981298
12991299
Show on old repository browser