HomeWildfire Games

Don't use range queries for global auras. Fix related team bonus. Add Mauryan…
AuditedrP19092

Description

Don't use range queries for global auras. Fix related team bonus. Add Mauryan team bonus. Based on a sanderd17 patch. Reviewed by wraitti.
Differential Revision: https://code.wildfiregames.com/D19

Details

Auditors
elexis
Committed
fatherbushidoJan 1 2017, 5:52 PM
Differential Revision
Restricted Differential Revision
Parents
rP19091: Commands.js cleanup.
Branches
Unknown
Tags
Unknown
Build Status
Buildable 90
Build 146: Post-Commit BuildJenkins

Event Timeline

elexis raised a concern with this commit.Feb 13 2017, 4:19 PM
elexis added a subscriber: elexis.

Segfaults when ordering a packed unit to move in some cases, see #4480

This commit now has outstanding concerns.Feb 13 2017, 4:19 PM

What do you expect of me?

In null, @fatherbushido wrote:

What do you expect of me?

No expectations, as contribution is entirely voluntary!
We (as in team) do have to either fix, bandage or revert this thing though before releasing, as the game should really attempt to not segfault.
I'll take a look at how to heal this too as soon as I get to it.

In null, @elexis wrote:
In null, @fatherbushido wrote:

What do you expect of me?

No expectations, as contribution is entirely voluntary!
We (as in team) do have to either fix, bandage or revert this thing though before releasing, as the game should really attempt to not segfault.
I'll take a look at how to heal this too as soon as I get to it.

I can revert that, I can also add some check irrelevant to that commit, but it would perhaps hide other stuff :/ So it seems I should not adress straightly the (commit) concern, but I can if needed. (Else, I was looking today at the said bug).

What happens with the same action before that commit?

As mentioned in the ticket, it is not clear whether this commit is responsible for the segfault, it only triggers it. I just r

In null, @fatherbushido wrote:

What happens with the same action before that commit?

At least doesn't segfault and appears to work correctly (as in alpha 21).
There is also a command to revert a specific commit, svn merge -c -REV or something.

fatherbushido added a comment.EditedFeb 13 2017, 8:06 PM

ok I cheked, it indeed occurs in that said revision.
The strange stuff is that we don't get the null cmpPlayer warning for the packing stuff.

If I don't understand until tommorow, I will just revert all that and the following patch.

See D143.
It sets things back to the previous state.
(Wich doesn't mean closing #4480)

elexis accepted this commit.May 4 2017, 8:19 AM

Unpacked all siege engines on the Units demo map, no more crashes.
Proper test written revealing the crash, issue deeply buried in the engine properly fixed, side-issues noticed fixed too.
Exemplary case handling, thanks!

All concerns with this commit have now been addressed.May 4 2017, 8:19 AM
fatherbushido added a comment.EditedApr 2 2018, 9:35 PM

(The author of the patch (edit: and of this line) should have done the unit tests he promised to do and never completed.)
Regression : team bonus (at least for 'template' change) are messed with diplomacy changes (with the proper amount of players)

edit: in fact not only team bonus, but all template changes (triggered when there are different players affected by the auras)

fatherbushido added inline comments.Apr 2 2018, 11:13 PM
/ps/trunk/binaries/data/mods/public/simulation/components/Auras.js
204

l217 or something like that

temple added a subscriber: temple.Apr 3 2018, 4:05 AM
temple added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/Auras.js
204

Yeah this is applying the bonuses over and over again.
I'm okay with having player auras for the reasons in the TODO, but it shouldn't be done in the same spot as global auras. I'll upload a patch after more testing.

fatherbushido added a comment.EditedApr 3 2018, 7:20 AM

if one would want to start its dev from this rev, here is the fix:

Index: binaries/data/mods/public/simulation/components/Auras.js
===================================================================
--- binaries/data/mods/public/simulation/components/Auras.js	(révision 19092)
+++ binaries/data/mods/public/simulation/components/Auras.js	(copie de travail)
@@ -201,8 +201,6 @@
 
 		if (this.IsGlobalAura(name))
 		{
-			for (let player of affectedPlayers)
-			{
 				this.ApplyTemplateBonus(name, affectedPlayers);
 				// When only Player class affected, we do not need a rangeQuery
 				// as applicable only to player entity and templates
@@ -214,8 +212,8 @@
 					this.ApplyBonus(name, playerEnts);
 				}
 				else
-					this.ApplyBonus(name, cmpRangeManager.GetEntitiesByPlayer(player));
-			}
+					affectedPlayers.forEach(player => this.ApplyBonus(name, cmpRangeManager.GetEntitiesByPlayer(player)));
+
 			continue;
 		}

(with wrong identation)