本文整理汇总了C++中PropStream::GET_ULONG方法的典型用法代码示例。如果您正苦于以下问题:C++ PropStream::GET_ULONG方法的具体用法?C++ PropStream::GET_ULONG怎么用?C++ PropStream::GET_ULONG使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropStream
的用法示例。
在下文中一共展示了PropStream::GET_ULONG方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMap
bool IOMapSerialize::loadMap(Map* map)
{
int64_t start = OTSYS_TIME();
Database* db = Database::getInstance();
std::ostringstream query;
DBResult* result = db->storeQuery("SELECT `id` FROM `houses`");
if (!result) {
return true;
}
do {
query.str("");
query << "SELECT `data` FROM `tile_store` WHERE `house_id` = " << result->getDataInt("id");
DBResult* tileResult = db->storeQuery(query.str());
if (!tileResult) {
continue;
}
do {
unsigned long attrSize = 0;
const char* attr = tileResult->getDataStream("data", attrSize);
PropStream propStream;
propStream.init(attr, attrSize);
uint16_t x = 0, y = 0;
uint8_t z = 0;
propStream.GET_USHORT(x);
propStream.GET_USHORT(y);
propStream.GET_UCHAR(z);
if (x == 0 || y == 0) {
continue;
}
Tile* tile = map->getTile(x, y, z);
if (!tile) {
continue;
}
uint32_t item_count = 0;
propStream.GET_ULONG(item_count);
while (item_count--) {
loadItem(propStream, tile);
}
} while (tileResult->next());
db->freeResult(tileResult);
} while (result->next());
db->freeResult(result);
std::cout << "> Loaded house items in: " << (OTSYS_TIME() - start) / (1000.) << " s" << std::endl;
return true;
}
示例2: readAttr
Attr_ReadValue BedItem::readAttr(AttrTypes_t attr, PropStream& propStream)
{
switch(attr)
{
case ATTR_SLEEPERGUID:
{
uint32_t _sleeper;
if(!propStream.GET_ULONG(_sleeper))
return ATTR_READ_ERROR;
if(_sleeper)
{
std::string name;
if(IOLoginData::getInstance()->getNameByGuid(_sleeper, name))
{
setSpecialDescription(name + " is sleeping there.");
Beds::getInstance().setBedSleeper(this, _sleeper);
}
}
sleeper = _sleeper;
return ATTR_READ_CONTINUE;
}
case ATTR_SLEEPSTART:
{
uint32_t _sleepStart;
if(!propStream.GET_ULONG(_sleepStart))
return ATTR_READ_ERROR;
sleepStart = (time_t)_sleepStart;
return ATTR_READ_CONTINUE;
}
default:
break;
}
return Item::readAttr(attr, propStream);
}
示例3: readAttr
Attr_ReadValue Container::readAttr(AttrTypes_t attr, PropStream& propStream)
{
if (attr == ATTR_CONTAINER_ITEMS) {
uint32_t count;
if (!propStream.GET_ULONG(count)) {
return ATTR_READ_ERROR;
}
serializationCount = count;
return ATTR_READ_END;
}
return Item::readAttr(attr, propStream);
}
示例4: readAttr
Attr_ReadValue Container::readAttr(AttrTypes_t attr, PropStream& propStream)
{
switch (attr) {
case ATTR_CONTAINER_ITEMS: {
uint32_t count;
if (!propStream.GET_ULONG(count)) {
return ATTR_READ_ERROR;
}
serializationCount = count;
return ATTR_READ_END;
}
default:
break;
}
return Item::readAttr(attr, propStream);
}
示例5: unserialize
bool ItemAttribute::unserialize(PropStream& stream)
{
// dealloc possible string value
dealloc();
// read type
stream.GET_UCHAR(reinterpret_cast<uint8_t&>(m_type));
// do not call here set(...) or any other function depending on m_type which may result in deallocating phantom string !
// read contents
switch(m_type){
case STRING: {
m_var.string = new std::string;
if(!stream.GET_LSTRING(*m_var.string))
return false;
break;
}
case INTEGER:
case FLOAT: {
if(!stream.GET_ULONG(m_var.unsignedInteger))
return false;
break;
}
case BOOLEAN: {
if(!stream.GET_UCHAR(m_var.unsignedChar))
return false;
break;
}
default: {
m_type = NONE;
break;
}
}
return true;
}
示例6: loadMap
void IOMapSerialize::loadMap(Map* map)
{
int64_t start = OTSYS_TIME();
Database* db = Database::getInstance();
DBResult* result = db->storeQuery("SELECT `data` FROM `tile_store`");
if (!result) {
return;
}
do {
unsigned long attrSize;
const char* attr = result->getDataStream("data", attrSize);
PropStream propStream;
propStream.init(attr, attrSize);
uint16_t x, y;
uint8_t z;
if (!propStream.GET_USHORT(x) || !propStream.GET_USHORT(y) || !propStream.GET_UCHAR(z)) {
continue;
}
Tile* tile = map->getTile(x, y, z);
if (!tile) {
continue;
}
uint32_t item_count;
if (!propStream.GET_ULONG(item_count)) {
continue;
}
while (item_count--) {
loadItem(propStream, tile);
}
} while (result->next());
db->freeResult(result);
std::cout << "> Loaded house items in: " << (OTSYS_TIME() - start) / (1000.) << " s" << std::endl;
}
示例7: loadMap
//.........这里部分代码省略.........
NODE nodeTile = f.getChildNode(nodeMapData, type);
while(nodeTile != NO_NODE)
{
if(f.getError() != ERROR_NONE)
{
setLastErrorString("Could not read node data.");
return false;
}
if(type == OTBM_TILE || type == OTBM_HOUSETILE)
{
if(!f.getProps(nodeTile, propStream))
{
setLastErrorString("Could not read node data.");
return false;
}
OTBM_Tile_coords* tileCoord;
if(!propStream.GET_STRUCT(tileCoord))
{
setLastErrorString("Could not read tile position.");
return false;
}
Tile* tile = NULL;
Item* groundItem = NULL;
uint32_t tileflags = 0;
uint16_t px = base_x + tileCoord->_x, py = base_y + tileCoord->_y, pz = base_z;
House* house = NULL;
if(type == OTBM_HOUSETILE)
{
uint32_t _houseid;
if(!propStream.GET_ULONG(_houseid))
{
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Could not read house id.";
setLastErrorString(ss.str());
return false;
}
house = Houses::getInstance().getHouse(_houseid, true);
if(!house)
{
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Could not create house id: " << _houseid;
setLastErrorString(ss.str());
return false;
}
tile = new HouseTile(px, py, pz, house);
house->addTile(static_cast<HouseTile*>(tile));
}
//read tile attributes
uint8_t attribute;
while(propStream.GET_UCHAR(attribute))
{
switch(attribute)
{
case OTBM_ATTR_TILE_FLAGS:
{
uint32_t flags;
if(!propStream.GET_ULONG(flags))
示例8: loadMap
//.........这里部分代码省略.........
while (nodeTile != NO_NODE) {
if (f.getError() != ERROR_NONE) {
setLastErrorString("Could not read node data.");
return false;
}
if (type == OTBM_TILE || type == OTBM_HOUSETILE) {
if (!f.getProps(nodeTile, propStream)) {
setLastErrorString("Could not read node data.");
return false;
}
unsigned short px, py, pz;
OTBM_Tile_coords* tile_coord;
if (!propStream.GET_STRUCT(tile_coord)) {
setLastErrorString("Could not read tile position.");
return false;
}
px = base_x + tile_coord->_x;
py = base_y + tile_coord->_y;
pz = base_z;
bool isHouseTile = false;
House* house = nullptr;
Tile* tile = nullptr;
Item* ground_item = nullptr;
uint32_t tileflags = TILESTATE_NONE;
if (type == OTBM_HOUSETILE) {
uint32_t _houseid;
if (!propStream.GET_ULONG(_houseid)) {
std::ostringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Could not read house id.";
setLastErrorString(ss.str());
return false;
}
house = Houses::getInstance().addHouse(_houseid);
if (!house) {
std::ostringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Could not create house id: " << _houseid;
setLastErrorString(ss.str());
return false;
}
tile = new HouseTile(px, py, pz, house);
house->addTile(static_cast<HouseTile*>(tile));
isHouseTile = true;
}
//read tile attributes
while (propStream.GET_UCHAR(attribute)) {
switch (attribute) {
case OTBM_ATTR_TILE_FLAGS: {
uint32_t flags;
if (!propStream.GET_ULONG(flags)) {
std::ostringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] Failed to read tile flags.";
setLastErrorString(ss.str());
return false;
}
示例9: loadFromOtb
int Items::loadFromOtb(std::string file)
{
ItemLoader f;
if(!f.openFile(file.c_str(), false, true)){
return f.getError();
}
unsigned long type,len;
const unsigned char* data;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if(f.getProps(node,props)){
//4 byte flags
//attributes
//0x01 = version data
unsigned long flags;
if(!props.GET_ULONG(flags)){
return ERROR_INVALID_FORMAT;
}
attribute_t attr;
datasize_t datalen = 0;
if(!props.GET_VALUE(attr)){
return ERROR_INVALID_FORMAT;
}
if(attr == ROOT_ATTR_VERSION){
if(!props.GET_VALUE(datalen)){
return ERROR_INVALID_FORMAT;
}
if(datalen != sizeof(VERSIONINFO)){
return ERROR_INVALID_FORMAT;
}
VERSIONINFO *vi;
if(!props.GET_STRUCT(vi)){
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion;
Items::dwMinorVersion = vi->dwMinorVersion;
Items::dwBuildNumber = vi->dwBuildNumber;
}
}
if(Items::dwMinorVersion != CLIENT_VERSION_760){
std::cout << "Not supported items.otb client version." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while(node != NO_NODE) {
data = f.getProps(node, len);
if(data == NULL && f.getError() != ERROR_NONE)
return f.getError();
flags_t flags;
if(data != NULL) {
const unsigned char* p = &data[0];
ItemType* iType = new ItemType();
bool loadedFlags = false;
while(p < data + len) {
iType->group = (itemgroup_t)type;
switch(type) {
case ITEM_GROUP_NONE:
case ITEM_GROUP_GROUND:
case ITEM_GROUP_CONTAINER:
case ITEM_GROUP_WEAPON:
case ITEM_GROUP_AMMUNITION:
case ITEM_GROUP_ARMOR:
case ITEM_GROUP_RUNE:
case ITEM_GROUP_TELEPORT:
case ITEM_GROUP_MAGICFIELD:
case ITEM_GROUP_WRITEABLE:
case ITEM_GROUP_KEY:
case ITEM_GROUP_SPLASH:
case ITEM_GROUP_FLUID:
{
if(!loadedFlags) {
//read 4 byte flags
memcpy((void*)&flags, p, sizeof(flags_t)); p+= sizeof(flags_t);
iType->blockSolid = ((flags & FLAG_BLOCK_SOLID) == FLAG_BLOCK_SOLID);
iType->blockProjectile = ((flags & FLAG_BLOCK_PROJECTILE) == FLAG_BLOCK_PROJECTILE);
iType->blockPathFind = ((flags & FLAG_BLOCK_PATHFIND) == FLAG_BLOCK_PATHFIND);
iType->hasHeight = ((flags & FLAG_HAS_HEIGHT) == FLAG_HAS_HEIGHT);
iType->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE);
iType->pickupable = ((flags & FLAG_PICKUPABLE) == FLAG_PICKUPABLE);
iType->moveable = ((flags & FLAG_MOVEABLE) == FLAG_MOVEABLE);
iType->stackable = ((flags & FLAG_STACKABLE) == FLAG_STACKABLE);
iType->floorChangeDown = ((flags & FLAG_FLOORCHANGEDOWN) == FLAG_FLOORCHANGEDOWN);
iType->floorChangeNorth = ((flags & FLAG_FLOORCHANGENORTH) == FLAG_FLOORCHANGENORTH);
iType->floorChangeEast = ((flags & FLAG_FLOORCHANGEEAST) == FLAG_FLOORCHANGEEAST);
iType->floorChangeSouth = ((flags & FLAG_FLOORCHANGESOUTH) == FLAG_FLOORCHANGESOUTH);
iType->floorChangeWest = ((flags & FLAG_FLOORCHANGEWEST) == FLAG_FLOORCHANGEWEST);
iType->alwaysOnTop = ((flags & FLAG_ALWAYSONTOP) == FLAG_ALWAYSONTOP);
iType->canDecay = !((flags & FLAG_CANNOTDECAY) == FLAG_CANNOTDECAY);
if(type == ITEM_GROUP_WRITEABLE) {
iType->RWInfo |= CAN_BE_WRITTEN;
//.........这里部分代码省略.........
示例10: loadFromOtb
int32_t Items::loadFromOtb(const std::string& file)
{
FileLoader f;
if (!f.openFile(file.c_str(), "OTBI")) {
return f.getError();
}
uint32_t type;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if (f.getProps(node, props)) {
//4 byte flags
//attributes
//0x01 = version data
uint32_t flags;
if (!props.GET_ULONG(flags)) {
return ERROR_INVALID_FORMAT;
}
uint8_t attr;
if (!props.GET_VALUE(attr)) {
return ERROR_INVALID_FORMAT;
}
if (attr == ROOT_ATTR_VERSION) {
uint16_t datalen;
if (!props.GET_VALUE(datalen)) {
return ERROR_INVALID_FORMAT;
}
if (datalen != sizeof(VERSIONINFO)) {
return ERROR_INVALID_FORMAT;
}
VERSIONINFO* vi;
if (!props.GET_STRUCT(vi)) {
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion; //items otb format file version
Items::dwMinorVersion = vi->dwMinorVersion; //client version
Items::dwBuildNumber = vi->dwBuildNumber; //revision
}
}
if (Items::dwMajorVersion == 0xFFFFFFFF) {
std::cout << "[Warning - Items::loadFromOtb] items.otb using generic client version." << std::endl;
} else if (Items::dwMajorVersion != 3) {
std::cout << "Old version detected, a newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
} else if (Items::dwMinorVersion < CLIENT_VERSION_1035) {
std::cout << "A newer version of items.otb is required." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while (node != NO_NODE) {
PropStream stream;
if (!f.getProps(node, stream)) {
return f.getError();
}
uint32_t flags;
if (!stream.GET_VALUE(flags)) {
return ERROR_INVALID_FORMAT;
}
uint16_t serverId = 0;
uint16_t clientId = 0;
uint16_t speed = 0;
uint16_t lightLevel = 0;
uint16_t lightColor = 0;
uint16_t wareId = 0;
uint8_t alwaysOnTopOrder = 0;
uint8_t attrib;
while (stream.GET_VALUE(attrib)) {
uint16_t datalen;
if (!stream.GET_VALUE(datalen)) {
return ERROR_INVALID_FORMAT;
}
switch (attrib) {
case ITEM_ATTR_SERVERID: {
if (datalen != sizeof(uint16_t)) {
return ERROR_INVALID_FORMAT;
}
if (!stream.GET_USHORT(serverId)) {
return ERROR_INVALID_FORMAT;
}
if (serverId > 30000 && serverId < 30100) {
serverId -= 30000;
}
break;
}
case ITEM_ATTR_CLIENTID: {
//.........这里部分代码省略.........
示例11: loadMapBinary
bool IOMapSerialize::loadMapBinary(Map* map)
{
Database* db = Database::getInstance();
DBResult* result;
DBQuery query;
query << "SELECT `house_id`, `data` FROM `house_data` 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.GET_USHORT(x);
propStream.GET_USHORT(y);
propStream.GET_UCHAR(z);
uint32_t itemCount = 0;
propStream.GET_ULONG(itemCount);
Position pos(x, y, (int16_t)z);
if(house && house->hasPendingTransfer())
{
if(Player* player = g_game.getPlayerByGuidEx(house->getOwner()))
{
Depot* depot = player->getDepot(player->getTown(), true);
while(itemCount--)
loadItem(propStream, depot, 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::cout << "[Error - IOMapSerialize::loadMapBinary] Unserialization of invalid tile"
<< " at position " << pos << std::endl;
break;
}
}
}
while(result->next());
result->free();
return true;
}
示例12: readAttr
Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream& propStream)
{
switch (attr) {
case ATTR_COUNT: {
uint8_t _count = 0;
if (!propStream.GET_UCHAR(_count)) {
return ATTR_READ_ERROR;
}
setSubType(_count);
break;
}
case ATTR_ACTION_ID: {
uint16_t _actionid = 0;
if (!propStream.GET_USHORT(_actionid)) {
return ATTR_READ_ERROR;
}
setActionId(_actionid);
break;
}
case ATTR_UNIQUE_ID: {
uint16_t _uniqueid;
if (!propStream.GET_USHORT(_uniqueid)) {
return ATTR_READ_ERROR;
}
setUniqueId(_uniqueid);
break;
}
case ATTR_TEXT: {
std::string _text;
if (!propStream.GET_STRING(_text)) {
return ATTR_READ_ERROR;
}
setText(_text);
break;
}
case ATTR_WRITTENDATE: {
uint32_t _writtenDate;
if (!propStream.GET_ULONG(_writtenDate)) {
return ATTR_READ_ERROR;
}
setDate(_writtenDate);
break;
}
case ATTR_WRITTENBY: {
std::string _writer;
if (!propStream.GET_STRING(_writer)) {
return ATTR_READ_ERROR;
}
setWriter(_writer);
break;
}
case ATTR_DESC: {
std::string _text;
if (!propStream.GET_STRING(_text)) {
return ATTR_READ_ERROR;
}
setSpecialDescription(_text);
break;
}
case ATTR_RUNE_CHARGES: {
uint8_t _charges = 1;
if (!propStream.GET_UCHAR(_charges)) {
return ATTR_READ_ERROR;
}
setSubType(_charges);
break;
}
case ATTR_CHARGES: {
uint16_t _charges = 1;
if (!propStream.GET_USHORT(_charges)) {
return ATTR_READ_ERROR;
}
setSubType(_charges);
break;
//.........这里部分代码省略.........
示例13: loadFromOtb
int Items::loadFromOtb(std::string file)
{
ItemLoader f;
if(!f.openFile(file.c_str(), false, true)){
return f.getError();
}
unsigned long type;
NODE node = f.getChildNode(NO_NODE, type);
PropStream props;
if(f.getProps(node,props)){
//4 byte flags
//attributes
//0x01 = version data
unsigned long flags;
if(!props.GET_ULONG(flags)){
return ERROR_INVALID_FORMAT;
}
attribute_t attr;
if(!props.GET_VALUE(attr)){
return ERROR_INVALID_FORMAT;
}
if(attr == ROOT_ATTR_VERSION){
datasize_t datalen = 0;
if(!props.GET_VALUE(datalen)){
return ERROR_INVALID_FORMAT;
}
if(datalen != sizeof(VERSIONINFO)){
return ERROR_INVALID_FORMAT;
}
VERSIONINFO *vi;
if(!props.GET_STRUCT(vi)){
return ERROR_INVALID_FORMAT;
}
Items::dwMajorVersion = vi->dwMajorVersion; //items otb format file version
Items::dwMinorVersion = vi->dwMinorVersion; //client version
Items::dwBuildNumber = vi->dwBuildNumber; //revision
}
}
if(Items::dwMajorVersion != 1){
std::cout << "Not supported items.otb version." << std::endl;
return ERROR_INVALID_FORMAT;
}
if(Items::dwMinorVersion != CLIENT_VERSION_760){
std::cout << "Not supported items.otb client version." << std::endl;
return ERROR_INVALID_FORMAT;
}
node = f.getChildNode(node, type);
while(node != NO_NODE){
PropStream props;
if(!f.getProps(node,props)){
return f.getError();
}
flags_t flags;
ItemType* iType = new ItemType();
iType->group = (itemgroup_t)type;
switch(type){
case ITEM_GROUP_NONE:
case ITEM_GROUP_GROUND:
case ITEM_GROUP_CONTAINER:
case ITEM_GROUP_WEAPON:
case ITEM_GROUP_AMMUNITION:
case ITEM_GROUP_ARMOR:
case ITEM_GROUP_RUNE:
case ITEM_GROUP_TELEPORT:
case ITEM_GROUP_MAGICFIELD:
case ITEM_GROUP_WRITEABLE:
case ITEM_GROUP_KEY:
case ITEM_GROUP_SPLASH:
case ITEM_GROUP_FLUID:
case ITEM_GROUP_DOOR:
break;
default:
return ERROR_INVALID_FORMAT;
break;
}
//read 4 byte flags
if(!props.GET_VALUE(flags)){
return ERROR_INVALID_FORMAT;
}
iType->blockSolid = ((flags & FLAG_BLOCK_SOLID) == FLAG_BLOCK_SOLID);
iType->blockProjectile = ((flags & FLAG_BLOCK_PROJECTILE) == FLAG_BLOCK_PROJECTILE);
iType->blockPathFind = ((flags & FLAG_BLOCK_PATHFIND) == FLAG_BLOCK_PATHFIND);
iType->hasHeight = ((flags & FLAG_HAS_HEIGHT) == FLAG_HAS_HEIGHT);
iType->useable = ((flags & FLAG_USEABLE) == FLAG_USEABLE);
iType->pickupable = ((flags & FLAG_PICKUPABLE) == FLAG_PICKUPABLE);
iType->moveable = ((flags & FLAG_MOVEABLE) == FLAG_MOVEABLE);
iType->stackable = ((flags & FLAG_STACKABLE) == FLAG_STACKABLE);
iType->floorChangeDown = ((flags & FLAG_FLOORCHANGEDOWN) == FLAG_FLOORCHANGEDOWN);
iType->floorChangeNorth = ((flags & FLAG_FLOORCHANGENORTH) == FLAG_FLOORCHANGENORTH);
iType->floorChangeEast = ((flags & FLAG_FLOORCHANGEEAST) == FLAG_FLOORCHANGEEAST);
//.........这里部分代码省略.........
示例14: loadMap
//.........这里部分代码省略.........
NODE nodeTile = f.getChildNode(nodeMapData, type);
while(nodeTile != NO_NODE){
if(f.getError() != ERROR_NONE){
setLastErrorString("Could not read node data.");
return false;
}
if(type == OTBM_TILE || type == OTBM_HOUSETILE){
if(!f.getProps(nodeTile, propStream)){
setLastErrorString("Could not read node data.");
return false;
}
unsigned short px, py, pz;
OTBM_Tile_coords* tile_coord;
if(!propStream.GET_STRUCT(tile_coord)){
setLastErrorString("Could not read tile position.");
return false;
}
px = base_x + tile_coord->_x;
py = base_y + tile_coord->_y;
pz = base_z;
bool isHouseTile = false;
House* house = NULL;
if(type == OTBM_TILE){
tile = new Tile(px, py, pz);
}
else if(type == OTBM_HOUSETILE){
uint32_t _houseid;
if(!propStream.GET_ULONG(_houseid)){
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] " << "Could not read house id.";
setLastErrorString(ss.str());
return false;
}
house = Houses::getInstance().getHouse(_houseid, true);
if(!house){
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] " << "Could not create house id: " << _houseid;
setLastErrorString(ss.str());
return false;
}
tile = new HouseTile(px, py, pz, house);
house->addTile(static_cast<HouseTile*>(tile));
isHouseTile = true;
}
//read tile attributes
unsigned char attribute;
while(propStream.GET_UCHAR(attribute)){
switch(attribute){
case OTBM_ATTR_TILE_FLAGS:
{
uint32_t flags;
if(!propStream.GET_ULONG(flags)){
std::stringstream ss;
ss << "[x:" << px << ", y:" << py << ", z:" << pz << "] " << "Failed to read tile flags.";
setLastErrorString(ss.str());
return false;
}