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;
}
@@ -305,14 +305,12 @@ void JRenderer::TransferTextureToGLContext(JTexture& inTexture)
JTexture* JRenderer::CreateTexture(int width, int height, int mode __attribute__((unused)))
{
JTexture *tex = new JTexture();
return tex;
}
JTexture* JRenderer::LoadTexture(const char* filename, int mode, int textureFormat)
{
JTexture *tex = new JTexture();
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;
}

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 = "",
int restrictions = 0, MTGGameZone * dest = NULL);
GenericActivatedAbility(const GenericActivatedAbility& other);
int resolve();
const char * getMenuText();
int isReactingToClick(MTGCardInstance * card, ManaCost * mana = NULL);

View File

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

View File

@@ -55,6 +55,12 @@ GenericActivatedAbility::GenericActivatedAbility(GameObserver* observer, string
target = ability->target;
}
GenericActivatedAbility::GenericActivatedAbility(const GenericActivatedAbility &other):
ActivatedAbility(other), NestedAbility(other), activeZone(other.activeZone), newName(other.newName)
{
}
int GenericActivatedAbility::resolve()
{
//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 * a = NEW GenericActivatedAbility(*this);
a->ability = ability->clone();
return a;
}

View File

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

View File

@@ -66,7 +66,7 @@ CardSelector::SelectorMemory::SelectorMemory()
}
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
OptionASkipPhase OptionASkipPhase::mDef;
OptionASkipPhase OptionASkipPhase::mDef = OptionASkipPhase();
OptionASkipPhase::OptionASkipPhase()
{
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;
mCost = NULL;
forceDestroy = 0;
forcedAlive = 0;
oneShot = 0;
canBeInterrupted = true;
}
@@ -4381,6 +4382,7 @@ MTGAbility::MTGAbility(GameObserver* observer, int id, MTGCardInstance * _source
aType = MTGAbility::UNKNOWN;
mCost = NULL;
forceDestroy = 0;
forcedAlive = 0;
oneShot = 0;
canBeInterrupted = true;
}
@@ -5451,6 +5453,7 @@ AManaProducer::AManaProducer(GameObserver* observer, int id, MTGCardInstance * c
aType = MTGAbility::MANA_PRODUCER;
setCost(_cost);
output = _output;
tap = 0;
Producing = producing;
menutext = "";
DoesntEmpty = doesntEmpty;

View File

@@ -125,6 +125,7 @@ int MTGCardInstance::init()
void MTGCardInstance::initMTGCI()
{
X = 0;
sample = "";
model = NULL;
isToken = false;
@@ -195,6 +196,8 @@ void MTGCardInstance::initMTGCI()
lastController = NULL;
regenerateTokens = 0;
blocked = false;
graveEffects = false;
exileEffects = false;
currentZone = NULL;
cardsAbilities = vector<MTGAbility *>();
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();
}
StyleManager::StyleManager()
StyleManager::StyleManager(): topRule(0), topSize(0), playerSrc(0)
{
loadRules();
}