Page MenuHomeWildfire Games

Commit resources at dropsite and add tests for dropsite and gatherer.
ClosedPublic

Authored by Freagarach on Jan 7 2021, 6:59 PM.

Details

Reviewers
None
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP24543: Commit resources at dropsite and add tests.
Summary

rP23733 made it such that a ResourceGatherer takes a target to commit resources. This patch lets the unit actually drop their resources at the dropsite.
While at it also add some unit-tests for cmpResourceDropsite and cmpResourceGatherer.

Test Plan

Verify unmodified behaviour.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Freagarach created this revision.Jan 7 2021, 6:59 PM
Vulcan added a comment.Jan 7 2021, 7:04 PM

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/2711/display/redirect for more details.

Freagarach requested review of this revision.Jan 7 2021, 7:08 PM
Stan added a subscriber: Stan.Jan 7 2021, 7:23 PM
Stan added inline comments.
binaries/data/mods/public/simulation/components/ResourceDropsite.js
56 ↗(On Diff #15045)

Always true no?

binaries/data/mods/public/simulation/components/ResourceGatherer.js
311 ↗(On Diff #15045)

can it be negative?

wraitii added a subscriber: wraitii.Jan 9 2021, 9:49 AM

I think this is a good idea in general, will make it easier in the future if somebody wants to mod per-dropside resources or something too.

binaries/data/mods/public/simulation/components/ResourceDropsite.js
45 ↗(On Diff #15045)

TakeResources maybe? In general the 'subject' is the resource dropsite, so 'add resources' doesn't seem very obvious.

binaries/data/mods/public/simulation/components/ResourceGatherer.js
314 ↗(On Diff #15045)

I'm wondering if you wouldn't have a neater interface if you returned the left-over resources directly.
Then this function basically becomes a wrapper around the dropsite function.

Freagarach added inline comments.Jan 10 2021, 7:14 AM
binaries/data/mods/public/simulation/components/ResourceDropsite.js
56 ↗(On Diff #15045)

You're right, I guess we don't really need to check for that. (I thought {} was falsy.)

binaries/data/mods/public/simulation/components/ResourceGatherer.js
311 ↗(On Diff #15045)

If one alters the receiver, yes of course. Just as changed could be greater than carrying which would be odd.

314 ↗(On Diff #15045)

I was mostly following the routes in e.g. PerformGather, but also in other components (Health, Capturable): Return what has changed.

Freagarach updated this revision to Diff 15087.Jan 10 2021, 9:04 AM
Freagarach marked an inline comment as done.
  • AddResources -> ReceiveResources.
  • Linter.

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/2739/display/redirect for more details.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 11 2021, 12:59 PM
This revision was automatically updated to reflect the committed changes.