diff --git a/src/game/boe.combat.cpp b/src/game/boe.combat.cpp index eab2b62e..401d5db4 100644 --- a/src/game/boe.combat.cpp +++ b/src/game/boe.combat.cpp @@ -1243,7 +1243,7 @@ void do_combat_cast(location target) { if(stat_window == univ.cur_pc) put_item_screen(stat_window); do_mindduel(univ.cur_pc,cur_monst); - } else add_string_to_buf(" You need a smoky crystal. "); + } else add_pc_needs_to_buf("a smoky crystal"); } store_sound = 24; break; diff --git a/src/game/boe.party.cpp b/src/game/boe.party.cpp index cf15061b..000c4c33 100644 --- a/src/game/boe.party.cpp +++ b/src/game/boe.party.cpp @@ -748,7 +748,7 @@ void do_mage_spell(short pc_num,eSpell spell_num,bool freebie) { { cInvenSlot item = univ.party[pc_num].has_abil(eItemAbil::SAPPHIRE); if(!item && !freebie) - add_string_to_buf(" You need a sapphire."); + add_pc_needs_to_buf("a sapphire"); else if(univ.town->defy_scrying || univ.town->defy_mapping) add_string_to_buf(" The spell fails."); else { diff --git a/src/game/boe.text.cpp b/src/game/boe.text.cpp index 906cbcf0..d7cabe6b 100644 --- a/src/game/boe.text.cpp +++ b/src/game/boe.text.cpp @@ -1064,6 +1064,15 @@ void add_string_to_buf(std::string str, unsigned short indent) { } +void add_pc_needs_to_buf(std::string needs_what, unsigned short pre_indent, unsigned short indent) { + std::ostringstream sout; + for(int i = 0; i < pre_indent; ++i){ + sout << ' '; + } + sout << univ.party[univ.cur_pc].name << " needs " << needs_what << "."; + add_string_to_buf(sout.str(), indent); +} + void init_buf() { for(short i = 0; i < TEXT_BUF_LEN; i++) sprintf((char *) text_buffer[buf_pointer].line, " "); diff --git a/src/game/boe.text.hpp b/src/game/boe.text.hpp index 19fbb373..5167583e 100644 --- a/src/game/boe.text.hpp +++ b/src/game/boe.text.hpp @@ -31,6 +31,7 @@ void print_nums(short a,short b,short c); short print_terrain(location space); void add_string_to_buf(std::string str, unsigned short indent); // Set second parameter to nonzero to auto-split the line if it's too long void add_string_to_buf(std::string str); +void add_pc_needs_to_buf(std::string needs_what, unsigned short pre_indent = 2, unsigned short indent = 4); void init_buf(); void print_buf () ; void restart_printing();