本文整理汇总了C++中House::getDoorsCount方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getDoorsCount方法的具体用法?C++ House::getDoorsCount怎么用?C++ House::getDoorsCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getDoorsCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateHouses
bool IOMapSerialize::updateHouses()
{
Database* db = Database::getInstance();
DBQuery query;
House* house = NULL;
for(HouseMap::iterator it = Houses::getInstance()->getHouseBegin(); it != Houses::getInstance()->getHouseEnd(); ++it)
{
if(!(house = it->second))
continue;
query << "SELECT `price` FROM `houses` WHERE `id` = " << house->getId() << " AND `world_id` = "
<< g_config.getNumber(ConfigManager::WORLD_ID) << " LIMIT 1";
if(DBResult* result = db->storeQuery(query.str()))
{
if((uint32_t)result->getDataInt("price") != house->getPrice())
house->setSyncFlag(House::HOUSE_SYNC_UPDATE);
result->free();
query.str("");
query << "UPDATE `houses` SET ";
if(house->hasSyncFlag(House::HOUSE_SYNC_NAME))
query << "`name` = " << db->escapeString(house->getName()) << ", ";
if(house->hasSyncFlag(House::HOUSE_SYNC_TOWN))
query << "`town` = " << house->getTownId() << ", ";
if(house->hasSyncFlag(House::HOUSE_SYNC_SIZE))
query << "`size` = " << house->getSize() << ", ";
if(house->hasSyncFlag(House::HOUSE_SYNC_PRICE))
query << "`price` = " << house->getPrice() << ", ";
if(house->hasSyncFlag(House::HOUSE_SYNC_RENT))
query << "`rent` = " << house->getRent() << ", ";
query << "`doors` = " << house->getDoorsCount() << ", `beds` = "
<< house->getBedsCount() << ", `tiles` = " << house->getTilesCount();
if(house->hasSyncFlag(House::HOUSE_SYNC_GUILD))
query << ", `guild` = " << house->isGuild();
query << " WHERE `id` = " << house->getId() << " AND `world_id` = "
<< g_config.getNumber(ConfigManager::WORLD_ID) << db->getUpdateLimiter();
}
else
{
query.str("");
query << "INSERT INTO `houses` (`id`, `world_id`, `owner`, `name`, `town`, `size`, `price`, `rent`, `doors`, `beds`, `tiles`, `guild`) VALUES ("
<< house->getId() << ", " << g_config.getNumber(ConfigManager::WORLD_ID) << ", 0, "
//we need owner for compatibility reasons (field doesn't have a default value)
<< db->escapeString(house->getName()) << ", " << house->getTownId() << ", "
<< house->getSize() << ", " << house->getPrice() << ", " << house->getRent() << ", "
<< house->getDoorsCount() << ", " << house->getBedsCount() << ", "
<< house->getTilesCount() << ", " << house->isGuild() << ")";
}
if(!db->query(query.str()))
return false;
query.str("");
}
return true;
}