本文整理汇总了C++中PropStream::size方法的典型用法代码示例。如果您正苦于以下问题:C++ PropStream::size方法的具体用法?C++ PropStream::size怎么用?C++ PropStream::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropStream
的用法示例。
在下文中一共展示了PropStream::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMapBinaryTileBased
bool IOMapSerialize::loadMapBinaryTileBased(Map* map)
{
Database* db = Database::getInstance();
DBResult* result;
DBQuery query;
query << "SELECT `house_id`, `data` FROM `tile_store` WHERE `world_id` = " << g_config.getNumber(ConfigManager::WORLD_ID);
if(!(result = db->storeQuery(query.str())))
return false;
House* house = NULL;
do
{
int32_t houseId = result->getDataInt("house_id");
house = Houses::getInstance()->getHouse(houseId);
uint64_t attrSize = 0;
const char* attr = result->getDataStream("data", attrSize);
PropStream propStream;
propStream.init(attr, attrSize);
while(propStream.size())
{
uint16_t x = 0, y = 0;
uint8_t z = 0;
propStream.getShort(x);
propStream.getShort(y);
propStream.getByte(z);
uint32_t itemCount = 0;
propStream.getLong(itemCount);
Position pos(x, y, (int16_t)z);
if(house && house->hasPendingTransfer())
{
if(Player* player = g_game.getPlayerByGuidEx(house->getOwner()))
{
while(itemCount--)
loadItem(propStream, player->getInbox(), true);
if(player->isVirtual())
{
IOLoginData::getInstance()->savePlayer(player);
delete player;
}
}
}
else if(Tile* tile = map->getTile(pos))
{
while(itemCount--)
loadItem(propStream, tile, false);
}
else
{
std::clog << "[Error - IOMapSerialize::loadMapBinary] Unserialization of invalid tile"
<< " at position " << pos << std::endl;
break;
}
}
}
while(result->next());
result->free();
return true;
}