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

Function LoadSpells

shared_memory/spells.cpp:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include "../common/spdat.h"
26
27void LoadSpells(SharedDatabase *database, const std::string &prefix) {
28 EQ::IPCMutex mutex("spells");
29 mutex.Lock();
30 int records = database->GetMaxSpellID() + 1;
31 if(records == 0) {
32 EQ_EXCEPT("Shared Memory", "Unable to get any spells from the database.");
33 }
34
35 uint32 size = records * sizeof(SPDat_Spell_Struct) + sizeof(uint32);
36
37 auto Config = EQEmuConfig::get();
38 std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
39 EQ::MemoryMappedFile mmf(file_name, size);
40 mmf.ZeroFile();
41
42 void *ptr = mmf.Get();
43 database->LoadSpells(ptr, records);
44 mutex.Unlock();
45}
46

Callers 1

mainFunction · 0.85

Calls 8

stringFunction · 0.85
GetMaxSpellIDMethod · 0.80
ZeroFileMethod · 0.80
LoadSpellsMethod · 0.80
UnlockMethod · 0.80
getFunction · 0.50
LockMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected