MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UpdateQuestions

Method UpdateQuestions

ogsr_engine/xrGame/ui/UITalkWnd.cpp:122–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120void CUITalkWnd::NeedUpdateQuestions() { m_bNeedToUpdateQuestions = true; }
121
122void CUITalkWnd::UpdateQuestions()
123{
124 UITalkDialogWnd->ClearQuestions();
125
126 //если нет активного диалога, то
127 //режима выбора темы
128 if (!m_pCurrentDialog)
129 {
130 m_pOurDialogManager->UpdateAvailableDialogs(m_pOthersDialogManager);
131 int number = 0;
132 for (u32 i = 0; i < m_pOurDialogManager->AvailableDialogs().size(); ++i)
133 {
134 const DIALOG_SHARED_PTR& phrase_dialog = m_pOurDialogManager->AvailableDialogs()[i];
135 AddQuestion(phrase_dialog->DialogCaption(), phrase_dialog->GetDialogID(), number);
136 }
137 }
138 else
139 {
140 if (m_pCurrentDialog->IsWeSpeaking(m_pOurDialogManager))
141 {
142 //если в списке допустимых фраз только одна фраза пустышка, то просто
143 //сказать (игрок сам не производит никаких действий)
144 if (!m_pCurrentDialog->PhraseList().empty() && m_pCurrentDialog->allIsDummy())
145 {
146 CPhrase* phrase = m_pCurrentDialog->PhraseList()[Random.randI(m_pCurrentDialog->PhraseList().size())];
147 SayPhrase(phrase->GetID());
148 };
149
150 //выбор доступных фраз из активного диалога
151 if (m_pCurrentDialog && !m_pCurrentDialog->allIsDummy())
152 {
153 int number = 0;
154 for (PHRASE_VECTOR::const_iterator it = m_pCurrentDialog->PhraseList().begin(); it != m_pCurrentDialog->PhraseList().end(); it++)
155 {
156 CPhrase* phrase = *it;
157 AddQuestion(phrase->GetText(), phrase->GetID(), number);
158 }
159 }
160 else
161 UpdateQuestions();
162 }
163 }
164 m_bNeedToUpdateQuestions = false;
165}
166
167//////////////////////////////////////////////////////////////////////////
168

Callers

nothing calls this directly

Calls 12

ClearQuestionsMethod · 0.80
DialogCaptionMethod · 0.80
IsWeSpeakingMethod · 0.80
allIsDummyMethod · 0.80
randIMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
GetIDMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected