Remove some redundant code

pull/541/head
Capostrophic 6 years ago
parent 91ec1d1c2c
commit 624db99bf2

@ -1,9 +1,5 @@
#include "ref.hpp"
#include <cmath>
#include <sstream>
#include "cellcoordinates.hpp"
CSMWorld::CellRef::CellRef() : mNew (true)

@ -1,7 +1,5 @@
#include "aiwander.hpp"
#include <cfloat>
#include <components/debug/debuglog.hpp>
#include <components/misc/rng.hpp>
#include <components/esm/aisequence.hpp>

@ -240,19 +240,6 @@ namespace MWMechanics
return true;
}
ESM::Skill::SkillEnum mapSchoolToSkill(int school)
{
std::map<int, ESM::Skill::SkillEnum> schoolSkillMap; // maps spell school to skill id
schoolSkillMap[0] = ESM::Skill::Alteration;
schoolSkillMap[1] = ESM::Skill::Conjuration;
schoolSkillMap[3] = ESM::Skill::Illusion;
schoolSkillMap[2] = ESM::Skill::Destruction;
schoolSkillMap[4] = ESM::Skill::Mysticism;
schoolSkillMap[5] = ESM::Skill::Restoration;
assert(schoolSkillMap.find(school) != schoolSkillMap.end());
return schoolSkillMap[school];
}
void calcWeakestSchool (const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm)
{
// Morrowind for some reason uses a formula slightly different from magicka cost calculation
@ -288,7 +275,7 @@ namespace MWMechanics
if (effect.mRange == ESM::RT_Target)
x *= 1.5f;
float s = 2.f * actorSkills[mapSchoolToSkill(magicEffect->mData.mSchool)];
float s = 2.f * actorSkills[spellSchoolToSkill(magicEffect->mData.mSchool)];
if (s - x < minChance)
{
minChance = s - x;
@ -308,7 +295,7 @@ namespace MWMechanics
float skillTerm = 0;
if (effectiveSchool != -1)
skillTerm = 2.f * actorSkills[mapSchoolToSkill(effectiveSchool)];
skillTerm = 2.f * actorSkills[spellSchoolToSkill(effectiveSchool)];
else
calcWeakestSchool(spell, actorSkills, effectiveSchool, skillTerm); // Note effectiveSchool is unused after this

@ -1,9 +1,6 @@
#ifndef OPENMW_AUTOCALCSPELL_H
#define OPENMW_AUTOCALCSPELL_H
#include <cfloat>
#include <set>
#include <components/esm/loadspel.hpp>
#include <components/esm/loadskil.hpp>
#include <components/esm/loadrace.hpp>
@ -22,8 +19,6 @@ std::vector<std::string> autoCalcPlayerSpells(const int* actorSkills, const int*
bool attrSkillCheck (const ESM::Spell* spell, const int* actorSkills, const int* actorAttributes);
ESM::Skill::SkillEnum mapSchoolToSkill(int school);
void calcWeakestSchool(const ESM::Spell* spell, const int* actorSkills, int& effectiveSchool, float& skillTerm);
float calcAutoCastChance(const ESM::Spell* spell, const int* actorSkills, const int* actorAttributes, int effectiveSchool);

@ -60,13 +60,6 @@ void wrap(float& rad)
rad = std::fmod(rad-osg::PI, 2.0f*osg::PI)+osg::PI;
}
std::string toString(int num)
{
std::ostringstream stream;
stream << num;
return stream.str();
}
std::string getBestAttack (const ESM::Weapon* weapon)
{
int slash = (weapon->mData.mSlash[0] + weapon->mData.mSlash[1])/2;
@ -235,13 +228,13 @@ public:
std::string CharacterController::chooseRandomGroup (const std::string& prefix, int* num) const
{
int numAnims=0;
while (mAnimation->hasAnimation(prefix + toString(numAnims+1)))
while (mAnimation->hasAnimation(prefix + std::to_string(numAnims+1)))
++numAnims;
int roll = Misc::Rng::rollDice(numAnims) + 1; // [1, numAnims]
if (num)
*num = roll;
return prefix + toString(roll);
return prefix + std::to_string(roll);
}
void CharacterController::refreshHitRecoilAnims(CharacterState& idle)
@ -783,7 +776,7 @@ void CharacterController::playDeath(float startpoint, CharacterState death)
mCurrentDeath = "deathknockout";
break;
default:
mCurrentDeath = "death" + toString(death - CharState_Death1 + 1);
mCurrentDeath = "death" + std::to_string(death - CharState_Death1 + 1);
}
mDeathState = death;

@ -1,8 +1,5 @@
#include "mechanicsmanagerimp.hpp"
#include <limits.h>
#include <set>
#include <components/misc/rng.hpp>
#include <components/esm/esmwriter.hpp>

@ -1,6 +1,5 @@
#include "spellcasting.hpp"
#include <cfloat>
#include <limits>
#include <iomanip>

@ -1,7 +1,5 @@
#include "objects.hpp"
#include <cmath>
#include <osg/Group>
#include <osg/UserDataContainer>

Loading…
Cancel
Save