• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revisionac77535a363ce9d7be062d21f94062dbde8e8b53 (tree)
Time2019-06-21 23:35:55
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38997 set_blind() に player_type * 引数を追加. hit_trap_set_abnormal_status_p() を仮実装.

Change Summary

Incremental Difference

--- a/src/bldg.c
+++ b/src/bldg.c
@@ -2065,7 +2065,7 @@ static bool inn_comm(int cmd)
20652065 }
20662066 else
20672067 {
2068- set_blind(0);
2068+ set_blind(p_ptr, 0);
20692069 set_confused(0);
20702070 p_ptr->stun = 0;
20712071 p_ptr->chp = p_ptr->mhp;
--- a/src/cmd-eat.c
+++ b/src/cmd-eat.c
@@ -82,7 +82,7 @@ void exe_eat_food(INVENTORY_IDX item)
8282 {
8383 if (!p_ptr->resist_blind)
8484 {
85- if (set_blind(p_ptr->blind + randint0(200) + 200))
85+ if (set_blind(p_ptr, p_ptr->blind + randint0(200) + 200))
8686 {
8787 ident = TRUE;
8888 }
@@ -194,7 +194,7 @@ void exe_eat_food(INVENTORY_IDX item)
194194
195195 case SV_FOOD_CURE_BLINDNESS:
196196 {
197- if (set_blind(0)) ident = TRUE;
197+ if (set_blind(p_ptr, 0)) ident = TRUE;
198198 break;
199199 }
200200
--- a/src/cmd-quaff.c
+++ b/src/cmd-quaff.c
@@ -163,7 +163,7 @@ void exe_quaff_potion(INVENTORY_IDX item)
163163 case SV_POTION_BLINDNESS:
164164 if (!p_ptr->resist_blind)
165165 {
166- if (set_blind(p_ptr->blind + randint0(100) + 100))
166+ if (set_blind(p_ptr, p_ptr->blind + randint0(100) + 100))
167167 {
168168 ident = TRUE;
169169 }
--- a/src/cmd-read.c
+++ b/src/cmd-read.c
@@ -96,7 +96,7 @@ void exe_read(INVENTORY_IDX item, bool known)
9696 {
9797 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
9898 {
99- (void)set_blind(p_ptr->blind + 3 + randint1(5));
99+ (void)set_blind(p_ptr, p_ptr->blind + 3 + randint1(5));
100100 }
101101 if (unlite_area(10, 3)) ident = TRUE;
102102 break;
--- a/src/cmd-usestaff.c
+++ b/src/cmd-usestaff.c
@@ -41,7 +41,7 @@ int staff_effect(OBJECT_SUBTYPE_VALUE sval, bool *use_charge, bool powerful, boo
4141 {
4242 if (!(p_ptr->resist_blind) && !(p_ptr->resist_dark))
4343 {
44- if (set_blind(p_ptr->blind + 3 + randint1(5))) ident = TRUE;
44+ if (set_blind(p_ptr, p_ptr->blind + 3 + randint1(5))) ident = TRUE;
4545 }
4646 if (unlite_area(10, (powerful ? 6 : 3))) ident = TRUE;
4747 break;
--- a/src/core.c
+++ b/src/core.c
@@ -1822,7 +1822,7 @@ static void process_world_aux_timeout(void)
18221822 /* Blindness */
18231823 if (p_ptr->blind)
18241824 {
1825- (void)set_blind(p_ptr->blind - dec_count);
1825+ (void)set_blind(p_ptr, p_ptr->blind - dec_count);
18261826 }
18271827
18281828 /* Times see-invisible */
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -3179,7 +3179,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
31793179 /* Increase "blind" */
31803180 if (!p_ptr->resist_blind && !CHECK_MULTISHADOW())
31813181 {
3182- if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
3182+ if (set_blind(p_ptr, p_ptr->blind + 10 + randint1(rlev)))
31833183 {
31843184 #ifdef JP
31853185 if (m_ptr->r_idx == MON_DIO) msg_print("どうだッ!この血の目潰しはッ!");
--- a/src/mspells4.c
+++ b/src/mspells4.c
@@ -1505,7 +1505,7 @@ void spell_RF5_BLIND(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
15051505
15061506 if (!resist && !saving_throw)
15071507 {
1508- (void)set_blind(12 + randint0(4));
1508+ (void)set_blind(p_ptr, 12 + randint0(4));
15091509 }
15101510 learn_spell(MS_BLIND);
15111511 update_smart_learn(m_idx, DRS_BLIND);
--- a/src/player-effects.c
+++ b/src/player-effects.c
@@ -421,19 +421,19 @@ bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec)
421421 * Note that blindness is currently the only thing which can affect\n
422422 * "player_can_see_bold()".\n
423423 */
424-bool set_blind(TIME_EFFECT v)
424+bool set_blind(player_type *creature_ptr, TIME_EFFECT v)
425425 {
426426 bool notice = FALSE;
427427 v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
428428
429- if (p_ptr->is_dead) return FALSE;
429+ if (creature_ptr->is_dead) return FALSE;
430430
431431 /* Open */
432432 if (v)
433433 {
434- if (!p_ptr->blind)
434+ if (!creature_ptr->blind)
435435 {
436- if (p_ptr->prace == RACE_ANDROID)
436+ if (creature_ptr->prace == RACE_ANDROID)
437437 {
438438 msg_print(_("センサーをやられた!", "You are blind!"));
439439 }
@@ -450,9 +450,9 @@ bool set_blind(TIME_EFFECT v)
450450 /* Shut */
451451 else
452452 {
453- if (p_ptr->blind)
453+ if (creature_ptr->blind)
454454 {
455- if (p_ptr->prace == RACE_ANDROID)
455+ if (creature_ptr->prace == RACE_ANDROID)
456456 {
457457 msg_print(_("センサーが復旧した。", "You can see again."));
458458 }
@@ -466,17 +466,17 @@ bool set_blind(TIME_EFFECT v)
466466 }
467467
468468 /* Use the value */
469- p_ptr->blind = v;
470- p_ptr->redraw |= (PR_STATUS);
469+ creature_ptr->blind = v;
470+ creature_ptr->redraw |= (PR_STATUS);
471471
472472 /* Nothing to notice */
473473 if (!notice) return (FALSE);
474474 if (disturb_state) disturb(FALSE, FALSE);
475475
476476 /* Fully update the visuals */
477- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
478- p_ptr->redraw |= (PR_MAP);
479- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
477+ creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_MONSTERS | PU_MON_LITE);
478+ creature_ptr->redraw |= (PR_MAP);
479+ creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
480480 handle_stuff();
481481 return (TRUE);
482482 }
--- a/src/player-effects.h
+++ b/src/player-effects.h
@@ -15,7 +15,7 @@ extern void set_action(ACTION_IDX typ);
1515 extern void reset_tim_flags(void);
1616 extern void dispel_player(void);
1717 extern bool set_mimic(player_type *creature_ptr, TIME_EFFECT v, IDX p, bool do_dec);
18-extern bool set_blind(TIME_EFFECT v);
18+extern bool set_blind(player_type *creature_ptr, TIME_EFFECT v);
1919 extern bool set_confused(TIME_EFFECT v);
2020 extern bool set_poisoned(TIME_EFFECT v);
2121 extern bool set_afraid(TIME_EFFECT v);
--- a/src/spells-floor.c
+++ b/src/spells-floor.c
@@ -693,7 +693,7 @@ bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
693693 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
694694 {
695695 /* Become blind */
696- (void)set_blind(p_ptr->blind + 10 + randint1(10));
696+ (void)set_blind(p_ptr, p_ptr->blind + 10 + randint1(10));
697697 }
698698 }
699699
--- a/src/spells-status.c
+++ b/src/spells-status.c
@@ -278,7 +278,7 @@ bool_hack life_stream(bool_hack message, bool_hack virtue_change)
278278 }
279279 restore_level();
280280 (void)set_poisoned(0);
281- (void)set_blind(0);
281+ (void)set_blind(p_ptr, 0);
282282 (void)set_confused(0);
283283 (void)set_image(0);
284284 (void)set_stun(0);
@@ -313,7 +313,7 @@ bool_hack cure_light_wounds(DICE_NUMBER dice, DICE_SID sides)
313313 {
314314 bool_hack ident = FALSE;
315315 if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
316- if (set_blind(0)) ident = TRUE;
316+ if (set_blind(p_ptr, 0)) ident = TRUE;
317317 if (set_cut(p_ptr->cut - 10)) ident = TRUE;
318318 if (set_shero(0, TRUE)) ident = TRUE;
319319 return ident;
@@ -323,7 +323,7 @@ bool_hack cure_serious_wounds(DICE_NUMBER dice, DICE_SID sides)
323323 {
324324 bool_hack ident = FALSE;
325325 if (hp_player(p_ptr, damroll(dice, sides))) ident = TRUE;
326- if (set_blind(0)) ident = TRUE;
326+ if (set_blind(p_ptr, 0)) ident = TRUE;
327327 if (set_confused(0)) ident = TRUE;
328328 if (set_cut((p_ptr->cut / 2) - 50)) ident = TRUE;
329329 if (set_shero(0, TRUE)) ident = TRUE;
@@ -334,7 +334,7 @@ bool_hack cure_critical_wounds(HIT_POINT pow)
334334 {
335335 bool_hack ident = FALSE;
336336 if (hp_player(p_ptr, pow)) ident = TRUE;
337- if (set_blind(0)) ident = TRUE;
337+ if (set_blind(p_ptr, 0)) ident = TRUE;
338338 if (set_confused(0)) ident = TRUE;
339339 if (set_poisoned(0)) ident = TRUE;
340340 if (set_stun(0)) ident = TRUE;
@@ -347,7 +347,7 @@ bool_hack true_healing(HIT_POINT pow)
347347 {
348348 bool_hack ident = FALSE;
349349 if (hp_player(p_ptr, pow)) ident = TRUE;
350- if (set_blind(0)) ident = TRUE;
350+ if (set_blind(p_ptr, 0)) ident = TRUE;
351351 if (set_confused(0)) ident = TRUE;
352352 if (set_poisoned(0)) ident = TRUE;
353353 if (set_stun(0)) ident = TRUE;
@@ -459,7 +459,7 @@ bool cosmic_cast_off(player_type *creature_ptr, object_type *o_ptr)
459459 /* Get effects */
460460 msg_print(_("「燃え上がれ俺の小宇宙!」", "You say, 'Burn up my cosmo!"));
461461 t = 20 + randint1(20);
462- (void)set_blind(creature_ptr->blind + t);
462+ (void)set_blind(p_ptr, creature_ptr->blind + t);
463463 (void)set_afraid(0);
464464 (void)set_tim_esp(creature_ptr->tim_esp + t, FALSE);
465465 (void)set_tim_regen(creature_ptr->tim_regen + t, FALSE);
--- a/src/spells1.c
+++ b/src/spells1.c
@@ -4513,7 +4513,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
45134513 }
45144514 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
45154515 {
4516- (void)set_blind(p_ptr->blind + randint1(5) + 2);
4516+ (void)set_blind(p_ptr, p_ptr->blind + randint1(5) + 2);
45174517 }
45184518
45194519 if (PRACE_IS_(p_ptr, RACE_VAMPIRE) || (p_ptr->mimic_form == MIMIC_VAMPIRE))
@@ -4555,7 +4555,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
45554555 }
45564556 else if (!blind && !p_ptr->resist_blind && !CHECK_MULTISHADOW())
45574557 {
4558- (void)set_blind(p_ptr->blind + randint1(5) + 2);
4558+ (void)set_blind(p_ptr, p_ptr->blind + randint1(5) + 2);
45594559 }
45604560 get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
45614561 break;
@@ -4926,7 +4926,7 @@ static bool project_p(MONSTER_IDX who, concptr who_name, int r, POSITION y, POSI
49264926 {
49274927 if (!p_ptr->resist_blind)
49284928 {
4929- (void)set_blind(p_ptr->blind + 8 + randint0(8));
4929+ (void)set_blind(p_ptr, p_ptr->blind + 8 + randint0(8));
49304930 }
49314931 if (!p_ptr->resist_conf)
49324932 {
--- a/src/trap.c
+++ b/src/trap.c
@@ -387,6 +387,15 @@ static void hit_trap_set_abnormal_status(concptr trap_message, bool resist, bool
387387 }
388388 }
389389
390+static void hit_trap_set_abnormal_status_p(concptr trap_message, bool resist, bool(*set_status)(player_type *, IDX), IDX turn_aux)
391+{
392+ msg_print(trap_message);
393+ if (!resist)
394+ {
395+ set_status(p_ptr, turn_aux);
396+ }
397+}
398+
390399 /*!
391400 * @brief プレイヤーへのトラップ作動処理メインルーチン /
392401 * Handle player hitting a real trap
@@ -520,7 +529,7 @@ void hit_trap(bool break_trap)
520529
521530 case TRAP_BLIND:
522531 {
523- hit_trap_set_abnormal_status(
532+ hit_trap_set_abnormal_status_p(
524533 _("黒いガスに包み込まれた!", "A black gas surrounds you!"),
525534 p_ptr->resist_blind,
526535 set_blind, p_ptr->blind + (TIME_EFFECT)randint0(50) + 25);
Show on old repository browser