Conversation
24b9ee8 to
763e9c8
Compare
763e9c8 to
4843a2e
Compare
| protected: | ||
| DialoguePage* BacklogPage; | ||
| int TextLength = 0; | ||
| std::unique_ptr<BacklogPage> Page; |
There was a problem hiding this comment.
Instead of having a backlogpage pointer per backlog entry (which adds a lot of indirection and fragmentation), could we instead maybe store a vector of backlogpages inside backlog menu (since it's not polymorphic), and then access that in backlogentry with an index and maybe a pointer to the backlogmenu?
If backlog max count should be a bounded value, we should store it in a static array as well.
| DialoguePageMode PageMode = DPM_ADV; | ||
|
|
||
| protected: | ||
| void ParseLineBreak(const StringToken& token); |
There was a problem hiding this comment.
I would suggest a template function for this templated on the StringToken, then you can specialize it in the textparser.cpp since it's only being used there anyway. To handle runtime to compiletime lookup, I would recommend doing a constexpr static lookup table like what we had for backgrounds2d table rather than a heap allocated map + std function, just do nullptr checks if you wanna leave some blank.
template <StringTokenType T>
void ParseStringToken(const Stringtoken& t);
using TextParserProc = auto (TextParser::*)(const StringToken&) -> void;
auto constexpr static textParserLUT = std::to_array<TextParserProc>({
&TextParser::ParseStringToken<STT_LineBreak>,
&TextParser::ParseStringToken<STT_CharacterNameStart>,
nullptr,
});
Trifurcates the
DialoguePageclass into separate instances for dialogue, backlog entries, and tip entriesMoves text parsing to a separate class, with separate directive functions for dialogue, backlog, and tips, handling what is parsed and how
InstMesMain, instead of at the start ofInstMes