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

Function save_bubbles

src/save.c:590–613  ·  view source on GitHub ↗

save Plane of Water's air bubbles and Plane of Air's clouds */

Source from the content-addressed store, hash-verified

588
589/* save Plane of Water's air bubbles and Plane of Air's clouds */
590staticfn void
591save_bubbles(NHFILE *nhfp, xint8 lev)
592{
593 xint8 bbubbly;
594
595 /* air bubbles and clouds used to be saved as part of game state
596 because restoring them needs dungeon data that isn't available
597 during the first pass of their levels; now that they are part of
598 the current level instead, we write a zero or non-zero marker
599 so that restore can determine whether they are present even when
600 u.uz and ledger_no() aren't available to it yet */
601 bbubbly = 0;
602 if (lev == ledger_no(&water_level) || lev == ledger_no(&air_level))
603 bbubbly = lev; /* non-zero */
604 if (update_file(nhfp))
605 Sfo_xint8(nhfp, &bbubbly, "bubbles-bbubbly");
606#if 0
607 if (nhfp->structlevel)
608 xxwrite(nhfp->fd, (genericptr_t) &bbubbly, sizeof bbubbly);
609#endif
610
611 if (bbubbly)
612 save_waterlevel(nhfp); /* save air bubbles or clouds */
613}
614
615/* used when saving a level and also when saving dungeon overview data */
616void

Callers 1

savelev_coreFunction · 0.85

Calls 3

ledger_noFunction · 0.85
update_fileFunction · 0.85
save_waterlevelFunction · 0.85

Tested by

no test coverage detected