Fix issues with editing dialog text

- If there were no strings following the assigned six dialog strings, the scenario editor thought the string was out of range and tried to assign a new set
- Whenever the text is edited, make sure all six strings still exist.
This commit is contained in:
2017-02-02 11:44:09 -05:00
parent 933f7e7644
commit f520e1ac0a

View File

@@ -1092,8 +1092,10 @@ static bool edit_dialog_text_event_filter(cDialog& me, std::string item_hit, eSt
// mode 0 - scen 1 - out 2 - town
void edit_dialog_text(eStrMode mode,short *str1,cDialog* parent) {
if(*str1 >= num_strs(mode) - 6)
if(*str1 >= num_strs(mode))
*str1 = -1;
else if(*str1 + 5 >= num_strs(mode))
ensure_str(mode, *str1 + 5);
// first, assign the 6 strs for the dialog.
if(*str1 < 0) {
size_t n = num_strs(mode);