SCI: adding uninit workarounds for cnick games

longbow and king's quest
KQ has the same issues as hoyle 3

svn-id: r51063
This commit is contained in:
Martin Kiewitz 2010-07-20 14:27:30 +00:00
parent 6ebcb53265
commit ef69fb1af5
3 changed files with 16 additions and 4 deletions

View file

@ -744,9 +744,17 @@ uint Kernel::getSelectorNamesSize() const {
return _selectorNames.size();
}
const Common::String &Kernel::getSelectorName(uint selector) const {
if (selector >= _selectorNames.size())
return _invalid;
const Common::String &Kernel::getSelectorName(uint selector) {
if (selector >= _selectorNames.size()) {
// This should only occur in games w/o a selector-table
// We need this for proper workaround tables
// TODO: maybe check, if there is a fixed selector-table and error() out in that case
for (uint loopSelector = _selectorNames.size(); loopSelector <= selector; loopSelector++) {
Common::String newSelectorName;
newSelectorName = newSelectorName.printf("<noname %d>", loopSelector);
_selectorNames.push_back(newSelectorName);
}
}
return _selectorNames[selector];
}