MCPcopy Create free account
hub / github.com/crawl/crawl / _parse_maps

Function _parse_maps

crawl-ref/source/maps.cc:1483–1518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1481}
1482
1483static void _parse_maps(const string &s)
1484{
1485 string cache_name = get_cache_name(s);
1486 if (map_files_read.count(cache_name))
1487 return;
1488
1489 map_files_read.insert(cache_name);
1490
1491 if (_load_map_cache(s, cache_name))
1492 return;
1493
1494 FILE *dat = fopen_u(s.c_str(), "r");
1495 if (!dat)
1496 end(1, true, "Failed to open %s for reading", s.c_str());
1497
1498#if defined(DEBUG_DIAGNOSTICS) && !(defined(TARGET_COMPILER_VC) && defined(USE_TILE))
1499 printf("Regenerating des: %s\n", s.c_str());
1500#endif
1501 // won't be seen by the user unless they look for it
1502 mprf(MSGCH_PLAIN, "Regenerating des: %s", s.c_str());
1503
1504 time_t mtime = file_modtime(dat);
1505 _reset_map_parser();
1506
1507 extern int yyparse();
1508 extern FILE *yyin;
1509 yyin = dat;
1510
1511 const size_t file_start = vdefs.size();
1512 yyparse();
1513 fclose(dat);
1514
1515 global_preludes.push_back(lc_global_prelude);
1516
1517 _write_map_cache(cache_name, file_start, vdefs.size(), mtime);
1518}
1519
1520void read_map(const string &file)
1521{

Callers 1

read_mapFunction · 0.85

Calls 13

get_cache_nameFunction · 0.85
_load_map_cacheFunction · 0.85
fopen_uFunction · 0.85
endFunction · 0.85
mprfFunction · 0.85
file_modtimeFunction · 0.85
_reset_map_parserFunction · 0.85
yyparseFunction · 0.85
_write_map_cacheFunction · 0.85
countMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected