MCPcopy Create free account
hub / github.com/NetHack/NetHack / load_mapseen

Function load_mapseen

src/dungeon.c:2720–2754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2718#endif /* !SFCTOOL */
2719
2720staticfn mapseen *
2721load_mapseen(NHFILE *nhfp)
2722{
2723 int i, branchnum = 0, brindx;
2724 mapseen *load;
2725 branch *curr;
2726
2727 load = (mapseen *) alloc(sizeof *load);
2728
2729 Sfi_int(nhfp, &branchnum, "mapseen-branch_index");
2730 for (brindx = 0, curr = svb.branches; curr; curr = curr->next, ++brindx)
2731 if (brindx == branchnum)
2732 break;
2733 load->br = curr;
2734
2735 Sfi_d_level(nhfp, &load->lev, "mapseen-d_level");
2736 Sfi_mapseen_feat(nhfp, &load->feat, "mapseen-feat");
2737 Sfi_mapseen_flags(nhfp, &load->flags, "mapseen-flags");
2738 Sfi_unsigned(nhfp, &load->custom_lth, "mapseen-custom_lth");
2739
2740 if (load->custom_lth) {
2741 /* length doesn't include terminator (which isn't saved & restored) */
2742 load->custom = (char *) alloc(load->custom_lth + 1);
2743 Sfi_char(nhfp, load->custom, "mapseen-custom",
2744 (int) load->custom_lth);
2745 load->custom[load->custom_lth] = '\0';
2746 } else {
2747 load->custom = 0;
2748 }
2749 for (i = 0; i < ((MAXNROFROOMS + 1) * 2); ++i) {
2750 Sfi_mapseen_rooms(nhfp, &load->msrooms[i], "mapseen-msrooms");
2751 }
2752 restcemetery(nhfp, &load->final_resting_place);
2753 return load;
2754}
2755#ifndef SFCTOOL
2756
2757DISABLE_WARNING_FORMAT_NONLITERAL

Callers 1

restore_dungeonFunction · 0.85

Calls 2

restcemeteryFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected