X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Fspell%2Fspell-info.cpp;h=6887faaeefd59d87fe4257184f5f565339a8cafa;hb=d05f0b2e1929edce1664b9804b0e5c2d1725314f;hp=50c631bc746ccd12dfc6c430ec51fa4dae0c928a;hpb=17ea1def242e00f9797f563a295dea968327f087;p=hengbandforosx%2Fhengbandosx.git diff --git a/src/spell/spell-info.cpp b/src/spell/spell-info.cpp index 50c631bc7..6887faaee 100644 --- a/src/spell/spell-info.cpp +++ b/src/spell/spell-info.cpp @@ -1,4 +1,4 @@ -#include "spell/spell-info.h" +#include "spell/spell-info.h" #include "io/input-key-requester.h" #include "monster-race/monster-race.h" #include "player-base/player-class.h" @@ -10,11 +10,12 @@ #include "realm/realm-types.h" #include "spell/spells-execution.h" #include "system/floor-type-definition.h" -#include "system/monster-race-definition.h" -#include "system/monster-type-definition.h" +#include "system/monster-entity.h" +#include "system/monster-race-info.h" #include "system/player-type-definition.h" #include "term/screen-processor.h" #include "term/term-color-types.h" +#include "term/z-form.h" #include "timed-effect/player-stun.h" #include "timed-effect/timed-effects.h" #include "util/bit-flags-calculator.h" @@ -72,7 +73,7 @@ PERCENTAGE mod_spell_chance_1(PlayerType *player_ptr, PERCENTAGE chance) { chance += player_ptr->to_m_chance; - if (player_ptr->heavy_spell) { + if (player_ptr->hard_spell) { chance += 20; } @@ -104,7 +105,7 @@ PERCENTAGE mod_spell_chance_2(PlayerType *player_ptr, PERCENTAGE chance) if (player_ptr->dec_mana) { chance--; } - if (player_ptr->heavy_spell) { + if (player_ptr->hard_spell) { chance += 5; } return std::max(chance, 0); @@ -254,8 +255,6 @@ void print_spells(PlayerType *player_ptr, SPELL_IDX target_spell, SPELL_IDX *spe int i; const magic_type *s_ptr; - char info[80]; - char out_val[160]; char ryakuji[5]; bool max = false; for (i = 0; i < num; i++) { @@ -296,24 +295,25 @@ void print_spells(PlayerType *player_ptr, SPELL_IDX target_spell, SPELL_IDX *spe ryakuji[4] = '\0'; } + std::string out_val; if (use_menu && target_spell) { if (i == (target_spell - 1)) { - strcpy(out_val, _(" 》 ", " > ")); + out_val = _(" 》 ", " > "); } else { - strcpy(out_val, " "); + out_val = " "; } } else { - sprintf(out_val, " %c) ", I2A(i)); + out_val = format(" %c) ", I2A(i)); } if (s_ptr->slevel >= 99) { - strcat(out_val, format("%-30s", _("(判読不能)", "(illegible)"))); + out_val.append(format("%-30s", _("(判読不能)", "(illegible)"))); c_prt(TERM_L_DARK, out_val, y + i + 1, x); continue; } - strcpy(info, exe_spell(player_ptr, use_realm, spell, SpellProcessType::INFO)); - concptr comment = info; + const auto info = exe_spell(player_ptr, use_realm, spell, SpellProcessType::INFO); + concptr comment = info->data(); byte line_attr = TERM_WHITE; if (pc.is_every_magic()) { if (s_ptr->slevel > player_ptr->max_plv) { @@ -337,12 +337,12 @@ void print_spells(PlayerType *player_ptr, SPELL_IDX target_spell, SPELL_IDX *spe line_attr = TERM_L_GREEN; } + const auto spell_name = exe_spell(player_ptr, use_realm, spell, SpellProcessType::NAME); if (use_realm == REALM_HISSATSU) { - strcat(out_val, format("%-25s %2d %4d", exe_spell(player_ptr, use_realm, spell, SpellProcessType::NAME), s_ptr->slevel, need_mana)); + out_val.append(format("%-25s %2d %4d", spell_name->data(), s_ptr->slevel, need_mana)); } else { - strcat(out_val, - format("%-25s%c%-4s %2d %4d %3d%% %s", exe_spell(player_ptr, use_realm, spell, SpellProcessType::NAME), (max ? '!' : ' '), ryakuji, s_ptr->slevel, - need_mana, spell_chance(player_ptr, spell, use_realm), comment)); + out_val.append(format("%-25s%c%-4s %2d %4d %3d%% %s", spell_name->data(), (max ? '!' : ' '), ryakuji, s_ptr->slevel, + need_mana, spell_chance(player_ptr, spell, use_realm), comment)); } c_prt(line_attr, out_val, y + i + 1, x);