MCPcopy Create free account
hub / github.com/ZDoom/Raze / InsertMap

Function InsertMap

source/core/menu/usermap.cpp:54–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52static FUsermapDirectory root;
53
54void InsertMap(int lumpnum)
55{
56 FString filename = fileSystem.GetFileFullName(lumpnum);
57 auto path = filename.Split("/");
58
59 auto current = &root;
60 for (unsigned i = 0; i < path.Size() - 1; i++)
61 {
62 unsigned place = current->subdirectories.FindEx([=](const FUsermapDirectory& entry) { return entry.dirname.CompareNoCase(path[i]) == 0; });
63 if (place == current->subdirectories.Size())
64 {
65 place = current->subdirectories.Reserve(1);
66 current->subdirectories.Last().dirname = path[i];
67 }
68 current = &current->subdirectories[place];
69 }
70 current->entries.Reserve(1);
71 current->entries.Last().displayname = path.Last();
72 current->entries.Last().filename = fileSystem.GetFileFullName(lumpnum);
73 current->entries.Last().container = fileSystem.GetResourceFileName(fileSystem.GetFileContainer(lumpnum));
74 current->entries.Last().size = (int)fileSystem.FileLength(lumpnum);
75 auto mapinfo = FindMapByName(StripExtension(path.Last().GetChars()).GetChars());
76 if (mapinfo) current->entries.Last().info = mapinfo->name;
77}
78
79bool ValidateMap(int lumpnum)
80{

Callers 1

ReadUserMapsFunction · 0.85

Calls 12

FindMapByNameFunction · 0.85
StripExtensionFunction · 0.85
GetFileFullNameMethod · 0.80
SplitMethod · 0.80
FindExMethod · 0.80
CompareNoCaseMethod · 0.80
ReserveMethod · 0.80
GetResourceFileNameMethod · 0.80
GetFileContainerMethod · 0.80
FileLengthMethod · 0.80
SizeMethod · 0.45
GetCharsMethod · 0.45

Tested by

no test coverage detected