Page MenuHomeWildfire Games

Move pathfinder work to a worker (not yet threaded - D14 prerequisite)
Needs ReviewPublic

Authored by wraitii on Sat, May 25, 10:51 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

Split from D14.

This just moves the "async" pathfinding computations to a worker, in order for D14 to be only about the threading stuff.
This code is thus much easier to review as it's strictly moving things around in a still-not-threaded environment.

Test Plan

Compile, check that things still work.

Diff Detail

Event Timeline

Stan added inline comments.
source/simulation2/Simulation2.cpp
597

Should't a boolean be passed ?

source/simulation2/components/CCmpPathfinder.cpp
99

could it be a shared_pointer ? @vladislavbelov said we should avoid raw pointers but I'm not sure when we should use those.

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

Link to build: https://jenkins.wildfiregames.com/job/differential/1503/display/redirect

theotherhiveking added inline comments.
source/simulation2/components/CCmpPathfinder.cpp
99

Here is what Herb Sutter has to say about it:

Guideline: Don’t pass a smart pointer as a function parameter unless you want to use or manipulate the smart pointer itself, such as to share or transfer ownership.

Source:
https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/

wraitii added inline comments.Sun, May 26, 12:51 PM
source/simulation2/components/CCmpPathfinder.cpp
99

Here I'm just initialising the unique pointer, so using new is legitimate.

wraitii updated this revision to Diff 8159.Sun, May 26, 3:49 PM

Re-upload after D1854 is committed, this should apply cleanly.

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...

source/simulation2/Simulation2.cpp
|   1| /*·Copyright·(C)·2018·Wildfire·Games.
|    | [NORMAL] LicenseYearBear:
|    | License should have "2019" year instead of "2018"
Executing section JS...
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/differential/1510/display/redirect