Fix Valgrind warnings appearing during the test suit.

This commit is contained in:
Tobias Loose
2013-11-29 18:20:41 +01:00
parent 89206b3a6b
commit 031f2dbffb
11 changed files with 23 additions and 7 deletions

View File

@@ -65,7 +65,7 @@ void JQuad::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL) JTexture::JTexture() : mWidth(0), mHeight(0), mBuffer(NULL)
{ {
mTexId = -1; mTexId = -1;
} }
@@ -305,14 +305,12 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused))) JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{ {
JTexture *tex = new JTexture(); JTexture *tex = new JTexture();
return tex; return tex;
} }
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat) JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
{ {
JTexture *tex = new JTexture(); JTexture *tex = new JTexture();
return tex; return tex;
} }

View File

@@ -343,7 +343,7 @@ void JQuad::SetHotSpot(float x, float y)
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
JTexture::JTexture() : mBuffer(NULL) JTexture::JTexture() : mBuffer(NULL), mHeight(0), mWidth(0)
{ {
mTexId = -1; mTexId = -1;
} }

View File

@@ -1258,6 +1258,7 @@ public:
GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "", GenericActivatedAbility(GameObserver* observer, string newName,string castRestriction,int _id, MTGCardInstance * card, MTGAbility * a, ManaCost * _cost, string limit = "",MTGAbility * sideEffects = NULL,string usesBeforeSideEffects = "",
int restrictions = 0, MTGGameZone * dest = NULL); int restrictions = 0, MTGGameZone * dest = NULL);
GenericActivatedAbility(const GenericActivatedAbility& other);
int resolve(); int resolve();
const char * getMenuText(); const char * getMenuText();
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL); int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);

View File

@@ -675,6 +675,7 @@ ActionStack::ActionStack(GameObserver* game)
currentState = -1; currentState = -1;
mode = ACTIONSTACK_STANDARD; mode = ACTIONSTACK_STANDARD;
checked = 0; checked = 0;
lastActionController = NULL;
if(!observer->getResourceManager()) return; if(!observer->getResourceManager()) return;
for (int i = 0; i < 8; ++i) for (int i = 0; i < 8; ++i)

View File

@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
target = ability->target; target = ability->target;
} }
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
{
}
int GenericActivatedAbility::resolve() int GenericActivatedAbility::resolve()
{ {
//Note: I've seen a similar block in some other MTGAbility, can this be refactored . //Note: I've seen a similar block in some other MTGAbility, can this be refactored .
@@ -105,6 +111,7 @@ int GenericActivatedAbility::testDestroy()
GenericActivatedAbility * GenericActivatedAbility::clone() const GenericActivatedAbility * GenericActivatedAbility::clone() const
{ {
GenericActivatedAbility * a = NEW GenericActivatedAbility(*this); GenericActivatedAbility * a = NEW GenericActivatedAbility(*this);
a->ability = ability->clone(); a->ability = ability->clone();
return a; return a;
} }

View File

@@ -84,6 +84,9 @@ int CardPrimitive::init()
alias = 0; alias = 0;
restrictions = NULL; restrictions = NULL;
dredgeAmount = 0; dredgeAmount = 0;
power = 0;
toughness = 0;
return 1; return 1;
} }

View File

@@ -66,7 +66,7 @@ CardSelector::SelectorMemory::SelectorMemory()
} }
CardSelector::CardSelector(GameObserver *observer, DuelLayers* duel) : CardSelector::CardSelector(GameObserver *observer, DuelLayers* duel) :
CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220) CardSelectorBase(observer), active(NULL), duel(duel), limitor(NULL), bigpos(300, 145, 1.0, 0.0, 220), timer(0.0f)
{ {
} }

View File

@@ -956,7 +956,7 @@ OptionMaxGrade::OptionMaxGrade()
// MARK: OptionASkipPhase // MARK: OptionASkipPhase
OptionASkipPhase OptionASkipPhase::mDef; OptionASkipPhase OptionASkipPhase::mDef = OptionASkipPhase();
OptionASkipPhase::OptionASkipPhase() OptionASkipPhase::OptionASkipPhase()
{ {
mDef.values.push_back(EnumDefinition::assoc(Constants::ASKIP_NONE, "Off")); mDef.values.push_back(EnumDefinition::assoc(Constants::ASKIP_NONE, "Off"));

View File

@@ -4368,6 +4368,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * card) :
aType = MTGAbility::UNKNOWN; aType = MTGAbility::UNKNOWN;
mCost = NULL; mCost = NULL;
forceDestroy = 0; forceDestroy = 0;
forcedAlive = 0;
oneShot = 0; oneShot = 0;
canBeInterrupted = true; canBeInterrupted = true;
} }
@@ -4381,6 +4382,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * _source
aType = MTGAbility::UNKNOWN; aType = MTGAbility::UNKNOWN;
mCost = NULL; mCost = NULL;
forceDestroy = 0; forceDestroy = 0;
forcedAlive = 0;
oneShot = 0; oneShot = 0;
canBeInterrupted = true; canBeInterrupted = true;
} }
@@ -5451,6 +5453,7 @@ AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * c
aType = MTGAbility::MANA_PRODUCER; aType = MTGAbility::MANA_PRODUCER;
setCost(_cost); setCost(_cost);
output = _output; output = _output;
tap = 0;
Producing = producing; Producing = producing;
menutext = ""; menutext = "";
DoesntEmpty = doesntEmpty; DoesntEmpty = doesntEmpty;

View File

@@ -125,6 +125,7 @@ int MTGCardInstance::init()
void MTGCardInstance::initMTGCI() void MTGCardInstance::initMTGCI()
{ {
X = 0;
sample = ""; sample = "";
model = NULL; model = NULL;
isToken = false; isToken = false;
@@ -195,6 +196,8 @@ void MTGCardInstance::initMTGCI()
lastController = NULL; lastController = NULL;
regenerateTokens = 0; regenerateTokens = 0;
blocked = false; blocked = false;
graveEffects = false;
exileEffects = false;
currentZone = NULL; currentZone = NULL;
cardsAbilities = vector<MTGAbility *>(); cardsAbilities = vector<MTGAbility *>();
data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item data = this; //an MTGCardInstance point to itself for data, allows to update it without killing the underlying database item

View File

@@ -25,7 +25,7 @@ void StyleManager::killRules()
styles.clear(); styles.clear();
} }
StyleManager::StyleManager() StyleManager::StyleManager(): topRule(0), topSize(0), playerSrc(0)
{ {
loadRules(); loadRules();
} }