Page MenuHomeWildfire Games

Fix r19027: show graphs in the summary screen
ClosedPublic

Authored by wraitii on Dec 30 2016, 4:27 PM.

Details

Summary

Related to #3403. This should fix style issues noted by Leper.

Test Plan

Code review and verification that behaviour isn't broken.

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

wraitii updated this revision to Diff 81.Dec 30 2016, 4:27 PM
wraitii retitled this revision from to Fix r19027: show graphs in the summary screen.
wraitii updated this object.
wraitii edited the test plan for this revision. (Show Details)
wraitii added a reviewer: leper.
wraitii set the repository for this revision to rP 0 A.D. Public Repository.
wraitii updated this revision to Diff 82.Dec 30 2016, 4:30 PM

Forgot a file.

wraitii added inline comments.Dec 30 2016, 4:48 PM
source/gui/CChart.cpp
143 ↗(On Diff #82)

Feel like this should work fine but I don't want to be confident.

source/scriptinterface/ScriptConversions.h
37 ↗(On Diff #82)

@leper : I believe this is what you meant for the infinite loop? Didn't add it to FromJSVal since it can't loop forever there.

leper requested changes to this revision.Dec 30 2016, 5:00 PM
leper edited edge metadata.

Looks a lot better already.

source/gui/CChart.cpp
143 ↗(On Diff #82)

Have you checked whether this actually works when we end up calling Draw more than once?

source/scriptinterface/ScriptConversions.cpp
418 ↗(On Diff #82)

It might still be worth thinking about whether using this array representation is nicer than using Vector2D.

source/scriptinterface/ScriptConversions.h
21 ↗(On Diff #82)

What is this doing in a header?

24 ↗(On Diff #82)

Is this line really needed here? IIRC JS_IsTypedArrayObject is not defined in there, and we do not want to add lots of includes to headers.

37 ↗(On Diff #82)

There should be a macro constant or std::numeric_limits template around that makes this a bit more obvious.

This revision now requires changes to proceed.Dec 30 2016, 5:00 PM
Vulcan added a subscriber: Vulcan.Dec 30 2016, 5:02 PM

Build has FAILED

Updating workspaces.
Build (release)...
../../../source/scriptinterface/ScriptConversions.cpp:20:31: fatal error: ScriptConversions.h: No such file or directory
 #include "ScriptConversions.h"
                               ^
compilation terminated.
make[1]: *** [obj/scriptinterface_Release/ScriptConversions.o] Error 1
make: *** [scriptinterface] Error 2
make: *** Waiting for unfinished jobs....
../../../source/simulation2/scripting/EngineScriptConversions.cpp:20:47: fatal error: scriptinterface/ScriptConversions.h: No such file or directory
 #include "scriptinterface/ScriptConversions.h"
                                               ^
compilation terminated.
make[1]: *** [obj/simulation2_Release/EngineScriptConversions.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [simulation2] Error 2

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

Build is green

Updating workspaces.
Build (release)...
../../../source/lib/tex/tex_png.cpp: In member function ‘virtual Status TexCodecPng::encode(Tex*, DynArray*) const’:
../../../source/lib/tex/tex_png.cpp:309:9: warning: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
  Status ret = ERR::FAIL;
         ^
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

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

wraitii updated this revision to Diff 108.Jan 2 2017, 1:59 PM
wraitii edited edge metadata.

Fix further issues noticed by leper.

wraitii marked 6 inline comments as done.Jan 2 2017, 2:00 PM
wraitii added inline comments.
source/gui/CChart.cpp
143 ↗(On Diff #82)

On second thought, I think this wouldn't have worked, so I changed it to only call UpdateSeries when something changes, and put the copy back in.

source/scriptinterface/ScriptConversions.cpp
418 ↗(On Diff #82)

the JS Vector2D you mean?

source/scriptinterface/ScriptConversions.h
24 ↗(On Diff #82)

Needed also for Js::ToNumber so I kept it.

Vulcan added a comment.Jan 2 2017, 3:50 PM

Build is green

Updating workspaces.
Build (release)...
../../../source/lib/tex/tex_png.cpp: In member function ‘virtual Status TexCodecPng::encode(Tex*, DynArray*) const’:
../../../source/lib/tex/tex_png.cpp:309:9: warning: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
  Status ret = ERR::FAIL;
         ^
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

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

leper requested changes to this revision.Jan 2 2017, 7:27 PM
leper edited edge metadata.
leper added inline comments.
source/gui/CChart.cpp
32 ↗(On Diff #108)

Not entirely sure that this is needed.

44 ↗(On Diff #108)

That's not how we format switch statements.

source/scriptinterface/ScriptConversions.cpp
418 ↗(On Diff #82)

Yes, though this one is probably a bit more memory efficent, though I don't think the code in question should have to care about that. (Not really requesting a change here, but maybe someone else has another opinion.)

source/scriptinterface/ScriptConversions.h
26 ↗(On Diff #108)

This should not leak out of the header, undef it. While at it, you should probably move the definition closer to the usage.

37 ↗(On Diff #108)

A blank line above this would be nice.

77 ↗(On Diff #108)

Some indentation might be nice here. Same for the one right below.

24 ↗(On Diff #82)

None of those is needed in this header AFAICS.

This revision now requires changes to proceed.Jan 2 2017, 7:27 PM
wraitii updated this revision to Diff 115.Jan 3 2017, 3:27 PM
wraitii edited edge metadata.
wraitii marked 9 inline comments as done.

Fixes above.

source/scriptinterface/ScriptConversions.h
24 ↗(On Diff #82)

We do call JS_IsTypedArrayObject in this header, unless you mean something else?

Vulcan added a comment.Jan 3 2017, 5:23 PM

Build is green

Updating workspaces.
Build (release)...
../../../source/lib/tex/tex_png.cpp: In member function ‘virtual Status TexCodecPng::encode(Tex*, DynArray*) const’:
../../../source/lib/tex/tex_png.cpp:309:9: warning: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
  Status ret = ERR::FAIL;
         ^
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

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

leper requested changes to this revision.Jan 3 2017, 10:13 PM
leper edited edge metadata.

I guess I'll have to actually test this soon. Actually is there any user for this code included?

source/scriptinterface/ScriptConversions.cpp
29 ↗(On Diff #115)

Why move this from the old position in this file?

source/scriptinterface/ScriptConversions.h
24 ↗(On Diff #82)

Ah, that is indeed in jsfriendapi.h which is only in that header (as opposed to eg JS_IsArrayObject which is in jsapi.h), but then you should list JS_IsTypedArrayObject as the reason for this header, and only that (as none of the others is actually used in this header).

Though I guess we could get away with a lot given that the below are templates and only insantiated later, so forward decls should work, but that might mean some more work for the few users of this. Your call.

This revision now requires changes to proceed.Jan 3 2017, 10:13 PM
wraitii updated this revision to Diff 119.Jan 4 2017, 9:34 AM
wraitii edited edge metadata.

Remove the Fail macro in the header, it was hardly that useful anyway. Fix comment.

As for the test case, there are JS files in the original ticket, but they weren't committed because they had no labels or anything.

Build is green

Updating workspaces.
Build (release)...
../../../source/lib/tex/tex_png.cpp: In member function ‘virtual Status TexCodecPng::encode(Tex*, DynArray*) const’:
../../../source/lib/tex/tex_png.cpp:309:9: warning: variable ‘ret’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
  Status ret = ERR::FAIL;
         ^
Build (debug)...
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

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

leper accepted this revision.Jan 5 2017, 11:47 PM
leper edited edge metadata.

With the latter of these two fixed, your call on the former. Also update the copyright year.

source/scriptinterface/ScriptConversions.cpp
29 ↗(On Diff #115)

...

source/scriptinterface/ScriptConversions.h
50 ↗(On Diff #119)

This was IMO nicer to read with the macro, though I guess one should make the name a bit less generic as to not redefine something else (though that would cause warnings), and undef it after use.

This revision is now accepted and ready to land.Jan 5 2017, 11:47 PM
This revision was automatically updated to reflect the committed changes.
elexis changed the visibility from "All Users" to "Public (No Login Required)".Jun 26 2017, 2:22 PM