Page MenuHomeWildfire Games

Mustang error + UnitMotionFlying tests
ClosedPublic

Authored by bb on Feb 11 2017, 3:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 13, 12:16 PM
Unknown Object (File)
Fri, Sep 13, 12:16 PM
Unknown Object (File)
Fri, Sep 13, 12:16 PM
Unknown Object (File)
Fri, Sep 13, 12:16 PM
Unknown Object (File)
Fri, Sep 13, 12:14 PM
Unknown Object (File)
Fri, Sep 13, 11:10 AM
Unknown Object (File)
Tue, Sep 3, 6:25 PM
Unknown Object (File)
Apr 28 2017, 2:07 PM
Subscribers
Restricted Owners Package
Restricted Owners Package

Details

Summary

When summoning our mustang, we get an error because the UnitMotionFlying component doesn't have a getPassClass function. and that is called in the footprint component.

The mustang is created with typing "how do you turn this on?" while selecting a building.

This bug has already been there since a19.

Test Plan

Summon mustang without patch, see error,
Summon mustang with patch, see the absence of error.

Run tests

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bb added inline comments.
source/simulation2/components/CCmpFootprint.cpp
167 ↗(On Diff #510)

Don't like the change of this line, but UnitMotionFlying as a js file...

Build is green

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

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

Itms requested changes to this revision.Feb 19 2017, 5:53 PM
Itms added a subscriber: Itms.

Very nice patch! ?
I agree the change in the engine is bad and I suggested a way to do it better.

source/simulation2/components/CCmpFootprint.cpp
167 ↗(On Diff #510)

What you need is to implement GetPassabilityClass in the JS file, like you already did for GetPassabilityClassName.

I suggest calling cmpPathfinder.GetPassabilityClass in Init and storing the result in a JS attribute, similarly to what is done in CCmpUnitMotion in the engine. Then GetPassabilityClass would return that stored value.

This revision now requires changes to proceed.Feb 19 2017, 5:53 PM
source/simulation2/components/CCmpFootprint.cpp
167 ↗(On Diff #510)

I thought of doing so, but I seem not be able to call that pathfinder function from js, i.o. Engine.QueryInterface(this.entity, IID_Pathfinder) and Engine.QueryInterface(SYSTEM_ENTITY, IID_Pathfinder) results in a null object. Any idea how to call the pathfinder function?

fatherbushido added inline comments.
source/simulation2/components/CCmpFootprint.cpp
167 ↗(On Diff #510)

ICmpPathfinder.cpp

bb edited edge metadata.

That helped, changed the footprint back, and adding test for this new function. Leaving the getPassCLassName function for avoiding future bugs (it is unused now).
Updating the hawk template, as that was forgotten in earlier diff.

Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Feb 22 2017, 4:52 PM

Build is green

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

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

Itms requested changes to this revision.Mar 8 2017, 12:26 PM

A few bits that should be fixed but it's looking good! Sorry for the delay in reviewing...

binaries/data/mods/public/simulation/components/UnitMotionFlying.js
41 ↗(On Diff #575)

missing space here

binaries/data/mods/public/simulation/components/tests/test_UnitMotionFlying.js
10 ↗(On Diff #575)

Maybe write it with bit-shifting notation so it's clearer and easier to adapt if the classes change.

13 ↗(On Diff #575)

This should be cmpUnitMotionFlying.

This revision now requires changes to proceed.Mar 8 2017, 12:26 PM
bb edited edge metadata.

Fixing comments above, also removing a trailing comma and adding a newline.

Build is green

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

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

This revision is now accepted and ready to land.Apr 3 2017, 11:51 AM
This revision was automatically updated to reflect the committed changes.

(I just add a useless formal comment)

binaries/data/mods/public/simulation/components/tests/test_UnitMotionFlying.js
43 ↗(On Diff #744)

({ "x": 50, "y": 100 }) can do the job too

44 ↗(On Diff #744)

same

45 ↗(On Diff #744)

same

Thanks for the patch bb! (There are also towers and runway in atlas, but no map? Sounds like something for a demo map)

There are also towers and runway in atlas, but no map? Sounds like something for a demo map

Can I propose that we name it Flight_demo_2.{xml,pmp}?