Map reloads counter - new processor variable #10836
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
@mapReloadsprocessor variable. The variable is set to zero on code compilation, and gets incremented each time a map is loaded. It serves for easy detection of map reload events (either from a save file, or by switching a sector in campaign). Since display content is not stored in the map file, this allows programs that update their display incrementally to detect the display needs to be fully redrawn. There might be other use cases; maybe world processors could trigger some events in custom maps when a map gets loaded.Reload detection is possible in two ways: firstly, the last value of
@mapReloadscan be stored in a variable; when a difference is found, the stored value is updated and the display is redrawn. Secondly, since@mapReloadsis writable, it is possible to set it back to zero when a non-zero value, and thus a map reload, is detected.The variable is displayed in the Vars screen, which makes it perhaps more prominent than it deserves. If this is a problem, I'll try to add a fix to hide it from this list. (I've also added it to the list of built-in variables, even though
@counterisn't there.)Notes:
If your pull request is not translation or serverlist-related, read the list of requirements below and check each box: