-#include "spell-realm/spells-song.h"
+#include "spell-realm/spells-song.h"
#include "core/disturbance.h"
-#include "core/player-redraw-types.h"
-#include "core/player-update-types.h"
#include "core/stuff-handler.h"
#include "core/window-redrawer.h"
#include "game-option/disturbance-options.h"
#include "status/action-setter.h"
#include "system/floor-type-definition.h"
#include "system/player-type-definition.h"
+#include "system/redrawing-flags-updater.h"
#include "util/bit-flags-calculator.h"
#include "view/display-messages.h"
*/
void check_music(PlayerType *player_ptr)
{
- if (player_ptr->pclass != PlayerClassType::BARD)
+ if (!PlayerClass(player_ptr).equals(PlayerClassType::BARD)) {
return;
+ }
auto interupting_song_effect = get_interrupting_song_effect(player_ptr);
- if ((get_singing_song_effect(player_ptr) == 0) && (interupting_song_effect == 0))
+ if ((get_singing_song_effect(player_ptr) == 0) && (interupting_song_effect == 0)) {
return;
+ }
if (player_ptr->anti_magic) {
stop_singing(player_ptr);
if (s64b_cmp(player_ptr->csp, player_ptr->csp_frac, need_mana, need_mana_frac) < 0) {
stop_singing(player_ptr);
return;
- } else {
- s64b_sub(&(player_ptr->csp), &(player_ptr->csp_frac), need_mana, need_mana_frac);
-
- player_ptr->redraw |= PR_MANA;
- if (interupting_song_effect != 0) {
- set_singing_song_effect(player_ptr, interupting_song_effect);
- set_interrupting_song_effect(player_ptr, MUSIC_NONE);
- msg_print(_("歌を再開した。", "You resume singing."));
- player_ptr->action = ACTION_SING;
- player_ptr->update |= (PU_BONUS | PU_HP | PU_MONSTERS);
- player_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
- player_ptr->window_flags |= (PW_OVERHEAD | PW_DUNGEON);
- }
}
- PlayerSkill(player_ptr).gain_continuous_spell_skill_exp(REALM_MUSIC, spell);
+ s64b_sub(&(player_ptr->csp), &(player_ptr->csp_frac), need_mana, need_mana_frac);
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ rfu.set_flag(MainWindowRedrawingFlag::MP);
+ if (interupting_song_effect != 0) {
+ set_singing_song_effect(player_ptr, interupting_song_effect);
+ set_interrupting_song_effect(player_ptr, MUSIC_NONE);
+ msg_print(_("歌を再開した。", "You resume singing."));
+ player_ptr->action = ACTION_SING;
+ static constexpr auto flags_srf = {
+ StatusRecalculatingFlag::BONUS,
+ StatusRecalculatingFlag::HP,
+ StatusRecalculatingFlag::MONSTER_STATUSES,
+ };
+ rfu.set_flags(flags_srf);
+ static constexpr auto flags_mwrf = {
+ MainWindowRedrawingFlag::MAP,
+ MainWindowRedrawingFlag::TIMED_EFFECT,
+ MainWindowRedrawingFlag::ACTION,
+ };
+ rfu.set_flags(flags_mwrf);
+ static constexpr auto flags_swrf = {
+ SubWindowRedrawingFlag::OVERHEAD,
+ SubWindowRedrawingFlag::DUNGEON,
+ };
+ rfu.set_flags(flags_swrf);
+ }
+ PlayerSkill(player_ptr).gain_continuous_spell_skill_exp(REALM_MUSIC, spell);
exe_spell(player_ptr, REALM_MUSIC, spell, SpellProcessType::CONTNUATION);
}
bool set_tim_stealth(PlayerType *player_ptr, TIME_EFFECT v, bool do_dec)
{
bool notice = false;
- v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
+ v = (v > 10000) ? 10000 : (v < 0) ? 0
+ : v;
- if (player_ptr->is_dead)
+ if (player_ptr->is_dead) {
return false;
+ }
if (v) {
if (player_ptr->tim_stealth && !do_dec) {
- if (player_ptr->tim_stealth > v)
+ if (player_ptr->tim_stealth > v) {
return false;
+ }
} else if (!is_time_limit_stealth(player_ptr)) {
msg_print(_("足音が小さくなった!", "You begin to walk silently!"));
notice = true;
}
player_ptr->tim_stealth = v;
- player_ptr->redraw |= (PR_STATUS);
-
- if (!notice)
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ rfu.set_flag(MainWindowRedrawingFlag::TIMED_EFFECT);
+ if (!notice) {
return false;
+ }
- if (disturb_state)
+ if (disturb_state) {
disturb(player_ptr, false, false);
- player_ptr->update |= (PU_BONUS);
+ }
+
+ rfu.set_flag(StatusRecalculatingFlag::BONUS);
handle_stuff(player_ptr);
return true;
}
*/
void stop_singing(PlayerType *player_ptr)
{
- if (player_ptr->pclass != PlayerClassType::BARD)
+ if (!PlayerClass(player_ptr).equals(PlayerClassType::BARD)) {
return;
+ }
if (get_interrupting_song_effect(player_ptr) != 0) {
set_interrupting_song_effect(player_ptr, MUSIC_NONE);
return;
}
- if (get_singing_song_effect(player_ptr) == 0)
+ if (get_singing_song_effect(player_ptr) == 0) {
return;
+ }
- if (player_ptr->action == ACTION_SING)
+ if (player_ptr->action == ACTION_SING) {
set_action(player_ptr, ACTION_NONE);
+ }
(void)exe_spell(player_ptr, REALM_MUSIC, get_singing_song_id(player_ptr), SpellProcessType::STOP);
set_singing_song_effect(player_ptr, MUSIC_NONE);
set_singing_song_id(player_ptr, 0);
- set_bits(player_ptr->update, PU_BONUS);
- set_bits(player_ptr->redraw, PR_STATUS);
+ auto &rfu = RedrawingFlagsUpdater::get_instance();
+ rfu.set_flag(StatusRecalculatingFlag::BONUS);
+ rfu.set_flag(MainWindowRedrawingFlag::TIMED_EFFECT);
}
bool music_singing(PlayerType *player_ptr, int music_songs)