本文整理汇总了C++中DB2Storage类的典型用法代码示例。如果您正苦于以下问题:C++ DB2Storage类的具体用法?C++ DB2Storage怎么用?C++ DB2Storage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DB2Storage类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadDB2
inline void LoadDB2(uint32& availableDb2Locales, StoreProblemList1& errlist, DB2Storage<T>& storage, const std::string& db2_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str()))
{
for (uint8 loc = 1; loc < TOTAL_LOCALES; ++loc)
{
if (!(availableDb2Locales & (1 << loc)))
continue;
std::string localizedFileName = db2_path + localeNames[loc] + "/" + filename;
if (!storage.LoadStringsFrom(localizedFileName.c_str(), loc))
availableDb2Locales &= ~(1<<loc); // mark locale as not available
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
FILE * f = fopen(db2_filename.c_str(), "rb");
if (f)
{
char buf[100];
snprintf(buf, 100, "(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
}
示例2: LoadDB2
inline void LoadDB2(uint32& availableDb2Locales, StoreProblemList1& errlist, DB2Storage<T>& storage, const std::string& db2_path, const std::string& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str()))
{
//bar.step();
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
FILE * f = fopen(db2_filename.c_str(), "rb");
if (f)
{
char buf[100];
snprintf(buf, 100,"(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
}
示例3: LoadDB2
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Storage<T>& storage, std::string const& db2_path, std::string const& filename)
{
// compatibility format and C++ structure sizes
if (!(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename)))
return;
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale())))
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
{
if (!(availableDb2Locales & (1 << i)))
continue;
if (uint32(sWorld->GetDefaultDbcLocale()) == i)
continue;
std::string localizedName(db2_path);
localizedName.append(localeNames[i]);
localizedName.push_back('/');
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str(), i))
availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2_filename.c_str(), "rb"))
{
char buf[100];
snprintf(buf, 100,"(exist, but have %d fields instead " SIZEFMTD ") Wrong client version DBC file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errlist.push_back(db2_filename + buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
DB2Stores[storage.GetHash()] = &storage;
}
示例4: LoadDB2
inline void LoadDB2(uint32& availableDb2Locales, DB2StoreProblemList& errlist, DB2Storage<T>& storage, std::string const& db2_path, std::string const& filename)
{
// compatibility format and C++ structure sizes
ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FilesCount;
std::string db2_filename = db2_path + filename;
if (storage.Load(db2_filename.c_str(), uint32(sWorld->GetDefaultDbcLocale())))
{
for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
{
if (!(availableDb2Locales & (1 << i)))
continue;
if (uint32(sWorld->GetDefaultDbcLocale()) == i)
continue;
std::string localizedName(db2_path);
localizedName.append(localeNames[i]);
localizedName.push_back('/');
localizedName.append(filename);
if (!storage.LoadStringsFrom(localizedName.c_str(), i))
availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2_filename.c_str(), "rb"))
{
std::ostringstream stream;
stream << db2_filename << " exists, and has " << storage.GetFieldCount() << " field(s) (expected " << strlen(storage.GetFormat()) << "). Extracted file might be from wrong client version or a database-update has been forgotten.";
std::string buf = stream.str();
errlist.push_back(buf);
fclose(f);
}
else
errlist.push_back(db2_filename);
}
DB2Stores[storage.GetHash()] = &storage;
}
示例5: LoadDB2
inline void LoadDB2(LocalDB2Data& localeData, StoreProblemList1& errors, DB2Storage<T>& storage, std::string const& db2Path, std::string const& filename)
{
// compatibility format and C++ structure sizes
MANGOS_ASSERT(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDB2_assert_print(DB2FileLoader::GetFormatRecordSize(storage.GetFormat()), sizeof(T), filename));
++DB2FileCount;
std::string db2Filename = db2Path + filename;
if (storage.Load(db2Filename.c_str(), localeData.defaultLocale))
{
for(uint8 i = 0; fullLocaleNameList[i].name; ++i)
{
if (!(localeData.availableDb2Locales & (1 << i)))
continue;
LocaleNameStr const* localStr = &fullLocaleNameList[i];
std::string db2_dir_loc = db2Path + localStr->name + "/";
std::string localizedName = db2Path + localStr->name + "/" + filename;
if(!storage.LoadStringsFrom(localizedName.c_str(), localStr->locale))
localeData.availableDb2Locales &= ~(1<<i); // mark as not available for speedup next checks
}
}
else
{
// sort problematic db2 to (1) non compatible and (2) nonexistent
if (FILE* f = fopen(db2Filename.c_str(), "rb"))
{
char buf[100];
snprintf(buf, 100, " (exist, but have %d fields instead " SIZEFMTD ") Wrong client version DB2 file?", storage.GetFieldCount(), strlen(storage.GetFormat()));
errors.push_back(db2Filename + buf);
fclose(f);
}
else
errors.push_back(db2Filename);
}
}
示例6:
uint32 DB2Manager::GetQuestUniqueBitFlag(uint32 questId)
{
QuestV2Entry const* v2 = sQuestV2Store.LookupEntry(questId);
if (!v2)
return 0;
return v2->UniqueBitFlag;
}
示例7: LoadDB2Stores
void LoadDB2Stores(std::string const& dataPath)
{
std::string db2Path = dataPath + "dbc/";
DB2StoreProblemList bad_db2_files;
uint32 availableDb2Locales = 0xFF;
LoadDB2(availableDb2Locales, bad_db2_files, sBroadcastTextStore, db2Path, "BroadcastText.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sKeyChainStore, db2Path, "KeyChain.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSceneScriptStore, db2Path, "SceneScript.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellReagentsStore, db2Path, "SpellReagents.db2");
// error checks
if (bad_db2_files.size() >= DB2FilesCount)
{
TC_LOG_ERROR("misc", "\nIncorrect DataDir value in worldserver.conf or ALL required *.db2 files (%d) not found by path: %sdb2", DB2FilesCount, dataPath.c_str());
exit(1);
}
else if (!bad_db2_files.empty())
{
std::string str;
for (std::list<std::string>::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
str += *i + "\n";
TC_LOG_ERROR("misc", "\nSome required *.db2 files (%u from %d) not found or not compatible:\n%s", (uint32)bad_db2_files.size(), DB2FilesCount, str.c_str());
exit(1);
}
// Check loaded DB2 files proper version
if (!sBroadcastTextStore.LookupEntry(77161) || // last broadcast text added in 5.4.7 (17956)
!sItemStore.LookupEntry(109014) || // last item added in 5.4.7 (17956)
!sItemExtendedCostStore.LookupEntry(5268) || // last item extended cost added in 5.4.7 (17956)
!sSceneScriptStore.LookupEntry(11156)) // last scene script added in 5.4.7 (17956)
{
TC_LOG_ERROR("misc", "You have _outdated_ DB2 files, Please extract correct db2 files from client 5.4.7 17956.");
exit(1);
}
TC_LOG_INFO("misc", ">> Initialized %d DB2 data stores.", DB2FilesCount);
}
示例8: LoadDB2Stores
void LoadDB2Stores(std::string const& dataPath)
{
std::string db2Path = dataPath + "dbc/";
DB2StoreProblemList bad_db2_files;
uint32 availableDb2Locales = 0xFF;
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sKeyChainStore, db2Path, "KeyChain.db2");
// error checks
if (bad_db2_files.size() >= DB2FilesCount)
{
TC_LOG_ERROR(LOG_FILTER_GENERAL, "\nIncorrect DataDir value in worldserver.conf or ALL required *.db2 files (%d) not found by path: %sdb2", DB2FilesCount, dataPath.c_str());
exit(1);
}
else if (!bad_db2_files.empty())
{
std::string str;
for (std::list<std::string>::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
str += *i + "\n";
TC_LOG_ERROR(LOG_FILTER_GENERAL, "\nSome required *.db2 files (%u from %d) not found or not compatible:\n%s", (uint32)bad_db2_files.size(), DB2FilesCount, str.c_str());
exit(1);
}
// Check loaded DB2 files proper version
if (!sItemStore.LookupEntry(106130) || // last item added in 5.4.0 (17399)
!sItemExtendedCostStore.LookupEntry(5268)) // last item extended cost added in 5.4.0 (17399)
{
TC_LOG_ERROR(LOG_FILTER_GENERAL, "Please extract correct db2 files from client 5.4.0 17399.");
//exit(1);
}
TC_LOG_ERROR(LOG_FILTER_GENERAL, ">> Initialized %d DB2 data stores.", DB2FilesCount);
}
示例9: LoadDB2Stores
void LoadDB2Stores(std::string const& dataPath)
{
std::string db2Path = dataPath + "dbc/";
DB2StoreProblemList bad_db2_files;
uint32 availableDb2Locales = 0xFF;
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetAbilityStore, db2Path, "BattlePetAbility.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetAbilityStateStore, db2Path, "BattlePetAbilityState.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetBreedStateStore, db2Path, "BattlePetBreedState.db2");
for (uint32 i = 0; i < sBattlePetBreedStateStore.GetNumRows(); i++)
if (BattlePetBreedStateEntry const* breedStateEntry = sBattlePetBreedStateStore.LookupEntry(i))
if (sBattlePetBreedSet.find(breedStateEntry->BreedId) == sBattlePetBreedSet.end())
sBattlePetBreedSet.insert(breedStateEntry->BreedId);
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetSpeciesStore, db2Path, "BattlePetSpecies.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetSpeciesStateStore, db2Path, "BattlePetSpeciesState.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetSpeciesXAbilityStore, db2Path, "BattlePetSpeciesXAbility.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sBattlePetStateStore, db2Path, "BattlePetState.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemToBattlePetStore, db2Path, "ItemToBattlePet.db2");
for (uint32 i = 0; i < sItemToBattlePetStore.GetNumRows(); i++)
if (ItemToBattlePetEntry const* itemEntry = sItemToBattlePetStore.LookupEntry(i))
sBattlePetItemXSpeciesStore.insert(std::make_pair(itemEntry->ItemId, itemEntry->SpeciesId));
LoadDB2(availableDb2Locales, bad_db2_files, sBroadcastTextStore, db2Path, "BroadcastText.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemStore, db2Path, "Item.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemCurrencyCostStore, db2Path, "ItemCurrencyCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemSparseStore, db2Path, "Item-sparse.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sItemExtendedCostStore, db2Path, "ItemExtendedCost.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sKeyChainStore, db2Path, "KeyChain.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sQuestPackageItemStore, db2Path, "QuestPackageItem.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSceneScriptStore, db2Path, "SceneScript.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sSpellReagentsStore, db2Path, "SpellReagents.db2");
// error checks
if (bad_db2_files.size() >= DB2FilesCount)
{
TC_LOG_ERROR("misc", "\nIncorrect DataDir value in worldserver.conf or ALL required *.db2 files (%d) not found by path: %sdbc", DB2FilesCount, dataPath.c_str());
exit(1);
}
else if (!bad_db2_files.empty())
{
std::string str;
for (std::list<std::string>::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
str += *i + "\n";
TC_LOG_ERROR("misc", "\nSome required *.db2 files (%u from %d) not found or not compatible:\n%s", (uint32)bad_db2_files.size(), DB2FilesCount, str.c_str());
exit(1);
}
// Check loaded DB2 files proper version
if (!sBattlePetAbilityStore.LookupEntry(1238) // last battle pet ability added in 5.4.8 (18414)
|| !sBattlePetSpeciesStore.LookupEntry(1386) // last battle pet species added in 5.4.8 (18414)
|| !sBattlePetStateStore.LookupEntry(176) // last battle pet state added in 5.4.8 (18414)
|| !sItemToBattlePetStore.LookupEntry(109014) // last battle pet item added in 5.4.8 (18414)
|| !sBroadcastTextStore.LookupEntry(77161) // last broadcast text added in 5.4.8 (18414)
|| !sItemStore.LookupEntry(112353) // last item added in 5.4.8 (18414)
|| !sItemExtendedCostStore.LookupEntry(5280) // last item extended cost added in 5.4.8 (18414)
|| !sQuestPackageItemStore.LookupEntry(2256) // last quest package item in 5.4.8 (18414)
|| !sSceneScriptStore.LookupEntry(11156)) // last scene script added in 5.4.8 (18414)
{
TC_LOG_ERROR("misc", "You have _outdated_ DB2 files, Please extract correct db2 files from client 5.4.8 18414.");
exit(1);
}
TC_LOG_INFO("misc", ">> Initialized %d DB2 data stores.", DB2FilesCount);
}
示例10: if
void DB2Manager::LoadStores(std::string const& dataPath)
{
uint32 oldMSTime = getMSTime();
std::string db2Path = dataPath + "dbc/";
DB2StoreProblemList bad_db2_files;
uint32 availableDb2Locales = 0xFF;
#define LOAD_DB2(store) LoadDB2(availableDb2Locales, bad_db2_files, _stores, &store, db2Path)
LOAD_DB2(sAreaGroupMemberStore);
LOAD_DB2(sAreaGroupStore);
LOAD_DB2(sAuctionHouseStore);
LOAD_DB2(sBarberShopStyleStore);
LOAD_DB2(sBroadcastTextStore);
LOAD_DB2(sCharStartOutfitStore);
LOAD_DB2(sChrClassesXPowerTypesStore);
LOAD_DB2(sCinematicSequencesStore);
LOAD_DB2(sCreatureDisplayInfoStore);
LOAD_DB2(sCreatureTypeStore);
LOAD_DB2(sCurrencyTypesStore);
LOAD_DB2(sCurvePointStore);
LOAD_DB2(sDestructibleModelDataStore);
LOAD_DB2(sDurabilityQualityStore);
LOAD_DB2(sGameObjectsStore);
LOAD_DB2(sGameTablesStore);
LOAD_DB2(sGarrAbilityStore);
LOAD_DB2(sGarrBuildingPlotInstStore);
LOAD_DB2(sGarrBuildingStore);
LOAD_DB2(sGarrClassSpecStore);
LOAD_DB2(sGarrFollowerStore);
LOAD_DB2(sGarrFollowerXAbilityStore);
LOAD_DB2(sGarrPlotBuildingStore);
LOAD_DB2(sGarrPlotInstanceStore);
LOAD_DB2(sGarrPlotStore);
LOAD_DB2(sGarrSiteLevelPlotInstStore);
LOAD_DB2(sGarrSiteLevelStore);
LOAD_DB2(sGlyphSlotStore);
LOAD_DB2(sGuildPerkSpellsStore);
LOAD_DB2(sHolidaysStore);
LOAD_DB2(sImportPriceArmorStore);
LOAD_DB2(sImportPriceQualityStore);
LOAD_DB2(sImportPriceShieldStore);
LOAD_DB2(sImportPriceWeaponStore);
LOAD_DB2(sItemAppearanceStore);
LOAD_DB2(sItemBonusStore);
LOAD_DB2(sItemBonusTreeNodeStore);
LOAD_DB2(sItemClassStore);
LOAD_DB2(sItemCurrencyCostStore);
LOAD_DB2(sItemDisenchantLootStore);
LOAD_DB2(sItemEffectStore);
LOAD_DB2(sItemExtendedCostStore);
LOAD_DB2(sItemLimitCategoryStore);
LOAD_DB2(sItemModifiedAppearanceStore);
LOAD_DB2(sItemPriceBaseStore);
LOAD_DB2(sItemRandomPropertiesStore);
LOAD_DB2(sItemRandomSuffixStore);
LOAD_DB2(sItemSparseStore);
LOAD_DB2(sItemSpecOverrideStore);
LOAD_DB2(sItemSpecStore);
LOAD_DB2(sItemStore);
LOAD_DB2(sItemXBonusTreeStore);
LOAD_DB2(sKeyChainStore);
LOAD_DB2(sMailTemplateStore);
LOAD_DB2(sMountCapabilityStore);
LOAD_DB2(sMountStore);
LOAD_DB2(sMountTypeXCapabilityStore);
LOAD_DB2(sNameGenStore);
LOAD_DB2(sOverrideSpellDataStore);
LOAD_DB2(sPhaseXPhaseGroupStore);
LOAD_DB2(sQuestMoneyRewardStore);
LOAD_DB2(sQuestPackageItemStore);
LOAD_DB2(sQuestSortStore);
LOAD_DB2(sQuestV2Store);
LOAD_DB2(sQuestXPStore);
LOAD_DB2(sScalingStatDistributionStore);
LOAD_DB2(sSoundEntriesStore);
LOAD_DB2(sSpecializationSpellsStore);
LOAD_DB2(sSpellAuraRestrictionsStore);
LOAD_DB2(sSpellCastTimesStore);
LOAD_DB2(sSpellCastingRequirementsStore);
LOAD_DB2(sSpellClassOptionsStore);
LOAD_DB2(sSpellDurationStore);
LOAD_DB2(sSpellItemEnchantmentConditionStore);
LOAD_DB2(sSpellLearnSpellStore);
LOAD_DB2(sSpellMiscStore);
LOAD_DB2(sSpellPowerDifficultyStore);
LOAD_DB2(sSpellPowerStore);
LOAD_DB2(sSpellRadiusStore);
LOAD_DB2(sSpellRangeStore);
LOAD_DB2(sSpellReagentsStore);
LOAD_DB2(sSpellRuneCostStore);
LOAD_DB2(sSpellTotemsStore);
LOAD_DB2(sSpellXSpellVisualStore);
LOAD_DB2(sTaxiNodesStore);
LOAD_DB2(sTaxiPathNodeStore);
LOAD_DB2(sTaxiPathStore);
LOAD_DB2(sTotemCategoryStore);
LOAD_DB2(sTransportAnimationStore);
//.........这里部分代码省略.........