It is currently 11 Sep 2025, 22:56
   
Text Size

Forge version 1.2.8

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Forge version 1.2.8

Postby friarsol » 09 Jun 2012, 18:05

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.2.8

Postby Chris H. » 10 Jun 2012, 23:40

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?
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Forge version 1.2.8

Postby friarsol » 11 Jun 2012, 01:34

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.2.8

Postby Chris H. » 11 Jun 2012, 02:34

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.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Forge version 1.2.8

Postby Max mtg » 11 Jun 2012, 06:11

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.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Forge version 1.2.8

Postby Chris H. » 11 Jun 2012, 11:43

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. :)
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Forge version 1.2.8

Postby Rob Cashwalker » 11 Jun 2012, 16:21

Another way to see how a method gets used in context:
Highlight the method name, right-click and select References -> Project.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Forge version 1.2.8

Postby moomarc » 11 Jun 2012, 17:36

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!
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: Google [Bot] and 29 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 30 users online :: 1 registered, 0 hidden and 29 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: Google [Bot] and 29 guests

Login Form