Files
wagic/projects/mtg/include/ManaCost.h
wrenczes d5f3e4cfea Enabled precompiled headers for the build. This cuts the win compile time in debug by at least half on my laptop; on the psp compile, it shaves it down by ~ 45 seconds. I only did a cursory inspection of what to add to PrecompiledHeader.h, there's probably more that we can throw in there for more incremental speed improvements.
Also fixed the project includes so that we don't need to always use the indirect include path, ie:
#include "../include/foo.h" -> #include "foo.h"

I'm don't know much about make files - if I busted the linux build, mea culpa, but I think we're okay on that front too.  For future reference, here's the most straightforward link on the topic of adding pch support to make files:

http://www.mercs-eng.com/~hulud/index.php?2008/06/13/6-writing-a-good-makefile-for-a-c-project
2010-10-24 05:55:24 +00:00

98 lines
2.3 KiB
C++

#ifndef _MANACOST_H_
#define _MANACOST_H_
#include "utils.h"
#include "MTGDefinitions.h"
class ManaCostHybrid;
class ExtraCosts;
class ExtraCost;
class MTGAbility;
class MTGCardInstance;
class Player;
class ManaCost{
protected:
int cost[Constants::MTG_NB_COLORS+1];
ManaCostHybrid * hybrids[10];
unsigned int nbhybrids;
int extraCostsIsCopy;
public:
enum{
MANA_PAID = 1,
MANA_PAID_WITH_KICKER = 2,
MANA_PAID_WITH_ALTERNATIVE = 3,
MANA_PAID_WITH_BUYBACK = 4,
MANA_PAID_WITH_FLASHBACK = 5,
MANA_PAID_WITH_RETRACE = 6
};
ExtraCosts * extraCosts;
ManaCost * kicker;
ManaCost * alternative;
ManaCost * BuyBack;
ManaCost * FlashBack;
ManaCost * Retrace;
static ManaCost * parseManaCost(string value, ManaCost * _manacost = NULL, MTGCardInstance * c = NULL);
virtual void init();
void x();
int hasX();
ManaCost(int _cost[], int nb_elems = 1);
ManaCost();
~ManaCost();
ManaCost(ManaCost * _manaCost);
void copy (ManaCost * _manaCost);
int isNull();
int getConvertedCost();
string toString();
int getCost(int color);
//Returns NULL if i is greater than nbhybrids
ManaCostHybrid * getHybridCost(unsigned int i);
int hasColor(int color);
int remove (int color, int value);
int add(int color, int value);
//
// Extra Costs (sacrifice,counters...)
//
int addExtraCost(ExtraCost * _cost);
int setExtraCostsAction(MTGAbility * action, MTGCardInstance * card);
int isExtraPaymentSet();
int canPayExtra();
int doPayExtra();
int addHybrid(int c1, int v1, int c2, int v2);
int tryToPayHybrids(ManaCostHybrid * _hybrids[], int _nbhybrids, int diff[]);
void randomDiffHybrids(ManaCost * _cost, int diff[]);
int add(ManaCost * _cost);
int pay (ManaCost * _cost);
//return 1 if _cost can be paid with current data, 0 otherwise
int canAfford(ManaCost * _cost);
int isPositive();
ManaCost * Diff(ManaCost * _cost);
#ifdef WIN32
void Dump();
#endif
};
std::ostream& operator<<(std::ostream& out, const ManaCost& m);
class ManaPool:public ManaCost{
protected:
Player * player;
public:
void init();
ManaPool(Player * player);
ManaPool(ManaCost * _manaCost, Player * player);
int remove (int color, int value);
int add(int color, int value, MTGCardInstance * source = NULL);
int add(ManaCost * _cost, MTGCardInstance * source = NULL);
int pay (ManaCost * _cost);
};
#endif