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

Function savefruitchn

src/save.c:950–971  ·  view source on GitHub ↗

save all the fruit names and ID's; this is used only in saving whole games * (not levels) and in saving bones levels. When saving a bones level, * we only want to save the fruits which exist on the bones level; the bones * level routine marks nonexistent fruits by making the fid negative. */

Source from the content-addressed store, hash-verified

948 * level routine marks nonexistent fruits by making the fid negative.
949 */
950void
951savefruitchn(NHFILE *nhfp)
952{
953 static struct fruit zerofruit;
954 struct fruit *f2, *f1;
955
956 f1 = gf.ffruit;
957 while (f1) {
958 f2 = f1->nextf;
959 if (f1->fid >= 0 && update_file(nhfp)) {
960 Sfo_fruit(nhfp, f1, "fruit");
961 }
962 if (release_data(nhfp))
963 dealloc_fruit(f1);
964 f1 = f2;
965 }
966 if (update_file(nhfp)) {
967 Sfo_fruit(nhfp, &zerofruit, "fruit");
968 }
969 if (release_data(nhfp))
970 gf.ffruit = 0;
971}
972
973staticfn void
974savelevchn(NHFILE *nhfp)

Callers 2

savebonesFunction · 0.85
savegamestateFunction · 0.85

Calls 1

update_fileFunction · 0.85

Tested by

no test coverage detected