本文整理汇总了C++中EnchantmentStore::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ EnchantmentStore::clear方法的具体用法?C++ EnchantmentStore::clear怎么用?C++ EnchantmentStore::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnchantmentStore
的用法示例。
在下文中一共展示了EnchantmentStore::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadRandomEnchantmentsTable
void LoadRandomEnchantmentsTable()
{
RandomItemPropEnch.clear(); // for reload case
RandomItemSuffixEnch.clear(); // for reload case
uint32 count = 0;
QueryResult* result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
{
BarGoLink bar(result->GetRowCount());
do
{
Field* fields = result->Fetch();
bar.step();
int32 entry = fields[0].GetInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
if (chance > 0.000001f && chance <= 100.0f)
{
if (entry > 0)
RandomItemPropEnch[entry].push_back(EnchStoreItem(ench, chance));
else
RandomItemSuffixEnch[-entry].push_back(EnchStoreItem(ench, chance));
}
else
{
sLog.outErrorDb("Item Enchantment %u for entry %i has too high or too low chance %f, skipped.", ench, entry, chance);
continue;
}
++count;
}
while (result->NextRow());
delete result;
sLog.outString();
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
}
else
{
sLog.outString();
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
}
示例2: LoadRandomEnchantmentsTable
void LoadRandomEnchantmentsTable()
{
uint32 oldMSTime = getMSTime();
RandomItemEnch.clear(); // for reload case
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
++count;
} while (result->NextRow());
TC_LOG_INFO("server.loading", ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
TC_LOG_ERROR("server.loading", ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
示例3: LoadRandomEnchantmentsTable
void LoadRandomEnchantmentsTable()
{
RandomItemEnch.clear(); // for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
{
uint32 count = 0;
do
{
Field *fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
++count;
} while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
}
else
{
sLog.outString();
sLog.outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
}
示例4: LoadRandomEnchantmentsTable
void LoadRandomEnchantmentsTable()
{
uint32 oldMSTime = getMSTime();
RandomPropertyItemEnch.clear(); // for reload case
RandomSuffixItemEnch.clear();
// 0 1 2
QueryResult result = WorldDatabase.Query("SELECT entry, ench, chance, type FROM item_enchantment_template");
if (result)
{
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 ench = fields[1].GetUInt32();
float chance = fields[2].GetFloat();
uint32 type = fields[3].GetUInt32();
if (chance > 0.000001f && chance <= 100.0f)
{
if (type == ENCHANTMENT_RANDOM_SUFFIX)
RandomSuffixItemEnch[entry].push_back(EnchStoreItem(ench, chance));
else if (type == ENCHANTMENT_RANDOM_PROPERTY)
RandomPropertyItemEnch[entry].push_back(EnchStoreItem(ench, chance));
}
++count;
}
while (result->NextRow());
sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
示例5: LoadRandomEnchantmentsTable
void LoadRandomEnchantmentsTable()
{
RandomItemEnch.clear(); // for reload case
EnchantmentStore::iterator tab;
uint32 entry, ench;
float chance;
uint32 count = 0;
QueryResultAutoPtr result = GameDataDatabase.Query("SELECT entry, ench, chance FROM item_enchantment_template");
if (result)
{
BarGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
bar.step();
entry = fields[0].GetUInt32();
ench = fields[1].GetUInt32();
chance = fields[2].GetFloat();
if (chance > 0.000001f && chance <= 100.0f)
RandomItemEnch[entry].push_back(EnchStoreItem(ench, chance));
++count;
} while (result->NextRow());
sLog.outString();
sLog.outString(">> Loaded %u Item Enchantment definitions", count);
}
else
{
sLog.outString();
sLog.outLog(LOG_DB_ERR, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
}
}