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

Chapter 9: May not need maintain after each RunState call to dispatch #173

Open
umaYnit opened this issue Sep 8, 2021 · 2 comments
Open

Comments

@umaYnit
Copy link

umaYnit commented Sep 8, 2021

In this section of Chapter 9 :

Testing this with cargo run gives a surprise: the potion isn't deleted after use! This is because the ECS simply marks entities as dead - it doesn't delete them in systems (so as to not mess up iterators and threading). So after every call to dispatch, we need to add a call to maintain. In main.ecs:

RunState::PreRun => {
    self.run_systems();
    self.ecs.maintain();
    newrunstate = RunState::AwaitingInput;
}

Maybe it is not necessary to do this here, because the maintain is called in self.run_systems();.

the potion isn't deleted after use!

It is because return to RunState::AwaitingInput when use the potion, It will keep waiting for input, and then keypress i, jump to the ShowInventory again.

@tigerplush
Copy link

Oh I think I made a second issue for the same problem, #203 . Mine might be a duplicate

@tigerplush
Copy link

Nevermind, I misread, #203 is closed and not a bug at all

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

No branches or pull requests

2 participants