fix word highlighting where substitutions are used

This commit is contained in:
2025-08-03 20:24:49 -05:00
parent ae03eac912
commit 2a845a7974

View File

@@ -34,6 +34,7 @@
#include "tools/enum_map.hpp"
#include "replay.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/replace.hpp>
short monsters_faces[190] = {
0,1,2,3,4,5,6,7,8,9,
@@ -994,6 +995,13 @@ void place_talk_str(std::string str_to_place,std::string str_to_place2,short col
// First determine the offsets of clickable words.
// The added spaces ensure that end-of-word boundaries are found
std::string str = str_to_place + " |" + str_to_place2 + " ";
// TODO use a font where we don't need this
extern std::map<std::string,std::string> substitutions;
for(auto it : substitutions){
boost::replace_all(str, it.first, it.second);
}
std::vector<hilite_t> hilites;
std::vector<int> nodes;
int wordStart = 0, wordEnd = 0;