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

Function loaddefinitionsfile

source/core/defparser.cpp:1942–1988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1940}
1941
1942void loaddefinitionsfile(TilesetBuildInfo& info, const char* fn, bool cumulative, bool maingame)
1943{
1944 tbuild = &info;
1945 bool done = false;
1946 auto parseit = [&](int lump)
1947 {
1948 FScanner sc;
1949 sc.OpenLumpNum(lump);
1950 defsparser(sc);
1951 done = true;
1952 Printf(PRINT_NONOTIFY, "\n");
1953 };
1954
1955 cycle_t deftimer;
1956 deftimer.Reset();
1957
1958 auto printtimer = [&](const char* fn)
1959 {
1960 deftimer.Unclock();
1961 DPrintf(DMSG_SPAMMY, "Definitions file \"%s\" loaded, %f ms.\n", fn, deftimer.TimeMS());
1962 deftimer.Reset();
1963 };
1964
1965 if (!cumulative)
1966 {
1967 int lump = fileSystem.FindFile(fn);
1968 if (lump >= 0)
1969 {
1970 Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fn);
1971 deftimer.Clock();
1972 parseit(lump);
1973 printtimer(fn);
1974 }
1975 }
1976 else
1977 {
1978 int lump, lastlump = 0;
1979 while ((lump = fileSystem.FindLumpFullName(fn, &lastlump)) >= 0)
1980 {
1981 if (maingame && fileSystem.GetFileContainer(lump) > fileSystem.GetMaxIwadNum()) break;
1982 Printf(PRINT_NONOTIFY, "Loading \"%s\"\n", fileSystem.GetFileFullPath(lump).c_str());
1983 deftimer.Clock();
1984 parseit(lump);
1985 printtimer(fn);
1986 }
1987 }
1988}

Callers 1

LoadDefinitionsFunction · 0.85

Calls 13

defsparserFunction · 0.85
PrintfFunction · 0.85
DPrintfFunction · 0.85
TimeMSMethod · 0.80
FindFileMethod · 0.80
FindLumpFullNameMethod · 0.80
GetFileContainerMethod · 0.80
GetMaxIwadNumMethod · 0.80
c_strMethod · 0.80
GetFileFullPathMethod · 0.80
ResetMethod · 0.45
UnclockMethod · 0.45

Tested by

no test coverage detected