From fe86ce5a2c263b72c85a592e2e8f47dfa613fc80 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 7 Jul 2012 20:53:19 +0200 Subject: [PATCH] DrawState workaround --- apps/openmw/mwinput/inputmanager.cpp | 4 ++-- apps/openmw/mwmechanics/drawstate.hpp | 5 ++--- apps/openmw/mwmechanics/npcstats.cpp | 4 ++-- apps/openmw/mwmechanics/npcstats.hpp | 6 +++--- apps/openmw/mwworld/player.cpp | 4 ++-- apps/openmw/mwworld/player.hpp | 7 ++----- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index 73cadacd0f..3a8315b71e 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -102,7 +102,7 @@ private: { if (windows.isGuiMode()) return; - MWMechanics::DrawState state = player.getDrawState(); + MWMechanics::DrawState_ state = player.getDrawState(); if (state == MWMechanics::DrawState_Weapon || state == MWMechanics::DrawState_Nothing) { player.setDrawState(MWMechanics::DrawState_Spell); @@ -119,7 +119,7 @@ private: { if (windows.isGuiMode()) return; - MWMechanics::DrawState state = player.getDrawState(); + MWMechanics::DrawState_ state = player.getDrawState(); if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing) { player.setDrawState(MWMechanics::DrawState_Weapon); diff --git a/apps/openmw/mwmechanics/drawstate.hpp b/apps/openmw/mwmechanics/drawstate.hpp index 94b48fdd8e..112b6e4f90 100644 --- a/apps/openmw/mwmechanics/drawstate.hpp +++ b/apps/openmw/mwmechanics/drawstate.hpp @@ -1,11 +1,10 @@ #ifndef GAME_MWMECHANICS_DRAWSTATE_H #define GAME_MWMECHANICS_DRAWSTATE_H -#undef DrawState - namespace MWMechanics { - enum DrawState + /// \note The _ suffix is required to avoid a collision with a Windoze macro. Die, Microsoft! Die! + enum DrawState_ { DrawState_Weapon = 0, DrawState_Spell = 1, diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 6c95c53721..08ac123748 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -16,12 +16,12 @@ MWMechanics::NpcStats::NpcStats() : mMovementFlags (0), mDrawState (DrawState_Nothing) {} -MWMechanics::DrawState MWMechanics::NpcStats::getDrawState() const +MWMechanics::DrawState_ MWMechanics::NpcStats::getDrawState() const { return mDrawState; } -void MWMechanics::NpcStats::setDrawState (DrawState state) +void MWMechanics::NpcStats::setDrawState (DrawState_ state) { mDrawState = state; } diff --git a/apps/openmw/mwmechanics/npcstats.hpp b/apps/openmw/mwmechanics/npcstats.hpp index 0264042723..1dccdd0d60 100644 --- a/apps/openmw/mwmechanics/npcstats.hpp +++ b/apps/openmw/mwmechanics/npcstats.hpp @@ -41,7 +41,7 @@ namespace MWMechanics /// \note the faction key must be in lowercase std::map mFactionRank; - DrawState mDrawState; + DrawState_ mDrawState; unsigned int mMovementFlags; Stat mSkill[27]; @@ -49,9 +49,9 @@ namespace MWMechanics NpcStats(); - DrawState getDrawState() const; + DrawState_ getDrawState() const; - void setDrawState (DrawState state); + void setDrawState (DrawState_ state); bool getMovementFlag (Flag flag) const; diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index d8b3285efc..4d508c3e9c 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -56,7 +56,7 @@ namespace MWWorld mClass = new_class; } - void Player::setDrawState (MWMechanics::DrawState state) + void Player::setDrawState (MWMechanics::DrawState_ state) { MWWorld::Ptr ptr = getPlayer(); MWWorld::Class::get(ptr).getNpcStats(ptr).setDrawState (state); @@ -111,7 +111,7 @@ namespace MWWorld MWWorld::Class::get (ptr).setStance (ptr, MWWorld::Class::Run, !running); } - MWMechanics::DrawState Player::getDrawState() + MWMechanics::DrawState_ Player::getDrawState() { MWWorld::Ptr ptr = getPlayer(); return MWWorld::Class::get(ptr).getNpcStats(ptr).getDrawState(); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 2a02635b40..ee7c030a51 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -9,9 +9,6 @@ #include "../mwmechanics/drawstate.hpp" -#undef DrawState // How did this get defined again? - // Maybe it's defined by default in every file for windows? - namespace MWBase { class World; @@ -86,7 +83,7 @@ namespace MWWorld void setClass (const ESM::Class& class_); - void setDrawState (MWMechanics::DrawState state); + void setDrawState (MWMechanics::DrawState_ state); std::string getName() const { @@ -118,7 +115,7 @@ namespace MWWorld return mAutoMove; } - MWMechanics::DrawState getDrawState(); /// \todo constness + MWMechanics::DrawState_ getDrawState(); /// \todo constness void setAutoMove (bool enable);