From bed971c84c16edfd88d804aabc25a0cbcd8a90d5 Mon Sep 17 00:00:00 2001 From: "wrenczes@gmail.com" Date: Fri, 3 Jun 2011 01:07:48 +0000 Subject: [PATCH] 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. --- JGE/include/Threading.h | 9 +++++ projects/mtg/include/MTGAbility.h | 6 +-- projects/mtg/src/MTGAbility.cpp | 64 +++++++++++++++---------------- projects/mtg/template.vcxproj | 7 +++- 4 files changed, 49 insertions(+), 37 deletions(-) diff --git a/JGE/include/Threading.h b/JGE/include/Threading.h index d024470f9..2d45952d2 100644 --- a/JGE/include/Threading.h +++ b/JGE/include/Threading.h @@ -3,7 +3,16 @@ #if !defined(PSP) #include + +#ifdef WIN32 +#pragma warning (push) +#pragma warning (disable : 4244) +#endif #include +#ifdef WIN32 +#pragma warning (pop) +#endif + #include #else #include diff --git a/projects/mtg/include/MTGAbility.h b/projects/mtg/include/MTGAbility.h index a609dae3a..5aae3acb8 100644 --- a/projects/mtg/include/MTGAbility.h +++ b/projects/mtg/include/MTGAbility.h @@ -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 * 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 * 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); diff --git a/projects/mtg/src/MTGAbility.cpp b/projects/mtg/src/MTGAbility.cpp index 000f3312f..71544d1ae 100644 --- a/projects/mtg/src/MTGAbility.cpp +++ b/projects/mtg/src/MTGAbility.cpp @@ -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(),false,forceFOREVER); + if (oneShot || forceUEOT || forceForever) + return NEW ATransformerInstant(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceForever); - return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),false,forceFOREVER); + return NEW ATransformer(id, card, target, stypes, sabilities,newPower,ptFound,newToughness,ptFound,vector(),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 * 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); diff --git a/projects/mtg/template.vcxproj b/projects/mtg/template.vcxproj index 7ad817671..660972987 100644 --- a/projects/mtg/template.vcxproj +++ b/projects/mtg/template.vcxproj @@ -121,6 +121,7 @@ Use PrecompiledHeader.h true + true NDEBUG;%(PreprocessorDefinitions) @@ -170,7 +171,8 @@ false Use PrecompiledHeader.h - true + false + true _DEBUG;%(PreprocessorDefinitions) @@ -222,6 +224,7 @@ Use PrecompiledHeader.h true + true NDEBUG;%(PreprocessorDefinitions) @@ -273,6 +276,7 @@ Use PrecompiledHeader.h true + true _DEBUG;%(PreprocessorDefinitions) @@ -395,6 +399,7 @@ Create Create Create + false