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

Fix for iterators not being cleared after a GMX #448

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
Open

Fix for iterators not being cleared after a GMX #448

wants to merge 1 commit into from

Conversation

mikecnr
Copy link

@mikecnr mikecnr commented May 23, 2020

The code from OnScriptInit now runs after a 0ms timer is called, to ensure the gamemode is reloaded after a GMX before clearing and re-processing the default iterators (e.g. Player, Vehicle etc.) as Iter_Clear doesn't seem to work under OnScriptInit after a GMX. Exact cause unknown. Probably related to the fact that GMX is crap and should be avoided!

The code from OnScriptInit now runs after a 0ms timer is called, to ensure the gamemode is reloaded after a GMX before clearing and re-processing the default iterators (e.g. Player, Vehicle etc.) as Iter_Clear doesn't seem to work under OnScriptInit after a GMX. Exact cause unknown. Probably related to the fact that GMX is crap and should be avoided!
@Y-Less
Copy link
Member

Y-Less commented Jun 3, 2020

OK, my only concern with this is what happens if the iterators are used in OnGameModeInit - like CreateVehicle etc. They'll be added then instantly destroyed. There are several options:

  1. Clear them right at the end of OnGameModeExit instead.

  2. Add a check to any hooked function that would call Iter_Add - OnPlayerConnect, CreateVehicle, etc, and if the init code hasn't run yet do it there first. Of course that also relies on that check variable somehow being correctly reset.

  3. Figure out why Iter_Clear doesn't seem to work, especially since the timer is called so its not even a case of the callback not being called.

  4. Don't use Iter_Clear there, just replace it with something else entirely like inline code.

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