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

Function LoadItems

shared_memory/items.cpp:27–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25#include "../common/item_data.h"
26
27void LoadItems(SharedDatabase *database, const std::string &prefix) {
28 EQ::IPCMutex mutex("items");
29 mutex.Lock();
30
31 int32 items = -1;
32 uint32 max_item = 0;
33 database->GetItemsCount(items, max_item);
34 if(items == -1) {
35 EQ_EXCEPT("Shared Memory", "Unable to get any items from the database.");
36 }
37
38 uint32 size = static_cast<uint32>(EQ::FixedMemoryHashSet<EQ::ItemData>::estimated_size(items, max_item));
39
40 auto Config = EQEmuConfig::get();
41 std::string file_name = Config->SharedMemDir + prefix + std::string("items");
42 EQ::MemoryMappedFile mmf(file_name, size);
43 mmf.ZeroFile();
44
45 void *ptr = mmf.Get();
46 database->LoadItems(ptr, size, items, max_item);
47 mutex.Unlock();
48}

Callers 2

ConnectMethod · 0.85
mainFunction · 0.85

Calls 8

stringFunction · 0.85
GetItemsCountMethod · 0.80
ZeroFileMethod · 0.80
UnlockMethod · 0.80
getFunction · 0.50
LockMethod · 0.45
GetMethod · 0.45
LoadItemsMethod · 0.45

Tested by

no test coverage detected