PhrasePtr Conversation::AutoChoosePhrase(SpeakerPtr speaker) { for (int i = 0; i < GetPhrasesCount(); ++i) { PhrasePtr p = GetPhrase(i); if (p->CheckCondition(speaker)) return p; } return PhrasePtr(); }
void Split(char * input, char ** &output) { char c; int i = 0; int n = 0; int h = 0; do { c = input[i++]; if(c == ' ') { if(h != 0) { output[n] = GetPhrase(input, i, h); n++; h = 0; } } else { h++; } } while (c != ''); output[n] = GetPhrase(input, i, h - 1); }