mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +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
2 changed files with 18 additions and 11 deletions
|
@ -34,17 +34,6 @@ bool sortSkills (const std::pair<int, int>& left, const std::pair<int, int>& rig
|
||||||
|
|
||||||
return left.first < right.first;
|
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
|
namespace MWGui
|
||||||
|
@ -53,6 +42,7 @@ namespace MWGui
|
||||||
TrainingWindow::TrainingWindow()
|
TrainingWindow::TrainingWindow()
|
||||||
: WindowBase("openmw_trainingwindow.layout")
|
: WindowBase("openmw_trainingwindow.layout")
|
||||||
, mTimeAdvancer(0.05f)
|
, mTimeAdvancer(0.05f)
|
||||||
|
, mTrainingSkillBasedOnBaseSkill(Settings::Manager::getBool("trainers training skills based on base skill", "Game"))
|
||||||
{
|
{
|
||||||
getWidget(mTrainingOptions, "TrainingOptions");
|
getWidget(mTrainingOptions, "TrainingOptions");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
@ -209,6 +199,13 @@ namespace MWGui
|
||||||
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
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)
|
void TrainingWindow::onFrame(float dt)
|
||||||
{
|
{
|
||||||
checkReferenceAvailable();
|
checkReferenceAvailable();
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
#include "timeadvancer.hpp"
|
#include "timeadvancer.hpp"
|
||||||
#include "waitdialog.hpp"
|
#include "waitdialog.hpp"
|
||||||
|
|
||||||
|
namespace MWMechanics
|
||||||
|
{
|
||||||
|
class NpcStats;
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -35,12 +40,17 @@ namespace MWGui
|
||||||
void onTrainingProgressChanged(int cur, int total);
|
void onTrainingProgressChanged(int cur, int total);
|
||||||
void onTrainingFinished();
|
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::Widget* mTrainingOptions;
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
MyGUI::TextBox* mPlayerGold;
|
MyGUI::TextBox* mPlayerGold;
|
||||||
|
|
||||||
WaitDialogProgressBar mProgressBar;
|
WaitDialogProgressBar mProgressBar;
|
||||||
TimeAdvancer mTimeAdvancer;
|
TimeAdvancer mTimeAdvancer;
|
||||||
|
bool mTrainingSkillBasedOnBaseSkill; //corresponds to the setting 'training skills based on base skill'
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue