本文整理汇总了C++中MapBlock::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ MapBlock::reset方法的具体用法?C++ MapBlock::reset怎么用?C++ MapBlock::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapBlock
的用法示例。
在下文中一共展示了MapBlock::reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
const DB::Block DBSQLite3::getBlockOnPos(const BlockPos &pos)
{
static thread_local MapBlock block;
block.reset();
block.setPos(pos);
int result = 0;
m_blocksQueriedCount++;
sqlite3_stmt *statement;
// Disabled RowID querying, as it may cause blocks not to be found when mapping
// while minetest is running (i.e. modifying blocks).
if (false && pos.databasePosIdIsValid()) {
statement = m_blockOnRowidStatement;
sqlite3_bind_int64(m_blockOnRowidStatement, 1, pos.databasePosId());
}
else {
statement = m_blockOnPosStatement;
sqlite3_bind_int64(m_blockOnPosStatement, 1, pos.databasePosI64());
}
while (true) {
result = sqlite3_step(statement);
if (result == SQLITE_ROW) {
//const auto *data = static_cast<const unsigned char *>(sqlite3_column_blob(statement, 1));
int size = sqlite3_column_bytes(statement, 1);
//block = MapBlock(pos, sqlite3_column_blob(statement, 1), size);
block.setData(sqlite3_column_blob(statement, 1), size);
//block.second.assign(&data[0], &data[size]);
m_blocksReadCount++;
break;
}
else if (result == SQLITE_BUSY) { // Wait some time and try again
sleepMs(10);
}
else {
break;
}
}
sqlite3_reset(statement);
return block;
}