2010-09-21 12:34:47 +02:00
|
|
|
#include "birth.hpp"
|
|
|
|
|
2015-01-10 02:50:43 +01:00
|
|
|
#include <MyGUI_Gui.h>
|
|
|
|
#include <MyGUI_ImageBox.h>
|
|
|
|
#include <MyGUI_ListBox.h>
|
2017-09-17 14:06:01 +04:00
|
|
|
#include <MyGUI_ScrollView.h>
|
2015-01-10 02:50:43 +01:00
|
|
|
|
2022-09-05 19:35:15 +02:00
|
|
|
#include <components/esm3/loadbsgn.hpp>
|
|
|
|
#include <components/esm3/loadspel.hpp>
|
2022-06-29 00:32:11 +02:00
|
|
|
#include <components/misc/resourcehelpers.hpp>
|
|
|
|
#include <components/resource/resourcesystem.hpp>
|
|
|
|
|
2012-08-12 14:36:46 +02:00
|
|
|
#include "../mwbase/environment.hpp"
|
2012-08-12 18:11:09 +02:00
|
|
|
#include "../mwbase/windowmanager.hpp"
|
2012-08-12 14:36:46 +02:00
|
|
|
#include "../mwbase/world.hpp"
|
2017-11-25 11:35:29 +04:00
|
|
|
|
2014-12-19 11:26:54 +01:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2017-11-25 11:35:29 +04:00
|
|
|
#include "../mwworld/player.hpp"
|
2012-08-12 14:36:46 +02:00
|
|
|
|
2022-08-24 22:16:03 +02:00
|
|
|
#include "ustring.hpp"
|
2012-08-12 14:36:46 +02:00
|
|
|
#include "widgets.hpp"
|
|
|
|
|
2012-10-19 20:13:37 +02:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
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
|
|
|
bool sortBirthSigns(const std::pair<ESM::RefId, const ESM::BirthSign*>& left,
|
|
|
|
const std::pair<ESM::RefId, const ESM::BirthSign*>& right)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
return left.second->mName.compare(right.second->mName) < 0;
|
|
|
|
}
|
2012-10-19 20:13:37 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
namespace MWGui
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
BirthDialog::BirthDialog()
|
|
|
|
: WindowModal("openmw_chargen_birth.layout")
|
|
|
|
{
|
|
|
|
// Centre dialog
|
|
|
|
center();
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mSpellArea, "SpellArea");
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mBirthImage, "BirthsignImage");
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mBirthList, "BirthsignList");
|
|
|
|
mBirthList->setScrollVisible(true);
|
2014-01-28 20:12:37 +01:00
|
|
|
mBirthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onAccept);
|
2013-04-17 18:56:48 -04:00
|
|
|
mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* backButton;
|
|
|
|
getWidget(backButton, "BackButton");
|
|
|
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
2022-08-24 22:16:03 +02:00
|
|
|
okButton->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
|
2013-04-17 18:56:48 -04:00
|
|
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
updateBirths();
|
|
|
|
updateSpells();
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::setNextButtonShow(bool shown)
|
|
|
|
{
|
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
if (shown)
|
2022-08-24 22:16:03 +02:00
|
|
|
okButton->setCaption(
|
|
|
|
toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
|
2013-04-17 18:56:48 -04:00
|
|
|
else
|
2022-08-24 22:16:03 +02:00
|
|
|
okButton->setCaption(
|
|
|
|
toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
|
|
|
|
2017-09-22 17:10:53 +02:00
|
|
|
void BirthDialog::onOpen()
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2017-09-22 17:10:53 +02:00
|
|
|
WindowModal::onOpen();
|
2013-04-17 18:56:48 -04:00
|
|
|
updateBirths();
|
|
|
|
updateSpells();
|
2019-06-09 02:08:09 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mBirthList);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2017-11-25 11:35:29 +04:00
|
|
|
// Show the current birthsign by default
|
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
|
|
|
const auto& signId = MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
2017-11-25 11:35:29 +04:00
|
|
|
|
|
|
|
if (!signId.empty())
|
|
|
|
setBirthId(signId);
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
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 BirthDialog::setBirthId(const ESM::RefId& birthId)
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
mCurrentBirthId = birthId;
|
|
|
|
mBirthList->setIndexSelected(MyGUI::ITEM_NONE);
|
|
|
|
size_t count = mBirthList->getItemCount();
|
|
|
|
for (size_t i = 0; i < count; ++i)
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
2022-10-03 14:02:59 +02:00
|
|
|
if (ESM::RefId::stringRefId(*mBirthList->getItemDataAt<std::string>(i)) == birthId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mBirthList->setIndexSelected(i);
|
|
|
|
break;
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
updateSpells();
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::onOkClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
if (mBirthList->getIndexSelected() == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
|
|
|
eventDone(this);
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2014-01-28 20:12:37 +01:00
|
|
|
void BirthDialog::onAccept(MyGUI::ListBox* _sender, size_t _index)
|
|
|
|
{
|
|
|
|
onSelectBirth(_sender, _index);
|
|
|
|
if (mBirthList->getIndexSelected() == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
|
|
|
eventDone(this);
|
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::onBackClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventBack();
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
|
|
|
{
|
|
|
|
if (_index == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
2012-11-03 06:02:33 +00:00
|
|
|
|
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
|
|
|
const ESM::RefId birthId = ESM::RefId::stringRefId(*mBirthList->getItemDataAt<std::string>(_index));
|
2022-10-03 14:02:59 +02:00
|
|
|
if (mCurrentBirthId == birthId)
|
2013-04-17 18:56:48 -04:00
|
|
|
return;
|
2010-09-21 12:34:47 +02:00
|
|
|
|
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
|
|
|
mCurrentBirthId = birthId;
|
2013-04-17 18:56:48 -04:00
|
|
|
updateSpells();
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// update widget content
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::updateBirths()
|
|
|
|
{
|
|
|
|
mBirthList->removeAllItems();
|
2011-04-21 10:49:45 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
const MWWorld::Store<ESM::BirthSign>& signs
|
|
|
|
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
|
2012-11-06 00:34:11 +04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// sort by name
|
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::vector<std::pair<ESM::RefId, const ESM::BirthSign*>> birthSigns;
|
2012-10-19 20:13:37 +02:00
|
|
|
|
2019-03-02 13:27:59 +04:00
|
|
|
for (const ESM::BirthSign& sign : signs)
|
2013-02-10 08:59:38 +04:00
|
|
|
{
|
2020-10-17 12:26:35 +04:00
|
|
|
birthSigns.emplace_back(sign.mId, &sign);
|
2013-02-10 08:59:38 +04:00
|
|
|
}
|
2013-04-17 18:56:48 -04:00
|
|
|
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
|
|
|
|
|
|
|
|
int index = 0;
|
2019-03-02 13:27:59 +04:00
|
|
|
for (auto& birthsignPair : birthSigns)
|
2013-02-10 08:59:38 +04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
mBirthList->addItem(birthsignPair.second->mName, birthsignPair.first);
|
2013-04-17 18:56:48 -04:00
|
|
|
if (mCurrentBirthId.empty())
|
|
|
|
{
|
|
|
|
mBirthList->setIndexSelected(index);
|
2019-03-02 13:27:59 +04:00
|
|
|
mCurrentBirthId = birthsignPair.first;
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2022-10-03 14:02:59 +02:00
|
|
|
else if (birthsignPair.first == mCurrentBirthId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mBirthList->setIndexSelected(index);
|
|
|
|
}
|
2019-03-02 13:27:59 +04:00
|
|
|
|
|
|
|
index++;
|
2013-02-10 08:59:38 +04:00
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void BirthDialog::updateSpells()
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
for (MyGUI::Widget* widget : mSpellItems)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
MyGUI::Gui::getInstance().destroyWidget(widget);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
|
|
|
mSpellItems.clear();
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
if (mCurrentBirthId.empty())
|
|
|
|
return;
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
Widgets::MWSpellPtr spellWidget;
|
2022-08-17 21:51:36 +04:00
|
|
|
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
|
|
|
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
2012-11-06 00:34:11 +04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
const ESM::BirthSign* birth = store.get<ESM::BirthSign>().find(mCurrentBirthId);
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2022-06-29 00:32:11 +02:00
|
|
|
mBirthImage->setImageTexture(Misc::ResourceHelpers::correctTexturePath(
|
|
|
|
birth->mTexture, MWBase::Environment::get().getResourceSystem()->getVFS()));
|
2010-09-21 12:34:47 +02:00
|
|
|
|
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::vector<ESM::RefId> abilities, powers, spells;
|
2010-09-21 12:34:47 +02:00
|
|
|
|
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::vector<ESM::RefId>::const_iterator it = birth->mPowers.mList.begin();
|
|
|
|
std::vector<ESM::RefId>::const_iterator end = birth->mPowers.mList.end();
|
2013-04-17 18:56:48 -04:00
|
|
|
for (; it != end; ++it)
|
|
|
|
{
|
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
|
|
|
const ESM::RefId& spellId = *it;
|
2013-04-17 18:56:48 -04:00
|
|
|
const ESM::Spell* spell = store.get<ESM::Spell>().search(spellId);
|
|
|
|
if (!spell)
|
|
|
|
continue; // Skip spells which cannot be found
|
|
|
|
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
|
|
|
|
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
|
|
|
|
continue; // We only want spell, ability and powers.
|
|
|
|
|
|
|
|
if (type == ESM::Spell::ST_Ability)
|
|
|
|
abilities.push_back(spellId);
|
|
|
|
else if (type == ESM::Spell::ST_Power)
|
|
|
|
powers.push_back(spellId);
|
|
|
|
else if (type == ESM::Spell::ST_Spell)
|
|
|
|
spells.push_back(spellId);
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
int i = 0;
|
2012-11-06 00:34:11 +04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
struct
|
|
|
|
{
|
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
|
|
|
const std::vector<ESM::RefId>& spells;
|
2013-04-17 18:56:48 -04:00
|
|
|
const char* label;
|
|
|
|
} categories[3] = { { abilities, "sBirthsignmenu1" }, { powers, "sPowers" }, { spells, "sBirthsignmenu2" } };
|
2012-11-06 00:34:11 +04:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int category = 0; category < 3; ++category)
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
if (!categories[category].spells.empty())
|
2010-09-21 12:34:47 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::TextBox* label = mSpellArea->createWidget<MyGUI::TextBox>(
|
|
|
|
"SandBrightText", coord, MyGUI::Align::Default, std::string("Label"));
|
2022-08-24 22:16:03 +02:00
|
|
|
label->setCaption(toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
categories[category].label, {})));
|
2013-04-17 18:56:48 -04:00
|
|
|
mSpellItems.push_back(label);
|
2010-09-21 12:34:47 +02:00
|
|
|
coord.top += lineHeight;
|
|
|
|
|
2016-10-06 01:12:06 +09:00
|
|
|
end = categories[category].spells.end();
|
2016-10-31 00:23:51 +09:00
|
|
|
for (it = categories[category].spells.begin(); it != end; ++it)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
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
|
|
|
const ESM::RefId& spellId = *it;
|
2015-01-10 03:01:01 +01:00
|
|
|
spellWidget = mSpellArea->createWidget<Widgets::MWSpell>("MW_StatName", coord,
|
|
|
|
MyGUI::Align::Default, std::string("Spell") + MyGUI::utility::toString(i));
|
2013-04-17 18:56:48 -04:00
|
|
|
spellWidget->setSpellId(spellId);
|
|
|
|
|
|
|
|
mSpellItems.push_back(spellWidget);
|
|
|
|
coord.top += lineHeight;
|
2010-09-21 12:34:47 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::IntCoord spellCoord = coord;
|
|
|
|
spellCoord.height = 24; // TODO: This should be fetched from the skin somehow, or perhaps a widget
|
|
|
|
// in the layout as a template?
|
|
|
|
spellWidget->createEffectWidgets(
|
|
|
|
mSpellItems, mSpellArea, spellCoord, (category == 0) ? Widgets::MWEffectList::EF_Constant : 0);
|
|
|
|
coord.top = spellCoord.top;
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
}
|
|
|
|
}
|
2013-04-17 18:56:48 -04:00
|
|
|
|
2017-09-17 14:06:01 +04:00
|
|
|
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
|
|
|
|
// scrollbar is hidden
|
|
|
|
mSpellArea->setVisibleVScroll(false);
|
|
|
|
mSpellArea->setCanvasSize(MyGUI::IntSize(mSpellArea->getWidth(), std::max(mSpellArea->getHeight(), coord.top)));
|
|
|
|
mSpellArea->setVisibleVScroll(true);
|
|
|
|
mSpellArea->setViewOffset(MyGUI::IntPoint(0, 0));
|
|
|
|
}
|
2010-09-21 12:34:47 +02:00
|
|
|
}
|