MCPcopy Index your code
hub / github.com/NetHack/NetHack / free_tutorial

Function free_tutorial

src/nhlua.c:1804–1833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1802}
1803
1804RESTORE_WARNING_UNREACHABLE_CODE
1805
1806/* free dynamic date allocated when entering tutorial;
1807 called when exiting tutorial normally or if player quits while in it */
1808void
1809free_tutorial(void)
1810{
1811 struct obj *otmp;
1812
1813 /* for normal tutorial exit, gmst_invent will already be Null */
1814 while ((otmp = gg.gmst_invent) != 0) {
1815 /* set otmp->where = OBJ_FREE, otmp->nobj = NULL */
1816 extract_nobj(otmp, &gg.gmst_invent);
1817 /* gmst_invent is a list of invent items sequestered when entering
1818 the tutorial; for them, owornmask is used as a flag to re-wear
1819 them when exiting tutorial, not that they are currently worn;
1820 clear it to avoid a "deleting worn obj" complaint from obfree() */
1821 otmp->owornmask = 0L;
1822 /* dealloc_obj() isn't enough (for containers, it assumes that
1823 caller has already freed their contents) */
1824 obfree(otmp, (struct obj *) 0);
1825 }
1826
1827 if (gg.gmst_ubak)
1828 free(gg.gmst_ubak), gg.gmst_ubak = NULL;
1829 if (gg.gmst_disco)
1830 free(gg.gmst_disco), gg.gmst_disco = NULL;
1831 if (gg.gmst_mvitals)
1832 free(gg.gmst_mvitals), gg.gmst_mvitals = NULL;
1833}
1834
1835/* called from gotolevel(do.c) */
1836void

Callers 2

nhl_gamestateFunction · 0.85
freedynamicdataFunction · 0.85

Calls 2

extract_nobjFunction · 0.85
obfreeFunction · 0.85

Tested by

no test coverage detected