diff --git a/apps/openmw/mwgui/layouts.cpp b/apps/openmw/mwgui/layouts.cpp index 3d5c0c6643..701d65e136 100644 --- a/apps/openmw/mwgui/layouts.cpp +++ b/apps/openmw/mwgui/layouts.cpp @@ -15,8 +15,16 @@ void StatsWindow::configureSkills (const std::set& major, const std::set& factions) +{ + this->factions = factions; +} + +void StatsWindow::configureBirthSign (const std::string& signId) +{ + birthSignId = signId; } void StatsWindow::addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) @@ -137,25 +145,38 @@ void StatsWindow::updateSkillArea() addSkills(miscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2); WindowManager *wm = environment.mWindowManager; + ESMS::ESMStore &store = environment.mWorld->getStore(); + + if (!factions.empty()) + { + // Add a line separator if there are items above + if (!skillWidgets.empty()) + 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) + { + const ESM::Faction *faction = store.factions.find(*it); + addItem(faction->name, coord1, coord2); + } + } + + if (!birthSignId.empty()) + { + // Add a line separator if there are items above + if (!skillWidgets.empty()) + addSeparator(coord1, coord2); + + addGroup(wm->getGameSettingString("sSign", "Sign"), coord1, coord2); + const ESM::BirthSign *sign = store.birthSigns.find(birthSignId); + addItem(sign->name, coord1, coord2); + } // Add a line separator if there are items above if (!skillWidgets.empty()) addSeparator(coord1, coord2); - addGroup(wm->getGameSettingString("sFaction", "Faction"), coord1, coord2); - addItem("Temple", coord1, coord2); - - // Add a line separator if there are items above - if (!skillWidgets.empty()) - addSeparator(coord1, coord2); - - addGroup(wm->getGameSettingString("sSign", "Sign"), coord1, coord2); - addItem("The Mage", coord1, coord2); - - // Add a line separator if there are items above - if (!skillWidgets.empty()) - addSeparator(coord1, coord2); - - addValueItem(wm->getGameSettingString("sReputation", "Reputation"), boost::lexical_cast(static_cast(0)), CS_Normal, coord1, coord2); - addValueItem(wm->getGameSettingString("sBounty", "Bounty"), boost::lexical_cast(static_cast(0)), CS_Normal, coord1, coord2); + addValueItem(wm->getGameSettingString("sReputation", "Reputation"), boost::lexical_cast(static_cast(reputation)), CS_Normal, coord1, coord2); + addValueItem(wm->getGameSettingString("sBounty", "Bounty"), boost::lexical_cast(static_cast(bounty)), CS_Normal, coord1, coord2); } diff --git a/apps/openmw/mwgui/layouts.hpp b/apps/openmw/mwgui/layouts.hpp index 0ea2dfe5a2..a9b095a073 100644 --- a/apps/openmw/mwgui/layouts.hpp +++ b/apps/openmw/mwgui/layouts.hpp @@ -294,6 +294,11 @@ namespace MWGui } void configureSkills (const std::set& major, const std::set& minor, const std::set& misc); + void configureFactions (const std::vector& factions); + void configureBirthSign (const std::string &signId); + void setReputation (int reputation) { this->reputation = reputation; } + void setBounty (int bounty) { this->bounty = bounty; } + void updateSkillArea(); private: enum ColorStyle @@ -302,7 +307,6 @@ namespace MWGui CS_Normal, CS_Super }; - void updateSkillArea(); void addSkills(const std::set &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); @@ -314,6 +318,9 @@ namespace MWGui MWWorld::Environment& environment; MyGUI::WidgetPtr skillAreaWidget; std::set majorSkills, minorSkills, miscSkills; + std::vector factions; + 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 2ec3ab2309..a7616a7216 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -171,6 +171,31 @@ void WindowManager::configureSkills (const std::set& major, const std::set< stats->configureSkills (major, minor, misc); } +void WindowManager::configureFactions (const std::vector& factions) +{ + stats->configureFactions (factions); +} + +void WindowManager::configureBirthSign (const std::string &signId) +{ + stats->configureBirthSign (signId); +} + +void WindowManager::setReputation (int reputation) +{ + stats->setReputation (reputation); +} + +void WindowManager::setBounty (int bounty) +{ + stats->setBounty (bounty); +} + +void WindowManager::updateSkillArea() +{ + stats->updateSkillArea(); +} + void WindowManager::messageBox (const std::string& message, const std::vector& buttons) { std::cout << "message box: " << message << std::endl; diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index c683fca16d..9f473b4f8e 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -141,6 +141,20 @@ 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 configureBirthSign (const std::string &signId); + ///< configure birth sign to display on stat window, use an empty string to disable. + + void setReputation (int reputation); + ///< set the current reputation value + + void setBounty (int bounty); + ///< set the current bounty value + + void updateSkillArea(); + ///< update display of skills, factions, birth sign, reputation and bounty void messageBox (const std::string& message, const std::vector& buttons);