• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

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


Commit MetaInfo

Revision5e93ddf77a678075bff9603b933ed63457099ca5 (tree)
Time2019-06-10 23:36:41
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38844 pet_t_m_idx, riding_t_m_idx を player_type 構造体に移動.

Change Summary

Incremental Difference

--- a/src/cmd-pet.c
+++ b/src/cmd-pet.c
@@ -500,10 +500,10 @@ void do_cmd_pet(void)
500500
501501 #ifdef JP
502502 sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)",
503- (pet_t_m_idx ? (p_ptr->image ? "何か奇妙な物" : (r_name + r_info[current_floor_ptr->m_list[pet_t_m_idx].ap_r_idx].name)) : "指定なし"));
503+ (p_ptr->pet_t_m_idx ? (p_ptr->image ? "何か奇妙な物" : (r_name + r_info[current_floor_ptr->m_list[p_ptr->pet_t_m_idx].ap_r_idx].name)) : "指定なし"));
504504 #else
505505 sprintf(target_buf, "specify a target of pet (now:%s)",
506- (pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[current_floor_ptr->m_list[pet_t_m_idx].ap_r_idx].name)) : "nothing"));
506+ (p_ptr->pet_t_m_idx ? (p_ptr->image ? "something strange" : (r_name + r_info[current_floor_ptr->m_list[p_ptr->pet_t_m_idx].ap_r_idx].name)) : "nothing"));
507507 #endif
508508 power_desc[num] = target_buf;
509509 powers[num++] = PET_TARGET;
@@ -840,16 +840,16 @@ void do_cmd_pet(void)
840840 case PET_TARGET:
841841 {
842842 project_length = -1;
843- if (!target_set(TARGET_KILL)) pet_t_m_idx = 0;
843+ if (!target_set(TARGET_KILL)) p_ptr->pet_t_m_idx = 0;
844844 else
845845 {
846846 grid_type *g_ptr = &current_floor_ptr->grid_array[target_row][target_col];
847847 if (g_ptr->m_idx && (current_floor_ptr->m_list[g_ptr->m_idx].ml))
848848 {
849- pet_t_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
849+ p_ptr->pet_t_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
850850 p_ptr->pet_follow_distance = PET_DESTROY_DIST;
851851 }
852- else pet_t_m_idx = 0;
852+ else p_ptr->pet_t_m_idx = 0;
853853 }
854854 project_length = 0;
855855
@@ -859,14 +859,14 @@ void do_cmd_pet(void)
859859 case PET_STAY_CLOSE:
860860 {
861861 p_ptr->pet_follow_distance = PET_CLOSE_DIST;
862- pet_t_m_idx = 0;
862+ p_ptr->pet_t_m_idx = 0;
863863 break;
864864 }
865865 /* "Follow Me" */
866866 case PET_FOLLOW_ME:
867867 {
868868 p_ptr->pet_follow_distance = PET_FOLLOW_DIST;
869- pet_t_m_idx = 0;
869+ p_ptr->pet_t_m_idx = 0;
870870 break;
871871 }
872872 /* "Seek and destoy" */
--- a/src/core.c
+++ b/src/core.c
@@ -4949,8 +4949,8 @@ static void dungeon(bool load_game)
49494949
49504950 /* Cancel the target */
49514951 target_who = 0;
4952- pet_t_m_idx = 0;
4953- riding_t_m_idx = 0;
4952+ p_ptr->pet_t_m_idx = 0;
4953+ p_ptr->riding_t_m_idx = 0;
49544954 p_ptr->ambush_flag = FALSE;
49554955
49564956 /* Cancel the health bar */
--- a/src/externs.h
+++ b/src/externs.h
@@ -56,6 +56,3 @@ extern bool repair_objects;
5656
5757
5858 extern player_type *p_ptr;
59-
60-extern MONSTER_IDX pet_t_m_idx;
61-extern MONSTER_IDX riding_t_m_idx;
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -2306,7 +2306,7 @@ bool py_attack(POSITION y, POSITION x, COMBAT_OPTION_IDX mode)
23062306 }
23072307 }
23082308
2309- riding_t_m_idx = g_ptr->m_idx;
2309+ p_ptr->riding_t_m_idx = g_ptr->m_idx;
23102310 if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
23112311 if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
23122312
--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -59,15 +59,15 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm)
5959 monster_race *r_ptr = &r_info[m_ptr->r_idx];
6060 monster_type *t_ptr;
6161
62- if (riding_t_m_idx && player_bold(m_ptr->fy, m_ptr->fx))
62+ if (p_ptr->riding_t_m_idx && player_bold(m_ptr->fy, m_ptr->fx))
6363 {
64- y = current_floor_ptr->m_list[riding_t_m_idx].fy;
65- x = current_floor_ptr->m_list[riding_t_m_idx].fx;
64+ y = current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fy;
65+ x = current_floor_ptr->m_list[p_ptr->riding_t_m_idx].fx;
6666 }
67- else if (is_pet(m_ptr) && pet_t_m_idx)
67+ else if (is_pet(m_ptr) && p_ptr->pet_t_m_idx)
6868 {
69- y = current_floor_ptr->m_list[pet_t_m_idx].fy;
70- x = current_floor_ptr->m_list[pet_t_m_idx].fx;
69+ y = current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fy;
70+ x = current_floor_ptr->m_list[p_ptr->pet_t_m_idx].fx;
7171 }
7272 else
7373 {
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -140,8 +140,8 @@ void delete_monster_idx(MONSTER_IDX i)
140140 /* Hack -- remove tracked monster */
141141 if (i == p_ptr->health_who) health_track(0);
142142
143- if (pet_t_m_idx == i ) pet_t_m_idx = 0;
144- if (riding_t_m_idx == i) riding_t_m_idx = 0;
143+ if (p_ptr->pet_t_m_idx == i ) p_ptr->pet_t_m_idx = 0;
144+ if (p_ptr->riding_t_m_idx == i) p_ptr->riding_t_m_idx = 0;
145145 if (p_ptr->riding == i) p_ptr->riding = 0;
146146
147147 /* Monster is gone */
@@ -237,8 +237,8 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2)
237237 if (target_who == i1) target_who = i2;
238238
239239 /* Hack -- Update the target */
240- if (pet_t_m_idx == i1) pet_t_m_idx = i2;
241- if (riding_t_m_idx == i1) riding_t_m_idx = i2;
240+ if (p_ptr->pet_t_m_idx == i1) p_ptr->pet_t_m_idx = i2;
241+ if (p_ptr->riding_t_m_idx == i1) p_ptr->riding_t_m_idx = i2;
242242
243243 /* Hack -- Update the riding */
244244 if (p_ptr->riding == i1) p_ptr->riding = i2;
@@ -434,8 +434,8 @@ void wipe_m_list(void)
434434
435435 /* Hack -- no more target */
436436 target_who = 0;
437- pet_t_m_idx = 0;
438- riding_t_m_idx = 0;
437+ p_ptr->pet_t_m_idx = 0;
438+ p_ptr->riding_t_m_idx = 0;
439439
440440 /* Hack -- no more tracking */
441441 health_track(0);
--- a/src/mspells2.c
+++ b/src/mspells2.c
@@ -313,9 +313,9 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
313313 f6 = r_ptr->a_ability_flags2;
314314
315315 /* Target is given for pet? */
316- if (pet_t_m_idx && pet)
316+ if (p_ptr->pet_t_m_idx && pet)
317317 {
318- target_idx = pet_t_m_idx;
318+ target_idx = p_ptr->pet_t_m_idx;
319319 t_ptr = &current_floor_ptr->m_list[target_idx];
320320
321321 /* Cancel if not projectable (for now) */
@@ -336,7 +336,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
336336
337337 /* Cancel if neither enemy nor a given target */
338338 if ((m_idx == target_idx) ||
339- ((target_idx != pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
339+ ((target_idx != p_ptr->pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
340340 {
341341 target_idx = 0;
342342 }
--- a/src/player-status.h
+++ b/src/player-status.h
@@ -544,6 +544,8 @@ struct player_type
544544 POSITION run_px;
545545 DIRECTION fishing_dir;
546546
547+ MONSTER_IDX pet_t_m_idx;
548+ MONSTER_IDX riding_t_m_idx;
547549
548550 /*** Extracted fields ***/
549551
--- a/src/variable.c
+++ b/src/variable.c
@@ -31,6 +31,3 @@ player_type p_body;
3131 player_type *p_ptr = &p_body;
3232
3333
34-MONSTER_IDX pet_t_m_idx;
35-MONSTER_IDX riding_t_m_idx;
36-
Show on old repository browser