Page 1 of 1

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

PostPosted: 14 Jan 2013, 07:25
by Max mtg
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.

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

PostPosted: 14 Jan 2013, 21:26
by Max mtg
Well... since this is approved, I've implemented and commited the changes.