Skip to content

Commit 4c607ce

Browse files
committed
Append dialog options always below existing options
1 parent 9e51f1f commit 4c607ce

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Source/stores.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,9 +2400,15 @@ void StartStore(TalkID s)
24002400
}
24012401
}
24022402

2403-
// Insert extra options into empty even-numbered lines before the leave option.
2403+
// Insert extra options into empty even-numbered lines before the leave option,
2404+
// after any existing menu lines (so e.g. "Talk to Farnham" stays above mod options).
2405+
int firstExtraOptionLine = 10;
2406+
for (int line = 10; line < lastSelectableLine; line += 2) {
2407+
if (TextLine[line].hasText())
2408+
firstExtraOptionLine = line + 2;
2409+
}
24042410
size_t optIdx = 0;
2405-
for (int line = 10; line < lastSelectableLine && optIdx < extraOpts->size(); line += 2) {
2411+
for (int line = firstExtraOptionLine; line < lastSelectableLine && optIdx < extraOpts->size(); line += 2) {
24062412
if (TextLine[line].hasText()) continue;
24072413
std::string label = (*extraOpts)[optIdx].getLabel();
24082414
if (!label.empty()) {

Source/stores.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ DVL_API_FOR_TEST const char *TownerNameForTalkID(TalkID s);
130130
/**
131131
* @brief Registers a dynamic dialog option for a towner's talk menu.
132132
*
133-
* Options are inserted into empty even-numbered lines before the towner's "leave" option.
133+
* Options are inserted into empty even-numbered lines before the towner's "leave" option,
134+
* after existing menu lines on even rows (so default choices like "Talk to …" stay first).
134135
* If no empty lines are available the option is silently skipped for that dialog session
135136
* and a warning is logged.
136137
*

0 commit comments

Comments
 (0)