Fix a number of NULL/0 errors.

This commit is contained in:
jean.chalard
2011-04-10 15:31:38 +00:00
parent 630c7eb1ee
commit 57c9c8a3b1
6 changed files with 13 additions and 15 deletions

View File

@@ -2720,7 +2720,7 @@ public:
{
tc = _tc;
tc->targetter = NULL;
includeSelf = NULL;
includeSelf = 0;
aType = MTGAbility::STANDARD_TEACH;
}

View File

@@ -935,8 +935,8 @@ void ActionStack::Update(float dt)
//this prevents you from "running out of time" while deciding.
//before this int was added, it was possible to run out of time if you had 10 stack actions
//and set the timer to 4 secs. BUG FIX //http://code.google.com/p/wagic/issues/detail?id=464
extraTime = count(NULL,NOT_RESOLVED,NULL);
if(extraTime == 0)
extraTime = count(0, NOT_RESOLVED, 0);
if (extraTime == 0)
extraTime = 1;//we never want this int to be 0.
if (timer < 0)
timer = options[Options::INTERRUPT_SECONDS].number * extraTime;

View File

@@ -832,7 +832,7 @@ int AAMorph::resolve()
_target->morphed = false;
_target->isMorphed = false;
_target->turningOver = true;
af.getAbilities(&currentAbilities, NULL, _target,NULL);
af.getAbilities(&currentAbilities, NULL, _target, 0);
for (size_t i = 0; i < currentAbilities.size(); ++i)
{
MTGAbility * a = currentAbilities[i];
@@ -2327,7 +2327,7 @@ ATransformer::ATransformer(int id, MTGCardInstance * source, MTGCardInstance * t
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
{
AbilityFactory af;
MTGAbility * aNew = af.parseMagicLine(newAbilitiesList[k],NULL, NULL, _target);
MTGAbility * aNew = af.parseMagicLine(newAbilitiesList[k], 0, NULL, _target);
aNew->isClone = 1;
GenericTargetAbility * gta = dynamic_cast<GenericTargetAbility*> (aNew);
if (gta)
@@ -2506,14 +2506,14 @@ int AForeverTransformer::addToGame()
{
_target->basicAbilities[*it]++;
}
if(newAbilityFound)
if (newAbilityFound)
{
for (unsigned int k = 0 ; k < newAbilitiesList.size();k++)
{
AbilityFactory af;
MTGAbility * aNew = af.parseMagicLine(newAbilitiesList[k],NULL, NULL, _target);
MTGAbility * aNew = af.parseMagicLine(newAbilitiesList[k], 0, NULL, _target);
aNew->isClone = 1;
GenericTargetAbility * gta = dynamic_cast<GenericTargetAbility*> (aNew);
if (gta)
{

View File

@@ -1137,7 +1137,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
SAFE_DELETE(tc);
vector<string> multiEffects = split(s,'&');
MultiAbility * multi = NEW MultiAbility(id, card, target, NULL, NULL);
MultiAbility * multi = NEW MultiAbility(id, card, target, NULL, 0);
for(unsigned int i = 0;i < multiEffects.size();i++)
{
if(!multiEffects[i].empty())
@@ -1782,7 +1782,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
else
{
tokenId = 0;
ATokenCreator * tok = NEW ATokenCreator(id, card,target, NULL, "ID NOT FOUND", "ERROR ID", NULL, NULL, "", 0, NULL);
ATokenCreator * tok = NEW ATokenCreator(id, card, target, NULL, "ID NOT FOUND", "ERROR ID", 0, 0, "", 0, NULL);
return tok;
}
}

View File

@@ -128,7 +128,7 @@ void MTGCardInstance::initMTGCI()
isRedAndWhite = 0;
isLeveler = 0;
enchanted = false;
CDenchanted = NULL;
CDenchanted = 0;
CDdamaged = 0;
blinked = false;
isExtraCostTarget = false;
@@ -140,7 +140,7 @@ void MTGCardInstance::initMTGCI()
didattacked = 0;
didblocked = 0;
notblocked = 0;
sunburst = NULL;
sunburst = 0;
equipment = 0;
auras = 0;
damageToOpponent = false;

View File

@@ -372,9 +372,7 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
void MTGAllCards::initCounters()
{
for (int i = 0; i < Constants::MTG_NB_COLORS; i++)
{
colorsCount[i] = NULL;
}
colorsCount[i] = 0;
}
void MTGAllCards::init()