forked from teamnwah/openmw-tes3coop
Removed the need to configure the misc skills, they are now automatically set to any skills not part of the major/minor group.
This commit is contained in:
parent
9a0aea1718
commit
573917f3e1
6 changed files with 60 additions and 11 deletions
|
@ -4,6 +4,8 @@
|
|||
#include "../mwmechanics/mechanicsmanager.hpp"
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
using namespace MWGui;
|
||||
|
@ -77,11 +79,23 @@ void StatsWindow::setValue (const std::string& id, const MWMechanics::Stat<float
|
|||
}
|
||||
}
|
||||
|
||||
void StatsWindow::configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc)
|
||||
void StatsWindow::configureSkills (const std::vector<int>& major, const std::vector<int>& minor)
|
||||
{
|
||||
majorSkills = major;
|
||||
minorSkills = minor;
|
||||
miscSkills = misc;
|
||||
|
||||
// Update misc skills with the remaining skills not in major or minor
|
||||
std::set<int> skillSet;
|
||||
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
|
||||
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
|
||||
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::skillIds.end();
|
||||
miscSkills.clear();
|
||||
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::skillIds.begin(); it != end; ++it)
|
||||
{
|
||||
int skill = *it;
|
||||
if (skillSet.find(skill) == skillSet.end())
|
||||
miscSkills.push_back(skill);
|
||||
}
|
||||
}
|
||||
|
||||
void StatsWindow::setFactions (const std::vector<Faction>& factions)
|
||||
|
@ -145,7 +159,7 @@ void StatsWindow::addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI
|
|||
coord2.top += lineHeight;
|
||||
}
|
||||
|
||||
void StatsWindow::addSkills(const std::set<int> &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
|
||||
{
|
||||
WindowManager *wm = environment.mWindowManager;
|
||||
MWMechanics::MechanicsManager *mm = environment.mMechanicsManager;
|
||||
|
@ -159,8 +173,8 @@ void StatsWindow::addSkills(const std::set<int> &skills, const std::string &titl
|
|||
|
||||
addGroup(wm->getGameSettingString(titleId, titleDefault), coord1, coord2);
|
||||
|
||||
std::set<int>::const_iterator end = skills.end();
|
||||
for (std::set<int>::const_iterator it = skills.begin(); it != end; ++it)
|
||||
SkillList::const_iterator end = skills.end();
|
||||
for (SkillList::const_iterator it = skills.begin(); it != end; ++it)
|
||||
{
|
||||
int skillId = *it;
|
||||
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
|
||||
|
|
|
@ -183,6 +183,8 @@ namespace MWGui
|
|||
typedef std::pair<std::string, int> Faction;
|
||||
typedef std::vector<Faction> FactionList;
|
||||
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
void setBar(const std::string& name, const std::string& tname, int val, int max)
|
||||
{
|
||||
MyGUI::ProgressPtr pt;
|
||||
|
@ -306,7 +308,7 @@ namespace MWGui
|
|||
|
||||
void setValue (const std::string& id, const MWMechanics::Stat<float>& value);
|
||||
|
||||
void configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc);
|
||||
void configureSkills (const SkillList& major, const SkillList& minor);
|
||||
void setFactions (const std::vector<Faction>& factions);
|
||||
void setBirthSign (const std::string &signId);
|
||||
void setReputation (int reputation) { this->reputation = reputation; }
|
||||
|
@ -321,7 +323,7 @@ namespace MWGui
|
|||
CS_Super
|
||||
};
|
||||
void setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value);
|
||||
void addSkills(const std::set<int> &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||
|
@ -331,7 +333,7 @@ namespace MWGui
|
|||
|
||||
MWWorld::Environment& environment;
|
||||
MyGUI::WidgetPtr skillAreaWidget;
|
||||
std::set<int> majorSkills, minorSkills, miscSkills;
|
||||
SkillList majorSkills, minorSkills, miscSkills;
|
||||
std::map<int, MWMechanics::Stat<float> > skillValues;
|
||||
std::map<int, MyGUI::WidgetPtr> skillWidgetMap;
|
||||
std::map<std::string, MyGUI::WidgetPtr> factionWidgetMap;
|
||||
|
|
|
@ -171,9 +171,9 @@ void WindowManager::setValue (const std::string& id, int value)
|
|||
stats->setValue (id, value);
|
||||
}
|
||||
|
||||
void WindowManager::configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc)
|
||||
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
|
||||
{
|
||||
stats->configureSkills (major, minor, misc);
|
||||
stats->configureSkills (major, minor);
|
||||
}
|
||||
|
||||
void WindowManager::setFactions (const FactionList& factions)
|
||||
|
|
|
@ -128,6 +128,7 @@ namespace MWGui
|
|||
|
||||
typedef std::pair<std::string, int> Faction;
|
||||
typedef std::vector<Faction> FactionList;
|
||||
typedef std::vector<int> SkillList;
|
||||
|
||||
void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
|
||||
///< Set value for the given ID.
|
||||
|
@ -144,7 +145,7 @@ namespace MWGui
|
|||
void setValue (const std::string& id, int value);
|
||||
///< set value for the given ID.
|
||||
|
||||
void configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc);
|
||||
void configureSkills (const SkillList& major, const SkillList& minor);
|
||||
///< configure skill groups, each set contains the skill ID for that group.
|
||||
|
||||
void setFactions (const FactionList& factions);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef _ESM_SKIL_H
|
||||
#define _ESM_SKIL_H
|
||||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include "esm_reader.hpp"
|
||||
#include "defs.hpp"
|
||||
|
||||
|
@ -62,6 +64,7 @@ struct Skill
|
|||
Length
|
||||
};
|
||||
static const std::string sSkillNameIds[Length];
|
||||
static const boost::array<SkillEnum, Length> skillIds;
|
||||
|
||||
void load(ESMReader &esm)
|
||||
{
|
||||
|
|
|
@ -31,4 +31,33 @@ namespace ESM
|
|||
"sSkillSpeechcraft",
|
||||
"sSkillHandtohand",
|
||||
};
|
||||
const boost::array<Skill::SkillEnum, Skill::Length> Skill::skillIds = {{
|
||||
Block,
|
||||
Armorer,
|
||||
MediumArmor,
|
||||
HeavyArmor,
|
||||
BluntWeapon,
|
||||
LongBlade,
|
||||
Axe,
|
||||
Spear,
|
||||
Athletics,
|
||||
Enchant,
|
||||
Destruction,
|
||||
Alteration,
|
||||
Illusion,
|
||||
Conjuration,
|
||||
Mysticism,
|
||||
Restoration,
|
||||
Alchemy,
|
||||
Unarmored,
|
||||
Security,
|
||||
Sneak,
|
||||
Acrobatics,
|
||||
LightArmor,
|
||||
ShortBlade,
|
||||
Marksman,
|
||||
Mercantile,
|
||||
Speechcraft,
|
||||
HandToHand
|
||||
}};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue