OSDN Git Service

[Refactor] #935 マクロ関数SINGING_SONG_ID を普通の関数に置換した / Changed macro function SINGING_SON...
authorHourier <grapefox.whitelucifer.0408@gmail.com>
Tue, 27 Apr 2021 12:12:12 +0000 (21:12 +0900)
committerHourier <grapefox.whitelucifer.0408@gmail.com>
Tue, 27 Apr 2021 13:48:58 +0000 (22:48 +0900)
src/player/player-status.cpp
src/player/player-status.h
src/realm/realm-hex.cpp
src/realm/realm-song.cpp
src/spell-realm/spells-song.cpp
src/status/buff-setter.cpp

index 92cc5a6..34f97fd 100644 (file)
@@ -3274,10 +3274,10 @@ void stop_singing(player_type *creature_ptr)
         set_action(creature_ptr, ACTION_NONE);
 
     /* Message text of each song or etc. */
-    exe_spell(creature_ptr, REALM_MUSIC, SINGING_SONG_ID(creature_ptr), SPELL_STOP);
+    exe_spell(creature_ptr, REALM_MUSIC, get_singing_song_id(creature_ptr), SPELL_STOP);
 
     set_singing_song_effect(creature_ptr, MUSIC_NONE);
-    SINGING_SONG_ID(creature_ptr) = 0;
+    set_singing_song_id(creature_ptr, 0);
     set_bits(creature_ptr->update, PU_BONUS);
     set_bits(creature_ptr->redraw, PR_STATUS);
 }
@@ -3452,3 +3452,13 @@ void set_singing_count(player_type* creature_ptr, MAGIC_NUM1 magic_num)
 {
     creature_ptr->magic_num1[2] = magic_num;
 }
+
+MAGIC_NUM2 get_singing_song_id(player_type* creature_ptr)
+{
+    return creature_ptr->magic_num2[0];
+}
+
+void set_singing_song_id(player_type* creature_ptr, MAGIC_NUM2 magic_num)
+{
+    creature_ptr->magic_num2[0] = magic_num;
+}
index 2e803cf..c81009d 100644 (file)
@@ -54,11 +54,11 @@ PERCENTAGE calculate_upkeep(player_type *creature_ptr);
 bool music_singing(player_type *caster_ptr, int music_songs);
 bool music_singing_any(player_type *creature_ptr);
 
-// @todo 後で普通の関数に直す
 MAGIC_NUM1 get_singing_song_effect(player_type *creature_ptr);
 void set_singing_song_effect(player_type *creature_ptr, MAGIC_NUM1 magic_num);
 MAGIC_NUM1 get_interrupting_song_effect(player_type *creature_ptr);
 void set_interrupting_song_effect(player_type *creature_ptr, MAGIC_NUM1 magic_num);
 MAGIC_NUM1 get_singing_count(player_type *creature_ptr);
 void set_singing_count(player_type *creature_ptr, MAGIC_NUM1 magic_num);
-#define SINGING_SONG_ID(P_PTR) ((P_PTR)->magic_num2[0])
+MAGIC_NUM2 get_singing_song_id(player_type *creature_ptr);
+void set_singing_song_id(player_type *creature_ptr, MAGIC_NUM2 magic_num);
index 3a5b69a..76c1263 100644 (file)
@@ -589,7 +589,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, spell_type mode)
                 exe_spell(caster_ptr, REALM_HEX, spell, SPELL_STOP);
                 casting_hex_flags(caster_ptr) &= ~(1UL << spell);
                 casting_hex_num(caster_ptr)--;
-                if (!SINGING_SONG_ID(caster_ptr))
+                if (get_singing_song_id(caster_ptr) == 0)
                     set_action(caster_ptr, ACTION_NONE);
             }
         }
index 1d1682d..99759f8 100644 (file)
@@ -38,7 +38,7 @@ static void start_singing(player_type *caster_ptr, SPELL_IDX spell, MAGIC_NUM1 s
     set_singing_song_effect(caster_ptr, song);
 
     /* Remember the index of the spell which activated the song */
-    SINGING_SONG_ID(caster_ptr) = (MAGIC_NUM2)spell;
+    set_singing_song_id(caster_ptr, (MAGIC_NUM2)spell);
 
     /* Now the player is singing */
     set_action(caster_ptr, ACTION_SING);
index 41cb3c3..6aeae57 100644 (file)
@@ -33,7 +33,7 @@ void check_music(player_type *caster_ptr)
         return;
     }
 
-    int spell = SINGING_SONG_ID(caster_ptr);
+    int spell = get_singing_song_id(caster_ptr);
     const magic_type *s_ptr;
     s_ptr = &technic_info[REALM_MUSIC - MIN_TECHNIC][spell];
 
index ca6f00d..2882b3e 100644 (file)
@@ -95,7 +95,7 @@ void reset_tim_flags(player_type *creature_ptr)
 
     if (creature_ptr->pclass == CLASS_BARD) {
         set_singing_song_effect(creature_ptr, MUSIC_NONE);
-        SINGING_SONG_ID(creature_ptr) = 0;
+        set_singing_song_id(creature_ptr, 0);
     }
 }