MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / LoadSpells

Method LoadSpells

common/shareddb.cpp:1645–1668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1643}
1644
1645bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp) {
1646 spells_mmf.reset(nullptr);
1647
1648 try {
1649 const auto Config = EQEmuConfig::get();
1650 EQ::IPCMutex mutex("spells");
1651 mutex.Lock();
1652
1653 std::string file_name = fmt::format("{}/{}{}", PathManager::Instance()->GetSharedMemoryPath(), prefix, std::string("spells"));
1654 spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
1655 LogInfo("Loading [{}]", file_name);
1656 *records = *static_cast<uint32*>(spells_mmf->Get());
1657 *sp = reinterpret_cast<const SPDat_Spell_Struct*>(static_cast<char*>(spells_mmf->Get()) + 4);
1658 mutex.Unlock();
1659
1660 LogInfo("Loaded [{}] spells via shared memory", Strings::Commify(m_shared_spells_count));
1661 }
1662 catch(std::exception& ex) {
1663 LogError("Error Loading Spells: {}", ex.what());
1664 return false;
1665 }
1666
1667 return true;
1668}
1669
1670void SharedDatabase::LoadSpells(void *data, int max_spells) {
1671 *static_cast<uint32*>(data) = max_spells;

Callers 3

HandleMessageMethod · 0.80
mainFunction · 0.80
LoadSpellsFunction · 0.80

Calls 12

stringFunction · 0.85
UnlockMethod · 0.80
SuccessMethod · 0.80
strn0cpyFunction · 0.70
getFunction · 0.50
resetMethod · 0.45
LockMethod · 0.45
GetMethod · 0.45
whatMethod · 0.45
ColumnCountMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected