make program_state initialization a discrete step

Having it rolled into decl_globals_init() was
causing some early options to misbehave because
those early options were trying to use program_state
fields to determine their behavior, but decl_globals_init()
was resetting the program_state fields that were being used
to do that.
This commit is contained in:
nhmall
2026-04-22 11:15:19 -04:00
parent 0a51a9656e
commit 965e1bf99d
3 changed files with 8 additions and 1 deletions

View File

@@ -510,6 +510,7 @@ extern void destroy_drawbridge(coordxy, coordxy);
/* ### decl.c ### */ /* ### decl.c ### */
extern void program_state_init(void);
extern void decl_globals_init(void); extern void decl_globals_init(void);
extern void sa_victual(volatile struct victual_info *); extern void sa_victual(volatile struct victual_info *);

View File

@@ -32,6 +32,7 @@ staticfn void interrupt_multi(const char *);
void void
early_init(int argc USED_FOR_CRASHREPORT, char *argv[] USED_FOR_CRASHREPORT) early_init(int argc USED_FOR_CRASHREPORT, char *argv[] USED_FOR_CRASHREPORT)
{ {
program_state_init();
#ifdef CRASHREPORT #ifdef CRASHREPORT
/* Do this as early as possible, but let ports do other things first. */ /* Do this as early as possible, but let ports do other things first. */
crashreport_init(argc, argv); crashreport_init(argc, argv);

View File

@@ -1063,6 +1063,12 @@ const struct const_globals cg = {
} \ } \
} while(0); } while(0);
void
program_state_init(void)
{
program_state = init_program_state;
}
void void
decl_globals_init(void) decl_globals_init(void)
{ {
@@ -1114,7 +1120,6 @@ decl_globals_init(void)
svu = init_svu; svu = init_svu;
svx = init_svx; svx = init_svx;
svy = init_svy; svy = init_svy;
program_state = init_program_state;
gv.valuables[0].list = gg.gems; gv.valuables[0].list = gg.gems;
gv.valuables[0].size = SIZE(gg.gems); gv.valuables[0].size = SIZE(gg.gems);