* ostream printing of JGui objects.
This commit is contained in:
jean.chalard
2009-05-23 08:34:50 +00:00
parent 215e23a975
commit dd054c4963
32 changed files with 1505 additions and 528 deletions
+5
View File
@@ -62,6 +62,7 @@ class NextGamePhase: public Interruptible {
public: public:
int resolve(); int resolve();
void Render(); void Render();
virtual ostream& toString(ostream& out) const;
NextGamePhase(int id); NextGamePhase(int id);
}; };
@@ -75,6 +76,7 @@ class Spell: public Interruptible, public TargetsList {
~Spell(); ~Spell();
int resolve(); int resolve();
void Render(); void Render();
virtual ostream& toString(ostream& out) const;
}; };
class StackAbility: public Interruptible { class StackAbility: public Interruptible {
@@ -82,6 +84,7 @@ class StackAbility: public Interruptible {
MTGAbility * ability; MTGAbility * ability;
int resolve(); int resolve();
void Render(); void Render();
virtual ostream& toString(ostream& out) const;
StackAbility(int id, MTGAbility * _ability); StackAbility(int id, MTGAbility * _ability);
}; };
@@ -91,6 +94,7 @@ class PutInGraveyard: public Interruptible {
int removeFromGame; int removeFromGame;
int resolve(); int resolve();
void Render(); void Render();
virtual ostream& toString(ostream& out) const;
PutInGraveyard(int id, MTGCardInstance * _card); PutInGraveyard(int id, MTGCardInstance * _card);
}; };
@@ -101,6 +105,7 @@ class DrawAction: public Interruptible {
Player * player; Player * player;
int resolve(); int resolve();
void Render(); void Render();
virtual ostream& toString(ostream& out) const;
DrawAction(int id, Player * _player, int _nbcards); DrawAction(int id, Player * _player, int _nbcards);
}; };
File diff suppressed because it is too large Load Diff
+4
View File
@@ -20,6 +20,7 @@ class CardDisplay:public PlayGuiObjectController{
bool CheckUserInput(u32 key); bool CheckUserInput(u32 key);
void Render(); void Render();
void init(MTGGameZone * zone); void init(MTGGameZone * zone);
virtual ostream& toString(ostream& out) const;
}; };
@@ -29,4 +30,7 @@ class DefaultTargetDisplay:CardDisplay{
DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y, JGuiListener * _listener, int _nb_displayed_items ); DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y, JGuiListener * _listener, int _nb_displayed_items );
~DefaultTargetDisplay(); ~DefaultTargetDisplay();
}; };
std::ostream& operator<<(std::ostream& out, const CardDisplay& m);
#endif #endif
+1
View File
@@ -20,6 +20,7 @@ class CardGui: public PlayGuiObject{
CardGui(int id, MTGCardInstance * _card, float desiredHeight, float _x=0, float _y=0, bool hasFocus = false); CardGui(int id, MTGCardInstance * _card, float desiredHeight, float _x=0, float _y=0, bool hasFocus = false);
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
virtual ostream& toString(ostream& out) const;
void RenderBig(float x=-1, float y = -1, int alternate = 0); void RenderBig(float x=-1, float y = -1, int alternate = 0);
static void alternateRender(MTGCard * card, JQuad ** manaIcons, float x, float y, float rotation= 0, float scale=1); static void alternateRender(MTGCard * card, JQuad ** manaIcons, float x, float y, float rotation= 0, float scale=1);
+2
View File
@@ -36,6 +36,7 @@ class Damage: public Interruptible {
Damage(int id, MTGCardInstance* _source, Damageable * _target); Damage(int id, MTGCardInstance* _source, Damageable * _target);
Damage(int id, MTGCardInstance* _source, Damageable * _target, int _damage); Damage(int id, MTGCardInstance* _source, Damageable * _target, int _damage);
int resolve(); int resolve();
virtual ostream& toString(ostream& out) const;
}; };
@@ -49,6 +50,7 @@ class DamageStack :public GuiLayer, public Interruptible{
void Render(); void Render();
int CombatDamages();//Deprecated ? int CombatDamages();//Deprecated ?
int CombatDamages(int strike); int CombatDamages(int strike);
virtual ostream& toString(ostream& out) const;
DamageStack(int id, GameObserver* _game); DamageStack(int id, GameObserver* _game);
}; };
+1
View File
@@ -54,6 +54,7 @@ class GameStateMenu: public GameState, public JGuiListener
int nextCardSet(); // Retrieves the next set subfolder automatically int nextCardSet(); // Retrieves the next set subfolder automatically
void createUsersFirstDeck(int setId); void createUsersFirstDeck(int setId);
virtual ostream& toString(ostream& out) const;
}; };
#endif #endif
+7 -1
View File
@@ -58,6 +58,7 @@ class MTGAbility: public ActionElement{
virtual int fireAbility(); virtual int fireAbility();
virtual int stillInUse(MTGCardInstance * card){if (card==source) return 1; return 0;}; virtual int stillInUse(MTGCardInstance * card){if (card==source) return 1; return 0;};
virtual int resolve(){return 0;}; virtual int resolve(){return 0;};
virtual ostream& toString(ostream& out) const;
/*Poor man's casting */ /*Poor man's casting */
/* Todo replace that crap with dynamic casting */ /* Todo replace that crap with dynamic casting */
@@ -70,7 +71,6 @@ class MTGAbility: public ActionElement{
PUT_INTO_PLAY = 5, PUT_INTO_PLAY = 5,
MOMIR = 6, MOMIR = 6,
MTG_BLOCK_RULE = 7, MTG_BLOCK_RULE = 7,
}; };
}; };
@@ -83,6 +83,7 @@ class TriggeredAbility:public MTGAbility{
virtual void Render(){}; virtual void Render(){};
virtual int trigger()=0; virtual int trigger()=0;
virtual int resolve() = 0; virtual int resolve() = 0;
virtual ostream& toString(ostream& out) const;
}; };
@@ -95,6 +96,7 @@ class ActivatedAbility:public MTGAbility{
virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); virtual int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
virtual int reactToTargetClick(Targetable * object); virtual int reactToTargetClick(Targetable * object);
virtual int resolve() = 0; virtual int resolve() = 0;
virtual ostream& toString(ostream& out) const;
}; };
class TargetAbility:public ActivatedAbility{ class TargetAbility:public ActivatedAbility{
@@ -105,6 +107,7 @@ class TargetAbility:public ActivatedAbility{
virtual int reactToClick(MTGCardInstance * card); virtual int reactToClick(MTGCardInstance * card);
virtual int reactToTargetClick(Targetable * object); virtual int reactToTargetClick(Targetable * object);
virtual void Render(); virtual void Render();
virtual ostream& toString(ostream& out) const;
}; };
class InstantAbility:public MTGAbility{ class InstantAbility:public MTGAbility{
@@ -115,6 +118,7 @@ class InstantAbility:public MTGAbility{
InstantAbility(int _id, MTGCardInstance * source); InstantAbility(int _id, MTGCardInstance * source);
InstantAbility(int _id, MTGCardInstance * source,Damageable * _target); InstantAbility(int _id, MTGCardInstance * source,Damageable * _target);
virtual int resolve(){return 0;}; virtual int resolve(){return 0;};
virtual ostream& toString(ostream& out) const;
}; };
/* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */ /* State based effects. This class works ONLY for InPlay and needs to be extended for other areas of the game !!! */
@@ -129,6 +133,7 @@ class ListMaintainerAbility:public MTGAbility{
virtual int added(MTGCardInstance * card) = 0; virtual int added(MTGCardInstance * card) = 0;
virtual int removed(MTGCardInstance * card) = 0; virtual int removed(MTGCardInstance * card) = 0;
virtual int destroy(); virtual int destroy();
virtual ostream& toString(ostream& out) const;
}; };
/* An attempt to globalize triggered abilities as much as possible */ /* An attempt to globalize triggered abilities as much as possible */
@@ -255,6 +260,7 @@ class AManaProducer: public MTGAbility{
const char * getMenuText(); const char * getMenuText();
int testDestroy(); int testDestroy();
~AManaProducer(); ~AManaProducer();
virtual ostream& toString(ostream& out) const;
}; };
#include "MTGCardInstance.h" #include "MTGCardInstance.h"
+1
View File
@@ -18,6 +18,7 @@ class MTGGamePhase: public ActionElement {
virtual void Render(); virtual void Render();
virtual void Update(float dt); virtual void Update(float dt);
bool CheckUserInput(u32 key); bool CheckUserInput(u32 key);
virtual ostream& toString(ostream& out) const;
}; };
+19 -3
View File
@@ -13,9 +13,9 @@ class MTGPutInPlayRule:public MTGAbility{
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int testDestroy(); int testDestroy();
virtual ostream& toString(ostream& out) const;
MTGPutInPlayRule(int _id); MTGPutInPlayRule(int _id);
const char * getMenuText(){return "Put into play";} const char * getMenuText(){return "Put into play";}
}; };
class MTGAttackRule:public MTGAbility{ class MTGAttackRule:public MTGAbility{
@@ -23,10 +23,10 @@ class MTGAttackRule:public MTGAbility{
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int testDestroy(); int testDestroy();
virtual ostream& toString(ostream& out) const;
MTGAttackRule(int _id); MTGAttackRule(int _id);
const char * getMenuText(){return "Attacker";} const char * getMenuText(){return "Attacker";}
void Update(float dt); void Update(float dt);
}; };
class MTGBlockRule:public MTGAbility{ class MTGBlockRule:public MTGAbility{
@@ -34,6 +34,7 @@ class MTGBlockRule:public MTGAbility{
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int testDestroy(); int testDestroy();
virtual ostream& toString(ostream& out) const;
MTGBlockRule(int _id); MTGBlockRule(int _id);
const char * getMenuText(){return "Blocker";} const char * getMenuText(){return "Blocker";}
}; };
@@ -78,8 +79,12 @@ OutputDebugString("Receive5\n");
return 0; return 0;
} }
virtual ostream& toString(ostream& out) const
{
out << "MTGPersistRule ::: (";
return MTGAbility::toString(out) << ")";
}
int testDestroy(){return 0;} int testDestroy(){return 0;}
}; };
@@ -119,6 +124,11 @@ class MTGLegendRule:public ListMaintainerAbility{
int removed(MTGCardInstance * card){return 0;} int removed(MTGCardInstance * card){return 0;}
int testDestroy(){return 0;} int testDestroy(){return 0;}
virtual ostream& toString(ostream& out) const
{
return out << "MTGLegendRule :::";
}
}; };
@@ -143,6 +153,7 @@ public:
int reactToClick(MTGCardInstance * card); int reactToClick(MTGCardInstance * card);
int reactToClick(MTGCardInstance * card, int id); int reactToClick(MTGCardInstance * card, int id);
const char * getMenuText(){return "Momir";} const char * getMenuText(){return "Momir";}
virtual ostream& toString(ostream& out) const;
}; };
@@ -166,6 +177,11 @@ class MTGLifelinkRule:public MTGAbility{
int testDestroy(){return 0;} int testDestroy(){return 0;}
virtual ostream& toString(ostream& out) const
{
out << "MTGLifelinkRule ::: (";
return MTGAbility::toString(out) << ")";
}
}; };
+2
View File
@@ -64,4 +64,6 @@ class ManaCost{
#endif #endif
}; };
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
#endif #endif
+2
View File
@@ -39,6 +39,8 @@ class MenuItem: public JGuiObject
virtual void Entering(); virtual void Entering();
virtual bool Leaving(u32 key); virtual bool Leaving(u32 key);
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const;
}; };
#endif #endif
+1
View File
@@ -22,6 +22,7 @@ class OptionItem:public JGuiObject{
virtual bool Leaving(); virtual bool Leaving();
void setData(); void setData();
virtual void updateValue(){value+=increment; if (value>maxValue) value=0;}; virtual void updateValue(){value+=increment; if (value>maxValue) value=0;};
virtual ostream& toString(ostream& out) const;
}; };
class OptionsList{ class OptionsList{
+4
View File
@@ -47,6 +47,7 @@ class GuiAvatar: public PlayGuiObject{
Player * player; Player * player;
virtual void Render(); virtual void Render();
GuiAvatar(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * _player); GuiAvatar(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * _player);
virtual ostream& toString(ostream& out) const;
}; };
class GuiGameZone: public PlayGuiObject{ class GuiGameZone: public PlayGuiObject{
@@ -62,16 +63,19 @@ class GuiGameZone: public PlayGuiObject{
~GuiGameZone(); ~GuiGameZone();
virtual void ButtonPressed(int controllerId, int controlId); virtual void ButtonPressed(int controllerId, int controlId);
void toggleDisplay(); void toggleDisplay();
virtual ostream& toString(ostream& out) const;
}; };
class GuiGraveyard: public GuiGameZone{ class GuiGraveyard: public GuiGameZone{
public: public:
GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player); GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
virtual ostream& toString(ostream& out) const;
}; };
class GuiLibrary: public GuiGameZone{ class GuiLibrary: public GuiGameZone{
public: public:
GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player); GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player);
virtual ostream& toString(ostream& out) const;
}; };
+1
View File
@@ -46,6 +46,7 @@ class ShopItem:public JGuiObject{
virtual bool ButtonPressed(); virtual bool ButtonPressed();
const char * getText(); const char * getText();
virtual ostream& toString(ostream& out) const;
}; };
class ShopItems:public JGuiController,public JGuiListener{ class ShopItems:public JGuiController,public JGuiListener{
+1
View File
@@ -40,6 +40,7 @@ class SimpleMenuItem: public JGuiObject
virtual void Entering(); virtual void Entering();
virtual bool Leaving(u32 key); virtual bool Leaving(u32 key);
virtual bool ButtonPressed(); virtual bool ButtonPressed();
virtual ostream& toString(ostream& out) const;
}; };
#endif #endif
+2 -1
View File
@@ -19,7 +19,7 @@ private:
float start; float start;
int timer; int timer;
vector<string> strings; vector<string> strings;
int currentId; unsigned int currentId;
int mRandom; int mRandom;
public: public:
void Add(string text); void Add(string text);
@@ -28,6 +28,7 @@ public:
TextScroller(JLBFont * font, float x, float y, float width, float speed = 30); TextScroller(JLBFont * font, float x, float y, float width, float speed = 30);
void Render(); void Render();
void Update(float dt); void Update(float dt);
virtual ostream& toString(ostream& out) const;
}; };
#endif #endif
+27
View File
@@ -38,6 +38,11 @@ NextGamePhase::NextGamePhase(int id): Interruptible(id){
type = ACTION_NEXTGAMEPHASE; type = ACTION_NEXTGAMEPHASE;
} }
ostream& NextGamePhase::toString(ostream& out) const
{
out << "NextGamePhase ::: ";
return out;
}
/* Ability */ /* Ability */
int StackAbility::resolve(){ int StackAbility::resolve(){
@@ -64,6 +69,11 @@ StackAbility::StackAbility(int id,MTGAbility * _ability): Interruptible(id),abil
type=ACTION_ABILITY; type=ACTION_ABILITY;
} }
ostream& StackAbility::toString(ostream& out) const
{
out << "StackAbility ::: ability : " << ability;
return out;
}
/* Spell Cast */ /* Spell Cast */
@@ -167,6 +177,12 @@ void Spell::Render(){
} }
} }
ostream& Spell::toString(ostream& out) const
{
out << "Spell ::: cost : " << cost;
return out;
}
/* Put a card in graveyard */ /* Put a card in graveyard */
@@ -206,6 +222,11 @@ void PutInGraveyard::Render(){
} }
} }
ostream& PutInGraveyard::toString(ostream& out) const
{
out << "PutInGraveyard ::: removeFromGame : " << removeFromGame;
return out;
}
/* Draw a Card */ /* Draw a Card */
DrawAction::DrawAction(int id, Player * _player, int _nbcards):Interruptible(id), nbcards(_nbcards), player(_player){ DrawAction::DrawAction(int id, Player * _player, int _nbcards):Interruptible(id), nbcards(_nbcards), player(_player){
@@ -229,6 +250,12 @@ void DrawAction::Render(){
mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT); mFont->DrawString(buffer, x + 20 , y, JGETEXT_LEFT);
} }
ostream& DrawAction::toString(ostream& out) const
{
out << "DrawAction ::: nbcards : " << nbcards << " ; player : " << player;
return out;
}
/* The Action Stack itself */ /* The Action Stack itself */
int ActionStack::addPutInGraveyard(MTGCardInstance * card){ int ActionStack::addPutInGraveyard(MTGCardInstance * card){
PutInGraveyard * death = NEW PutInGraveyard(mCount,card); PutInGraveyard * death = NEW PutInGraveyard(mCount,card);
+10
View File
@@ -145,6 +145,11 @@ void CardDisplay::Render(){
} }
} }
ostream& CardDisplay::toString(ostream& out) const
{
return (out << "CardDisplay ::: x,y : " << x << "," << y << " ; start_item : " << start_item << " ; nb_displayed_items " << nb_displayed_items << " ; tc : " << tc << " ; listener : " << listener);
}
DefaultTargetDisplay::DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y,JGuiListener * _listener, int _nb_displayed_items ):CardDisplay(id, _game, _x, _y, _listener, NULL, _nb_displayed_items ){ DefaultTargetDisplay::DefaultTargetDisplay(int id, GameObserver* _game, int _x, int _y,JGuiListener * _listener, int _nb_displayed_items ):CardDisplay(id, _game, _x, _y, _listener, NULL, _nb_displayed_items ){
tc = NEW TargetChooser(); tc = NEW TargetChooser();
} }
@@ -152,3 +157,8 @@ DefaultTargetDisplay::DefaultTargetDisplay(int id, GameObserver* _game, int _x,
DefaultTargetDisplay::~DefaultTargetDisplay(){ DefaultTargetDisplay::~DefaultTargetDisplay(){
SAFE_DELETE(tc); SAFE_DELETE(tc);
} }
std::ostream& operator<<(std::ostream& out, const CardDisplay& m)
{
return m.toString(out);
}
+4 -2
View File
@@ -414,5 +414,7 @@ CardGui::~CardGui(){
LOG("==CardGui object destruction Successful"); LOG("==CardGui object destruction Successful");
} }
ostream& CardGui::toString(ostream& out) const
{
return (out << "CardGui ::: mParticleSys : " << mParticleSys << " ; alpha : " << alpha << " ; card : " << card);
}
+10
View File
@@ -80,6 +80,12 @@ void Damage::Render(){
} }
ostream& Damage::toString(ostream& out) const
{
out << "Damage ::: target : " << target << " ; damage " << damage;
return out;
}
DamageStack::DamageStack(int id, GameObserver * _game):GuiLayer(id, _game), Interruptible(id){ DamageStack::DamageStack(int id, GameObserver * _game):GuiLayer(id, _game), Interruptible(id){
currentState = -1; currentState = -1;
type = ACTION_DAMAGES; type = ACTION_DAMAGES;
@@ -158,3 +164,7 @@ void DamageStack::Render(){
} }
} }
ostream& DamageStack::toString(ostream& out) const
{
return (out << "DamageStack ::: currentState : " << currentState);
}
+31
View File
@@ -584,3 +584,34 @@ JLBFont * mFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
break; break;
} }
} }
ostream& GameStateMenu::toString(ostream& out) const
{
return out << "GameStateMenu ::: scroller : " << scroller
<< " ; scrollerSet : " << scrollerSet
<< " ; mGuiController : " << mGuiController
<< " ; subMenuController : " << subMenuController
<< " ; gameTypeMenu : " << gameTypeMenu
<< " ; hasChosenGameType : " << hasChosenGameType
<< " ; mIcons : " << mIcons
<< " ; mIconsTexture : " << mIconsTexture
<< " ; bgTexture : " << bgTexture
<< " ; movingWTexture : " << movingWTexture
<< " ; mBg : " << mBg
<< " ; mMovingW : " << mMovingW
<< " ; splashTex : " << splashTex
<< " ; splashQuad : " << splashQuad
<< " ; mCreditsYPos : " << mCreditsYPos
<< " ; currentState : " << currentState
<< " ; mVolume : " << mVolume
<< " ; nbcardsStr : " << nbcardsStr
<< " ; mDip : " << mDip
<< " ; mDit : " << mDit
<< " ; mCurrentSetName : " << mCurrentSetName
<< " ; mCurrentSetFileName : " << mCurrentSetFileName
<< " ; mReadConf : " << mReadConf
<< " ; timeIndex : " << timeIndex
<< " ; angleMultiplier : " << angleMultiplier
<< " ; angleW : " << angleW
<< " ; yW : " << yW;
}
+56
View File
@@ -1926,6 +1926,17 @@ int MTGAbility::fireAbility(){
return 1; return 1;
} }
ostream& MTGAbility::toString(ostream& out) const
{
return out << "MTGAbility ::: menuText : " << menuText
<< " ; game : " << game
<< " ; forceDestroy : " << forceDestroy
<< " ; cost : " << cost
<< " ; target : " << target
<< " ; aType : " << aType
<< " ; source : " << source;
}
// //
ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int _playerturnonly,int tap):MTGAbility(id,card), playerturnonly(_playerturnonly), needsTapping(tap){ ActivatedAbility::ActivatedAbility(int id, MTGCardInstance * card, ManaCost * _cost, int _playerturnonly,int tap):MTGAbility(id,card), playerturnonly(_playerturnonly), needsTapping(tap){
@@ -1989,6 +2000,13 @@ int ActivatedAbility::reactToTargetClick(Targetable * object){
} }
ostream& ActivatedAbility::toString(ostream& out) const
{
out << "ActivatedAbility ::: playerturnonly : " << playerturnonly
<< " ; needsTapping : " << needsTapping
<< " (";
return MTGAbility::toString(out) << ")";
}
//The whole targetAbility mechanism is messed up, mainly because of its interactions with //The whole targetAbility mechanism is messed up, mainly because of its interactions with
@@ -2057,6 +2075,11 @@ void TargetAbility::Render(){
//TODO ? //TODO ?
} }
ostream& TargetAbility::toString(ostream& out) const
{
out << "TargetAbility ::: (";
return ActivatedAbility::toString(out) << ")";
}
// //
@@ -2072,6 +2095,11 @@ void TriggeredAbility::Update(float dt){
if (trigger()) fireAbility(); if (trigger()) fireAbility();
} }
ostream& TriggeredAbility::toString(ostream& out) const
{
out << "TriggeredAbility ::: (";
return MTGAbility::toString(out) << ")";
}
// //
@@ -2110,6 +2138,13 @@ int InstantAbility::testDestroy(){
} }
ostream& InstantAbility::toString(ostream& out) const
{
out << "InstantAbility ::: init : " << init
<< " (";
return MTGAbility::toString(out) << ")";
}
void ListMaintainerAbility::Update(float dt){ void ListMaintainerAbility::Update(float dt){
map<MTGCardInstance *,bool>::iterator it=cards.begin(); map<MTGCardInstance *,bool>::iterator it=cards.begin();
@@ -2167,6 +2202,12 @@ int ListMaintainerAbility::destroy(){
return 1; return 1;
} }
ostream& ListMaintainerAbility::toString(ostream& out) const
{
out << "ListMaintainerAbility ::: (";
return MTGAbility::toString(out) << ")";
}
/* An attempt to globalize triggered abilities as much as possible */ /* An attempt to globalize triggered abilities as much as possible */
@@ -2461,3 +2502,18 @@ other solutions need to be provided for abilities that add mana (ex: mana flare)
} }
int AManaProducer::currentlyTapping = 0; int AManaProducer::currentlyTapping = 0;
ostream& AManaProducer::toString(ostream& out) const
{
out << "AManaProducer ::: cost : " << cost
<< " ; output : " << output
<< " ; menutext : " << menutext
<< " ; x0,y0 : " << x0 << "," << y0
<< " ; x1,y1 : " << x1 << "," << y1
<< " ; x,y : " << x << "," << y
<< " ; animation : " << animation
<< " ; controller : " << controller
<< " ; tap : " << tap
<< " (";
return MTGAbility::toString(out) << ")";
}
+5
View File
@@ -53,3 +53,8 @@ bool MTGGamePhase::CheckUserInput(u32 key){
} }
return false; return false;
} }
ostream& MTGGamePhase::toString(ostream& out) const
{
return out << "MTGGamePhase ::: animation " << animation << " ; currentState : " << currentState;
}
+23 -1
View File
@@ -77,6 +77,13 @@ int MTGPutInPlayRule::testDestroy(){
return 0; return 0;
} }
ostream& MTGPutInPlayRule::toString(ostream& out) const
{
out << "MTGPutInPlayRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){ MTGAttackRule::MTGAttackRule(int _id):MTGAbility(_id,NULL){
aType=MTGAbility::MTG_ATTACK_RULE; aType=MTGAbility::MTG_ATTACK_RULE;
} }
@@ -112,7 +119,11 @@ int MTGAttackRule::testDestroy(){
return 0; return 0;
} }
ostream& MTGAttackRule::toString(ostream& out) const
{
out << "MTGAttackRule ::: (";
return MTGAbility::toString(out) << ")";
}
MTGBlockRule::MTGBlockRule(int _id):MTGAbility(_id,NULL){ MTGBlockRule::MTGBlockRule(int _id):MTGAbility(_id,NULL){
aType=MTGAbility::MTG_BLOCK_RULE; aType=MTGAbility::MTG_BLOCK_RULE;
@@ -149,6 +160,11 @@ int MTGBlockRule::testDestroy(){
return 0; return 0;
} }
ostream& MTGBlockRule::toString(ostream& out) const
{
out << "MTGBlockRule ::: (";
return MTGAbility::toString(out) << ")";
}
// //
// * Momir // * Momir
@@ -260,3 +276,9 @@ void MTGMomirRule::Render(){
mFont->SetColor(ARGB(textAlpha,255,255,255)); mFont->SetColor(ARGB(textAlpha,255,255,255));
mFont->DrawString(text.c_str(),SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER); mFont->DrawString(text.c_str(),SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
} }
ostream& MTGMomirRule::toString(ostream& out) const
{
out << "MTGMomirRule ::: pool : " << pool << " ; initialized : " << initialized << " ; textAlpha : " << textAlpha << " ; text " << text << " ; alreadyplayed : " << alreadyplayed << " ; collection : " << collection << "(";
return MTGAbility::toString(out) << ")";
}
+5
View File
@@ -401,3 +401,8 @@ void ManaCost::Dump(){
} }
#endif #endif
ostream& operator<<(ostream& out, const ManaCost& m)
{
return out << "(manacost)";
}
+15
View File
@@ -103,3 +103,18 @@ bool MenuItem::ButtonPressed()
MenuItem::~MenuItem(){ MenuItem::~MenuItem(){
if (mParticleSys) delete mParticleSys; if (mParticleSys) delete mParticleSys;
} }
ostream& MenuItem::toString(ostream& out) const
{
return out << "MenuItem ::: mHasFocus : " << mHasFocus
<< " ; mFont : " << mFont
<< " ; mText : " << mText
<< " ; mX,mY : " << mX << "," << mY
<< " ; updatedSinceLastRender : " << updatedSinceLastRender
<< " ; lastDt : " << lastDt
<< " ; mScale : " << mScale
<< " ; mTargetScale : " << mTargetScale
<< " ; onQuad : " << onQuad
<< " ; offQuad : " << offQuad
<< " ; mParticleSys : " << mParticleSys;
}
+11
View File
@@ -121,3 +121,14 @@ void OptionsList::Update(float dt){
options[i]->Update(dt); options[i]->Update(dt);
} }
} }
ostream& OptionItem::toString(ostream& out) const
{
return out << "OptionItem ::: displayValue : " << displayValue
<< " ; id : " << id
<< " ; value : " << value
<< " ; hasFocus : " << hasFocus
<< " ; maxValue : " << maxValue
<< " ; increment : " << increment
<< " ; x,y : " << x << "," << y;
}
+23
View File
@@ -88,6 +88,13 @@ void GuiAvatar::Render(){
mFont->DrawString(buffer, x+1,y+38); mFont->DrawString(buffer, x+1,y+38);
} }
ostream& GuiAvatar::toString(ostream& out) const
{
return out << "GuiAvatar ::: avatarRed : " << avatarRed
<< " ; currentLife : " << currentLife
<< " ; player : " << player;
}
void GuiGameZone::toggleDisplay(){ void GuiGameZone::toggleDisplay(){
if (showCards){ if (showCards){
@@ -140,12 +147,28 @@ GuiGameZone::~GuiGameZone(){
if(cd) delete cd; if(cd) delete cd;
} }
ostream& GuiGameZone::toString(ostream& out) const
{
return out << "GuiGameZone ::: zone : " << zone
<< " ; cd : " << cd
<< " ; showCards : " << showCards;
}
GuiGraveyard::GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->graveyard){ GuiGraveyard::GuiGraveyard(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->graveyard){
type= GUI_GRAVEYARD; type= GUI_GRAVEYARD;
} }
ostream& GuiGraveyard::toString(ostream& out) const
{
return out << "GuiGraveyard :::";
}
GuiLibrary::GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->library){ GuiLibrary::GuiLibrary(int id, float desiredHeight,float _x, float _y, bool hasFocus,Player * player):GuiGameZone(id, desiredHeight, _x, _y, hasFocus,player->game->library){
type = GUI_LIBRARY; type = GUI_LIBRARY;
} }
ostream& GuiLibrary::toString(ostream& out) const
{
return out << "GuiLibrary :::";
}
+17
View File
@@ -304,3 +304,20 @@ ShopItems::~ShopItems(){
safeDeleteDisplay(); safeDeleteDisplay();
SAFE_DELETE(myCollection); SAFE_DELETE(myCollection);
} }
ostream& ShopItem::toString(ostream& out) const
{
return out << "ShopItem ::: mHasFocus : " << mHasFocus
<< " ; mFont : " << mFont
<< " ; mText : " << mText
<< " ; mX,mY : " << mX << "," << mY
<< " ; quad : " << quad
<< " ; thumb : " << thumb
<< " ; mScale : " << mScale
<< " ; mTargetScale : " << mTargetScale
<< " ; mDDW : " << mDDW
<< " ; nameCount : " << nameCount
<< " ; quantity : " << quantity
<< " ; card : " << card
<< " ; price : " << price;
}
+11
View File
@@ -78,3 +78,14 @@ bool SimpleMenuItem::hasFocus()
{ {
return mHasFocus; return mHasFocus;
} }
ostream& SimpleMenuItem::toString(ostream& out) const
{
return out << "SimpleMenuItem ::: mHasFocus : " << mHasFocus
<< " ; parent : " << parent
<< " ; mFont : " << mFont
<< " ; mText : " << mText
<< " ; mScale : " << mScale
<< " ; mTargetScale : " << mTargetScale
<< " ; mX,mY : " << mX << "," << mY;
}
+15
View File
@@ -49,3 +49,18 @@ void TextScroller::Update(float dt){
void TextScroller::Render(){ void TextScroller::Render(){
mFont->DrawString(mText.c_str(),mX,mY,JGETEXT_LEFT,start,mWidth); mFont->DrawString(mText.c_str(),mX,mY,JGETEXT_LEFT,start,mWidth);
} }
ostream& TextScroller::toString(ostream& out) const
{
return out << "TextScroller ::: mText : " << mText
<< " ; tempText : " << tempText
<< " ; mFont : " << mFont
<< " ; mWidth : " << mWidth
<< " ; mSpeed : " << mSpeed
<< " ; mX,mY : " << mX << "," << mY
<< " ; start : " << start
<< " ; timer : " << timer
<< " ; strings : ?" // << strings
<< " ; currentId : " << currentId
<< " ; mRandom : " << mRandom;
}