Restructure u_init to allow for inventory rerolling

This doesn't implement inventory rerolling, just adds the
infrastructure: it's now possible to call u_init_inventory_attrs
multiple times and the starting inventory/attributes replace those
from the previous call rather than compounding.
This commit is contained in:
Alex Smith
2025-11-30 04:52:13 +00:00
parent d41cea8286
commit e428046ffa
3 changed files with 88 additions and 51 deletions

View File

@@ -786,7 +786,7 @@ newgame(void)
* in hero's initial inventory */
init_artifacts(); /* before u_init() in case $WIZKIT specifies
* any artifacts */
u_init();
u_init_misc();
l_nhcore_init(); /* create a Lua state that lasts until end of game */
reset_glyphmap(gm_newgame);
@@ -801,14 +801,15 @@ newgame(void)
mklev();
u_on_upstairs();
if (wizard)
obj_delivery(FALSE); /* finish wizkit */
vision_reset(); /* set up internals for level (after mklev) */
check_special_room(FALSE);
if (MON_AT(u.ux, u.uy))
mnexto(m_at(u.ux, u.uy), RLOC_NOMSG);
(void) makedog();
u_init_inventory_attrs();
u_init_skills_discoveries();
docrt();
if (flags.legacy) {