just-ero / asl-help

Helper library for LiveSplit's auto splitting language with special features for certain game engines.
GNU General Public License v3.0
5 stars 7 forks source link

#15 Correctly update the SceneEnumerator cache #16

Closed mitchell-merry closed 5 months ago

mitchell-merry commented 5 months ago

Addresses Issue #15

⚠️ This is stacked on https://github.com/just-ero/asl-help/pull/14, since I cannot build asl-help without that fix. Please review / merge that PR first.

Description

Calling Loaded.Count would first check and update _tick, and if they were different call this.Count(). That would then call the enumerator, which would also call Update(), which had _tick updated just before, so it would rely on the cache. That means calling Loaded.Count at the beginning of update {} means that the loaded scene cache never gets updated.

Testing

See MVP in #15 , before and after is that the value updates correctly.

Risk

Hard to say. I tried to keep this as minimal a change as possible. I don't know how common it is to be calling .Count in this way. I kept the update of _tick to be as close to where it was before (just after calling NeedsUpdate()) to prevent any significant changes in rate of update.