Page 2 of 2

Re: Forge version 1.2.8

PostPosted: 09 Jun 2012, 18:05
by friarsol
Chris H. wrote:I plan to release the next beta on Monday if no one has any objections. :)
That's fine, I poked through the draft code and couldn't figure out what the error was about. It looks like the pack is being created just fine, and the cards were generated, so it must not be being placed into the layout properly.

Re: Forge version 1.2.8

PostPosted: 10 Jun 2012, 23:40
by Chris H.
I was doing some checkstyle fixes before our next beta release and I came across one that causes me some concern and I wanted some input from people that are more experienced than myself.

In src.main.forge.gui.toolbox.CardFaceSymbols we have the following method at lines 234 through 248:

Code: Select all
    public static int getWidth(final CardManaCost manaCost) {
        int width = manaCost.getShards().size();
        if (manaCost.getGenericCost() > 0 || (manaCost.getGenericCost() == 0 && width == 0));
            width++;

        /*
        StringTokenizer tok = new StringTokenizer(manaCost, " ");
        while (tok.hasMoreTokens()) {
            String symbol = tok.nextToken();
            width += symbol.length() > 2 ? 10 : 14; // slash.png is only 10
                                                    // pixels wide.
        }
        */
        return width * 14;
    }
 
Line 236 gives us an "Empty statement" checkstyle error. It looks like we have a missplaced ";" char at the end of the if statement which will result in the next statement being processed whether or not the test returns true or not.

I think that we should delete the ";" char which causes the empty statement before the next beta release. Am I right about this situation?

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 01:34
by friarsol
Chris H. wrote:I think that we should delete the ";" char which causes the empty statement before the next beta release. Am I right about this situation?
Looks right. I'm not really sure if that conditional matters or not, but it's hard to tell without knowing the goal of that codeblock.

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 02:34
by Chris H.
friarsol wrote:
Chris H. wrote:I think that we should delete the ";" char which causes the empty statement before the next beta release. Am I right about this situation?
Looks right. I'm not really sure if that conditional matters or not, but it's hard to tell without knowing the goal of that codeblock.
 
It looks like this class draws the various symbols on top of the cards displayed in the battlefield display.

Mana, attack, defense, foil, phasing, summon sickness, counters, etc.

These symbols are already displayed OK I guess. Shrug.

I think that I may just leave it alone for tomorrow's beta release and then add it in afterwards. If it causes any problems I can then revert. And if it fixes anything we can then release another beta soon thereafter. :)

Wow, just did a search on the name for this method, getWidth. 110 instances. So it appears to be called from various areas of Doublestrike's new UI code.

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 06:11
by Max mtg
Thank you Chris, this was a bug causing a slight misalignment of mana costs without generic part.
I have commited r15868 to address that issue.

It is called from a single place: forge.view.arcane.CardPanel.paintChildren(Graphics).
If you are using Eclipse, invoke the "open call hierarchy" item from the context menu of the method in question to see the its actual callers.

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 11:43
by Chris H.
Max mtg wrote:If you are using Eclipse, invoke the "open call hierarchy" item from the context menu of the method in question to see the its actual callers.
 
Ah, I was not sure how to find the callers. Using the search command I found far to many references. The "open call hierarchy" is a nice feature. :)

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 16:21
by Rob Cashwalker
Another way to see how a method gets used in context:
Highlight the method name, right-click and select References -> Project.

Re: Forge version 1.2.8

PostPosted: 11 Jun 2012, 17:36
by moomarc
Rob Cashwalker wrote:Another way to see how a method gets used in context:
Highlight the method name, right-click and select References -> Project.
@Rob and Max: Thanks for the tips!