| 1481 | } |
| 1482 | |
| 1483 | static 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 | |
| 1520 | void read_map(const string &file) |
| 1521 | { |
no test coverage detected