Page MenuHomeWildfire Games

Move state from CCmpObstruction to CCmpObstructionManager
Needs ReviewPublic

Authored by wraitii on Nov 26 2020, 6:08 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

My existing approach in D14 is to lock modifying obstruction access behind mutexes. But that has a few drawbacks, namely that I lock way too often.

It seems simpler to move all state to the ObstructionManager, since that's where most is already, and let the manager handle things on its own.
I've set things up so that we could have a "deferred" mode, letting code change obstructions while paths are calculated, but I think an "instant" mode is useful for some code (e.g. a unit that garrisons inside a gate probably wants to trigger gate opening right now, not on the next turn, which is annoying if the obstruction update are deferred). This "instant mode" is pretty much svn behind a mutex.

D14 then just has to lock the mutex while paths make calculations to ensure nobody does anything stupid. It's a cleaner, easier solution.

This also refactors CmpObstruction somewhat.

Test Plan

Compile the game, notice things work.

Event Timeline

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/3242/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/3807/display/redirect

Build failure - The Moirai have given mortals hearts that can endure.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/2146/display/redirect

wraitii requested review of this revision.Nov 26 2020, 8:03 PM