2013-04-10 00:32:05 -04:00
|
|
|
#ifndef MWGUI_STATS_WINDOW_H
|
|
|
|
#define MWGUI_STATS_WINDOW_H
|
|
|
|
|
2020-06-05 18:22:53 +04:00
|
|
|
#include "statswatcher.hpp"
|
2013-04-10 00:32:05 -04:00
|
|
|
#include "windowpinnablebase.hpp"
|
2023-06-18 19:10:29 +02:00
|
|
|
#include <components/esm/attr.hpp>
|
2022-10-18 09:26:55 +02:00
|
|
|
#include <components/esm/refid.hpp>
|
2013-04-10 00:32:05 -04:00
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2020-06-05 18:22:53 +04:00
|
|
|
class StatsWindow : public WindowPinnableBase, public NoDrop, public StatsListener
|
2013-04-10 00:32:05 -04:00
|
|
|
{
|
|
|
|
public:
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
typedef std::map<ESM::RefId, int> FactionList;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2014-01-26 14:47:01 +01:00
|
|
|
StatsWindow(DragAndDrop* drag);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
/// automatically updates all the data in the stats window, but only if it has changed.
|
2020-07-04 10:36:02 +04:00
|
|
|
void onFrame(float dt) override;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
void setBar(const std::string& name, const std::string& tname, int val, int max);
|
|
|
|
void setPlayerName(const std::string& playerName);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
/// Set value for the given ID.
|
2023-08-03 20:21:44 +02:00
|
|
|
void setAttribute(ESM::RefId id, const MWMechanics::AttributeValue& value) override;
|
2022-10-02 23:16:43 +02:00
|
|
|
void setValue(std::string_view id, const MWMechanics::DynamicStat<float>& value) override;
|
|
|
|
void setValue(std::string_view id, const std::string& value) override;
|
|
|
|
void setValue(std::string_view id, int value) override;
|
2023-06-06 12:35:01 +02:00
|
|
|
void setValue(ESM::RefId id, const MWMechanics::SkillValue& value) override;
|
2023-06-06 19:17:03 +02:00
|
|
|
void configureSkills(const std::vector<ESM::RefId>& major, const std::vector<ESM::RefId>& minor) override;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
void setReputation(int reputation)
|
|
|
|
{
|
|
|
|
if (reputation != mReputation)
|
|
|
|
mChanged = true;
|
|
|
|
this->mReputation = reputation;
|
|
|
|
}
|
|
|
|
void setBounty(int bounty)
|
|
|
|
{
|
|
|
|
if (bounty != mBounty)
|
|
|
|
mChanged = true;
|
|
|
|
this->mBounty = bounty;
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2013-04-10 00:32:05 -04:00
|
|
|
void updateSkillArea();
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void onOpen() override { onWindowResize(mMainWidget->castType<MyGUI::Window>()); }
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2023-07-09 08:42:09 +02:00
|
|
|
std::string_view getWindowIdForLua() const override { return "Stats"; }
|
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
private:
|
2023-06-06 19:17:03 +02:00
|
|
|
void addSkills(const std::vector<ESM::RefId>& skills, const std::string& titleId,
|
|
|
|
const std::string& titleDefault, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
2013-04-10 00:32:05 -04:00
|
|
|
void addSeparator(MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
2022-08-24 22:16:03 +02:00
|
|
|
void addGroup(std::string_view label, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
|
|
|
std::pair<MyGUI::TextBox*, MyGUI::TextBox*> addValueItem(std::string_view text, const std::string& value,
|
|
|
|
const std::string& state, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
2013-04-10 00:32:05 -04:00
|
|
|
MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
void setFactions(const FactionList& factions);
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
void setExpelled(const std::set<ESM::RefId>& expelled);
|
|
|
|
void setBirthSign(const ESM::RefId& signId);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
void onWindowResize(MyGUI::Window* window);
|
|
|
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
MyGUI::Widget* mLeftPane;
|
|
|
|
MyGUI::Widget* mRightPane;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
MyGUI::ScrollView* mSkillView;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2023-06-06 19:17:03 +02:00
|
|
|
std::vector<ESM::RefId> mMajorSkills, mMinorSkills, mMiscSkills;
|
2023-06-06 12:35:01 +02:00
|
|
|
std::map<ESM::RefId, MWMechanics::SkillValue> mSkillValues;
|
2023-08-03 20:21:44 +02:00
|
|
|
std::map<ESM::RefId, MyGUI::TextBox*> mAttributeWidgets;
|
2023-06-06 12:35:01 +02:00
|
|
|
std::map<ESM::RefId, std::pair<MyGUI::TextBox*, MyGUI::TextBox*>> mSkillWidgetMap;
|
2013-04-10 00:32:05 -04:00
|
|
|
std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
|
|
|
|
FactionList mFactions; ///< Stores a list of factions and the current rank
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
ESM::RefId mBirthSignId;
|
2013-04-10 00:32:05 -04:00
|
|
|
int mReputation, mBounty;
|
|
|
|
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
|
Initial commit: In ESM structures, replace the string members that are RefIds to other records, to a new strong type
The strong type is actually just a string underneath, but this will help in the future to have a distinction so it's easier to search and replace when we use an integer ID
Slowly going through all the changes to make, still hundreds of errors
a lot of functions/structures use std::string or stringview to designate an ID. So it takes time
Continues slowly replacing ids. There are technically more and more compilation errors
I have good hope that there is a point where the amount of errors will dramatically go down as all the main functions use the ESM::RefId type
Continue moving forward, changes to the stores
slowly moving along
Starting to see the fruit of those changes.
still many many error, but more and more Irun into a situation where a function is sandwiched between two functions that use the RefId type.
More replacements. Things are starting to get easier
I can see more and more often the issue is that the function is awaiting a RefId, but is given a string
there is less need to go down functions and to fix a long list of them.
Still moving forward, and for the first time error count is going down!
Good pace, not sure about topics though, mId and mName are actually the same thing and are used interchangeably
Cells are back to using string for the name, haven't fixed everything yet. Many other changes
Under the bar of 400 compilation errors.
more good progress <100 compile errors!
More progress
Game settings store can use string for find, it was a bit absurd how every use of it required to create refId from string
some more progress on other fronts
Mostly game settings clean
one error opened a lot of other errors. Down to 18, but more will prbably appear
only link errors left??
Fixed link errors
OpenMW compiles, and launches, with some issues, but still!
2022-09-25 13:17:09 +02:00
|
|
|
std::set<ESM::RefId> mExpelled;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
bool mChanged;
|
2019-07-17 00:44:36 -04:00
|
|
|
const int mMinFullWidth;
|
2022-09-22 21:26:05 +03:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
protected:
|
2020-10-16 22:18:54 +04:00
|
|
|
void onPinToggled() override;
|
|
|
|
void onTitleDoubleClicked() override;
|
2013-04-10 00:32:05 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|