1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Factions now has a rank value in the stats window.

This commit is contained in:
Jan Borsodi 2010-09-18 18:21:37 +02:00
parent 6f1a41c1bd
commit ccdff570ad
4 changed files with 20 additions and 10 deletions

View File

@ -84,7 +84,7 @@ void StatsWindow::configureSkills (const std::set<int>& major, const std::set<in
miscSkills = misc; miscSkills = misc;
} }
void StatsWindow::configureFactions (const std::vector<std::string>& factions) void StatsWindow::setFactions (const std::vector<Faction>& factions)
{ {
this->factions = factions; this->factions = factions;
} }
@ -212,11 +212,12 @@ void StatsWindow::updateSkillArea()
addSeparator(coord1, coord2); addSeparator(coord1, coord2);
addGroup(wm->getGameSettingString("sFaction", "Faction"), coord1, coord2); addGroup(wm->getGameSettingString("sFaction", "Faction"), coord1, coord2);
std::vector<std::string>::const_iterator end = factions.end(); FactionList::const_iterator end = factions.end();
for (std::vector<std::string>::const_iterator it = factions.begin(); it != end; ++it) for (FactionList::const_iterator it = factions.begin(); it != end; ++it)
{ {
const ESM::Faction *faction = store.factions.find(*it); const ESM::Faction *faction = store.factions.find(it->first);
addItem(faction->name, coord1, coord2); addItem(faction->name, coord1, coord2);
// TODO: Faction rank should be placed in tooltip
} }
} }

View File

@ -9,6 +9,8 @@
#include <sstream> #include <sstream>
#include <set> #include <set>
#include <string>
#include <utility>
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
#include "../mwworld/environment.hpp" #include "../mwworld/environment.hpp"
@ -178,6 +180,9 @@ namespace MWGui
class StatsWindow : public OEngine::GUI::Layout class StatsWindow : public OEngine::GUI::Layout
{ {
public: public:
typedef std::pair<std::string, int> Faction;
typedef std::vector<Faction> FactionList;
void setBar(const std::string& name, const std::string& tname, int val, int max) void setBar(const std::string& name, const std::string& tname, int val, int max)
{ {
MyGUI::ProgressPtr pt; MyGUI::ProgressPtr pt;
@ -302,7 +307,7 @@ namespace MWGui
void setValue (const std::string& id, const MWMechanics::Stat<float>& value); 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 std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc);
void configureFactions (const std::vector<std::string>& factions); void setFactions (const std::vector<Faction>& factions);
void configureBirthSign (const std::string &signId); void configureBirthSign (const std::string &signId);
void setReputation (int reputation) { this->reputation = reputation; } void setReputation (int reputation) { this->reputation = reputation; }
void setBounty (int bounty) { this->bounty = bounty; } void setBounty (int bounty) { this->bounty = bounty; }
@ -329,7 +334,8 @@ namespace MWGui
std::set<int> majorSkills, minorSkills, miscSkills; std::set<int> majorSkills, minorSkills, miscSkills;
std::map<int, MWMechanics::Stat<float> > skillValues; std::map<int, MWMechanics::Stat<float> > skillValues;
std::map<int, MyGUI::WidgetPtr> skillWidgetMap; std::map<int, MyGUI::WidgetPtr> skillWidgetMap;
std::vector<std::string> factions; std::map<std::string, MyGUI::WidgetPtr> factionWidgetMap;
FactionList factions; ///< Stores a list of factions and the current rank
std::string birthSignId; std::string birthSignId;
int reputation, bounty; int reputation, bounty;
std::vector<MyGUI::WidgetPtr> skillWidgets; //< Skills and other information std::vector<MyGUI::WidgetPtr> skillWidgets; //< Skills and other information

View File

@ -176,9 +176,9 @@ void WindowManager::configureSkills (const std::set<int>& major, const std::set<
stats->configureSkills (major, minor, misc); stats->configureSkills (major, minor, misc);
} }
void WindowManager::configureFactions (const std::vector<std::string>& factions) void WindowManager::setFactions (const FactionList& factions)
{ {
stats->configureFactions (factions); stats->setFactions (factions);
} }
void WindowManager::configureBirthSign (const std::string &signId) void WindowManager::configureBirthSign (const std::string &signId)

View File

@ -126,6 +126,9 @@ namespace MWGui
MyGUI::Gui* getGui() const { return gui; } MyGUI::Gui* getGui() const { return gui; }
typedef std::pair<std::string, int> Faction;
typedef std::vector<Faction> FactionList;
void setValue (const std::string& id, const MWMechanics::Stat<int>& value); void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
///< Set value for the given ID. ///< Set value for the given ID.
@ -144,8 +147,8 @@ namespace MWGui
void configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc); void configureSkills (const std::set<int>& major, const std::set<int>& minor, const std::set<int>& misc);
///< configure skill groups, each set contains the skill ID for that group. ///< configure skill groups, each set contains the skill ID for that group.
void configureFactions (const std::vector<std::string>& factions); void setFactions (const FactionList& factions);
///< configure factions to display on stat window, use an empty set to disable ///< set faction and rank to display on stat window, use an empty vector to disable
void configureBirthSign (const std::string &signId); void configureBirthSign (const std::string &signId);
///< configure birth sign to display on stat window, use an empty string to disable. ///< configure birth sign to display on stat window, use an empty string to disable.