fix word highlighting where substitutions are used

This commit is contained in:
2025-08-03 20:24:49 -05:00
parent 1ea9c61063
commit 88d43f6443

View File

@@ -35,6 +35,7 @@
#include "replay.hpp"
#include <boost/lexical_cast.hpp>
#include <fmt/format.h>
#include <boost/algorithm/string/replace.hpp>
short monsters_faces[190] = {
0,1,2,3,4,5,6,7,8,9,
@@ -995,6 +996,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;