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
Add map refresh #19885
Add map refresh #19885
Conversation
9daa4a7
to
a2e7f69
Compare
947936f
to
3612602
Compare
Fixed all bugs and crashes I could find. I changed ComputeUID to include map.png. |
9e6a47b
to
317d256
Compare
68d8c1d
to
5716d67
Compare
rebased |
a8652b8
to
65cf3de
Compare
Now when a user picks a map in map chooser that has been updated while user was in map chooser window, the game will act as if nothing was selected and exit. I also separated |
5d1caf6
to
0fa2f61
Compare
0fa2f61
to
1edad65
Compare
bdc2a6d
to
48c16a9
Compare
Now when you force start or click on a ready checkbox, the game properly handles the selected map becoming unavailable. The previous behaviour was quite unpolished. On game start the screen become black, and then the lobby is refreshed. |
Handled a crash. Now if you try to play a map in |
e61a538
to
158f7e5
Compare
I undid the checkbox behaviour (but kept force start). My solution felt a bit hacky and honestly unnecessary. It's a minor polish feature that can be added in a followup pr |
158f7e5
to
8a7febf
Compare
8a7febf
to
34ff79a
Compare
rebased and changed console reporting from "Added 'map'" to "'map' was added" I'm unsure wether we should keep this reporting. For me it made sense to exist, however when looking back on it, you wouldn't really use it for anything |
I am fine with it, as the map editor also reports file system changes that way. |
Closes #19420
This is my first code contribution to ORA, so there's probably a lot of room for improvement
The way map refresh works:
MapCache
has 2 instances ofMapDirectoryTracker
tracking both the custom and official maps folders for changes respectively. When they detect something, they analyse what and if they need to take action, then they put or edit appropriate actions inmapActionQueue
. WheneverMapCache
is queried for maps, it is updated from the records inmapActionQueue
I needed to queue actions because
FileSystemWatcher
is spamming quite a lot and those actions are often in an illogical order. F.e. when I add a file it callsChanged
, thenCreated
. Another example is when I add / edit an uncompressed map, then it spams a ton of actions. Furthermore maps are never deleted fromMapCache
. So if we were to updateMapCache
at everyFileSystemWatcher
event it would likely clog up memory with very similar maps. The queue is designed to address all of this by updatingMapCache
only when it is requiredMap editor no longer updates the cache, since it already happens when when MapDirectoryTracker kicks in
The game now selects the last edited map when entering map chooser. If in lobby the selected map is updated it, it will switch to the updated version. I'm not sure if this change is necessary, but it would be fairly convenient.