2010-09-19 04:29:22 +02:00
|
|
|
#include "class.hpp"
|
|
|
|
|
2015-01-10 02:50:43 +01:00
|
|
|
#include <MyGUI_Gui.h>
|
|
|
|
#include <MyGUI_ImageBox.h>
|
|
|
|
#include <MyGUI_ListBox.h>
|
|
|
|
|
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
|
|
|
|
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
2014-12-19 11:26:54 +01:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2012-08-12 14:36:46 +02:00
|
|
|
|
2018-08-14 23:05:43 +04:00
|
|
|
#include <components/debug/debuglog.hpp>
|
2022-06-29 00:32:11 +02:00
|
|
|
#include <components/esm3/loadnpc.hpp>
|
|
|
|
#include <components/misc/resourcehelpers.hpp>
|
|
|
|
#include <components/resource/resourcesystem.hpp>
|
|
|
|
#include <components/vfs/manager.hpp>
|
2018-08-14 23:05:43 +04:00
|
|
|
|
2012-05-27 06:39:10 +02:00
|
|
|
#include "tooltips.hpp"
|
2022-08-24 22:16:03 +02:00
|
|
|
#include "ustring.hpp"
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2014-12-23 19:31:39 +01: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 sortClasses(const std::pair<ESM::RefId, std::string>& left, const std::pair<ESM::RefId, std::string>& right)
|
2014-12-23 19:31:39 +01:00
|
|
|
{
|
|
|
|
return left.second.compare(right.second) < 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
namespace MWGui
|
2010-10-10 01:52:08 +02:00
|
|
|
{
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* GenerateClassResultDialog */
|
2010-10-10 01:52:08 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
GenerateClassResultDialog::GenerateClassResultDialog()
|
|
|
|
: WindowModal("openmw_chargen_generate_class_result.layout")
|
|
|
|
{
|
2022-08-24 22:16:03 +02:00
|
|
|
setText("ReflectT",
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString("sMessageQuestionAnswer1", {}));
|
2010-10-10 01:52:08 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mClassImage, "ClassImage");
|
|
|
|
getWidget(mClassName, "ClassName");
|
2010-10-10 01:52:08 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* backButton;
|
|
|
|
getWidget(backButton, "BackButton");
|
2014-01-10 21:13:03 +01:00
|
|
|
backButton->setCaptionWithReplacing("#{sMessageQuestionAnswer3}");
|
2013-04-17 18:56:48 -04:00
|
|
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
|
2010-10-10 01:52:08 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
2014-01-10 21:13:03 +01:00
|
|
|
okButton->setCaptionWithReplacing("#{sMessageQuestionAnswer2}");
|
2013-04-17 18:56:48 -04:00
|
|
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
2014-09-20 13:07:38 +02:00
|
|
|
|
|
|
|
center();
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-10-10 01:52:08 +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 GenerateClassResultDialog::setClassId(const ESM::RefId& classId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mCurrentClassId = classId;
|
2016-03-24 16:52:16 +01:00
|
|
|
|
|
|
|
setClassImage(mClassImage, mCurrentClassId);
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mClassName->setCaption(
|
|
|
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mCurrentClassId)->mName);
|
2014-09-20 13:07:38 +02:00
|
|
|
|
|
|
|
center();
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-10-10 01:52:08 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void GenerateClassResultDialog::onOkClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventDone(this);
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventBack();
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* PickClassDialog */
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
PickClassDialog::PickClassDialog()
|
|
|
|
: WindowModal("openmw_chargen_class.layout")
|
2010-11-05 19:40:00 +01:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
// Centre dialog
|
|
|
|
center();
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mSpecializationName, "SpecializationName");
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mFavoriteAttribute[0], "FavoriteAttribute0");
|
|
|
|
getWidget(mFavoriteAttribute[1], "FavoriteAttribute1");
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
char theIndex = '0' + i;
|
|
|
|
getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
|
|
|
getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mClassList, "ClassList");
|
|
|
|
mClassList->setScrollVisible(true);
|
2014-01-28 20:12:37 +01:00
|
|
|
mClassList->eventListSelectAccept += MyGUI::newDelegate(this, &PickClassDialog::onAccept);
|
2013-04-17 18:56:48 -04:00
|
|
|
mClassList->eventListChangePosition += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass);
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mClassImage, "ClassImage");
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* backButton;
|
|
|
|
getWidget(backButton, "BackButton");
|
|
|
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
|
|
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
updateClasses();
|
|
|
|
updateStats();
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::setNextButtonShow(bool shown)
|
|
|
|
{
|
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
2010-09-19 04:29:22 +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 PickClassDialog::onOpen()
|
2010-09-19 04:29:22 +02:00
|
|
|
{
|
2017-09-22 17:10:53 +02:00
|
|
|
WindowModal::onOpen();
|
2013-04-17 18:56:48 -04:00
|
|
|
updateClasses();
|
|
|
|
updateStats();
|
2019-06-09 02:08:09 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mClassList);
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2017-11-25 11:35:29 +04:00
|
|
|
// Show the current class by default
|
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
|
|
|
|
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& classId = player.get<ESM::NPC>()->mBase->mClass;
|
2017-11-25 11:35:29 +04:00
|
|
|
|
|
|
|
if (!classId.empty())
|
|
|
|
setClassId(classId);
|
|
|
|
}
|
2010-09-19 04:29:22 +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 PickClassDialog::setClassId(const ESM::RefId& classId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mCurrentClassId = classId;
|
|
|
|
mClassList->setIndexSelected(MyGUI::ITEM_NONE);
|
|
|
|
size_t count = mClassList->getItemCount();
|
|
|
|
for (size_t i = 0; i < count; ++i)
|
|
|
|
{
|
2022-10-03 14:02:59 +02:00
|
|
|
if (*mClassList->getItemDataAt<ESM::RefId>(i) == classId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mClassList->setIndexSelected(i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
updateStats();
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
if (mClassList->getIndexSelected() == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
|
|
|
eventDone(this);
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventBack();
|
|
|
|
}
|
2012-11-03 06:02:33 +00:00
|
|
|
|
2014-01-28 20:12:37 +01:00
|
|
|
void PickClassDialog::onAccept(MyGUI::ListBox* _sender, size_t _index)
|
|
|
|
{
|
|
|
|
onSelectClass(_sender, _index);
|
|
|
|
if (mClassList->getIndexSelected() == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
|
|
|
eventDone(this);
|
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
|
|
|
{
|
|
|
|
if (_index == MyGUI::ITEM_NONE)
|
|
|
|
return;
|
2010-09-19 04:29:22 +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
|
|
|
const ESM::RefId* classId = mClassList->getItemDataAt<ESM::RefId>(_index);
|
2022-10-03 14:02:59 +02:00
|
|
|
if (mCurrentClassId == *classId)
|
2013-04-17 18:56:48 -04:00
|
|
|
return;
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mCurrentClassId = *classId;
|
|
|
|
updateStats();
|
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// update widget content
|
2011-04-21 10:49:45 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::updateClasses()
|
2010-09-19 04:29:22 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
mClassList->removeAllItems();
|
2010-09-19 04:29:22 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
|
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, std::string>> items; // class id, class name
|
2019-03-02 13:27:59 +04:00
|
|
|
for (const ESM::Class& classInfo : store.get<ESM::Class>())
|
2013-02-10 08:59:38 +04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
bool playable = (classInfo.mData.mIsPlayable != 0);
|
2013-04-17 18:56:48 -04:00
|
|
|
if (!playable) // Only display playable classes
|
|
|
|
continue;
|
|
|
|
|
2019-03-02 13:27:59 +04:00
|
|
|
if (store.get<ESM::Class>().isDynamic(classInfo.mId))
|
2016-03-21 11:46:25 +01:00
|
|
|
continue; // custom-made class not relevant for this dialog
|
|
|
|
|
2020-10-17 12:26:35 +04:00
|
|
|
items.emplace_back(classInfo.mId, classInfo.mName);
|
2014-12-23 19:31:39 +01:00
|
|
|
}
|
|
|
|
std::sort(items.begin(), items.end(), sortClasses);
|
|
|
|
|
|
|
|
int index = 0;
|
2019-03-02 13:27:59 +04:00
|
|
|
for (auto& itemPair : items)
|
2014-12-23 19:31:39 +01: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& id = itemPair.first;
|
2019-03-02 13:27:59 +04:00
|
|
|
mClassList->addItem(itemPair.second, id);
|
2013-04-17 18:56:48 -04:00
|
|
|
if (mCurrentClassId.empty())
|
|
|
|
{
|
|
|
|
mCurrentClassId = id;
|
|
|
|
mClassList->setIndexSelected(index);
|
|
|
|
}
|
2022-10-03 14:02:59 +02:00
|
|
|
else if (id == mCurrentClassId)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
mClassList->setIndexSelected(index);
|
|
|
|
}
|
|
|
|
++index;
|
2013-02-10 08:59:38 +04:00
|
|
|
}
|
2010-09-19 04:29:22 +02:00
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void PickClassDialog::updateStats()
|
|
|
|
{
|
|
|
|
if (mCurrentClassId.empty())
|
|
|
|
return;
|
|
|
|
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
const ESM::Class* klass = store.get<ESM::Class>().search(mCurrentClassId);
|
|
|
|
if (!klass)
|
|
|
|
return;
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
ESM::Class::Specialization specialization
|
|
|
|
= static_cast<ESM::Class::Specialization>(klass->mData.mSpecialization);
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2022-08-24 22:16:03 +02:00
|
|
|
static const std::string_view specIds[3]
|
|
|
|
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
|
|
|
std::string specName{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
specIds[specialization], specIds[specialization]) };
|
2013-04-17 18:56:48 -04:00
|
|
|
mSpecializationName->setCaption(specName);
|
|
|
|
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mFavoriteAttribute[0]->setAttributeId(klass->mData.mAttribute[0]);
|
|
|
|
mFavoriteAttribute[1]->setAttributeId(klass->mData.mAttribute[1]);
|
|
|
|
ToolTips::createAttributeToolTip(mFavoriteAttribute[0], mFavoriteAttribute[0]->getAttributeId());
|
|
|
|
ToolTips::createAttributeToolTip(mFavoriteAttribute[1], mFavoriteAttribute[1]->getAttributeId());
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
mMinorSkill[i]->setSkillNumber(klass->mData.mSkills[i][0]);
|
|
|
|
mMajorSkill[i]->setSkillNumber(klass->mData.mSkills[i][1]);
|
|
|
|
ToolTips::createSkillToolTip(mMinorSkill[i], klass->mData.mSkills[i][0]);
|
|
|
|
ToolTips::createSkillToolTip(mMajorSkill[i], klass->mData.mSkills[i][1]);
|
|
|
|
}
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2016-03-24 16:52:16 +01:00
|
|
|
setClassImage(mClassImage, mCurrentClassId);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* InfoBoxDialog */
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void InfoBoxDialog::fitToText(MyGUI::TextBox* widget)
|
2010-10-10 00:42:56 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::IntCoord inner = widget->getTextRegion();
|
|
|
|
MyGUI::IntCoord outer = widget->getCoord();
|
|
|
|
MyGUI::IntSize size = widget->getTextSize();
|
|
|
|
size.width += outer.width - inner.width;
|
|
|
|
size.height += outer.height - inner.height;
|
|
|
|
widget->setSize(size);
|
2010-10-10 00:42:56 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void InfoBoxDialog::layoutVertically(MyGUI::Widget* widget, int margin)
|
2010-10-10 00:42:56 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
size_t count = widget->getChildCount();
|
|
|
|
int pos = 0;
|
|
|
|
pos += margin;
|
|
|
|
int width = 0;
|
|
|
|
for (unsigned i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
MyGUI::Widget* child = widget->getChildAt(i);
|
|
|
|
if (!child->getVisible())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
child->setPosition(child->getLeft(), pos);
|
|
|
|
width = std::max(width, child->getWidth());
|
|
|
|
pos += child->getHeight() + margin;
|
|
|
|
}
|
|
|
|
width += margin * 2;
|
|
|
|
widget->setSize(width, pos);
|
2010-10-10 00:42:56 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
InfoBoxDialog::InfoBoxDialog()
|
|
|
|
: WindowModal("openmw_infobox.layout")
|
|
|
|
{
|
|
|
|
getWidget(mTextBox, "TextBox");
|
|
|
|
getWidget(mText, "Text");
|
|
|
|
mText->getSubWidgetText()->setWordWrap(true);
|
|
|
|
getWidget(mButtonBar, "ButtonBar");
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
center();
|
|
|
|
}
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void InfoBoxDialog::setText(const std::string& str)
|
|
|
|
{
|
|
|
|
mText->setCaption(str);
|
|
|
|
mTextBox->setVisible(!str.empty());
|
|
|
|
fitToText(mText);
|
|
|
|
}
|
2010-10-10 00:42:56 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::string InfoBoxDialog::getText() const
|
|
|
|
{
|
|
|
|
return mText->getCaption();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InfoBoxDialog::setButtons(ButtonList& buttons)
|
2010-10-10 00:42:56 +02:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
for (MyGUI::Button* button : this->mButtons)
|
2010-10-10 00:42:56 +02:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
MyGUI::Gui::getInstance().destroyWidget(button);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
|
|
|
this->mButtons.clear();
|
|
|
|
|
|
|
|
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
|
|
|
|
MyGUI::Button* button;
|
|
|
|
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
|
2019-03-02 13:27:59 +04:00
|
|
|
for (const std::string& text : buttons)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
button = mButtonBar->createWidget<MyGUI::Button>(
|
|
|
|
"MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, "");
|
|
|
|
button->getSubWidgetText()->setWordWrap(true);
|
|
|
|
button->setCaption(text);
|
|
|
|
fitToText(button);
|
|
|
|
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InfoBoxDialog::onButtonClicked);
|
|
|
|
coord.top += button->getHeight();
|
|
|
|
this->mButtons.push_back(button);
|
2010-10-10 00:42:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-22 17:10:53 +02:00
|
|
|
void InfoBoxDialog::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
|
|
|
// Fix layout
|
|
|
|
layoutVertically(mTextBox, 4);
|
|
|
|
layoutVertically(mButtonBar, 6);
|
|
|
|
layoutVertically(mMainWidget, 4 + 6);
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
center();
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void InfoBoxDialog::onButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
int i = 0;
|
2019-03-02 13:27:59 +04:00
|
|
|
for (MyGUI::Button* button : mButtons)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
if (button == _sender)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
eventButtonSelected(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* ClassChoiceDialog */
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
ClassChoiceDialog::ClassChoiceDialog()
|
|
|
|
: InfoBoxDialog()
|
2010-11-05 19:40:31 +01:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
setText("");
|
|
|
|
ButtonList buttons;
|
2022-08-24 22:16:03 +02:00
|
|
|
buttons.emplace_back(
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu1", {}));
|
|
|
|
buttons.emplace_back(
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu2", {}));
|
|
|
|
buttons.emplace_back(
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString("sClassChoiceMenu3", {}));
|
|
|
|
buttons.emplace_back(MWBase::Environment::get().getWindowManager()->getGameSettingString("sBack", {}));
|
2013-04-17 18:56:48 -04:00
|
|
|
setButtons(buttons);
|
2010-11-05 19:40:31 +01:00
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* CreateClassDialog */
|
|
|
|
|
|
|
|
CreateClassDialog::CreateClassDialog()
|
|
|
|
: WindowModal("openmw_chargen_create_class.layout")
|
2018-10-09 10:21:12 +04:00
|
|
|
, mAffectedAttribute(nullptr)
|
|
|
|
, mAffectedSkill(nullptr)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
// Centre dialog
|
|
|
|
center();
|
|
|
|
|
|
|
|
setText("SpecializationT",
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString("sChooseClassMenu1", "Specialization"));
|
|
|
|
getWidget(mSpecializationName, "SpecializationName");
|
|
|
|
mSpecializationName->eventMouseButtonClick
|
|
|
|
+= MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationClicked);
|
|
|
|
|
|
|
|
setText("FavoriteAttributesT",
|
|
|
|
MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
"sChooseClassMenu2", "Favorite Attributes:"));
|
|
|
|
getWidget(mFavoriteAttribute0, "FavoriteAttribute0");
|
|
|
|
getWidget(mFavoriteAttribute1, "FavoriteAttribute1");
|
|
|
|
mFavoriteAttribute0->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
|
|
|
mFavoriteAttribute1->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeClicked);
|
|
|
|
|
2022-08-24 22:16:03 +02:00
|
|
|
setText(
|
|
|
|
"MajorSkillT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSkillClassMajor", {}));
|
|
|
|
setText(
|
|
|
|
"MinorSkillT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sSkillClassMinor", {}));
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
char theIndex = '0' + i;
|
|
|
|
getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex));
|
|
|
|
getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex));
|
|
|
|
mSkills.push_back(mMajorSkill[i]);
|
|
|
|
mSkills.push_back(mMinorSkill[i]);
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2019-03-02 13:27:59 +04:00
|
|
|
for (Widgets::MWSkillPtr& skill : mSkills)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
skill->eventClicked += MyGUI::newDelegate(this, &CreateClassDialog::onSkillClicked);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2022-08-24 22:16:03 +02:00
|
|
|
setText("LabelT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", {}));
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mEditName, "EditName");
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// Make sure the edit box has focus
|
2019-06-09 02:08:09 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mEditName);
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* descriptionButton;
|
|
|
|
getWidget(descriptionButton, "DescriptionButton");
|
|
|
|
descriptionButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* backButton;
|
|
|
|
getWidget(backButton, "BackButton");
|
|
|
|
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
|
|
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// Set default skills, attributes
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mFavoriteAttribute0->setAttributeId(ESM::Attribute::Strength);
|
|
|
|
mFavoriteAttribute1->setAttributeId(ESM::Attribute::Agility);
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mMajorSkill[0]->setSkillId(ESM::Skill::Block);
|
|
|
|
mMajorSkill[1]->setSkillId(ESM::Skill::Armorer);
|
|
|
|
mMajorSkill[2]->setSkillId(ESM::Skill::MediumArmor);
|
|
|
|
mMajorSkill[3]->setSkillId(ESM::Skill::HeavyArmor);
|
|
|
|
mMajorSkill[4]->setSkillId(ESM::Skill::BluntWeapon);
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mMinorSkill[0]->setSkillId(ESM::Skill::LongBlade);
|
|
|
|
mMinorSkill[1]->setSkillId(ESM::Skill::Axe);
|
|
|
|
mMinorSkill[2]->setSkillId(ESM::Skill::Spear);
|
|
|
|
mMinorSkill[3]->setSkillId(ESM::Skill::Athletics);
|
|
|
|
mMinorSkill[4]->setSkillId(ESM::Skill::Enchant);
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
setSpecialization(0);
|
|
|
|
update();
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2022-07-20 22:13:33 +02:00
|
|
|
CreateClassDialog::~CreateClassDialog() = default;
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::update()
|
|
|
|
{
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
ToolTips::createSkillToolTip(mMajorSkill[i], mMajorSkill[i]->getSkillId());
|
|
|
|
ToolTips::createSkillToolTip(mMinorSkill[i], mMinorSkill[i]->getSkillId());
|
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
ToolTips::createAttributeToolTip(mFavoriteAttribute0, mFavoriteAttribute0->getAttributeId());
|
|
|
|
ToolTips::createAttributeToolTip(mFavoriteAttribute1, mFavoriteAttribute1->getAttributeId());
|
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::string CreateClassDialog::getName() const
|
|
|
|
{
|
2017-08-19 14:31:25 +04:00
|
|
|
return mEditName->getCaption();
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::string CreateClassDialog::getDescription() const
|
|
|
|
{
|
|
|
|
return mDescription;
|
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
ESM::Class::Specialization CreateClassDialog::getSpecializationId() const
|
2010-11-05 19:40:31 +01:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
return mSpecializationId;
|
2010-11-05 19:40:31 +01:00
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::vector<int> CreateClassDialog::getFavoriteAttributes() const
|
2010-11-05 19:40:31 +01:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
std::vector<int> v;
|
|
|
|
v.push_back(mFavoriteAttribute0->getAttributeId());
|
|
|
|
v.push_back(mFavoriteAttribute1->getAttributeId());
|
|
|
|
return v;
|
2010-11-05 19:40:31 +01:00
|
|
|
}
|
2010-10-10 02:43:44 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMajorSkills() const
|
|
|
|
{
|
|
|
|
std::vector<ESM::Skill::SkillEnum> v;
|
2021-08-29 19:20:49 +02:00
|
|
|
v.reserve(5);
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
v.push_back(mMajorSkill[i]->getSkillId());
|
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
std::vector<ESM::Skill::SkillEnum> CreateClassDialog::getMinorSkills() const
|
|
|
|
{
|
|
|
|
std::vector<ESM::Skill::SkillEnum> v;
|
2021-08-29 19:20:49 +02:00
|
|
|
v.reserve(5);
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
v.push_back(mMinorSkill[i]->getSkillId());
|
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::setNextButtonShow(bool shown)
|
|
|
|
{
|
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
2010-09-24 15:28:14 +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
|
|
|
}
|
2012-08-12 16:07:04 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2012-08-12 16:07:04 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onDialogCancel()
|
|
|
|
{
|
2022-07-20 22:13:33 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mSpecDialog));
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mAttribDialog));
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mSkillDialog));
|
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mDescDialog));
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onSpecializationClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
2022-07-20 22:13:33 +02:00
|
|
|
mSpecDialog = std::make_unique<SelectSpecializationDialog>();
|
2013-04-17 18:56:48 -04:00
|
|
|
mSpecDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
|
|
|
mSpecDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSpecializationSelected);
|
|
|
|
mSpecDialog->setVisible(true);
|
|
|
|
}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onSpecializationSelected()
|
|
|
|
{
|
|
|
|
mSpecializationId = mSpecDialog->getSpecializationId();
|
|
|
|
setSpecialization(mSpecializationId);
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2022-07-20 22:13:33 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mSpecDialog));
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::setSpecialization(int id)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
mSpecializationId = (ESM::Class::Specialization)id;
|
2022-08-24 22:16:03 +02:00
|
|
|
static const std::string_view specIds[3]
|
|
|
|
= { "sSpecializationCombat", "sSpecializationMagic", "sSpecializationStealth" };
|
|
|
|
std::string specName{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
specIds[mSpecializationId], specIds[mSpecializationId]) };
|
2013-04-17 18:56:48 -04:00
|
|
|
mSpecializationName->setCaption(specName);
|
|
|
|
ToolTips::createSpecializationToolTip(mSpecializationName, specName, mSpecializationId);
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
2013-04-17 18:56:48 -04:00
|
|
|
|
|
|
|
void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2022-07-20 22:13:33 +02:00
|
|
|
mAttribDialog = std::make_unique<SelectAttributeDialog>();
|
2013-04-17 18:56:48 -04:00
|
|
|
mAffectedAttribute = _sender;
|
|
|
|
mAttribDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
|
|
|
mAttribDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onAttributeSelected);
|
|
|
|
mAttribDialog->setVisible(true);
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onAttributeSelected()
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
ESM::Attribute::AttributeID id = mAttribDialog->getAttributeId();
|
|
|
|
if (mAffectedAttribute == mFavoriteAttribute0)
|
|
|
|
{
|
|
|
|
if (mFavoriteAttribute1->getAttributeId() == id)
|
|
|
|
mFavoriteAttribute1->setAttributeId(mFavoriteAttribute0->getAttributeId());
|
|
|
|
}
|
|
|
|
else if (mAffectedAttribute == mFavoriteAttribute1)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
if (mFavoriteAttribute0->getAttributeId() == id)
|
|
|
|
mFavoriteAttribute0->setAttributeId(mFavoriteAttribute1->getAttributeId());
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
2013-04-17 18:56:48 -04:00
|
|
|
mAffectedAttribute->setAttributeId(id);
|
2022-07-20 22:13:33 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mAttribDialog));
|
2013-04-17 18:56:48 -04:00
|
|
|
|
|
|
|
update();
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
|
|
|
{
|
2022-07-20 22:13:33 +02:00
|
|
|
mSkillDialog = std::make_unique<SelectSkillDialog>();
|
2013-04-17 18:56:48 -04:00
|
|
|
mAffectedSkill = _sender;
|
|
|
|
mSkillDialog->eventCancel += MyGUI::newDelegate(this, &CreateClassDialog::onDialogCancel);
|
|
|
|
mSkillDialog->eventItemSelected += MyGUI::newDelegate(this, &CreateClassDialog::onSkillSelected);
|
|
|
|
mSkillDialog->setVisible(true);
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onSkillSelected()
|
|
|
|
{
|
|
|
|
ESM::Skill::SkillEnum id = mSkillDialog->getSkillId();
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// Avoid duplicate skills by swapping any skill field that matches the selected one
|
2019-03-02 13:27:59 +04:00
|
|
|
for (Widgets::MWSkillPtr& skill : mSkills)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
if (skill == mAffectedSkill)
|
2013-04-17 18:56:48 -04:00
|
|
|
continue;
|
2019-03-02 13:27:59 +04:00
|
|
|
if (skill->getSkillId() == id)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
2019-03-02 13:27:59 +04:00
|
|
|
skill->setSkillId(mAffectedSkill->getSkillId());
|
2013-04-17 18:56:48 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
mAffectedSkill->setSkillId(mSkillDialog->getSkillId());
|
2022-07-20 22:13:33 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mSkillDialog));
|
2013-04-17 18:56:48 -04:00
|
|
|
update();
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
2022-07-20 22:13:33 +02:00
|
|
|
mDescDialog = std::make_unique<DescriptionDialog>();
|
2013-04-17 18:56:48 -04:00
|
|
|
mDescDialog->setTextInput(mDescription);
|
|
|
|
mDescDialog->eventDone += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionEntered);
|
|
|
|
mDescDialog->setVisible(true);
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
|
|
|
|
{
|
|
|
|
mDescription = mDescDialog->getTextInput();
|
2022-07-20 22:13:33 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeDialog(std::move(mDescDialog));
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
if (getName().size() <= 0)
|
|
|
|
return;
|
|
|
|
eventDone(this);
|
|
|
|
}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventBack();
|
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* SelectSpecializationDialog */
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
SelectSpecializationDialog::SelectSpecializationDialog()
|
|
|
|
: WindowModal("openmw_chargen_select_specialization.layout")
|
|
|
|
{
|
|
|
|
// Centre dialog
|
|
|
|
center();
|
|
|
|
|
|
|
|
getWidget(mSpecialization0, "Specialization0");
|
|
|
|
getWidget(mSpecialization1, "Specialization1");
|
|
|
|
getWidget(mSpecialization2, "Specialization2");
|
2022-08-24 22:16:03 +02:00
|
|
|
std::string combat{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
ESM::Class::sGmstSpecializationIds[ESM::Class::Combat], {}) };
|
|
|
|
std::string magic{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
ESM::Class::sGmstSpecializationIds[ESM::Class::Magic], {}) };
|
|
|
|
std::string stealth{ MWBase::Environment::get().getWindowManager()->getGameSettingString(
|
|
|
|
ESM::Class::sGmstSpecializationIds[ESM::Class::Stealth], {}) };
|
2013-04-17 18:56:48 -04:00
|
|
|
|
|
|
|
mSpecialization0->setCaption(combat);
|
|
|
|
mSpecialization0->eventMouseButtonClick
|
|
|
|
+= MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
|
|
|
mSpecialization1->setCaption(magic);
|
|
|
|
mSpecialization1->eventMouseButtonClick
|
|
|
|
+= MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
|
|
|
mSpecialization2->setCaption(stealth);
|
|
|
|
mSpecialization2->eventMouseButtonClick
|
|
|
|
+= MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
|
2012-07-13 03:51:58 -07:00
|
|
|
mSpecializationId = ESM::Class::Combat;
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
ToolTips::createSpecializationToolTip(mSpecialization0, combat, ESM::Class::Combat);
|
|
|
|
ToolTips::createSpecializationToolTip(mSpecialization1, magic, ESM::Class::Magic);
|
|
|
|
ToolTips::createSpecializationToolTip(mSpecialization2, stealth, ESM::Class::Stealth);
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* cancelButton;
|
|
|
|
getWidget(cancelButton, "CancelButton");
|
|
|
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
|
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
SelectSpecializationDialog::~SelectSpecializationDialog() {}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectSpecializationDialog::onSpecializationClicked(MyGUI::Widget* _sender)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
if (_sender == mSpecialization0)
|
|
|
|
mSpecializationId = ESM::Class::Combat;
|
|
|
|
else if (_sender == mSpecialization1)
|
|
|
|
mSpecializationId = ESM::Class::Magic;
|
|
|
|
else if (_sender == mSpecialization2)
|
|
|
|
mSpecializationId = ESM::Class::Stealth;
|
|
|
|
else
|
|
|
|
return;
|
2010-11-05 18:49:44 +01:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
eventItemSelected();
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
|
2014-05-27 14:30:26 -04:00
|
|
|
{
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-09-23 12:18:39 +02:00
|
|
|
bool SelectSpecializationDialog::exit()
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
eventCancel();
|
2017-09-23 12:18:39 +02:00
|
|
|
return true;
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* SelectAttributeDialog */
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
SelectAttributeDialog::SelectAttributeDialog()
|
|
|
|
: WindowModal("openmw_chargen_select_attribute.layout")
|
2013-07-31 18:46:32 +02:00
|
|
|
, mAttributeId(ESM::Attribute::Strength)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
// Centre dialog
|
|
|
|
center();
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 8; ++i)
|
|
|
|
{
|
|
|
|
Widgets::MWAttributePtr attribute;
|
|
|
|
char theIndex = '0' + i;
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(attribute, std::string("Attribute").append(1, theIndex));
|
|
|
|
attribute->setAttributeId(ESM::Attribute::sAttributeIds[i]);
|
|
|
|
attribute->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
|
|
|
|
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
|
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* cancelButton;
|
|
|
|
getWidget(cancelButton, "CancelButton");
|
|
|
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
|
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
SelectAttributeDialog::~SelectAttributeDialog() {}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectAttributeDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
|
2010-11-05 18:51:42 +01:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
// TODO: Change MWAttribute to set and get AttributeID enum instead of int
|
|
|
|
mAttributeId = static_cast<ESM::Attribute::AttributeID>(_sender->getAttributeId());
|
|
|
|
eventItemSelected();
|
2010-11-05 18:51:42 +01:00
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
|
2014-05-27 14:30:26 -04:00
|
|
|
{
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-09-23 12:18:39 +02:00
|
|
|
bool SelectAttributeDialog::exit()
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
eventCancel();
|
2017-09-23 12:18:39 +02:00
|
|
|
return true;
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* SelectSkillDialog */
|
|
|
|
|
|
|
|
SelectSkillDialog::SelectSkillDialog()
|
|
|
|
: WindowModal("openmw_chargen_select_skill.layout")
|
2014-12-18 03:24:10 +01:00
|
|
|
, mSkillId(ESM::Skill::Block)
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
// Centre dialog
|
|
|
|
center();
|
|
|
|
|
|
|
|
for (int i = 0; i < 9; i++)
|
2011-04-21 10:49:45 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
char theIndex = '0' + i;
|
|
|
|
getWidget(mCombatSkill[i], std::string("CombatSkill").append(1, theIndex));
|
|
|
|
getWidget(mMagicSkill[i], std::string("MagicSkill").append(1, theIndex));
|
|
|
|
getWidget(mStealthSkill[i], std::string("StealthSkill").append(1, theIndex));
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
2010-09-22 20:59:13 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
Widgets::MWSkillPtr widget;
|
|
|
|
ESM::Skill::SkillEnum skillId;
|
|
|
|
} mSkills[3][9]
|
|
|
|
= { { { mCombatSkill[0], ESM::Skill::Block }, { mCombatSkill[1], ESM::Skill::Armorer },
|
|
|
|
{ mCombatSkill[2], ESM::Skill::MediumArmor }, { mCombatSkill[3], ESM::Skill::HeavyArmor },
|
|
|
|
{ mCombatSkill[4], ESM::Skill::BluntWeapon }, { mCombatSkill[5], ESM::Skill::LongBlade },
|
|
|
|
{ mCombatSkill[6], ESM::Skill::Axe }, { mCombatSkill[7], ESM::Skill::Spear },
|
|
|
|
{ mCombatSkill[8], ESM::Skill::Athletics } },
|
|
|
|
{ { mMagicSkill[0], ESM::Skill::Enchant }, { mMagicSkill[1], ESM::Skill::Destruction },
|
|
|
|
{ mMagicSkill[2], ESM::Skill::Alteration }, { mMagicSkill[3], ESM::Skill::Illusion },
|
|
|
|
{ mMagicSkill[4], ESM::Skill::Conjuration }, { mMagicSkill[5], ESM::Skill::Mysticism },
|
|
|
|
{ mMagicSkill[6], ESM::Skill::Restoration }, { mMagicSkill[7], ESM::Skill::Alchemy },
|
|
|
|
{ mMagicSkill[8], ESM::Skill::Unarmored } },
|
|
|
|
{ { mStealthSkill[0], ESM::Skill::Security }, { mStealthSkill[1], ESM::Skill::Sneak },
|
|
|
|
{ mStealthSkill[2], ESM::Skill::Acrobatics }, { mStealthSkill[3], ESM::Skill::LightArmor },
|
|
|
|
{ mStealthSkill[4], ESM::Skill::ShortBlade }, { mStealthSkill[5], ESM::Skill::Marksman },
|
|
|
|
{ mStealthSkill[6], ESM::Skill::Mercantile }, { mStealthSkill[7], ESM::Skill::Speechcraft },
|
|
|
|
{ mStealthSkill[8], ESM::Skill::HandToHand } } };
|
|
|
|
|
|
|
|
for (int spec = 0; spec < 3; ++spec)
|
2010-09-24 15:28:14 +02:00
|
|
|
{
|
2013-04-17 18:56:48 -04:00
|
|
|
for (int i = 0; i < 9; ++i)
|
|
|
|
{
|
|
|
|
mSkills[spec][i].widget->setSkillId(mSkills[spec][i].skillId);
|
|
|
|
mSkills[spec][i].widget->eventClicked += MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
|
|
|
|
ToolTips::createSkillToolTip(mSkills[spec][i].widget, mSkills[spec][i].widget->getSkillId());
|
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
}
|
2013-04-17 18:56:48 -04:00
|
|
|
|
|
|
|
MyGUI::Button* cancelButton;
|
|
|
|
getWidget(cancelButton, "CancelButton");
|
|
|
|
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
|
2010-09-22 20:59:13 +02:00
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
SelectSkillDialog::~SelectSkillDialog() {}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectSkillDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
|
|
|
|
{
|
|
|
|
mSkillId = _sender->getSkillId();
|
|
|
|
eventItemSelected();
|
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
2014-05-27 14:30:26 -04:00
|
|
|
{
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2017-09-23 12:18:39 +02:00
|
|
|
bool SelectSkillDialog::exit()
|
2013-04-17 18:56:48 -04:00
|
|
|
{
|
|
|
|
eventCancel();
|
2017-09-23 12:18:39 +02:00
|
|
|
return true;
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-09-24 15:28:14 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
/* DescriptionDialog */
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
DescriptionDialog::DescriptionDialog()
|
|
|
|
: WindowModal("openmw_chargen_class_description.layout")
|
|
|
|
{
|
|
|
|
// Centre dialog
|
|
|
|
center();
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
getWidget(mTextEdit, "TextEdit");
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
MyGUI::Button* okButton;
|
|
|
|
getWidget(okButton, "OKButton");
|
|
|
|
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked);
|
2022-08-24 22:16:03 +02:00
|
|
|
okButton->setCaption(
|
|
|
|
toUString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sInputMenu1", {})));
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// Make sure the edit box has focus
|
2019-06-09 02:08:09 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
|
2013-04-17 18:56:48 -04:00
|
|
|
}
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
DescriptionDialog::~DescriptionDialog() {}
|
2012-05-27 06:39:10 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
// widget controls
|
2010-09-27 12:56:48 +02:00
|
|
|
|
2013-04-17 18:56:48 -04:00
|
|
|
void DescriptionDialog::onOkClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
|
|
|
eventDone(this);
|
|
|
|
}
|
2010-09-27 12:56:48 +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 setClassImage(MyGUI::ImageBox* imageBox, const ESM::RefId& classId)
|
2016-03-24 16:52:16 +01:00
|
|
|
{
|
2022-06-29 00:32:11 +02:00
|
|
|
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
|
|
|
std::string classImage
|
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
|
|
|
= Misc::ResourceHelpers::correctTexturePath("textures\\levelup\\" + classId.getRefIdString() + ".dds", vfs);
|
2022-06-29 00:32:11 +02:00
|
|
|
if (!vfs->exists(classImage))
|
2016-03-24 16:52:16 +01: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
|
|
|
Log(Debug::Warning) << "No class image for " << classId.getRefIdString() << ", falling back to default";
|
2016-03-24 16:52:16 +01:00
|
|
|
classImage = "textures\\levelup\\warrior.dds";
|
|
|
|
}
|
|
|
|
imageBox->setImageTexture(classImage);
|
|
|
|
}
|
|
|
|
|
2010-09-27 12:56:48 +02:00
|
|
|
}
|