It is currently 09 Sep 2025, 00:22
   
Text Size

A small announcement about CardPrinted.toForgeCard(...)

Post MTG Forge Related Programming Questions Here

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

A small announcement about CardPrinted.toForgeCard(...)

Postby Max mtg » 14 Jan 2013, 07:25

There are 2 overloads at the moment:

* forge.item.CardPrinted.toForgeCard()
* forge.item.CardPrinted.toForgeCard(Player)

The first one is mostly used in deck editors, dual and single list-boxes - that is for presentation of a Card via components that do not support CardPrinted. Such conversion is mostly called on change of selection in a list, its results are cached sometimes (caching code appears to be duplicated in that cases)
The second overload is used to populate a deck with ready-to-play Card objects.

So, I'm going to introduce a centralized cache of Card instances requested to show CardPrinted in UI. That will eliminate multiple Card instances creation for each CardPrinted and consume less memory. Since those instances will be cached,
1. the local caches in classes like SelListener will be obsolette and safe to remove,
2. these instances will be unusable in game.

So, in the meantime expect the first overload to be renamed, and use only the second one to give cards to players.
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: A small announcement about CardPrinted.toForgeCard(...)

Postby Max mtg » 14 Jan 2013, 21:26

Well... since this is approved, I've implemented and commited the changes.
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 52 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 52 users online :: 0 registered, 0 hidden and 52 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 52 guests

Login Form