From 841fd9618fb973deb97db742e43d8252e70ab870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <3397065-ZehMatt@users.noreply.gitlab.com> Date: Sun, 17 Jul 2022 19:36:48 +0300 Subject: [PATCH] Rename DrawState_ to DrawState and use enum class --- apps/openmw/mwclass/creature.cpp | 2 +- apps/openmw/mwclass/npc.cpp | 2 +- apps/openmw/mwgui/quickkeysmenu.cpp | 8 ++++---- apps/openmw/mwgui/windowmanagerimp.cpp | 4 ++-- apps/openmw/mwinput/actionmanager.cpp | 16 ++++++++-------- apps/openmw/mwinput/bindingsmanager.cpp | 4 ++-- apps/openmw/mwlua/types/actor.cpp | 8 ++++---- apps/openmw/mwmechanics/aiactivate.cpp | 2 +- apps/openmw/mwmechanics/aicombataction.cpp | 8 ++++---- apps/openmw/mwmechanics/aiescort.cpp | 2 +- apps/openmw/mwmechanics/aifollow.cpp | 2 +- apps/openmw/mwmechanics/aipursue.cpp | 2 +- apps/openmw/mwmechanics/aitravel.cpp | 2 +- apps/openmw/mwmechanics/aiwander.cpp | 2 +- apps/openmw/mwmechanics/character.cpp | 10 +++++----- apps/openmw/mwmechanics/creaturestats.cpp | 10 +++++----- apps/openmw/mwmechanics/creaturestats.hpp | 6 +++--- apps/openmw/mwmechanics/drawstate.hpp | 10 +++++----- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 6 +++--- apps/openmw/mwmechanics/spelleffects.cpp | 2 +- apps/openmw/mwmechanics/spellpriority.cpp | 6 +++--- apps/openmw/mwmechanics/weapontype.cpp | 4 ++-- apps/openmw/mwrender/actoranimation.cpp | 2 +- apps/openmw/mwscript/miscextensions.cpp | 4 ++-- apps/openmw/mwworld/player.cpp | 4 ++-- apps/openmw/mwworld/player.hpp | 4 ++-- apps/openmw/mwworld/worldimp.cpp | 2 +- 27 files changed, 67 insertions(+), 67 deletions(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index c26b92993c..c71e277c15 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -234,7 +234,7 @@ namespace MWClass const MWWorld::Store &gmst = MWBase::Environment::get().getWorld()->getStore().get(); MWMechanics::CreatureStats &stats = getCreatureStats(ptr); - if (stats.getDrawState() != MWMechanics::DrawState_Weapon) + if (stats.getDrawState() != MWMechanics::DrawState::Weapon) return; // Get the weapon used (if hand-to-hand, weapon = inv.end()) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index fc4f655246..2c98b4dd3c 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -995,7 +995,7 @@ namespace MWClass else moveSpeed = getWalkSpeed(ptr); - if(stats.isWerewolf() && running && stats.getDrawState() == MWMechanics::DrawState_Nothing) + if(stats.isWerewolf() && running && stats.getDrawState() == MWMechanics::DrawState::Nothing) moveSpeed *= gmst.fWereWolfRunMult->mValue.getFloat(); return moveSpeed; diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 793c232e2e..aeadc88177 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -416,7 +416,7 @@ namespace MWGui // change draw state only if the item is in player's right hand if (rightHand != store.end() && item == *rightHand) { - MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon); + MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Weapon); } } else if (key->type == Type_MagicItem) @@ -432,7 +432,7 @@ namespace MWGui } store.setSelectedEnchantItem(it); - MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell); + MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Spell); } } else if (key->type == Type_Magic) @@ -452,12 +452,12 @@ namespace MWGui store.setSelectedEnchantItem(store.end()); MWBase::Environment::get().getWindowManager() ->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player))); - MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell); + MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Spell); } else if (key->type == Type_HandToHand) { store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player); - MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon); + MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState::Weapon); } } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 5442b22df2..6076b416ae 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1376,8 +1376,8 @@ namespace MWGui mHud->unsetSelectedSpell(); MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer(); - if (player->getDrawState() == MWMechanics::DrawState_Spell) - player->setDrawState(MWMechanics::DrawState_Nothing); + if (player->getDrawState() == MWMechanics::DrawState::Spell) + player->setDrawState(MWMechanics::DrawState::Nothing); mSpellWindow->setTitle("#{sNone}"); } diff --git a/apps/openmw/mwinput/actionmanager.cpp b/apps/openmw/mwinput/actionmanager.cpp index 6b5a100722..4674ead688 100644 --- a/apps/openmw/mwinput/actionmanager.cpp +++ b/apps/openmw/mwinput/actionmanager.cpp @@ -355,11 +355,11 @@ namespace MWInput if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer())) return; - MWMechanics::DrawState_ state = player.getDrawState(); - if (state == MWMechanics::DrawState_Weapon || state == MWMechanics::DrawState_Nothing) - player.setDrawState(MWMechanics::DrawState_Spell); + MWMechanics::DrawState state = player.getDrawState(); + if (state == MWMechanics::DrawState::Weapon || state == MWMechanics::DrawState::Nothing) + player.setDrawState(MWMechanics::DrawState::Spell); else - player.setDrawState(MWMechanics::DrawState_Nothing); + player.setDrawState(MWMechanics::DrawState::Nothing); } void ActionManager::quickLoad() @@ -390,11 +390,11 @@ namespace MWInput else if (MWBase::Environment::get().getMechanicsManager()->isAttackingOrSpell(player.getPlayer())) return; - MWMechanics::DrawState_ state = player.getDrawState(); - if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing) - player.setDrawState(MWMechanics::DrawState_Weapon); + MWMechanics::DrawState state = player.getDrawState(); + if (state == MWMechanics::DrawState::Spell || state == MWMechanics::DrawState::Nothing) + player.setDrawState(MWMechanics::DrawState::Weapon); else - player.setDrawState(MWMechanics::DrawState_Nothing); + player.setDrawState(MWMechanics::DrawState::Nothing); } void ActionManager::rest() diff --git a/apps/openmw/mwinput/bindingsmanager.cpp b/apps/openmw/mwinput/bindingsmanager.cpp index 4225a8c5d6..b3e3590125 100644 --- a/apps/openmw/mwinput/bindingsmanager.cpp +++ b/apps/openmw/mwinput/bindingsmanager.cpp @@ -709,8 +709,8 @@ namespace MWInput else { MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer(); - MWMechanics::DrawState_ state = player.getDrawState(); - player.setAttackingOrSpell(currentValue != 0 && state != MWMechanics::DrawState_Nothing); + MWMechanics::DrawState state = player.getDrawState(); + player.setAttackingOrSpell(currentValue != 0 && state != MWMechanics::DrawState::Nothing); } } else if (action == A_Jump) diff --git a/apps/openmw/mwlua/types/actor.cpp b/apps/openmw/mwlua/types/actor.cpp index 0e89b22052..464d85c76c 100644 --- a/apps/openmw/mwlua/types/actor.cpp +++ b/apps/openmw/mwlua/types/actor.cpp @@ -114,10 +114,10 @@ namespace MWLua void addActorBindings(sol::table actor, const Context& context) { - actor["STANCE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs({ - {"Nothing", MWMechanics::DrawState_Nothing}, - {"Weapon", MWMechanics::DrawState_Weapon}, - {"Spell", MWMechanics::DrawState_Spell}, + actor["STANCE"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs({ + {"Nothing", MWMechanics::DrawState::Nothing}, + {"Weapon", MWMechanics::DrawState::Weapon}, + {"Spell", MWMechanics::DrawState::Spell}, })); actor["EQUIPMENT_SLOT"] = LuaUtil::makeStrictReadOnly(context.mLua->tableFromPairs({ {"Helmet", MWWorld::InventoryStore::Slot_Helmet}, diff --git a/apps/openmw/mwmechanics/aiactivate.cpp b/apps/openmw/mwmechanics/aiactivate.cpp index 21287af1f6..ece071c601 100644 --- a/apps/openmw/mwmechanics/aiactivate.cpp +++ b/apps/openmw/mwmechanics/aiactivate.cpp @@ -22,7 +22,7 @@ namespace MWMechanics { const MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mObjectId, false); //The target to follow - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing); // Stop if the target doesn't exist // Really we should be checking whether the target is currently registered with the MechanicsManager diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index c2fdf70a72..48861e19ba 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -40,7 +40,7 @@ namespace MWMechanics void ActionSpell::prepare(const MWWorld::Ptr &actor) { actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(mSpellId); - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Spell); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Spell); if (actor.getClass().hasInventoryStore(actor)) { MWWorld::InventoryStore& inv = actor.getClass().getInventoryStore(actor); @@ -64,7 +64,7 @@ namespace MWMechanics { actor.getClass().getCreatureStats(actor).getSpells().setSelectedSpell(std::string()); actor.getClass().getInventoryStore(actor).setSelectedEnchantItem(mItem); - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Spell); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Spell); } float ActionEnchantedItem::getCombatRange(bool& isRanged) const @@ -106,7 +106,7 @@ namespace MWMechanics equip.execute(actor); } } - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Weapon); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Weapon); } float ActionWeapon::getCombatRange(bool& isRanged) const @@ -324,7 +324,7 @@ namespace MWMechanics static const float fHandToHandReach = gmst.find("fHandToHandReach")->mValue.getFloat(); dist = fHandToHandReach; } - else if (stats.getDrawState() == MWMechanics::DrawState_Spell) + else if (stats.getDrawState() == MWMechanics::DrawState::Spell) { dist = 1.0f; if (!selectedSpellId.empty()) diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index aa58dacd8f..0426035b8d 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -64,7 +64,7 @@ namespace MWMechanics if (!mCellId.empty() && mCellId != actor.getCell()->getCell()->getCellId().mWorldspace) return false; // Not in the correct cell, pause and rely on the player to go back through a teleport door - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing); actor.getClass().getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, false); const MWWorld::Ptr follower = MWBase::Environment::get().getWorld()->getPtr(mTargetActorRefId, false); diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index f1ced856f0..9a64a5bee3 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -72,7 +72,7 @@ bool AiFollow::execute (const MWWorld::Ptr& actor, CharacterController& characte if (target == MWWorld::Ptr() || !target.getRefData().getCount() || !target.getRefData().isEnabled()) return false; - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing); AiFollowStorage& storage = state.get(); diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index e5e1b0297c..6e60a79b3f 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -44,7 +44,7 @@ bool AiPursue::execute (const MWWorld::Ptr& actor, CharacterController& characte if (target.getClass().getCreatureStats(target).isDead()) return true; - actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing); + actor.getClass().getCreatureStats(actor).setDrawState(DrawState::Nothing); //Set the target destination const osg::Vec3f dest = target.getRefData().getPosition().asVec3(); diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index 14b416ac61..71432a5537 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -68,7 +68,7 @@ namespace MWMechanics const osg::Vec3f targetPos(mX, mY, mZ); stats.setMovementFlag(CreatureStats::Flag_Run, false); - stats.setDrawState(DrawState_Nothing); + stats.setDrawState(DrawState::Nothing); // Note: we should cancel internal "return after combat" package, if original location is too far away if (!isWithinMaxRange(targetPos, actorPos)) diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index 777e86955d..a2c97d641a 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -196,7 +196,7 @@ namespace MWMechanics mRemainingDuration -= ((duration*MWBase::Environment::get().getWorld()->getTimeScaleFactor()) / 3600); - cStats.setDrawState(DrawState_Nothing); + cStats.setDrawState(DrawState::Nothing); cStats.setMovementFlag(CreatureStats::Flag_Run, false); ESM::Position pos = actor.getRefData().getPosition(); diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index be46f3c06d..c6f28cca64 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1104,9 +1104,9 @@ bool CharacterController::updateState(CharacterState idle) const MWWorld::Class &cls = mPtr.getClass(); CreatureStats &stats = cls.getCreatureStats(mPtr); int weaptype = ESM::Weapon::None; - if(stats.getDrawState() == DrawState_Weapon) + if(stats.getDrawState() == DrawState::Weapon) weaptype = ESM::Weapon::HandToHand; - else if (stats.getDrawState() == DrawState_Spell) + else if (stats.getDrawState() == DrawState::Spell) weaptype = ESM::Weapon::Spell; const bool isWerewolf = cls.isNpc() && cls.getNpcStats(mPtr).isWerewolf(); @@ -1118,7 +1118,7 @@ bool CharacterController::updateState(CharacterState idle) { MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr); MWWorld::ContainerStoreIterator weapon = getActiveWeapon(mPtr, &weaptype); - if(stats.getDrawState() == DrawState_Spell) + if(stats.getDrawState() == DrawState::Spell) weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if(weapon != inv.end() && mWeaponType != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::HandToHand && weaptype != ESM::Weapon::Spell && weaptype != ESM::Weapon::None) @@ -1910,7 +1910,7 @@ void CharacterController::update(float duration) else if (canMove) { float targetMovementAngle = vec.y() >= 0 ? std::atan2(-vec.x(), vec.y()) : std::atan2(vec.x(), -vec.y()); - movementSettings.mIsStrafing = (stats.getDrawState() != MWMechanics::DrawState_Nothing || inwater) + movementSettings.mIsStrafing = (stats.getDrawState() != MWMechanics::DrawState::Nothing || inwater) && std::abs(targetMovementAngle) > osg::DegreesToRadians(60.0f); if (movementSettings.mIsStrafing) targetMovementAngle = 0; @@ -1929,7 +1929,7 @@ void CharacterController::update(float duration) } mAnimation->setLegsYawRadians(stats.getSideMovementAngle()); - if (stats.getDrawState() == MWMechanics::DrawState_Nothing || inwater) + if (stats.getDrawState() == MWMechanics::DrawState::Nothing || inwater) mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 2); else mAnimation->setUpperBodyYawRadians(stats.getSideMovementAngle() / 4); diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 8369a221db..ae4ebbce49 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -19,7 +19,7 @@ namespace MWMechanics int CreatureStats::sActorId = 0; CreatureStats::CreatureStats() - : mDrawState (DrawState_Nothing), mDead (false), mDeathAnimationFinished(false), mDied (false), mMurdered(false), mFriendlyHits (0), + : mDrawState (DrawState::Nothing), mDead (false), mDeathAnimationFinished(false), mDied (false), mMurdered(false), mFriendlyHits (0), mTalkedTo (false), mAlarmed (false), mAttacked (false), mKnockdown(false), mKnockdownOneFrame(false), mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false), mMovementFlags(0), @@ -499,12 +499,12 @@ namespace MWMechanics } } - DrawState_ CreatureStats::getDrawState() const + DrawState CreatureStats::getDrawState() const { return mDrawState; } - void CreatureStats::setDrawState(DrawState_ state) + void CreatureStats::setDrawState(DrawState state) { mDrawState = state; } @@ -542,7 +542,7 @@ namespace MWMechanics state.mLastHitObject = mLastHitObject; state.mLastHitAttemptObject = mLastHitAttemptObject; state.mRecalcDynamicStats = false; - state.mDrawState = mDrawState; + state.mDrawState = static_cast(mDrawState); state.mLevel = mLevel; state.mActorId = mActorId; state.mDeathAnimation = mDeathAnimation; @@ -596,7 +596,7 @@ namespace MWMechanics mFallHeight = state.mFallHeight; mLastHitObject = state.mLastHitObject; mLastHitAttemptObject = state.mLastHitAttemptObject; - mDrawState = DrawState_(state.mDrawState); + mDrawState = DrawState(state.mDrawState); mLevel = state.mLevel; mActorId = state.mActorId; mDeathAnimation = state.mDeathAnimation; diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index 1e6d378df7..a2370015e1 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -38,7 +38,7 @@ namespace MWMechanics class CreatureStats { static int sActorId; - DrawState_ mDrawState; + DrawState mDrawState; AttributeValue mAttributes[ESM::Attribute::Length]; DynamicStat mDynamic[3]; // health, magicka, fatigue Spells mSpells; @@ -98,8 +98,8 @@ namespace MWMechanics public: CreatureStats(); - DrawState_ getDrawState() const; - void setDrawState(DrawState_ state); + DrawState getDrawState() const; + void setDrawState(DrawState state); void recalculateMagicka(); diff --git a/apps/openmw/mwmechanics/drawstate.hpp b/apps/openmw/mwmechanics/drawstate.hpp index 7f59d8d782..1373d59ef8 100644 --- a/apps/openmw/mwmechanics/drawstate.hpp +++ b/apps/openmw/mwmechanics/drawstate.hpp @@ -3,12 +3,12 @@ namespace MWMechanics { - /// \note The _ suffix is required to avoid a collision with a Windoze macro. Die, Microsoft! Die! - enum DrawState_ + + enum class DrawState { - DrawState_Nothing = 0, - DrawState_Weapon = 1, - DrawState_Spell = 2 + Nothing = 0, + Weapon = 1, + Spell = 2 }; } diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 5e1462912a..1f953898c8 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -571,7 +571,7 @@ namespace MWMechanics x += fDispDiseaseMod; static const float fDispWeaponDrawn = gmst.find("fDispWeaponDrawn")->mValue.getFloat(); - if (playerStats.getDrawState() == MWMechanics::DrawState_Weapon) + if (playerStats.getDrawState() == MWMechanics::DrawState::Weapon) x += fDispWeaponDrawn; x += ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(ESM::MagicEffect::Charm).getMagnitude(); @@ -1789,8 +1789,8 @@ namespace MWMechanics MWWorld::Player* player = &MWBase::Environment::get().getWorld()->getPlayer(); // Werewolfs can not cast spells, so we need to unset the prepared spell if there is one. - if (npcStats.getDrawState() == MWMechanics::DrawState_Spell) - npcStats.setDrawState(MWMechanics::DrawState_Nothing); + if (npcStats.getDrawState() == MWMechanics::DrawState::Spell) + npcStats.setDrawState(MWMechanics::DrawState::Nothing); npcStats.setWerewolf(werewolf); diff --git a/apps/openmw/mwmechanics/spelleffects.cpp b/apps/openmw/mwmechanics/spelleffects.cpp index a43d19431b..81a3dc0921 100644 --- a/apps/openmw/mwmechanics/spelleffects.cpp +++ b/apps/openmw/mwmechanics/spelleffects.cpp @@ -190,7 +190,7 @@ namespace // change draw state only if the item is in player's right hand if (slot == MWWorld::InventoryStore::Slot_CarriedRight) - player.setDrawState(MWMechanics::DrawState_Weapon); + player.setDrawState(MWMechanics::DrawState::Weapon); if (prevItem != store.end()) player.setPreviousItem(itemId, prevItem->getCellRef().getRefId()); diff --git a/apps/openmw/mwmechanics/spellpriority.cpp b/apps/openmw/mwmechanics/spellpriority.cpp index 0f44ee7d07..245bd4fcdb 100644 --- a/apps/openmw/mwmechanics/spellpriority.cpp +++ b/apps/openmw/mwmechanics/spellpriority.cpp @@ -249,7 +249,7 @@ namespace MWMechanics return 0.f; // Enemy doesn't attack - if (stats.getDrawState() != MWMechanics::DrawState_Weapon) + if (stats.getDrawState() != MWMechanics::DrawState::Weapon) return 0.f; break; @@ -270,7 +270,7 @@ namespace MWMechanics return 0.f; // Enemy doesn't cast spells - if (stats.getDrawState() != MWMechanics::DrawState_Spell) + if (stats.getDrawState() != MWMechanics::DrawState::Spell) return 0.f; break; @@ -288,7 +288,7 @@ namespace MWMechanics return 0.f; // Enemy doesn't cast spells - if (stats.getDrawState() != MWMechanics::DrawState_Spell) + if (stats.getDrawState() != MWMechanics::DrawState::Spell) return 0.f; break; } diff --git a/apps/openmw/mwmechanics/weapontype.cpp b/apps/openmw/mwmechanics/weapontype.cpp index 6bf5b70fee..9e9e06eba7 100644 --- a/apps/openmw/mwmechanics/weapontype.cpp +++ b/apps/openmw/mwmechanics/weapontype.cpp @@ -11,13 +11,13 @@ namespace MWMechanics { MWWorld::InventoryStore &inv = actor.getClass().getInventoryStore(actor); CreatureStats &stats = actor.getClass().getCreatureStats(actor); - if(stats.getDrawState() == MWMechanics::DrawState_Spell) + if(stats.getDrawState() == MWMechanics::DrawState::Spell) { *weaptype = ESM::Weapon::Spell; return inv.end(); } - if(stats.getDrawState() == MWMechanics::DrawState_Weapon) + if(stats.getDrawState() == MWMechanics::DrawState::Weapon) { MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight); if(weapon == inv.end()) diff --git a/apps/openmw/mwrender/actoranimation.cpp b/apps/openmw/mwrender/actoranimation.cpp index f370f17e1c..9b9c521a51 100644 --- a/apps/openmw/mwrender/actoranimation.cpp +++ b/apps/openmw/mwrender/actoranimation.cpp @@ -178,7 +178,7 @@ bool ActorAnimation::updateCarriedLeftVisible(const int weaptype) const const MWWorld::ConstContainerStoreIterator shield = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); if (shield != inv.end() && shield->getType() == ESM::Armor::sRecordId && !getSheathedShieldMesh(*shield).empty()) { - if(stats.getDrawState() != MWMechanics::DrawState_Weapon) + if(stats.getDrawState() != MWMechanics::DrawState::Weapon) return false; if (weapon != inv.end()) diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index b84cc6b222..e5b44bccae 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -783,7 +783,7 @@ namespace MWScript MWWorld::Ptr ptr = R()(runtime); runtime.push((ptr.getClass().hasInventoryStore(ptr) || ptr.getClass().isBipedal(ptr)) && - ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState_Weapon); + ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState::Weapon); } }; @@ -796,7 +796,7 @@ namespace MWScript { MWWorld::Ptr ptr = R()(runtime); - runtime.push(ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState_Spell); + runtime.push(ptr.getClass().getCreatureStats (ptr).getDrawState () == MWMechanics::DrawState::Spell); } }; diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index dd5ad0c0f9..9c5f226bc6 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -152,7 +152,7 @@ namespace MWWorld return mSign; } - void Player::setDrawState (MWMechanics::DrawState_ state) + void Player::setDrawState (MWMechanics::DrawState state) { MWWorld::Ptr ptr = getPlayer(); ptr.getClass().getNpcStats(ptr).setDrawState (state); @@ -229,7 +229,7 @@ namespace MWWorld ptr.getClass().getMovementSettings(ptr).mRotation[1] += roll; } - MWMechanics::DrawState_ Player::getDrawState() + MWMechanics::DrawState Player::getDrawState() { MWWorld::Ptr ptr = getPlayer(); return ptr.getClass().getNpcStats(ptr).getDrawState(); diff --git a/apps/openmw/mwworld/player.hpp b/apps/openmw/mwworld/player.hpp index 3a3c58cb5d..54d9c08da4 100644 --- a/apps/openmw/mwworld/player.hpp +++ b/apps/openmw/mwworld/player.hpp @@ -86,8 +86,8 @@ namespace MWWorld void setBirthSign(const std::string &sign); const std::string &getBirthSign() const; - void setDrawState (MWMechanics::DrawState_ state); - MWMechanics::DrawState_ getDrawState(); /// \todo constness + void setDrawState (MWMechanics::DrawState state); + MWMechanics::DrawState getDrawState(); /// \todo constness /// Activate the object under the crosshair, if any void activate(); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 1f5532655d..0cb00341da 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3619,7 +3619,7 @@ namespace MWWorld mPlayer->setAttackingOrSpell(false); } - mPlayer->setDrawState(MWMechanics::DrawState_Nothing); + mPlayer->setDrawState(MWMechanics::DrawState::Nothing); mGoToJail = false; MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);