* Add some pretty printers to help debugging.
This commit is contained in:
jean.chalard
2009-09-04 13:22:15 +00:00
parent 2a7d6819bb
commit 2e7570fdea
15 changed files with 71 additions and 20 deletions

View File

@@ -62,7 +62,7 @@ class AIPlayer: public Player{
AIStats * getStats();
public:
void End(){};
virtual int displayStack(){return 0;};
virtual int displayStack() {return 0;};
AIStats * stats;
ManaCost * getPotentialMana();
AIPlayer(MTGPlayerCards * deck, string deckFile, string deckFileSmall);

View File

@@ -57,7 +57,7 @@ class Interruptible: public PlayGuiObject, public Targetable{
virtual void Render(){};
int typeAsTarget(){return TARGET_STACKACTION;};
Interruptible(bool hasFocus = false):PlayGuiObject(40,x,y,hasFocus){state=NOT_RESOLVED;display=0;source=NULL;};
virtual const string getDisplayName(){return "stack object";};
virtual const string getDisplayName() const {return "stack object";};
#if defined (WIN32) || defined (LINUX)
virtual void Dump();
#endif
@@ -82,7 +82,7 @@ class Spell: public Interruptible {
~Spell();
int resolve();
void Render();
const string getDisplayName();
const string getDisplayName() const;
virtual ostream& toString(ostream& out) const;
MTGCardInstance * getNextCardTarget(MTGCardInstance * previous = 0);
Player * getNextPlayerTarget(Player * previous = 0);

View File

@@ -68,10 +68,10 @@ class GuiHandSelf : public GuiHand
virtual int receiveEventPlus(WEvent* e);
virtual int receiveEventMinus(WEvent* e);
void Repos();
bool CheckUserInput(u32 key);
virtual void Render();
void Update(float dt);
void Repos();
float LeftBoundary();
HandLimitor* limitor;

View File

@@ -59,7 +59,7 @@ class MTGCardInstance: public MTGCard, public Damageable {
Player * owner;
Counters * counters;
int typeAsTarget(){return TARGET_CARD;}
const string getDisplayName();
const string getDisplayName() const;
MTGCardInstance * target;
void addType(int type);
@@ -124,9 +124,11 @@ class MTGCardInstance: public MTGCard, public Damageable {
int isInPlay();
void resetAllDamage();
JSample * getSample();
ostream& toString(ostream&) const;
};
ostream& operator<<(ostream&, const MTGCardInstance&);
#endif

View File

@@ -86,6 +86,8 @@ class MTGGameZone {
static int zoneStringToId(string zoneName);
static MTGGameZone *intToZone(int zoneId, MTGCardInstance * source = NULL,MTGCardInstance * target = NULL);
bool needShuffle;
virtual ostream& toString(ostream&) const;
};
class MTGLibrary: public MTGGameZone {
@@ -93,23 +95,28 @@ class MTGLibrary: public MTGGameZone {
// MTGLibrary();
void shuffleTopToBottom(int nbcards);
MTGCardInstance * draw();
virtual ostream& toString(ostream&) const;
};
class MTGGraveyard: public MTGGameZone {
public:
// MTGGraveyard();
virtual ostream& toString(ostream&) const;
};
class MTGHand: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
};
class MTGRemovedFromGame: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
};
class MTGStack: public MTGGameZone {
public:
virtual ostream& toString(ostream&) const;
};
class MTGInPlay: public MTGGameZone {
@@ -120,6 +127,7 @@ class MTGInPlay: public MTGGameZone {
MTGCardInstance * getNextDefenser(MTGCardInstance * previous, MTGCardInstance * attacker);
int nbDefensers( MTGCardInstance * attacker);
int nbPartners(MTGCardInstance * attacker);
virtual ostream& toString(ostream&) const;
};
@@ -153,8 +161,8 @@ class MTGPlayerCards {
MTGCardInstance * putInZone(MTGCardInstance * card, MTGGameZone * from, MTGGameZone * to);
MTGCardInstance * putInPlay(MTGCardInstance * card);
int isInPlay(MTGCardInstance * card);
};
ostream& operator<<(ostream&, const MTGGameZone&);
#endif

View File

@@ -17,7 +17,7 @@ class Player: public Damageable{
public:
virtual void End();
int typeAsTarget(){return TARGET_PLAYER;}
const string getDisplayName();
const string getDisplayName() const;
virtual int displayStack(){return 1;}
JTexture * mAvatarTex;
JQuad * mAvatar;
@@ -45,7 +45,6 @@ class HumanPlayer: public Player{
};
ostream& operator<<(ostream&, const Player&);
#endif

View File

@@ -8,7 +8,7 @@
class Targetable{
public:
virtual int typeAsTarget() = 0;
virtual const string getDisplayName() = 0;
virtual const string getDisplayName() const = 0;
};
#endif

View File

@@ -1,6 +1,7 @@
#ifndef _WEVENT_H_
#define _WEVENT_H_
#include <iostream>
#include "PhaseRing.h"
class MTGCardInstance;
@@ -21,6 +22,7 @@ public:
int type; //Deprecated, use dynamic casting instead
WEvent(int type = NOT_SPECIFIED);
virtual ~WEvent() {};
virtual std::ostream& toString(std::ostream& out) const;
};
struct WEventZoneChange : public WEvent {
@@ -29,6 +31,7 @@ struct WEventZoneChange : public WEvent {
MTGGameZone * to;
WEventZoneChange(MTGCardInstance * card, MTGGameZone * from, MTGGameZone *to);
virtual ~WEventZoneChange() {};
virtual std::ostream& toString(std::ostream& out) const;
};
@@ -116,4 +119,6 @@ struct WEventEmptyManaPool : public WEvent {
WEventEmptyManaPool(ManaPool * source);
};
std::ostream& operator<<(std::ostream&, const WEvent&);
#endif