Page MenuHomeWildfire Games

RangeManager GetGaiaAndNonGaiaEntities function
ClosedPublic

Authored by elexis on May 11 2017, 11:32 PM.

Details

Summary

A trigger script of a map might want to loop over entities of all players and gaia.
The function name GetNonGaiaEntities from #3215 might have been an unlucky choice, since it doesn't include entities without owner.

Test Plan

Run D229 instead, which contains and uses this patch.

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

elexis created this revision.May 11 2017, 11:32 PM
Vulcan added a subscriber: Vulcan.May 12 2017, 7:54 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/1156/ for more details.

bb edited edge metadata.May 15 2017, 1:26 PM

Code works and is correct, but shouldn't we also add this function to guiInterface since the getEntsByPlayer and getNonGaiaEnts are there too?

I didn't found any occurance with grepping for this function in current code.

bb added a comment.May 15 2017, 1:41 PM

As pointed out by fatherbusido the name looks weird, perhaps GetEntitiesWithOwner is better (simply GetEntities won't work since owner = -1 isn't and shouldn't be included)

Agree and as mentioned above and in #3215, the name GetNonGaiaEntities name is wrong too as we don't get non-gaia entities that are not owned by anyone, so should we name that GetAllPlayersEntities as proposed last june? (Ok there was no s in there at the time)
Then this one could be named GetGaiaAndAllPlayersEntities.

bb added a comment.May 15 2017, 2:06 PM

ok with me, can all go into 1 patch imo

bb accepted this revision.Dec 26 2017, 4:04 PM

Whatever the name is, the function is useful, and name isn't that bad imo

source/simulation2/components/ICmpRangeManager.h
202 ↗(On Diff #1860)

by a player or gaia.

This revision is now accepted and ready to land.Dec 26 2017, 4:04 PM

Maybe the proposed name is not ideal, but we failed to find a good one the entire year and the name is at least symmetric with the existing GetNonGaiaEntities, so not the worst possible name.
Indeed better to have the function with a sub-ideal name than not at all.
Since the patch was uploaded as a preparation of extinct volcano and since we have extinct volcano since half a year, I will add that hunk.
It's the only file using this currently.

Thanks for the reviews.

This revision was automatically updated to reflect the committed changes.
Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Dec 26 2017, 11:03 PM