Added/fixed primitives, improved the way to limit the number of total primitives to load at startup using the file named LimitedCardList.txt (that has to be copied in User folder). This should help to run the game even on older devices with low RAM such as PSP-3000 (It needs also a lighter graphics sub-folder in Res folder).

This commit is contained in:
Vittorio Alfieri
2021-08-28 16:34:22 +02:00
parent 8d6e0122bb
commit ebc281da6e
6 changed files with 149 additions and 102 deletions

View File

@@ -2,8 +2,11 @@
## [master] (https://github.com/WagicProject/wagic/tree/master)
### 28/08/21
- *Committed:* Added/fixed primitives, improved the way to limit the number of total primitives to load at startup using the file named LimitedCardList.txt (that has to be copied in User folder). This should help to run the game even on older devices with low RAM such as PSP-3000 (It needs also a lighter graphics sub-folder in Res folder). ([Vitty85](https://github.com/Vitty85))
### 27/08/21
- *Committed:* Added/fixed primitives. ([Vitty85](https://github.com/Vitty85))
- *Committed:* Added/fixed primitives. https://github.com/WagicProject/wagic/commit/8d6e0122bb7253d29700bc4519067ed4160ddf84 ([Vitty85](https://github.com/Vitty85))
### 26/08/21
- *Committed:* Added/fixed primitives, Added keywords "showopponenthand" and "showcontrollerhand" to allow controller and opponent to play with their hand revealed, added "mytarg" prefix to check values for a card target as like we do for "storedcard" prefix (e.g. "Redirect"), fixed "undocpy" keyoword for all cards (e.g. "Renegade Doppelganger") that have to be back from a previous copy. https://github.com/WagicProject/wagic/commit/1ce0facf215f2af172e7e42b1f4d0ea25a7df38d ([Vitty85](https://github.com/Vitty85))

View File

@@ -4472,6 +4472,17 @@ power=4
toughness=4
[/card]
[card]
name=Banshee of the Dread Choir
auto=@damageof(player) from(this):ability$!name(discard) target(*|myhand) reject!$ controller
auto=@damagefoeof(player) from(this):ability$!name(discard) target(*|myhand) reject!$ opponent
text=Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Whenever Banshee of the Dread Choir deals combat damage to a player, that player discards a card.
mana={3}{B}{B}
type=Creature
subtype=Spirit
power=4
toughness=4
[/card]
[card]
name=Bar the Gate
target=*[creature;planeswalker]|stack
auto=fizzle
@@ -5887,6 +5898,14 @@ power=3
toughness=2
[/card]
[card]
name=Blade of Selves
auto={4}:equip
text=Equipped creature has myriad. (Whenever it attacks, for each opponent other than defending player, you may put a token that's a copy of that creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Equip {4}
mana={2}
type=Artifact
subtype=Equipment
[/card]
[card]
name=Bladeback Sliver
abilities=hellbent
auto=aslongas(*|myhand) lord(sliver|myBattlefield) {T}:damage:1 target(player,planeswalker) <1
@@ -5943,6 +5962,24 @@ power=2
toughness=2
[/card]
[card]
name=Blast from the Past
target=player,creature
abilities=cycling,madness,hasotherkicker
kicker={2}{R}
flashback={3}{R}
buyback={4}{R}
autohand=__CYCLING__({1}{R})
autoexile=restriction{discarded} pay({R}) name(pay R to cast) activate name(pay R to cast) castcard(alternative)?name(put in graveyard) moveto(ownergraveyard)
auto=damage:2
auto=if paid(kicker) then token(Goblin,Creature Goblin,1/1,red)
auto=if paid(alternative) then may name(Pay also kicker) pay({2}{R}) name(Pay also kicker) token(Goblin,Creature Goblin,1/1,red)
auto=if paid(flashback) then may name(Pay also kicker) pay({2}{R}) name(Pay also kicker) token(Goblin,Creature Goblin,1/1,red)
auto=if paid(buyback) then may name(Pay also kicker) pay({2}{R}) name(Pay also kicker) token(Goblin,Creature Goblin,1/1,red)
text=Madness {R}, cycling {1}{R}, kicker {2}{R}, flashback {3}{R}, buyback {4}{R} -- Blast from the Past deals 2 damage to target creature or player. -- If the kicker cost was paid, put a 1/1 red Goblin creature token into play.
mana={2}{R}
type=Instant
[/card]
[card]
name=Blast Zone
auto=counter(0/0,1,Charge)
auto={T}:Add{C}
@@ -8022,6 +8059,16 @@ type=Artifact
subtype=Equipment
[/card]
[card]
name=Broodbirth Viper
auto=@combatdamaged(player) from(this):name(Draw a card) draw:1 controller
text=Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Whenever Broodbirth Viper deals combat damage to a player, you may draw a card.
mana={4}{U}
type=Creature
subtype=Snake
power=3
toughness=3
[/card]
[card]
name=Brought Back
auto=moveTo(myBattlefield) target(<upto:2>*[fresh;-instant;-sorcery]|mygraveyard) and!(tap(noevent))!
text=Choose up to two target permanent cards in your graveyard that were put there from the battlefield this turn. Return them to the battlefield tapped.
@@ -8212,6 +8259,33 @@ power=2
toughness=3
[/card]
[card]
name=Burn at the Stake
target=player,creature
auto=if type(creature[-tapped]|myBattlefield)~morethan~0 then choice name(Tap 1 creature) name(Tap 1 creature) damage:3 && ability$!name(Tap 1 creature) name(Tap 1 creature) target(creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~1 then choice name(Tap 2 creatures) name(Tap 2 creatures) damage:6 && ability$!name(Tap 2 creatures) name(Tap 2 creatures) target(<2>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~2 then choice name(Tap 3 creatures) name(Tap 3 creatures) damage:9 && ability$!name(Tap 3 creatures) name(Tap 3 creatures) target(<3>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~3 then choice name(Tap 4 creatures) name(Tap 4 creatures) damage:12 && ability$!name(Tap 4 creatures) name(Tap 4 creatures) target(<4>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~4 then choice name(Tap 5 creatures) name(Tap 5 creatures) damage:15 && ability$!name(Tap 5 creatures) name(Tap 5 creatures) target(<5>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~5 then choice name(Tap 6 creatures) name(Tap 6 creatures) damage:18 && ability$!name(Tap 6 creatures) name(Tap 6 creatures) target(<6>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~6 then choice name(Tap 7 creatures) name(Tap 7 creatures) damage:21 && ability$!name(Tap 7 creatures) name(Tap 7 creatures) target(<7>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~7 then choice name(Tap 8 creatures) name(Tap 8 creatures) damage:24 && ability$!name(Tap 8 creatures) name(Tap 8 creatures) target(<8>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~8 then choice name(Tap 9 creatures) name(Tap 9 creatures) damage:27 && ability$!name(Tap 9 creatures) name(Tap 9 creatures) target(<9>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~9 then choice name(Tap 10 creatures) name(Tap 10 creatures) damage:30 && ability$!name(Tap 10 creatures) name(Tap 10 creatures) target(<10>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~10 then choice name(Tap 11 creatures) name(Tap 11 creatures) damage:33 && ability$!name(Tap 11 creatures) name(Tap 11 creatures) target(<11>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~11 then choice name(Tap 12 creatures) name(Tap 12 creatures) damage:36 && ability$!name(Tap 12 creatures) name(Tap 12 creatures) target(<12>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~12 then choice name(Tap 13 creatures) name(Tap 13 creatures) damage:39 && ability$!name(Tap 13 creatures) name(Tap 13 creatures) target(<13>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~13 then choice name(Tap 14 creatures) name(Tap 14 creatures) damage:42 && ability$!name(Tap 14 creatures) name(Tap 14 creatures) target(<14>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~14 then choice name(Tap 15 creatures) name(Tap 15 creatures) damage:45 && ability$!name(Tap 15 creatures) name(Tap 15 creatures) target(<15>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~15 then choice name(Tap 16 creatures) name(Tap 16 creatures) damage:48 && ability$!name(Tap 16 creatures) name(Tap 16 creatures) target(<16>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~16 then choice name(Tap 17 creatures) name(Tap 17 creatures) damage:51 && ability$!name(Tap 17 creatures) name(Tap 17 creatures) target(<17>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~17 then choice name(Tap 18 creatures) name(Tap 18 creatures) damage:54 && ability$!name(Tap 18 creatures) name(Tap 18 creatures) target(<18>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~18 then choice name(Tap 19 creatures) name(Tap 19 creatures) damage:57 && ability$!name(Tap 19 creatures) name(Tap 19 creatures) target(<19>creature|myBattlefield) tap!$ controller
auto=if type(creature[-tapped]|myBattlefield)~morethan~19 then choice name(Tap 20 creatures) name(Tap 20 creatures) damage:60 && ability$!name(Tap 20 creatures) name(Tap 20 creatures) target(<20>creature|myBattlefield) tap!$ controller
text=As an additional cost to cast Burn at the Stake, tap any number of untapped creatures you control. -- Burn at the Stake deals damage to target creature or player equal to three times the number of creatures tapped this way.
mana={2}{R}{R}{R}
type=Sorcery
[/card]
[card]
name=Burn Bright
auto=all(creature|myBattlefield) +2/+0 ueot
text=Creatures you control get +2/+0 until end of turn.
@@ -8403,7 +8477,7 @@ type=Land
[card]
name=Cabal Therapist
abilities=menace
auto=@each my firstmain:may name(Sacrifice a creature) target(creature|mybattlefield) transforms((,newability[sacrifice],newability[chooseanameopp name(Look hand) target(*|opponenthand) moveto(opponenthand) and!( all(*[chosenname]|opponenthand) reject)! chooseend nonland])) oneshot
auto=@each my firstmain:may name(Sacrifice a creature) target(creature|mybattlefield) transforms((,newability[sacrifice],newability[chooseanameopp name(Look hand) target(*|opponenthand) moveto(opponentreveal) and!( moveto(opponenthand) and!( all(*[chosenname]|opponenthand) reject)! )! chooseend nonland])) oneshot
text=Menace -- At the beginning of your precombat main phase, you may sacrifice a creature. When you do, choose a nonland card name, then target player reveals their hand and discards all cards with that name.
mana={B}
type=Creature
@@ -8412,6 +8486,14 @@ power=1
toughness=1
[/card]
[card]
name=Cabal Therapy
flashback={S(creature|mybattlefield)}
auto=chooseanameopp name(Look hand) target(*|opponenthand) moveto(opponentreveal) and!( moveto(opponenthand) and!( all(*[chosenname]|opponenthand) reject)! )! chooseend nonland
text=Name a nonland card. Target player reveals his or her hand and discards all cards with that name. -- Flashback—Sacrifice a creature. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={B}
type=Sorcery
[/card]
[card]
name=Cacophodon
auto=_ENRAGE_untap target(*)
text=Enrage — Whenever Cacophodon is dealt damage, untap target permanent.
@@ -8544,6 +8626,16 @@ power=*
toughness=3
[/card]
[card]
name=Caller of the Pack
abilities=trample
text=Trample -- Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.)
mana={5}{G}{G}
type=Creature
subtype=Beast
power=8
toughness=6
[/card]
[card]
name=Callous Bloodmage
auto=choice name(Create Pest) token(Pest,Creature Pest,1/1,green,blue) and!( transforms((,newability[_DIES_life:1 controller])) forever )!
auto=choice name(Draw and lose life) draw:1 controller && life:-1 controller
@@ -70989,6 +71081,16 @@ power=2
toughness=3
[/card]
[card]
name=Warchief Giant
abilities=haste
text=Haste -- Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.)
mana={3}{R}{R}
type=Creature
subtype=Giant Warrior
power=5
toughness=3
[/card]
[card]
name=Warcry Phoenix
abilities=flying, haste
autograveyard=@each my blockers restriction{type(creature[attacking]|myBattlefield)~morethan~2}:pay({2}{r}) ninjutsu
@@ -71319,6 +71421,15 @@ power=2
toughness=2
[/card]
[card]
name=Wave of Vitriol
auto=all(artifact|battlefield) sacrifice
auto=all(enchantment|battlefield) sacrifice
auto=all(land[-basic]|battlefield) transforms((,newability[sacrifice],newability[may name(Search basic land) target(land[basic]|mylibrary) moveto(myBattlefield) and!( tap(noevent) )!])) oneshot
text=Each player sacrifices all artifacts, enchantments, and nonbasic lands he or she controls. For each land sacrificed this way, its controller may search his or her library for a basic land card and put it onto the battlefield tapped. Then each player who searched his or her library this way shuffles it.
mana={5}{G}{G}
type=Sorcery
[/card]
[card]
name=Wavebreak Hippocamp
auto=@movedto(*|mystack) restriction{opponentturnonly,thisturn(*|mystack)~equalto~0}:draw:1 controller
text=Whenever you cast your first spell during each opponents turn, draw a card.
@@ -71576,6 +71687,17 @@ power=1
toughness=4
[/card]
[card]
name=Whippoorwill
#MISSING: damage can't be prevented
auto={G}{G}{T}:name(Creature can't be regenerated) target(creature) transforms((,newability[cantregen],newability[exiledeath])) ueot
text={G}{G}, {T}: Target creature can't be regenerated this turn. Damage that would be dealt to that creature this turn can't be prevented or dealt instead to another creature or player. When the creature dies this turn, exile the creature.
mana={G}
type=Creature
subtype=Bird
power=1
toughness=1
[/card]
[card]
name=Whiptongue Hydra
abilities=reach
auto=@movedto(creature[flying]|graveyard):counter(1/1) oneshot

View File

@@ -683,15 +683,6 @@ power=2
toughness=3
[/card]
[card]
name=Banshee of the Dread Choir
text=Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Whenever Banshee of the Dread Choir deals combat damage to a player, that player discards a card.
mana={3}{B}{B}
type=Creature
subtype=Spirit
power=4
toughness=4
[/card]
[card]
name=Baral, Chief of Compliance
text=Instant and sorcery spells you cast cost {1} less to cast. -- Whenever a spell or ability you control counters a spell, you may draw a card. If you do, discard a card.
mana={1}{U}
@@ -880,19 +871,6 @@ mana={0}
type=Artifact
[/card]
[card]
name=Blade of Selves
text=Equipped creature has myriad. (Whenever it attacks, for each opponent other than defending player, you may put a token that's a copy of that creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Equip {4}
mana={2}
type=Artifact
subtype=Equipment
[/card]
[card]
name=Blast from the Past
text=Madness {R}, cycling {1}{R}, kicker {2}{R}, flashback {3}{R}, buyback {4}{R} -- Blast from the Past deals 2 damage to target creature or player. -- If the kicker cost was paid, put a 1/1 red Goblin creature token into play.
mana={2}{R}
type=Instant
[/card]
[card]
name=Blaze of Glory
text=Cast Blaze of Glory only during combat before blockers are declared. -- Target creature defending player controls can block any number of creatures this turn. It blocks each attacking creature this turn if able.
mana={W}
@@ -1259,7 +1237,7 @@ type=Artifact
[/card]
[card]
name=Bronzehide Lion
text={G}{W}: Bronzehide Lion gains indestructible until end of turn. -- When Bronzehide Lion dies, return it to the battlefield. It's an Aura enchantment with enchant creature you control and " {G}{W}: Enchanted creature gains indestructible until end of turn," and it loses all other abilities.
text={G}{W}: Bronzehide Lion gains indestructible until end of turn. -- When Bronzehide Lion dies, return it to the battlefield. It's an Aura enchantment with enchant creature you control and "{G}{W}: Enchanted creature gains indestructible until end of turn," and it loses all other abilities.
mana={G}{W}
type=Creature
subtype=Cat
@@ -1267,15 +1245,6 @@ power=3
toughness=3
[/card]
[card]
name=Broodbirth Viper
text=Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.) -- Whenever Broodbirth Viper deals combat damage to a player, you may draw a card.
mana={4}{U}
type=Creature
subtype=Snake
power=3
toughness=3
[/card]
[card]
name=Brown Ouphe
text={1}{G}, {T}: Counter target activated ability from an artifact source. (Mana abilities can't be targeted.)
mana={G}
@@ -1312,12 +1281,6 @@ mana={3}{U}{U}
type=Enchantment
[/card]
[card]
name=Burn at the Stake
text=As an additional cost to cast Burn at the Stake, tap any number of untapped creatures you control. -- Burn at the Stake deals damage to target creature or player equal to three times the number of creatures tapped this way.
mana={2}{R}{R}{R}
type=Sorcery
[/card]
[card]
name=Burning Cinder Fury of Crimson Chaos Fire
text=Whenever any player taps a card, that player gives control of that card to an opponent at end of turn. -- If a player does not tap any nonland cards during his or her turn, Burning Cinder Fury of Crimson Chaos Fire deals 3 damage to that player at end of turn.
mana={3}{R}
@@ -1378,12 +1341,6 @@ mana={2}{W}
type=Enchantment
[/card]
[card]
name=Cabal Therapy
text=Name a nonland card. Target player reveals his or her hand and discards all cards with that name. -- Flashback—Sacrifice a creature. (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={B}
type=Sorcery
[/card]
[card]
name=Call of the Nightwing
text=Put a 1/1 blue and black Horror creature token with flying onto the battlefield. -- Cipher (Then you may exile this spell card encoded on a creature you control. Whenever that creature deals combat damage to a player, its controller may cast a copy of the encoded card without paying its mana cost.)
mana={2}{U}{B}
@@ -1403,16 +1360,6 @@ type=Enchantment
subtype=Aura
[/card]
[card]
name=Caller of the Pack
abilities=trample
text=Trample -- Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.)
mana={5}{G}{G}
type=Creature
subtype=Beast
power=8
toughness=6
[/card]
[card]
name=Caller of the Untamed
text=Before you shuffle your deck to start the game, you may reveal this card from your deck and exile a creature card you drafted that isn't in your deck. -- {X}, {T}: Put a token onto the battlefield that's a copy of a card you exiled with cards named Caller of the Untamed. X is the converted mana cost of that card.
mana={3}{G}
@@ -12419,15 +12366,6 @@ power=3
toughness=3
[/card]
[card]
name=Warchief Giant
text=Haste -- Myriad (Whenever this creature attacks, for each opponent other than defending player, you may put a token that's a copy of this creature onto the battlefield tapped and attacking that player or a planeswalker he or she controls. Exile the tokens at end of combat.)
mana={3}{R}{R}
type=Creature
subtype=Giant Warrior
power=5
toughness=3
[/card]
[card]
name=Ward of Lights
text=You may cast Ward of Lights as though it had flash. If you cast it any time a sorcery couldn't have been cast, the controller of the permanent it becomes sacrifices it at the beginning of the next cleanup step. -- Enchant creature -- As Ward of Lights enters the battlefield, choose a color. -- Enchanted creature has protection from the chosen color. This effect doesn't remove Ward of Lights.
mana={W}{W}
@@ -12477,12 +12415,6 @@ text={T}: Add {1}{1} . Spend this mana only to cast spells with watermarks.
type=Land
[/card]
[card]
name=Wave of Vitriol
text=Each player sacrifices all artifacts, enchantments, and nonbasic lands he or she controls. For each land sacrificed this way, its controller may search his or her library for a basic land card and put it onto the battlefield tapped. Then each player who searched his or her library this way shuffles it.
mana={5}{G}{G}
type=Sorcery
[/card]
[card]
name=Waxing Moon
text=Transform up to one target Werewolf you control. Creatures you control gain trample until end of turn.
mana={1}{G}
@@ -12506,6 +12438,8 @@ toughness=5
[/card]
[card]
name=Weaver of Lies
facedown={3}
autofacedown={4}{U}:morph
text=Morph {4}{U} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.) -- When Weaver of Lies is turned face up, turn any number of target creatures with morph other than Weaver of Lies face down.
mana={5}{U}{U}
type=Creature
@@ -12591,15 +12525,6 @@ power=1
toughness=1
[/card]
[card]
name=Whippoorwill
text={G}{G}, {T}: Target creature can't be regenerated this turn. Damage that would be dealt to that creature this turn can't be prevented or dealt instead to another creature or player. When the creature dies this turn, exile the creature.
mana={G}
type=Creature
subtype=Bird
power=1
toughness=1
[/card]
[card]
name=Whirlpool Whelm
text=Clash with an opponent, then return target creature to its owner's hand. If you win, you may put that creature on top of its owner's library instead. (Each clashing player reveals the top card of his or her library, then puts that card on the top or bottom. A player wins if his or her card had a higher converted mana cost.)
mana={1}{U}

View File

@@ -121,6 +121,7 @@ public:
vector<int> ids;
map<int, MTGCard *> collection;
map<string, CardPrimitive *> primitives;
map<string, bool> limitedCardsMap; //used by parser in case of limited card list
MTGCard * _(int id);
MTGCard * getCardById(int id);

View File

@@ -562,6 +562,9 @@ void GameStateMenu::Update(float dt)
}
if (!nextSetFolder("sets/", "_cards.dat"))
{
//Reset LimitedCardsMap
MTGCollection()->limitedCardsMap.clear();
//Remove temporary translations
Translator::GetInstance()->tempValues.clear();

View File

@@ -414,6 +414,17 @@ void MTGAllCards::init()
tempPrimitive = NULL;
total_cards = 0;
initCounters();
izfstream limitedFile;
if (JFileSystem::GetInstance()->openForRead(limitedFile, "LimitedCardList.txt"))
{
string limitedLine;
while (getline(limitedFile,limitedLine))
{
if (limitedLine.size())
limitedCardsMap[limitedLine] = true;
}
}
limitedFile.close();
}
void MTGAllCards::loadFolder(const string& infolder, const string& filename )
@@ -474,19 +485,6 @@ int MTGAllCards::load(const string& config_file, const string &set_name)
int MTGAllCards::load(const string &config_file, int set_id)
{
izfstream limitedFile;
vector<string> limitedCardList;
if (JFileSystem::GetInstance()->openForRead(limitedFile, "LimitedCardList.txt"))
{
string limitedLine;
while (getline(limitedFile,limitedLine))
{
if (limitedLine.size())
limitedCardList.push_back(limitedLine);
}
}
limitedFile.close();
conf_read_mode = 0;
MTGSetInfo *si = setlist.getInfo(set_id);
@@ -556,15 +554,9 @@ int MTGAllCards::load(const string &config_file, int set_id)
if (s[0] == '[' && s[1] == '/')
{
conf_read_mode = MTGAllCards::READ_ANYTHING;
if (limitedCardList.size() && tempPrimitive){
bool found = false;
for(size_t i = 0; i < limitedCardList.size(); i++)
if(limitedCardList.at(i) == tempPrimitive->name)
found = true;
if(!found){
tempCard = NULL;
tempPrimitive = NULL;
}
if (limitedCardsMap.size() && ((tempPrimitive && !limitedCardsMap[tempPrimitive->name]) || (tempCard && !tempCard->data))){
SAFE_DELETE(tempCard);
SAFE_DELETE(tempPrimitive);
}
if (tempPrimitive) tempPrimitive = addPrimitive(tempPrimitive, tempCard);
if (tempCard)
@@ -604,6 +596,7 @@ MTGAllCards::~MTGAllCards()
for (map<string, CardPrimitive *>::iterator it = primitives.begin(); it != primitives.end(); it++)
delete (it->second);
primitives.clear();
limitedCardsMap.clear();
}
MTGAllCards* MTGAllCards::getInstance()