Erwan
- Replaced the BasicAbilities Array with a map. This reduces the size of MTGCard from >500 bytes to 392. Should be cool for people who have memory issues
This commit is contained in:
@@ -987,6 +987,7 @@ protected:
|
||||
}
|
||||
if (!_target) return 0;
|
||||
REDamagePrevention * re = NEW REDamagePrevention (
|
||||
this,
|
||||
NEW CardTargetChooser(_target,NULL),
|
||||
NEW PlayerTargetChooser(0,1,source->controller()));
|
||||
current[re] = 1;
|
||||
|
||||
@@ -24,6 +24,7 @@ class TexturesCache;
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
class MTGCard {
|
||||
@@ -40,6 +41,7 @@ class MTGCard {
|
||||
char image_name[MTGCARD_NAME_SIZE];
|
||||
|
||||
int init();
|
||||
|
||||
|
||||
public:
|
||||
TexturesCache * mCache;
|
||||
@@ -47,7 +49,7 @@ class MTGCard {
|
||||
string name;
|
||||
|
||||
int colors[Constants::MTG_NB_COLORS];
|
||||
int basicAbilities[Constants::NB_BASIC_ABILITIES];
|
||||
map<int,int> basicAbilities;
|
||||
vector<string> formattedText;
|
||||
string magicText;
|
||||
int alias;
|
||||
|
||||
@@ -6,6 +6,7 @@ using namespace std;
|
||||
#include "WEvent.h"
|
||||
|
||||
class TargetChooser;
|
||||
class MTGAbility;
|
||||
|
||||
class ReplacementEffect {
|
||||
public:
|
||||
@@ -15,12 +16,13 @@ public:
|
||||
|
||||
class REDamagePrevention: public ReplacementEffect {
|
||||
protected:
|
||||
MTGAbility * source;
|
||||
TargetChooser * tcSource;
|
||||
TargetChooser * tcTarget;
|
||||
int damage;
|
||||
bool oneShot;
|
||||
public:
|
||||
REDamagePrevention(TargetChooser *_tcSource = NULL,TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true);
|
||||
REDamagePrevention(MTGAbility * _source, TargetChooser *_tcSource = NULL,TargetChooser *_tcTarget = NULL, int _damage = -1, bool _oneShot = true);
|
||||
WEvent * replace (WEvent *e);
|
||||
~REDamagePrevention();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user