fix crash recording 1-string dialog, DRY recording code

This commit is contained in:
2025-05-03 17:31:26 -05:00
parent 8fa1ef3284
commit 1ad34d8814
3 changed files with 12 additions and 30 deletions

View File

@@ -31,24 +31,20 @@ void display_alchemy(bool allowEdit,cDialog* parent);
// Callback for recording encounter strings
class cStringRecorder {
private:
eEncNoteType type;
unsigned short label1, label2, label1b, label2b;
eSpecCtxType spec_type;
eEncNoteType note_type;
short label1, label2;
std::string location;
public:
cStringRecorder(eEncNoteType type) : type(type) {}
cStringRecorder& string1(unsigned short which) {
cStringRecorder(eSpecCtxType spec_type, eEncNoteType note_type) : spec_type(spec_type), note_type(note_type) {}
cStringRecorder& string1(short which) {
label1 = which;
return *this;
}
cStringRecorder& string2(unsigned short which) {
cStringRecorder& string2(short which) {
label2 = which;
return *this;
}
cStringRecorder& from(unsigned short where1, unsigned short where2) {
label1b = where1;
label2b = where2;
return *this;
}
cStringRecorder& at(std::string where) {
location = where;
return *this;