mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 04:45:34 +00:00
dialogue topic and choice sorting independent of case
This commit is contained in:
parent
af3ccd85e3
commit
eca18f3e1d
2 changed files with 20 additions and 2 deletions
|
@ -54,6 +54,20 @@ namespace
|
||||||
return lowerCase;
|
return lowerCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool stringCompareNoCase (std::string first, std::string second)
|
||||||
|
{
|
||||||
|
unsigned int i=0;
|
||||||
|
while ( (i<first.length()) && (i<second.length()) )
|
||||||
|
{
|
||||||
|
if (tolower(first[i])<tolower(second[i])) return true;
|
||||||
|
else if (tolower(first[i])>tolower(second[i])) return false;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
if (first.length()<second.length())
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T1, typename T2>
|
template<typename T1, typename T2>
|
||||||
bool selectCompare (char comp, T1 value1, T2 value2)
|
bool selectCompare (char comp, T1 value1, T2 value2)
|
||||||
|
@ -723,7 +737,11 @@ namespace MWDialogue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort again, because the previous sort was case-sensitive
|
||||||
|
keywordList.sort(stringCompareNoCase);
|
||||||
win->setKeywords(keywordList);
|
win->setKeywords(keywordList);
|
||||||
|
|
||||||
mChoice = choice;
|
mChoice = choice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +833,7 @@ namespace MWDialogue
|
||||||
{
|
{
|
||||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||||
win->askQuestion(question);
|
win->askQuestion(question);
|
||||||
mChoiceMap[question] = choice;
|
mChoiceMap[toLower(question)] = choice;
|
||||||
mIsInChoice = true;
|
mIsInChoice = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
|
||||||
UString key = history->getColorTextAt(cursorPosition);
|
UString key = history->getColorTextAt(cursorPosition);
|
||||||
if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
|
if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
|
||||||
|
|
||||||
if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(key);
|
if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue