mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
Make the getSkillForTraining a member method of TrainingWindow class.
The implementation is based now on the member of the class mTrainingSkillBasedOnBaseSkill instead of local static
This commit is contained in:
parent
998bf5da34
commit
096e25b29a
@ -34,17 +34,6 @@ bool sortSkills (const std::pair<int, int>& left, const std::pair<int, int>& rig
|
||||
|
||||
return left.first < right.first;
|
||||
}
|
||||
|
||||
// Retrieve the base skill value if the setting 'training skills based on base skill' is set;
|
||||
// otherwise returns the modified skill
|
||||
float getSkillForTraining(const MWMechanics::NpcStats& stats, int i)
|
||||
{
|
||||
static const bool trainersTrainingSkillsBasedOnBaseSkill = Settings::Manager::getBool("trainers training skills based on base skill", "Game");
|
||||
if (trainersTrainingSkillsBasedOnBaseSkill)
|
||||
return stats.getSkill(i).getBase();
|
||||
return stats.getSkill(i).getModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
@ -53,6 +42,7 @@ namespace MWGui
|
||||
TrainingWindow::TrainingWindow()
|
||||
: WindowBase("openmw_trainingwindow.layout")
|
||||
, mTimeAdvancer(0.05f)
|
||||
, mTrainingSkillBasedOnBaseSkill(Settings::Manager::getBool("trainers training skills based on base skill", "Game"))
|
||||
{
|
||||
getWidget(mTrainingOptions, "TrainingOptions");
|
||||
getWidget(mCancelButton, "CancelButton");
|
||||
@ -209,6 +199,13 @@ namespace MWGui
|
||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
||||
}
|
||||
|
||||
float TrainingWindow::getSkillForTraining(const MWMechanics::NpcStats& stats, int skillId) const
|
||||
{
|
||||
if (mTrainingSkillBasedOnBaseSkill)
|
||||
return stats.getSkill(skillId).getBase();
|
||||
return stats.getSkill(skillId).getModified();
|
||||
}
|
||||
|
||||
void TrainingWindow::onFrame(float dt)
|
||||
{
|
||||
checkReferenceAvailable();
|
||||
|
@ -6,6 +6,11 @@
|
||||
#include "timeadvancer.hpp"
|
||||
#include "waitdialog.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class NpcStats;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
@ -35,12 +40,17 @@ namespace MWGui
|
||||
void onTrainingProgressChanged(int cur, int total);
|
||||
void onTrainingFinished();
|
||||
|
||||
// Retrieve the base skill value if the setting 'training skills based on base skill' is set;
|
||||
// otherwise returns the modified skill
|
||||
float getSkillForTraining(const MWMechanics::NpcStats& stats, int skillId) const;
|
||||
|
||||
MyGUI::Widget* mTrainingOptions;
|
||||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::TextBox* mPlayerGold;
|
||||
|
||||
WaitDialogProgressBar mProgressBar;
|
||||
TimeAdvancer mTimeAdvancer;
|
||||
bool mTrainingSkillBasedOnBaseSkill; //corresponds to the setting 'training skills based on base skill'
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user