本文整理汇总了C++中Words::getEgoWordId方法的典型用法代码示例。如果您正苦于以下问题:C++ Words::getEgoWordId方法的具体用法?C++ Words::getEgoWordId怎么用?C++ Words::getEgoWordId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Words
的用法示例。
在下文中一共展示了Words::getEgoWordId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSaid
// When player has entered something, it is parsed elsewhere
uint8 AgiEngine::testSaid(uint8 nwords, uint8 *cc) {
AgiGame *state = &_game;
AgiEngine *vm = state->_vm;
Words *words = vm->_words;
int c, n = words->getEgoWordCount();
int z = 0;
if (vm->getFlag(VM_FLAG_SAID_ACCEPTED_INPUT) || !vm->getFlag(VM_FLAG_ENTERED_CLI))
return false;
// FR:
// I think the reason for the code below is to add some speed....
//
// if (nwords != num_ego_words)
// return false;
//
// In the disco scene in Larry 1 when you type "examine blonde",
// inside the logic is expected ( said("examine", "blonde", "rol") )
// where word("rol") = 9999
//
// According to the interpreter code 9999 means that whatever the
// user typed should be correct, but it looks like code 9999 means that
// if the string is empty at this point, the entry is also correct...
//
// With the removal of this code, the behavior of the scene was
// corrected
for (c = 0; nwords && n; c++, nwords--, n--) {
z = READ_LE_UINT16(cc);
cc += 2;
switch (z) {
case 9999: // rest of line (empty string counts to...)
nwords = 1;
break;
case 1: // any word
break;
default:
if (words->getEgoWordId(c) != z)
return false;
break;
}
}
// The entry string should be entirely parsed, or last word = 9999
if (n && z != 9999)
return false;
// The interpreter string shouldn't be entirely parsed, but next
// word must be 9999.
if (nwords != 0 && READ_LE_UINT16(cc) != 9999)
return false;
setFlag(VM_FLAG_SAID_ACCEPTED_INPUT, true);
return true;
}