Last of my warning cleanup - as of this revision, all warnings in the windows build are gone. I've turned on the 'treat warnings as errors' option in the mtg project to mirror our makefile behaviour on psp.

This commit is contained in:
wrenczes@gmail.com
2011-06-03 01:07:48 +00:00
parent cb9e5f2e95
commit bed971c84c
4 changed files with 49 additions and 37 deletions

View File

@@ -3,7 +3,16 @@
#if !defined(PSP)
#include <boost/date_time.hpp>
#ifdef WIN32
#pragma warning (push)
#pragma warning (disable : 4244)
#endif
#include <boost/thread.hpp>
#ifdef WIN32
#pragma warning (pop)
#endif
#include <boost/thread/mutex.hpp>
#else
#include <boost/bind.hpp>

View File

@@ -107,7 +107,7 @@ public:
int parseCastRestrictions(MTGCardInstance* card, Player* player, string restrictions, string otherRestrictions);
int allowedToCast(MTGCardInstance* card, Player* player);
int allowedToAltCast(MTGCardInstance* card, Player* player);
int oneShot;
bool oneShot;
int forceDestroy;
int forcedAlive;
bool canBeInterrupted;
@@ -479,8 +479,8 @@ public:
int parseRestriction(string s);
Counter * parseCounter(string s, MTGCardInstance * target, Spell * spell = NULL);
int parsePowerToughness(string s, int *power, int *toughness);
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0,MTGGameZone * dest = NULL);
MTGAbility * parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated = 0, int forceUEOT = 0,int oneShot = 0,int forceForever = 0, MTGGameZone * dest = NULL);
int getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCardInstance * card = NULL, int id = 0, MTGGameZone * dest = NULL);
MTGAbility* parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, bool activated = false, bool forceUEOT = false, MTGGameZone * dest = NULL);
int abilityEfficiency(MTGAbility * a, Player * p, int mode = MODE_ABILITY, TargetChooser * tc = NULL,Targetable * target = NULL);
int magicText(int id, Spell * spell, MTGCardInstance * card = NULL, int mode = MODE_PUTINTOPLAY, TargetChooser * tc = NULL, MTGGameZone * dest = NULL);

View File

@@ -696,8 +696,8 @@ MTGAbility * AbilityFactory::getCoreAbility(MTGAbility * a)
//Parses a string and returns the corresponding MTGAbility object
//Returns NULL if parsing failed
//Beware, Spell CAN be null when the function is called by the AI trying to analyze the effects of a given card
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, int activated, int forceUEOT,
int oneShot, int forceFOREVER, MTGGameZone * dest)
MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTGCardInstance *card, bool activated, bool forceUEOT,
MTGGameZone * dest)
{
size_t found;
trim(s);
@@ -1080,17 +1080,18 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
SAFE_DELETE(td);
return NULL;
}
MTGAbility * result = NULL;
int oneShot = 0;
bool oneShot = false;
found = s.find(" oneshot");
if (found != string::npos)
oneShot = 1;
if (activated)
oneShot = 1;
if (card->hasType(Subtypes::TYPE_SORCERY) || card->hasType(Subtypes::TYPE_INSTANT))
oneShot = 1;
if (a->oneShot)
oneShot = 1;
if (found != string::npos || activated ||
card->hasType(Subtypes::TYPE_SORCERY) ||
card->hasType(Subtypes::TYPE_INSTANT) ||
a->oneShot)
{
oneShot = true;
}
Damageable * _target = NULL;
if (spell)
_target = spell->getNextDamageableTarget();
@@ -1164,28 +1165,24 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
return NULL;
}
MTGAbility * a = parseMagicLine(s1, id, spell, card, 0, activated); //activated lords usually force an end of turn ability
MTGAbility * a = parseMagicLine(s1, id, spell, card, false, activated); //activated lords usually force an end of turn ability
if (!a)
{
SAFE_DELETE(lordTargets);
return NULL;
}
MTGAbility * result = NULL;
int oneShot = 0;
if (activated)
oneShot = 1;
if (i == 4)
oneShot = 1;
if (a->oneShot)
oneShot = 1;
bool oneShot = false;
if (activated || i == 4 || a->oneShot)
oneShot = true;
if (card->hasType(Subtypes::TYPE_SORCERY) || card->hasType(Subtypes::TYPE_INSTANT))
oneShot = 1;
oneShot = true;
found = s.find("while ");
if (found != string::npos)
oneShot = 0;
oneShot = false;
found = s.find(" oneshot");
if (found != string::npos)
oneShot = 1;
oneShot = true;
Damageable * _target = NULL;
if (spell)
_target = spell->getNextDamageableTarget();
@@ -1232,7 +1229,7 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
{
miniFound = true;
}
result = NEW AAsLongAs(id, card, _target, lordTargets, lordIncludeSelf, a, mini, maxi,miniFound,maxiFound,compareZone);
result = NEW AAsLongAs(id, card, _target, lordTargets, lordIncludeSelf, a, mini, maxi, miniFound, maxiFound, compareZone);
}
break;
case 3:
@@ -1650,16 +1647,17 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
a->oneShot = 1;
return a;
}
bool oneShot = false;
bool forceForever = false;
found = s.find("ueot");
if (found != string::npos)
forceUEOT = 1;
forceUEOT = true;
found = s.find("oneshot");
if (found != string::npos)
oneShot = 1;
oneShot = true;
found = s.find("forever");
if (found != string::npos)
forceFOREVER = 1;
forceForever = true;
//Prevent Damage
const string preventDamageKeywords[] = { "preventallcombatdamage", "preventallnoncombatdamage", "preventalldamage", "fog" };
const int preventDamageTypes[] = {0, 2, 1, 0}; //TODO enum ?
@@ -1983,10 +1981,10 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
sabilities.append(",");
}
}
if (oneShot || forceUEOT || forceFOREVER)
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
if (oneShot || forceUEOT || forceForever)
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceForever);
return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceFOREVER);
return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector<string>(),false,forceForever);
}
//bloodthirst
@@ -2077,8 +2075,8 @@ MTGAbility * AbilityFactory::parseMagicLine(string s, int id, Spell * spell, MTG
}
}
if (oneShot || forceUEOT || forceFOREVER)
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,forceFOREVER);
if (oneShot || forceUEOT || forceForever)
return NEW ATransformerInstant(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound,forceForever);
return NEW ATransformer(id, card, target, stypes, sabilities,newpower,newpowerfound,newtoughness,newtoughnessfound,newAbilitiesList,newAbilityFound);
@@ -2552,7 +2550,7 @@ int AbilityFactory::getAbilities(vector<MTGAbility *> * v, Spell * spell, MTGCar
line = magicText;
magicText = "";
}
MTGAbility * a = parseMagicLine(line, result, spell, card, 0, 0, 0, 0, dest);
MTGAbility * a = parseMagicLine(line, result, spell, card, false, false, dest);
if (a)
{
v->push_back(a);

View File

@@ -121,6 +121,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -170,7 +171,8 @@
<EnablePREfast>false</EnablePREfast>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -222,6 +224,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -273,6 +276,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -395,6 +399,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='HQ Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</MultiProcessorCompilation>
</ClCompile>
<ClCompile Include="src\PriceList.cpp" />
<ClCompile Include="src\ReplacementEffects.cpp" />