本文整理汇总了C++中common::SeekableReadStream::readChar方法的典型用法代码示例。如果您正苦于以下问题:C++ SeekableReadStream::readChar方法的具体用法?C++ SeekableReadStream::readChar怎么用?C++ SeekableReadStream::readChar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::SeekableReadStream
的用法示例。
在下文中一共展示了SeekableReadStream::readChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void VISFile::load(Common::SeekableReadStream &vis) {
clear();
Common::StreamTokenizer tokenizer(Common::StreamTokenizer::kRuleIgnoreAll);
tokenizer.addSeparator(' ');
tokenizer.addChunkEnd('\n');
tokenizer.addIgnore('\r');
for (;;) {
std::vector<Common::UString> strings;
tokenizer.getTokens(vis, strings);
// Make sure we don't get any empty lines
while (!vis.eos() && strings.empty()) {
tokenizer.nextChunk(vis);
tokenizer.getTokens(vis, strings);
}
if (vis.eos())
break;
if ((strings.size() == 1) && (strings[0] == "[Adjacent]"))
// TODO: New in Jade Empire
break;
if (strings.size() > 2)
throw Common::Exception("Malformed VIS file");
Common::UString room = strings[0].toLower();
std::vector<Common::UString> visibilityArray;
int roomCount = 0;
if (strings.size() > 1)
Common::parseString(strings[1], roomCount);
int realRoomCount = 0;
visibilityArray.reserve(roomCount);
while (!vis.eos()) {
size_t lineStart = vis.pos();
tokenizer.nextChunk(vis);
if (vis.readChar() != ' ') {
// Not indented => new room
vis.seek(lineStart);
break;
}
tokenizer.getTokens(vis, strings);
if (strings.size() != 1) {
// More than one token => new room
vis.seek(lineStart);
break;
}
visibilityArray.push_back(strings[0]);
realRoomCount++;
}
if (roomCount != realRoomCount)
// Thanks, BioWare! -.-
warning("Malformed VIS file. Wanted %d rooms, got %d?!?", roomCount, realRoomCount);
if (!visibilityArray.empty())
_map[room] = visibilityArray;
}
}