Bug Fix & Request for Commit Privileges
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Bug Fix & Request for Commit Privileges
by rikimbo » 07 Jun 2014, 00:40
I recently checked out a copy of the repository, and I've fixed a bug on my local copy. As Chris suggested, I'm going to post the bug fix here, as well as a bit of my background. I'd like to contribute to this project.
Me:
I am a software developer for a small robotics company. I work primarily in C#, but most of my programming during my undergraduate degree was in Java. I'm mostly interested in the AI component of Forge, but I want to spend some time tracking down bugs to learn the code base.
The bug:
The Licids (such as Leeching Licid) go into an alternate state when they their ability is activated and become enchantments. When a Licid is in the alternate state, its picture does not show on the battlefield, or in the card image panel.
The problem:
The getCard method in CardFactory sets the image key for a card. It sets an image key for each alternate state of the card, as well. There is no branch for the Licid alternate state, so the key set for this state is the default (""). When the image cache is queried to obtain the image for a card in this state, the key that gets sent to the cache is "".
The solution:
Add a method to the Card class to identify whether or not the card has the alternate Licid state. (This fits wit the current model, which also has methods for isFlipCard and isSplitCard, which have a similar structure.)
Me:
I am a software developer for a small robotics company. I work primarily in C#, but most of my programming during my undergraduate degree was in Java. I'm mostly interested in the AI component of Forge, but I want to spend some time tracking down bugs to learn the code base.
The bug:
The Licids (such as Leeching Licid) go into an alternate state when they their ability is activated and become enchantments. When a Licid is in the alternate state, its picture does not show on the battlefield, or in the card image panel.
The problem:
The getCard method in CardFactory sets the image key for a card. It sets an image key for each alternate state of the card, as well. There is no branch for the Licid alternate state, so the key set for this state is the default (""). When the image cache is queried to obtain the image for a card in this state, the key that gets sent to the cache is "".
The solution:
Add a method to the Card class to identify whether or not the card has the alternate Licid state. (This fits wit the current model, which also has methods for isFlipCard and isSplitCard, which have a similar structure.)
- Code: Select all
public final boolean isLicid() {
return characteristicsMap.containsKey(CardCharacteristicName.Licid);
}
- Code: Select all
if (c.hasAlternateState()) {
if (c.isFlipCard()) {
(...)
}
else if (c.isDoubleFaced() && cp instanceof PaperCard) {
(...)
}
else if (c.isSplitCard()) {
(...)
}
else if (c.isLicid()) {
c.setState(CardCharacteristicName.Licid);
c.setImageKey(originalPicture);
}
(...)
}
-
rikimbo - Posts: 52
- Joined: 25 Mar 2014, 14:15
- Location: Winnipeg
- Has thanked: 10 times
- Been thanked: 7 times
Re: Bug Fix & Request for Commit Privileges
by Chris H. » 08 Jun 2014, 13:01
Looks good to me. If you make an official request to join the forge usergroup via the
slightly magic -> user control panel -> usergroups -> developers - forge
then someone will likely give you your commit privs within a couple of days.
slightly magic -> user control panel -> usergroups -> developers - forge
then someone will likely give you your commit privs within a couple of days.
-
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: Bug Fix & Request for Commit Privileges
by rikimbo » 09 Jun 2014, 01:03
Awesome. I just committed the changes to fix the bug. I'm excited to start contributing more to this project.
-
rikimbo - Posts: 52
- Joined: 25 Mar 2014, 14:15
- Location: Winnipeg
- Has thanked: 10 times
- Been thanked: 7 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 107 guests