Page MenuHomeWildfire Games

Don't early return but actually update an active query (and send the RangeUpdate message) when the query source is out of world
AbandonedPublic

Authored by fatherbushido on Jul 2 2017, 6:01 PM.

Details

Reviewers
None
Trac Tickets
#4658
Summary

When the source of a range aura is garrisoned, the aura effect is not updated. See #4658.
Indeed, when the source of an active query is moved out of world (garrisoning for example), when the active queries are updated on a turn, that query is just ignored (early continue).
Imo, that one should be actually updated (it should be cleared and the RangeUpdate message should be sent).

(test)

Test Plan
  • For the problem described in #4658, build a fortress, an hero (bouddica for example), a champion, garrison the hero, and check for example the capture stat).
  • Check also that nothing is broken with active range queries (unitAI, buildingAI, Gate are using those queries).
  • (Check also that there not useless empty RangeUpdate messages sent)

There are different ways to do that change in ExecuteActiveQueries, in the patch there are minimal changes to reuse the comparaison with last queries. Suggestion are welcome.

One could also argue that the change should be done in the js part and that the RangeManager has already the right behavior, but I don't think so (For example, queries are already handled in the other part of the RM for out of world source).

I thought (started) to write a test but seeing that there were no unit test for any of those queries function, I gave up.

Event Timeline

fatherbushido created this revision.Jul 2 2017, 6:01 PM
Vulcan added a subscriber: Vulcan.Jul 2 2017, 6:02 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/278/ for more details.

Vulcan added a comment.Jul 2 2017, 6:51 PM

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!
Checking XML files...

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

elexis added reviewers: bb, mimo, elexis, leper, Restricted Owners Package.Jul 7 2017, 12:12 PM
elexis added a subscriber: elexis.

(High potential for abuse (applying the hero aura for the units without the hero being around, without the units being grouped by the hero range. At least one player (the one who reported it in the lobby) found out about this and the the new hero auras and global auras that changed to ranged auras, it will become a much more visible issue (which also explains why noone found it yet).)
(fatherbushido is N/A currently and said we should commit it if it's correct and for the release.)

bb added inline comments.Jul 7 2017, 1:21 PM
source/simulation2/components/CCmpRangeManager.cpp
1100

actually this early continue should be removed too, for mod support. (or imagine a TS that removes the position component), don't ask why we would add it, but as supporting is very easy and even leaves shorter code, I don't see a reason to not do it.

This check can simply be added in the implemented IsInWorld checks

1106

We duplicate the execution of this, was wondering whether we should store it under a bool, but as it doesn't cost much performance seems fine to keep like this.

1125

cmpSourcePosition->GetPosition2D() already have that under "pos"

fatherbushido edited the summary of this revision. (Show Details)

up

fatherbushido added 1 blocking reviewer(s): Itms.Aug 8 2017, 1:46 PM
fatherbushido marked an inline comment as done.

(still a draft)

source/simulation2/components/CCmpRangeManager.cpp
1100

What is a TS?
(I didn't understand so I didn't change it for now.)

bb added inline comments.Aug 8 2017, 1:49 PM
source/simulation2/components/CCmpRangeManager.cpp
1100

TS == trigger script

fatherbushido added inline comments.Aug 8 2017, 1:52 PM
source/simulation2/components/CCmpRangeManager.cpp
1100

thx

Vulcan added a comment.Aug 8 2017, 6:40 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/364/ for more details.

Vulcan added a comment.Aug 8 2017, 7:54 PM

Build has FAILED

Updating workspaces.
Build (release)...
../../../source/simulation2/components/CCmpRangeManager.cpp: In member function ‘void CCmpRangeManager::ExecuteActiveQueries()’:
../../../source/simulation2/components/CCmpRangeManager.cpp:1125:87: error: ‘pos’ was not declared in this scope
     std::stable_sort(added.begin(), added.end(), EntityDistanceOrdering(m_EntityData, pos));
                                                                                       ^
make[1]: *** [obj/simulation2_Release/CCmpRangeManager.o] Error 1
make: *** [simulation2] Error 2
make: *** Waiting for unfinished jobs....

Link to build: http://jw:8080/job/phabricator/1817/
See console output for more information: http://jw:8080/job/phabricator/1817/console

fatherbushido marked an inline comment as not done.Aug 8 2017, 8:41 PM
fatherbushido added inline comments.
source/simulation2/components/CCmpRangeManager.cpp
1125

It seems that Vulcan doesn't like that

fatherbushido marked an inline comment as not done.

Don't use pos in the second if.

Vulcan added a comment.Aug 9 2017, 3:06 PM

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!
Checking XML files...

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

Vulcan added a comment.Aug 9 2017, 3:07 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/370/ for more details.

fatherbushido abandoned this revision.Aug 20 2017, 11:12 PM
temple added a subscriber: temple.Sep 11 2017, 9:27 PM

Seems to work fine.

source/simulation2/components/CCmpRangeManager.cpp
1104

Suppose this could go in the if below.

1107–1110

Don't need pos since it's not used again.

1127

Seems unnecessary.

1135

query

fatherbushido reclaimed this revision.Oct 1 2017, 8:44 AM
fatherbushido planned changes to this revision.

(one could perhaps also do things in MT_PositionChanged)

fatherbushido added inline comments.Oct 8 2017, 9:12 PM
source/simulation2/components/CCmpRangeManager.cpp
1127

perhaps even false, I need to read all that again

fatherbushido abandoned this revision.Nov 12 2017, 5:33 PM
fatherbushido removed reviewers: wraitii, Itms, bb, mimo, elexis, leper, Restricted Owners Package.
temple edited the summary of this revision. (Show Details)Jan 12 2018, 6:01 PM