Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize non-static data after static #19618

Closed
wants to merge 1 commit into from

Conversation

mugling
Copy link
Contributor

@mugling mugling commented Dec 3, 2016

As noted by @mutability in #19583 auto pickup and safe mode depend on non-static data so shouldn't be initialized in load_static_data

// Load everything that will not depend on any mods
void game::load_static_data() {
    ....
    // The content they load/initialize is hardcoded into the program.
    // Therefore they can be loaded here.
    // If this changes (if they load data from json), they have to
    // be moved to game::load_mod or game::load_core_data

@mutability
Copy link
Contributor

(from the other issue)

It seems OK to load the global autopickup config [early on] since it's just text and doesn't directly depend on any sort of moddable data, but it doesn't make sense to actually match them up to items (in create_rules()) until the world is loaded.

Delaying the loading of global rules entirely is trickier since you can edit the global rules from the settings menu with no world loaded at all.

@mutability
Copy link
Contributor

A quick workaround would be to bail out of create_rules() immediately if( !g->u ) (or whatever the right test for "actually in a game" is)

@mugling
Copy link
Contributor Author

mugling commented Dec 4, 2016

Can you PR that. I'm not quite sure what you mean.

@mutability
Copy link
Contributor

Not going to get to it tonight, sorry, I have an early flight in a couple of days and I need to get my sleep schedule back in sync..

@mugling
Copy link
Contributor Author

mugling commented Dec 4, 2016

No worries, we'll see what the morning brings

@mugling
Copy link
Contributor Author

mugling commented Dec 4, 2016

Replaced by #19626

@mugling mugling closed this Dec 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants