A small announcement about CardPrinted.toForgeCard(...)
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
2 posts
• Page 1 of 1
A small announcement about CardPrinted.toForgeCard(...)
by 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.
* 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(...)
by 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
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 52 guests