| 1940 | } |
| 1941 | |
| 1942 | void 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 | } |
no test coverage detected