It is currently 29 Oct 2025, 12:35
   
Text Size

Deck Editor Problem

Post MTG Forge Related Programming Questions Here

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

Deck Editor Problem

Postby ArsenalNut » 27 Jan 2012, 00:39

Deck Editor is messed up. It saves decks out of order so the next time you start Forge the deck shows up with the last card name and won't open.
So many cards, so little time
User avatar
ArsenalNut
 
Posts: 512
Joined: 08 Jul 2011, 03:49
Has thanked: 27 times
Been thanked: 121 times

Re: Deck Editor Problem

Postby Chris H. » 27 Jan 2012, 01:23

I created this constructed mode deck using this morning's snapshot build and it looks like this:

snapshot | Open
[metadata]
Name=AEther
Deck Type=Constructed
[main]
1 AErathi Berserker|LEG
1 AEther Adept|M11
1 AEther Barrier|NMS
1 AEther Burst|ODY
1 AEther Charge|ONS
[sideboard]

`
Using rev 13545 the same deck file now looks like this:

rev 13545 | Open
1 AErathi Berserker|LEG

1 AEther Adept|M11

1 AEther Barrier|NMS

1 AEther Burst|ODY

1 AEther Charge|ONS

Deck Type=Constructed

Name=AEther

[main]

[metadata]

[sideboard]
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: Deck Editor Problem

Postby friarsol » 27 Jan 2012, 01:25

Hey Max, looks like this was your change. Not sure what the plan was here, care to chime in?
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Deck Editor Problem

Postby Max mtg » 27 Jan 2012, 06:29

Yes, the change was mine.

The general idea was to save most files by calling FileUtil.writeFile(final File file, final List<String> data) without creating BufferedWriters in game code. However, that method did contain collectins.sort(data)... for unknown reason.

fixed in 13548
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: Deck Editor Problem

Postby Max mtg » 27 Jan 2012, 06:53

+ The reason is known: that method was mainly used to save ratings. Someone decided to sort the data right in writeFile, which turned out in a contract violation (other developers don't expect writeFile to do something besides saving strings to disk).

I tried to add precon decks to quest shop and could not imagine how to store them in memory, so maybe a cleanup of deckmanager, that manages too much at the moment, might help. That's what I am about to do.
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: Deck Editor Problem

Postby Rob Cashwalker » 30 Jan 2012, 14:34

I've always thought the Deck and DeckManager classes were in need of over-haul.
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: Deck Editor Problem

Postby Max mtg » 31 Jan 2012, 05:58

Look at them now, Rob... or at what remains of them.

Evolution is not over, however. Deckmanager still has a couple of methods for each action - one for constructed, other for draft. These twins will recieve some surgery soon.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 11 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 11 guests

Login Form