From 4af4f0a707172e3274e02384307b51caa89d118c Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Fri, 27 May 2011 22:34:58 +0000 Subject: [PATCH] Compile and warning fixes. --- AI/GeniusAI/CGeniusAI.cpp | 6 ++--- client/CCreatureWindow.cpp | 2 +- client/CCreatureWindow.h | 4 +-- lib/ERMInterpreter.cpp | 50 ++++++++++++++++++-------------------- 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/AI/GeniusAI/CGeniusAI.cpp b/AI/GeniusAI/CGeniusAI.cpp index 3db6214ac..9f8f7a877 100644 --- a/AI/GeniusAI/CGeniusAI.cpp +++ b/AI/GeniusAI/CGeniusAI.cpp @@ -50,7 +50,7 @@ bool CGeniusAI::AIObjectContainer::operator<(const AIObjectContainer& b) const CGeniusAI::HypotheticalGameState::HeroModel::HeroModel( const CGHeroInstance* h) - : h(h), finished(false) + : finished(false), h(h) { pos = h->getPosition(false); remainingMovement = h->movement; @@ -140,7 +140,7 @@ CGeniusAI::HeroObjective::HeroObjective(const HypotheticalGameState &hgs, const CGObjectInstance* object, HypotheticalGameState::HeroModel* h, CGeniusAI* ai) - : object(object), hgs(hgs) + : hgs(hgs), object(object) { AI = ai; pos = object->pos; @@ -262,7 +262,7 @@ CGeniusAI::TownObjective::TownObjective( HypotheticalGameState::TownModel* tn, int Which, CGeniusAI * ai) - : whichTown(tn), which(Which), hgs(hgs) + : hgs(hgs), whichTown(tn), which(Which) { AI = ai; type = t; diff --git a/client/CCreatureWindow.cpp b/client/CCreatureWindow.cpp index 8712e0f63..1d17d3a0b 100644 --- a/client/CCreatureWindow.cpp +++ b/client/CCreatureWindow.cpp @@ -72,7 +72,7 @@ CCreatureWindow::CCreatureWindow(int Cid, int Type, int creatureCount) } CCreatureWindow::CCreatureWindow(const CStackInstance &st, int Type, boost::function Upg, boost::function Dsm, UpgradeInfo *ui) - : type(Type), dsm(Dsm), dismiss(0), upgrade(0), ok(0) + : type(Type), dismiss(0), upgrade(0), ok(0), dsm(Dsm) { OBJ_CONSTRUCTION_CAPTURING_ALL; init(&st, &st,dynamic_cast(st.armyObj)); diff --git a/client/CCreatureWindow.h b/client/CCreatureWindow.h index bbb2b3ce9..ee3eddc7b 100644 --- a/client/CCreatureWindow.h +++ b/client/CCreatureWindow.h @@ -45,7 +45,7 @@ public: CSlider * slider; //Abilities AdventureMapButton *dismiss, *upgrade, *ok; AdventureMapButton * leftArtRoll, * rightArtRoll; //artifact selection - //TODO: Arifact drop + //TODO: Artifact drop boost::function dsm; //dismiss button callback boost::function Upg; //upgrade button callback @@ -81,4 +81,4 @@ public: void setBonus (const Bonus &bonus); void showAll (SDL_Surface * to); -}; \ No newline at end of file +}; diff --git a/lib/ERMInterpreter.cpp b/lib/ERMInterpreter.cpp index 9dee64c92..0f28afac2 100644 --- a/lib/ERMInterpreter.cpp +++ b/lib/ERMInterpreter.cpp @@ -688,7 +688,7 @@ struct HEPerformer; template struct HE_BPerformer : StandardBodyOptionItemVisitor { - explicit HE_BPerformer(HEPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) + explicit HE_BPerformer(HEPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) {} using StandardBodyOptionItemVisitor::operator(); @@ -702,16 +702,10 @@ void HE_BPerformer::operator()( TIexp const& cmp ) const throw EScriptExecError("Setting hero name is not implemented!"); } -template -void HE_BPerformer::operator()( TVarpExp const& cmp ) const -{ - erm->getIexp(cmp).setTo(owner.identifier->name); -} - template struct HE_CPerformer : StandardBodyOptionItemVisitor { - explicit HE_CPerformer(HEPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) + explicit HE_CPerformer(HEPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) {} using StandardBodyOptionItemVisitor::operator(); @@ -725,16 +719,9 @@ void HE_CPerformer::operator()( TIexp const& cmp ) const throw EScriptExecError("Setting hero army is not implemented!"); } -template -void HE_CPerformer::operator()( TVarpExp const& cmp ) const -{ - erm->getIexp(cmp).setTo(owner.identifier->name); -} - - struct HEPerformer : StandardReceiverVisitor { - HEPerformer(ERMInterpreter * _interpr, const CGHeroInstance * hero) : StandardReceiverVisitor(_interpr, hero) + HEPerformer(ERMInterpreter * _interpr, const CGHeroInstance * hero) : StandardReceiverVisitor(_interpr, hero) {} using StandardReceiverVisitor::operator(); @@ -788,6 +775,17 @@ struct HEPerformer : StandardReceiverVisitor }; +template +void HE_BPerformer::operator()( TVarpExp const& cmp ) const +{ + erm->getIexp(cmp).setTo(owner.identifier->name); +} + +template +void HE_CPerformer::operator()( TVarpExp const& cmp ) const +{ + erm->getIexp(cmp).setTo(owner.identifier->name); +} ////MA struct MAPerformer; @@ -802,7 +800,7 @@ struct MA_PPerformer : StandardBodyOptionItemVisitor struct MAPerformer : StandardReceiverVisitor { - MAPerformer(ERMInterpreter * _interpr) : StandardReceiverVisitor(_interpr, 0) + MAPerformer(ERMInterpreter * _interpr) : StandardReceiverVisitor(_interpr, 0) {} using StandardReceiverVisitor::operator(); @@ -841,7 +839,7 @@ void MA_PPerformer::operator()( TVarpExp const& cmp ) const struct MOPerformer; struct MO_GPerformer : StandardBodyOptionItemVisitor { - explicit MO_GPerformer(MOPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) + explicit MO_GPerformer(MOPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) {} using StandardBodyOptionItemVisitor::operator(); @@ -851,7 +849,7 @@ struct MO_GPerformer : StandardBodyOptionItemVisitor struct MOPerformer: StandardReceiverVisitor { - MOPerformer(ERMInterpreter * _interpr, int3 pos) : StandardReceiverVisitor(_interpr, pos) + MOPerformer(ERMInterpreter * _interpr, int3 pos) : StandardReceiverVisitor(_interpr, pos) {} using StandardReceiverVisitor::operator(); @@ -887,7 +885,7 @@ struct ConditionDisemboweler; struct OBPerformer; struct OB_UPerformer : StandardBodyOptionItemVisitor { - explicit OB_UPerformer(OBPerformer & owner) : StandardBodyOptionItemVisitor(owner) + explicit OB_UPerformer(OBPerformer & owner) : StandardBodyOptionItemVisitor(owner) {} using StandardBodyOptionItemVisitor::operator(); @@ -897,7 +895,7 @@ struct OB_UPerformer : StandardBodyOptionItemVisitor struct OBPerformer : StandardReceiverVisitor { - OBPerformer(ERMInterpreter * _interpr, int3 objPos) : StandardReceiverVisitor(_interpr, objPos) + OBPerformer(ERMInterpreter * _interpr, int3 objPos) : StandardReceiverVisitor(_interpr, objPos) {} using StandardReceiverVisitor::operator(); //it removes compilation error... not sure why it *must* be here void operator()(TNormalBodyOption const& trig) const @@ -986,7 +984,7 @@ struct VR_SPerformer : StandardBodyOptionItemVisitor struct VRPerformer : StandardReceiverVisitor { - VRPerformer(ERMInterpreter * _interpr, IexpValStr ident) : StandardReceiverVisitor(_interpr, ident) + VRPerformer(ERMInterpreter * _interpr, IexpValStr ident) : StandardReceiverVisitor(_interpr, ident) {} void operator()(TVRLogic const& trig) const OVERRIDE @@ -1085,7 +1083,7 @@ struct VRPerformer : StandardReceiverVisitor }; -VR_SPerformer::VR_SPerformer(VRPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) +VR_SPerformer::VR_SPerformer(VRPerformer & _owner) : StandardBodyOptionItemVisitor(_owner) {} void VR_SPerformer::operator()(ERM::TIexp const& trig) const @@ -1535,8 +1533,8 @@ namespace IexpDisemboweler struct LVL2IexpDisemboweler : boost::static_visitor { - IexpDisemboweler::EDir dir; /*const*/ ERMInterpreter * env; + IexpDisemboweler::EDir dir; LVL2IexpDisemboweler(/*const*/ ERMInterpreter * _env, IexpDisemboweler::EDir _dir) : env(_env), dir(_dir) //writes value to given var @@ -1564,8 +1562,8 @@ struct LVL2IexpDisemboweler : boost::static_visitor struct LVL1IexpDisemboweler : boost::static_visitor { - IexpDisemboweler::EDir dir; /*const*/ ERMInterpreter * env; + IexpDisemboweler::EDir dir; LVL1IexpDisemboweler(/*const*/ ERMInterpreter * _env, IexpDisemboweler::EDir _dir) : env(_env), dir(_dir) //writes value to given var @@ -1619,7 +1617,7 @@ IexpValStr ERMInterpreter::getIexp( const ERM::TVarpExp & tid ) const struct LVL3BodyOptionItemVisitor : StandardBodyOptionItemVisitor { - explicit LVL3BodyOptionItemVisitor(IexpValStr & _owner) : StandardBodyOptionItemVisitor(_owner) + explicit LVL3BodyOptionItemVisitor(IexpValStr & _owner) : StandardBodyOptionItemVisitor(_owner) {} using StandardBodyOptionItemVisitor::operator();