Erwan
- Magic 2010 - blockers ordering - Fixed a memory leak introduced in a previous revision (foreach)
This commit is contained in:
@@ -51,6 +51,7 @@ class AIPlayer: public Player{
|
||||
ManaCost * potentialMana;
|
||||
queue<AIAction *> clickstream;
|
||||
void tapLandsForMana(ManaCost * potentialMana, ManaCost * cost);
|
||||
int orderBlockers();
|
||||
int combatDamages();
|
||||
int interruptIfICan();
|
||||
int chooseAttackers();
|
||||
|
||||
@@ -931,17 +931,17 @@ class AInstantPowerToughnessModifierUntilEOT: public InstantAbility{
|
||||
|
||||
|
||||
//Untap Blockers with simple Mana Mechanism
|
||||
class AUntapManaBlocker: public Blocker{
|
||||
class AUntapManaBlocker: public UntapBlocker{
|
||||
public:
|
||||
AUntapManaBlocker(int id, MTGCardInstance * card, ManaCost * _cost):Blocker(id, card, _cost){
|
||||
AUntapManaBlocker(int id, MTGCardInstance * card, ManaCost * _cost):UntapBlocker(id, card, _cost){
|
||||
}
|
||||
|
||||
AUntapManaBlocker(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost):Blocker(id, card,_target, _cost){
|
||||
AUntapManaBlocker(int id, MTGCardInstance * card, MTGCardInstance * _target, ManaCost * _cost):UntapBlocker(id, card,_target, _cost){
|
||||
}
|
||||
virtual ostream& toString(ostream& out) const
|
||||
{
|
||||
out << "AUntapManaBlocker ::: (";
|
||||
return Blocker::toString(out) << ")";
|
||||
return UntapBlocker::toString(out) << ")";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class ManaCost;
|
||||
class GameObserver;
|
||||
class MTGAbility;
|
||||
|
||||
class Blocker : public MTGAbility {
|
||||
class UntapBlocker : public MTGAbility {
|
||||
protected:
|
||||
ManaCost * manaCost;
|
||||
int currentPhase;
|
||||
@@ -20,28 +20,28 @@ class Blocker : public MTGAbility {
|
||||
public:
|
||||
virtual ManaCost * untapManaCost(){return manaCost;};
|
||||
virtual int unblock(){return 1;};
|
||||
Blocker(int id, MTGCardInstance * card, ManaCost * _cost);
|
||||
Blocker(int id, MTGCardInstance * card);
|
||||
Blocker(int id, MTGCardInstance * card, MTGCardInstance *_target);
|
||||
Blocker(int id, MTGCardInstance * card, MTGCardInstance *_target, ManaCost * _cost);
|
||||
~Blocker();
|
||||
UntapBlocker(int id, MTGCardInstance * card, ManaCost * _cost);
|
||||
UntapBlocker(int id, MTGCardInstance * card);
|
||||
UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target);
|
||||
UntapBlocker(int id, MTGCardInstance * card, MTGCardInstance *_target, ManaCost * _cost);
|
||||
~UntapBlocker();
|
||||
virtual void Update(float dt);
|
||||
virtual int destroy();
|
||||
};
|
||||
|
||||
|
||||
class Blockers {
|
||||
class UntapBlockers {
|
||||
protected:
|
||||
int cursor;
|
||||
int blockers[MAX_BLOCKERS];
|
||||
GameObserver * game;
|
||||
public:
|
||||
Blockers();
|
||||
~Blockers();
|
||||
int Add (Blocker * ability);
|
||||
int Remove (Blocker * ability);
|
||||
UntapBlockers();
|
||||
~UntapBlockers();
|
||||
int Add (UntapBlocker * ability);
|
||||
int Remove (UntapBlocker * ability);
|
||||
int init();
|
||||
Blocker * next();
|
||||
UntapBlocker * next();
|
||||
int rewind();
|
||||
int isEmpty();
|
||||
};
|
||||
|
||||
@@ -10,8 +10,11 @@ class DamageStack;
|
||||
class DamageResolverLayer:public PlayGuiObjectController{
|
||||
protected:
|
||||
int trampleDamage();
|
||||
void updateAllCoordinates();
|
||||
public:
|
||||
int buttonOk;
|
||||
int orderingIsNeeded;
|
||||
|
||||
int currentPhase;
|
||||
int remainingDamageSteps;
|
||||
Player * currentChoosingPlayer;
|
||||
@@ -23,16 +26,26 @@ class DamageResolverLayer:public PlayGuiObjectController{
|
||||
int initResolve();
|
||||
Player * whoSelectsDamagesDealtBy(MTGCardInstance * card);
|
||||
int addAutoDamageToOpponents(MTGCardInstance * card);
|
||||
int addIfNotExists(MTGCardInstance * card, Player * selecter);
|
||||
DamagerDamaged * addIfNotExists(MTGCardInstance * card, Player * selecter);
|
||||
int addDamager(MTGCardInstance * card, Player * selecter);
|
||||
int updateCoordinates(MTGCardInstance * card);
|
||||
DamagerDamaged * findByCard(MTGCardInstance * card);
|
||||
int canStopDealDamages();
|
||||
int resolveDamages();
|
||||
int isOpponent(DamagerDamaged * a, DamagerDamaged * b);
|
||||
void nextPlayer();
|
||||
int nextPlayer();
|
||||
virtual void Update(float dt);
|
||||
virtual bool CheckUserInput(u32 key);
|
||||
virtual void Render();
|
||||
int isDisplayed(){return mCount;};
|
||||
int autoOrderBlockers();
|
||||
bool blockersOrderingDone();
|
||||
|
||||
bool clickDamage(DamagerDamaged * current);
|
||||
bool clickDamage(MTGCardInstance * c);
|
||||
bool clickReorderBlocker(MTGCardInstance * blocker);
|
||||
|
||||
bool checkUserInputOrderBlockers(u32 key);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,10 +28,11 @@ class GameObserver{
|
||||
int nbPlayers;
|
||||
int currentPlayerId;
|
||||
int currentRound;
|
||||
|
||||
int blockersAssigned;
|
||||
|
||||
|
||||
public:
|
||||
int blockersSorted;
|
||||
int forceShuffleLibrary[2];
|
||||
int turn;
|
||||
int forceShuffleLibraries();
|
||||
|
||||
@@ -17,11 +17,12 @@ class MTGAbility;
|
||||
class MTGCard;
|
||||
class TexturesCache;
|
||||
class ManaCost;
|
||||
class Blockers;
|
||||
class UntapBlockers;
|
||||
class CardDescriptor;
|
||||
class Counters;
|
||||
|
||||
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
class MTGCardInstance: public MTGCard, public Damageable {
|
||||
protected:
|
||||
@@ -31,9 +32,9 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
int tapped;
|
||||
|
||||
int lifeOrig;
|
||||
Blockers * blockers;
|
||||
UntapBlockers * untapBlockers;
|
||||
MTGPlayerCards * belongs_to;
|
||||
MTGAbility * UntapBlockers[10];
|
||||
MTGAbility * untapBlockerAbilities[10];
|
||||
void unband();
|
||||
MTGCardInstance * getNextPartner();
|
||||
void initMTGCI();
|
||||
@@ -51,38 +52,47 @@ class MTGCardInstance: public MTGCard, public Damageable {
|
||||
// The recommended method to test for summoning Sickness !
|
||||
int hasSummoningSickness();
|
||||
MTGCardInstance * changeController(Player * newcontroller);
|
||||
MTGCardInstance * defenser;
|
||||
float changedZoneRecently;
|
||||
Player * owner;
|
||||
Counters * counters;
|
||||
int typeAsTarget(){return TARGET_CARD;}
|
||||
int attacker;
|
||||
MTGCardInstance * banding; // If belongs to a band when attacking
|
||||
MTGCardInstance * target;
|
||||
void addType(int type);
|
||||
|
||||
//Combat
|
||||
MTGCardInstance * defenser;
|
||||
list<MTGCardInstance *>blockers;
|
||||
int attacker;
|
||||
int toggleDefenser(MTGCardInstance * opponent);
|
||||
int moveBlockerInRow(MTGCardInstance * blocker);
|
||||
int toggleAttacker();
|
||||
MTGCardInstance * banding; // If belongs to a band when attacking
|
||||
int canBlock();
|
||||
int canBlock(MTGCardInstance * opponent);
|
||||
int canAttack();
|
||||
int isAttacker();
|
||||
MTGCardInstance * isDefenser();
|
||||
int initAttackersDefensers();
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
||||
MTGCardInstance * getNextDefenser(MTGCardInstance * previous=NULL);
|
||||
int nbOpponents();
|
||||
|
||||
int afterDamage();
|
||||
|
||||
int has(int ability);
|
||||
int cleanup();
|
||||
int reset();
|
||||
int isAttacker();
|
||||
MTGCardInstance * isDefenser();
|
||||
int toggleDefenser(MTGCardInstance * opponent);
|
||||
int toggleAttacker();
|
||||
|
||||
|
||||
MTGCard * model;
|
||||
MTGCardInstance();
|
||||
MTGCardInstance(MTGCard * card, MTGPlayerCards * _belongs_to);
|
||||
Blockers * getBlockers();
|
||||
UntapBlockers * getUntapBlockers();
|
||||
int regenerate();
|
||||
int triggerRegenerate();
|
||||
Player * controller();
|
||||
JQuad * getIcon();
|
||||
int initAttackersDefensers();
|
||||
MTGCardInstance * getNextOpponent(MTGCardInstance * previous=NULL);
|
||||
int nbOpponents();
|
||||
|
||||
~MTGCardInstance();
|
||||
int bury();
|
||||
int destroy();
|
||||
|
||||
@@ -15,9 +15,9 @@ class MTGGuiPlay: public PlayGuiObjectController {
|
||||
int offset;
|
||||
Player * currentPlayer;
|
||||
MTGCardInstance * cardsGrid[SCREEN_WIDTH/5][SCREEN_HEIGHT/5];
|
||||
int nb_creatures;
|
||||
int nb_spells;
|
||||
int nb_lands;
|
||||
int nb_creatures[2];
|
||||
int nb_spells[2];
|
||||
int nb_lands[2];
|
||||
int cards_x_limit;
|
||||
|
||||
JQuad * phaseIcons[24];
|
||||
|
||||
Reference in New Issue
Block a user