mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 09:39:49 +00:00
Removal of duplicit enumeration and unnecessary conditions.
This commit is contained in:
parent
bbec3680c6
commit
dc17fa1636
@ -74,19 +74,19 @@ namespace MWGui
|
|||||||
|
|
||||||
switch(mEnchanting.getCastStyle())
|
switch(mEnchanting.getCastStyle())
|
||||||
{
|
{
|
||||||
case ESM::CastingStyle_CastOnce:
|
case ESM::Enchantment::CastOnce:
|
||||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce","Cast Once"));
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce","Cast Once"));
|
||||||
mAddEffectDialog.constantEffect=false;
|
mAddEffectDialog.constantEffect=false;
|
||||||
break;
|
break;
|
||||||
case ESM::CastingStyle_WhenStrikes:
|
case ESM::Enchantment::WhenStrikes:
|
||||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
||||||
mAddEffectDialog.constantEffect=false;
|
mAddEffectDialog.constantEffect=false;
|
||||||
break;
|
break;
|
||||||
case ESM::CastingStyle_WhenUsed:
|
case ESM::Enchantment::WhenUsed:
|
||||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenUsed", "When Used"));
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenUsed", "When Used"));
|
||||||
mAddEffectDialog.constantEffect=false;
|
mAddEffectDialog.constantEffect=false;
|
||||||
break;
|
break;
|
||||||
case ESM::CastingStyle_ConstantEffect:
|
case ESM::Enchantment::ConstantEffect:
|
||||||
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastConstant", "Cast Constant"));
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastConstant", "Cast Constant"));
|
||||||
mAddEffectDialog.constantEffect=true;
|
mAddEffectDialog.constantEffect=true;
|
||||||
break;
|
break;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
Enchanting::Enchanting():
|
Enchanting::Enchanting():
|
||||||
mCastStyle(ESM::CastingStyle_CastOnce)
|
mCastStyle(ESM::Enchantment::CastOnce)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
void Enchanting::setOldItem(MWWorld::Ptr oldItem)
|
||||||
@ -74,7 +74,7 @@ namespace MWMechanics
|
|||||||
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 1);
|
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
if(mCastStyle==ESM::Enchantment::ConstantEffect)
|
||||||
{
|
{
|
||||||
enchantment.mData.mCharge=0;
|
enchantment.mData.mCharge=0;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ namespace MWMechanics
|
|||||||
{
|
{
|
||||||
if (itemEmpty())
|
if (itemEmpty())
|
||||||
{
|
{
|
||||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,12 +112,12 @@ namespace MWMechanics
|
|||||||
{ // Armor or Clothing
|
{ // Armor or Clothing
|
||||||
switch(mCastStyle)
|
switch(mCastStyle)
|
||||||
{
|
{
|
||||||
case ESM::CastingStyle_WhenUsed:
|
case ESM::Enchantment::WhenUsed:
|
||||||
if (powerfulSoul)
|
if (powerfulSoul)
|
||||||
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
mCastStyle = ESM::Enchantment::ConstantEffect;
|
||||||
return;
|
return;
|
||||||
default: // takes care of Constant effect too
|
default: // takes care of Constant effect too
|
||||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,28 +125,28 @@ namespace MWMechanics
|
|||||||
{ // Weapon
|
{ // Weapon
|
||||||
switch(mCastStyle)
|
switch(mCastStyle)
|
||||||
{
|
{
|
||||||
case ESM::CastingStyle_WhenStrikes:
|
case ESM::Enchantment::WhenStrikes:
|
||||||
mCastStyle = ESM::CastingStyle_WhenUsed;
|
mCastStyle = ESM::Enchantment::WhenUsed;
|
||||||
return;
|
return;
|
||||||
case ESM::CastingStyle_WhenUsed:
|
case ESM::Enchantment::WhenUsed:
|
||||||
if (powerfulSoul)
|
if (powerfulSoul)
|
||||||
mCastStyle = ESM::CastingStyle_ConstantEffect;
|
mCastStyle = ESM::Enchantment::ConstantEffect;
|
||||||
else
|
else
|
||||||
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
mCastStyle = ESM::Enchantment::WhenStrikes;
|
||||||
return;
|
return;
|
||||||
default: // takes care of Constant effect too
|
default: // takes care of Constant effect too
|
||||||
mCastStyle = ESM::CastingStyle_WhenStrikes;
|
mCastStyle = ESM::Enchantment::WhenStrikes;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mObjectType == typeid(ESM::Book).name())
|
else if(mObjectType == typeid(ESM::Book).name())
|
||||||
{ // Scroll or Book
|
{ // Scroll or Book
|
||||||
mCastStyle = ESM::CastingStyle_CastOnce;
|
mCastStyle = ESM::Enchantment::CastOnce;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fail case
|
// Fail case
|
||||||
mCastStyle = ESM::CastingStyle_CastOnce;
|
mCastStyle = ESM::Enchantment::CastOnce;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,7 +184,7 @@ namespace MWMechanics
|
|||||||
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
magMax = (it->mMagnMax == 0) ? 1 : it->mMagnMax;
|
||||||
area = (it->mArea == 0) ? 1 : it->mArea;
|
area = (it->mArea == 0) ? 1 : it->mArea;
|
||||||
|
|
||||||
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
||||||
{
|
{
|
||||||
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
magnitudeCost = (magMin + magMax) * baseCost * 2.5;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ namespace MWMechanics
|
|||||||
|
|
||||||
float Enchanting::getCastCost() const
|
float Enchanting::getCastCost() const
|
||||||
{
|
{
|
||||||
if (mCastStyle == ESM::CastingStyle_ConstantEffect)
|
if (mCastStyle == ESM::Enchantment::ConstantEffect)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const float enchantCost = getEnchantPoints();
|
const float enchantCost = getEnchantPoints();
|
||||||
@ -256,16 +256,12 @@ namespace MWMechanics
|
|||||||
}
|
}
|
||||||
bool Enchanting::soulEmpty() const
|
bool Enchanting::soulEmpty() const
|
||||||
{
|
{
|
||||||
if (mSoulGemPtr.isEmpty())
|
return mSoulGemPtr.isEmpty();
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Enchanting::itemEmpty() const
|
bool Enchanting::itemEmpty() const
|
||||||
{
|
{
|
||||||
if(mOldItemPtr.isEmpty())
|
return mOldItemPtr.isEmpty();
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Enchanting::setSelfEnchanting(bool selfEnchanting)
|
void Enchanting::setSelfEnchanting(bool selfEnchanting)
|
||||||
@ -291,7 +287,7 @@ namespace MWMechanics
|
|||||||
+ (0.125 * creatureStats.getAttribute (ESM::Attribute::Luck).getModified()));
|
+ (0.125 * creatureStats.getAttribute (ESM::Attribute::Luck).getModified()));
|
||||||
|
|
||||||
float chance2 = 2.5 * getEnchantPoints();
|
float chance2 = 2.5 * getEnchantPoints();
|
||||||
if(mCastStyle==ESM::CastingStyle_ConstantEffect)
|
if(mCastStyle==ESM::Enchantment::ConstantEffect)
|
||||||
{
|
{
|
||||||
float constantChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentConstantChanceMult")->getFloat();
|
float constantChance = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fEnchantmentConstantChanceMult")->getFloat();
|
||||||
chance2 /= constantChance;
|
chance2 /= constantChance;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include <components/esm/effectlist.hpp>
|
#include <components/esm/effectlist.hpp>
|
||||||
#include <components/esm/defs.hpp>
|
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
|
@ -23,15 +23,6 @@ enum RangeType
|
|||||||
RT_Target = 2
|
RT_Target = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// Casting style (in enchanting)
|
|
||||||
enum CastingStyle
|
|
||||||
{
|
|
||||||
CastingStyle_CastOnce = 0,
|
|
||||||
CastingStyle_WhenStrikes = 1,
|
|
||||||
CastingStyle_WhenUsed = 2,
|
|
||||||
CastingStyle_ConstantEffect = 3
|
|
||||||
};
|
|
||||||
|
|
||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user