From ccdff570ad362ba2e8f2888db3467e26781bcf16 Mon Sep 17 00:00:00 2001 From: Jan Borsodi Date: Sat, 18 Sep 2010 18:21:37 +0200 Subject: [PATCH] Factions now has a rank value in the stats window. --- apps/openmw/mwgui/layouts.cpp | 9 +++++---- apps/openmw/mwgui/layouts.hpp | 10 ++++++++-- apps/openmw/mwgui/window_manager.cpp | 4 ++-- apps/openmw/mwgui/window_manager.hpp | 7 +++++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwgui/layouts.cpp b/apps/openmw/mwgui/layouts.cpp index fcb4a13432..93e5255172 100644 --- a/apps/openmw/mwgui/layouts.cpp +++ b/apps/openmw/mwgui/layouts.cpp @@ -84,7 +84,7 @@ void StatsWindow::configureSkills (const std::set& major, const std::set& factions) +void StatsWindow::setFactions (const std::vector& factions) { this->factions = factions; } @@ -212,11 +212,12 @@ void StatsWindow::updateSkillArea() addSeparator(coord1, coord2); addGroup(wm->getGameSettingString("sFaction", "Faction"), coord1, coord2); - std::vector::const_iterator end = factions.end(); - for (std::vector::const_iterator it = factions.begin(); it != end; ++it) + FactionList::const_iterator end = factions.end(); + 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); + // TODO: Faction rank should be placed in tooltip } } diff --git a/apps/openmw/mwgui/layouts.hpp b/apps/openmw/mwgui/layouts.hpp index 64758dc5d2..6298d0b089 100644 --- a/apps/openmw/mwgui/layouts.hpp +++ b/apps/openmw/mwgui/layouts.hpp @@ -9,6 +9,8 @@ #include #include +#include +#include #include "../mwmechanics/stat.hpp" #include "../mwworld/environment.hpp" @@ -178,6 +180,9 @@ namespace MWGui class StatsWindow : public OEngine::GUI::Layout { public: + typedef std::pair Faction; + typedef std::vector FactionList; + void setBar(const std::string& name, const std::string& tname, int val, int max) { MyGUI::ProgressPtr pt; @@ -302,7 +307,7 @@ namespace MWGui void setValue (const std::string& id, const MWMechanics::Stat& value); void configureSkills (const std::set& major, const std::set& minor, const std::set& misc); - void configureFactions (const std::vector& factions); + void setFactions (const std::vector& factions); void configureBirthSign (const std::string &signId); void setReputation (int reputation) { this->reputation = reputation; } void setBounty (int bounty) { this->bounty = bounty; } @@ -329,7 +334,8 @@ namespace MWGui std::set majorSkills, minorSkills, miscSkills; std::map > skillValues; std::map skillWidgetMap; - std::vector factions; + std::map factionWidgetMap; + FactionList factions; ///< Stores a list of factions and the current rank std::string birthSignId; int reputation, bounty; std::vector skillWidgets; //< Skills and other information diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index deeb06f81f..0253271e17 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -176,9 +176,9 @@ void WindowManager::configureSkills (const std::set& major, const std::set< stats->configureSkills (major, minor, misc); } -void WindowManager::configureFactions (const std::vector& factions) +void WindowManager::setFactions (const FactionList& factions) { - stats->configureFactions (factions); + stats->setFactions (factions); } void WindowManager::configureBirthSign (const std::string &signId) diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 7125824d55..55c8197772 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -126,6 +126,9 @@ namespace MWGui MyGUI::Gui* getGui() const { return gui; } + typedef std::pair Faction; + typedef std::vector FactionList; + void setValue (const std::string& id, const MWMechanics::Stat& value); ///< Set value for the given ID. @@ -144,8 +147,8 @@ namespace MWGui void configureSkills (const std::set& major, const std::set& minor, const std::set& misc); ///< configure skill groups, each set contains the skill ID for that group. - void configureFactions (const std::vector& factions); - ///< configure factions to display on stat window, use an empty set to disable + void setFactions (const FactionList& factions); + ///< set faction and rank to display on stat window, use an empty vector to disable void configureBirthSign (const std::string &signId); ///< configure birth sign to display on stat window, use an empty string to disable.