2012-09-26 18:30:47 +02:00
|
|
|
#include "travelwindow.hpp"
|
|
|
|
|
2015-01-10 02:50:43 +01:00
|
|
|
#include <MyGUI_Button.h>
|
|
|
|
#include <MyGUI_Gui.h>
|
|
|
|
#include <MyGUI_ScrollView.h>
|
|
|
|
|
2022-09-08 21:08:59 +02:00
|
|
|
#include <components/esm3/loadcrea.hpp>
|
2022-06-26 16:42:29 +02:00
|
|
|
#include <components/esm3/loadgmst.hpp>
|
2018-04-09 01:00:40 +03:00
|
|
|
|
2012-09-26 18:30:47 +02:00
|
|
|
#include "../mwbase/environment.hpp"
|
2012-10-16 19:34:29 +02:00
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
2012-09-26 18:30:47 +02:00
|
|
|
#include "../mwbase/windowmanager.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
2014-06-16 03:17:31 +02:00
|
|
|
#include "../mwworld/actionteleport.hpp"
|
2014-02-23 20:11:05 +01:00
|
|
|
#include "../mwworld/cellstore.hpp"
|
2022-05-23 19:21:44 +02:00
|
|
|
#include "../mwworld/cellutils.hpp"
|
2013-05-11 18:38:27 +02:00
|
|
|
#include "../mwworld/class.hpp"
|
2022-06-26 16:42:29 +02:00
|
|
|
#include "../mwworld/containerstore.hpp"
|
|
|
|
#include "../mwworld/esmstore.hpp"
|
|
|
|
#include "../mwworld/store.hpp"
|
2022-12-06 00:11:19 +01:00
|
|
|
#include "../mwworld/worldmodel.hpp"
|
2012-09-26 18:30:47 +02:00
|
|
|
|
2022-06-26 16:42:29 +02:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
2022-07-16 16:37:31 +02:00
|
|
|
#include "../mwmechanics/creaturestats.hpp"
|
2022-01-22 22:44:02 +01:00
|
|
|
|
2012-09-26 18:30:47 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2013-04-10 14:46:21 -04:00
|
|
|
TravelWindow::TravelWindow()
|
|
|
|
: WindowBase("openmw_travel_window.layout")
|
2012-09-26 18:30:47 +02:00
|
|
|
, mCurrentY(0)
|
|
|
|
{
|
|
|
|
getWidget(mCancelButton, "CancelButton");
|
|
|
|
getWidget(mPlayerGold, "PlayerGold");
|
|
|
|
getWidget(mSelect, "Select");
|
2012-10-06 17:52:46 +02:00
|
|
|
getWidget(mDestinations, "Travel");
|
|
|
|
getWidget(mDestinationsView, "DestinationsView");
|
2012-09-26 18:30:47 +02:00
|
|
|
|
|
|
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onCancelButtonClicked);
|
|
|
|
|
|
|
|
mDestinations->setCoord(450 / 2 - mDestinations->getTextSize().width / 2, mDestinations->getTop(),
|
|
|
|
mDestinations->getTextSize().width, mDestinations->getHeight());
|
|
|
|
mSelect->setCoord(8, mSelect->getTop(), mSelect->getTextSize().width, mSelect->getHeight());
|
|
|
|
}
|
|
|
|
|
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 TravelWindow::addDestination(const ESM::RefId& name, const ESM::Position& pos, bool interior)
|
2012-09-26 18:30:47 +02:00
|
|
|
{
|
2016-12-20 12:38:51 +01:00
|
|
|
int price;
|
2012-10-16 20:25:50 +02:00
|
|
|
|
2012-11-06 11:29:18 +04:00
|
|
|
const MWWorld::Store<ESM::GameSetting>& gmst
|
|
|
|
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
|
|
|
|
2014-01-08 23:37:46 +01:00
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
|
|
|
|
2018-08-08 02:05:12 +03:00
|
|
|
if (!mPtr.getCell()->isExterior())
|
2012-10-08 15:51:36 +02:00
|
|
|
{
|
2018-08-29 18:38:12 +03:00
|
|
|
price = gmst.find("fMagesGuildTravel")->mValue.getInteger();
|
2012-10-08 15:51:36 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ESM::Position PlayerPos = player.getRefData().getPosition();
|
2016-12-20 12:38:51 +01:00
|
|
|
float d = sqrt(pow(pos.pos[0] - PlayerPos.pos[0], 2) + pow(pos.pos[1] - PlayerPos.pos[1], 2)
|
|
|
|
+ pow(pos.pos[2] - PlayerPos.pos[2], 2));
|
2020-09-08 16:55:12 +04:00
|
|
|
float fTravelMult = gmst.find("fTravelMult")->mValue.getFloat();
|
|
|
|
if (fTravelMult != 0)
|
|
|
|
price = static_cast<int>(d / fTravelMult);
|
|
|
|
else
|
|
|
|
price = static_cast<int>(d);
|
2012-10-08 15:51:36 +02:00
|
|
|
}
|
2012-10-16 20:25:50 +02:00
|
|
|
|
2020-09-08 16:55:12 +04:00
|
|
|
price = std::max(1, price);
|
2016-12-23 21:27:29 +01:00
|
|
|
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, price, true);
|
2016-12-20 12:38:51 +01:00
|
|
|
|
2016-12-23 21:27:29 +01:00
|
|
|
// Add price for the travelling followers
|
|
|
|
std::set<MWWorld::Ptr> followers;
|
2021-10-06 18:25:28 +02:00
|
|
|
MWWorld::ActionTeleport::getFollowers(player, followers, !interior);
|
2016-12-20 12:38:51 +01:00
|
|
|
|
2019-04-17 17:13:25 +03:00
|
|
|
// Apply followers cost, unlike vanilla the first follower doesn't travel for free
|
|
|
|
price *= 1 + static_cast<int>(followers.size());
|
2012-11-05 11:07:43 +01:00
|
|
|
|
2018-06-18 13:43:39 +04:00
|
|
|
int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
|
|
|
|
|
|
|
|
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>(
|
|
|
|
"SandTextButton", 0, mCurrentY, 200, lineHeight, MyGUI::Align::Default);
|
2016-12-20 12:38:51 +01:00
|
|
|
toAdd->setEnabled(price <= playerGold);
|
2018-06-18 13:43:39 +04:00
|
|
|
mCurrentY += lineHeight;
|
2012-10-16 20:25:50 +02:00
|
|
|
if (interior)
|
|
|
|
toAdd->setUserString("interior", "y");
|
|
|
|
else
|
|
|
|
toAdd->setUserString("interior", "n");
|
|
|
|
|
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::string nameString = name.getRefIdString();
|
2019-01-07 17:47:39 +04:00
|
|
|
toAdd->setUserString("price", std::to_string(price));
|
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
|
|
|
toAdd->setCaptionWithReplacing("#{sCell=" + nameString + "} - " + MyGUI::utility::toString(price) + "#{sgp}");
|
2018-06-18 13:43:39 +04:00
|
|
|
toAdd->setSize(mDestinationsView->getWidth(), lineHeight);
|
2012-09-26 18:30:47 +02:00
|
|
|
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &TravelWindow::onMouseWheel);
|
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
|
|
|
toAdd->setUserString("Destination", nameString);
|
2012-10-08 11:14:22 +02:00
|
|
|
toAdd->setUserData(pos);
|
2012-09-26 18:30:47 +02:00
|
|
|
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onTravelButtonClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::clearDestinations()
|
|
|
|
{
|
|
|
|
mDestinationsView->setViewOffset(MyGUI::IntPoint(0, 0));
|
|
|
|
mCurrentY = 0;
|
|
|
|
while (mDestinationsView->getChildCount())
|
|
|
|
MyGUI::Gui::getInstance().destroyWidget(mDestinationsView->getChildAt(0));
|
|
|
|
}
|
|
|
|
|
2017-09-22 21:26:41 +02:00
|
|
|
void TravelWindow::setPtr(const MWWorld::Ptr& actor)
|
2012-09-26 18:30:47 +02:00
|
|
|
{
|
|
|
|
center();
|
2012-09-28 17:02:27 +02:00
|
|
|
mPtr = actor;
|
2012-09-26 18:30:47 +02:00
|
|
|
clearDestinations();
|
|
|
|
|
2015-03-08 20:44:41 +01:00
|
|
|
std::vector<ESM::Transport::Dest> transport;
|
|
|
|
if (mPtr.getClass().isNpc())
|
|
|
|
transport = mPtr.get<ESM::NPC>()->mBase->getTransport();
|
2021-10-11 11:46:21 +00:00
|
|
|
else if (mPtr.getType() == ESM::Creature::sRecordId)
|
2015-03-08 20:44:41 +01:00
|
|
|
transport = mPtr.get<ESM::Creature>()->mBase->getTransport();
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < transport.size(); i++)
|
2012-09-26 18:30: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
|
|
|
ESM::RefId cellname = transport[i].mCellName;
|
2012-10-08 11:14:22 +02:00
|
|
|
bool interior = true;
|
2022-05-23 19:21:44 +02:00
|
|
|
const osg::Vec2i cellIndex
|
|
|
|
= MWWorld::positionToCellIndex(transport[i].mPos.pos[0], transport[i].mPos.pos[1]);
|
2022-08-27 13:07:59 +02:00
|
|
|
if (cellname.empty())
|
2014-02-21 11:35:46 +01:00
|
|
|
{
|
2022-05-23 19:21:44 +02:00
|
|
|
MWWorld::CellStore* cell
|
2022-11-06 20:06:45 +01:00
|
|
|
= MWBase::Environment::get().getWorldModel()->getExterior(cellIndex.x(), cellIndex.y());
|
2014-06-16 03:17:31 +02:00
|
|
|
cellname = MWBase::Environment::get().getWorld()->getCellName(cell);
|
2014-02-21 11:35:46 +01:00
|
|
|
interior = false;
|
|
|
|
}
|
2015-03-08 20:44:41 +01:00
|
|
|
addDestination(cellname, transport[i].mPos, interior);
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
updateLabels();
|
2014-07-26 02:23:42 +02:00
|
|
|
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
|
|
|
|
// scrollbar is hidden
|
|
|
|
mDestinationsView->setVisibleVScroll(false);
|
2012-09-26 18:30:47 +02:00
|
|
|
mDestinationsView->setCanvasSize(
|
|
|
|
MyGUI::IntSize(mDestinationsView->getWidth(), std::max(mDestinationsView->getHeight(), mCurrentY)));
|
2014-07-26 02:23:42 +02:00
|
|
|
mDestinationsView->setVisibleVScroll(true);
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::onTravelButtonClick(MyGUI::Widget* _sender)
|
|
|
|
{
|
2012-10-08 11:14:22 +02:00
|
|
|
std::istringstream iss(_sender->getUserString("price"));
|
|
|
|
int price;
|
|
|
|
iss >> price;
|
2012-09-26 18:30:47 +02:00
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-01-08 23:37:46 +01:00
|
|
|
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
2013-11-21 04:27:53 +01:00
|
|
|
|
2014-01-08 23:37:46 +01:00
|
|
|
if (playerGold < price)
|
2012-10-17 18:17:53 +02:00
|
|
|
return;
|
2012-10-16 20:25:50 +02:00
|
|
|
|
2018-08-13 08:30:50 +04:00
|
|
|
// Set "traveling" flag, so GetPCTraveling can detect teleportation.
|
|
|
|
// We will reset this flag during next world update.
|
|
|
|
MWBase::Environment::get().getWorld()->setPlayerTraveling(true);
|
|
|
|
|
2014-06-19 03:29:36 +02:00
|
|
|
if (!mPtr.getCell()->isExterior())
|
|
|
|
// Interior cell -> mages guild transport
|
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
|
|
|
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("mysticism cast"));
|
2013-11-21 04:27:53 +01:00
|
|
|
|
2014-01-08 23:37:46 +01:00
|
|
|
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);
|
2013-02-17 18:30:21 +01:00
|
|
|
|
2014-07-28 00:55:57 +02:00
|
|
|
// add gold to NPC trading gold pool
|
|
|
|
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
|
|
|
|
npcStats.setGoldPool(npcStats.getGoldPool() + price);
|
|
|
|
|
2014-08-01 16:25:41 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
2012-10-16 20:25:50 +02:00
|
|
|
ESM::Position pos = *_sender->getUserData<ESM::Position>();
|
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& cellname = ESM::RefId::stringRefId(_sender->getUserString("Destination"));
|
2012-10-16 20:25:50 +02:00
|
|
|
bool interior = _sender->getUserString("interior") == "y";
|
2018-08-08 12:27:18 +03:00
|
|
|
if (mPtr.getCell()->isExterior())
|
2012-09-26 18:30:47 +02:00
|
|
|
{
|
2013-04-15 03:13:25 +02:00
|
|
|
ESM::Position playerPos = player.getRefData().getPosition();
|
2015-06-03 19:41:19 +02:00
|
|
|
float d
|
|
|
|
= (osg::Vec3f(pos.pos[0], pos.pos[1], 0) - osg::Vec3f(playerPos.pos[0], playerPos.pos[1], 0)).length();
|
2018-08-29 18:38:12 +03:00
|
|
|
int hours = static_cast<int>(d
|
|
|
|
/ MWBase::Environment::get()
|
|
|
|
.getWorld()
|
|
|
|
->getStore()
|
|
|
|
.get<ESM::GameSetting>()
|
|
|
|
.find("fTravelTimeMult")
|
|
|
|
->mValue.getFloat());
|
2019-01-25 20:04:35 +04:00
|
|
|
MWBase::Environment::get().getMechanicsManager()->rest(hours, true);
|
2013-04-15 03:13:25 +02:00
|
|
|
MWBase::Environment::get().getWorld()->advanceTime(hours);
|
2012-10-08 11:14:22 +02:00
|
|
|
}
|
2013-04-11 10:15:42 +02:00
|
|
|
|
2014-08-04 02:13:44 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
2017-09-26 23:27:53 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
2014-08-04 02:13:44 +02:00
|
|
|
|
2017-10-04 17:39:19 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(1);
|
|
|
|
|
2014-06-16 03:17:31 +02:00
|
|
|
// Teleports any followers, too.
|
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
|
|
|
MWWorld::ActionTeleport action(interior ? cellname.getRefIdString() : "", pos, true);
|
2014-06-16 03:17:31 +02:00
|
|
|
action.execute(player);
|
|
|
|
|
2014-08-01 16:25:41 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->fadeScreenOut(0);
|
|
|
|
MWBase::Environment::get().getWindowManager()->fadeScreenIn(1);
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
|
|
|
|
{
|
2017-09-23 12:18:39 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::updateLabels()
|
|
|
|
{
|
2014-01-08 23:37:46 +01:00
|
|
|
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
|
|
|
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
|
|
|
|
2015-01-10 03:01:01 +01:00
|
|
|
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + MyGUI::utility::toString(playerGold));
|
2012-09-26 18:30:47 +02:00
|
|
|
mPlayerGold->setCoord(8, mPlayerGold->getTop(), mPlayerGold->getTextSize().width, mPlayerGold->getHeight());
|
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::onReferenceUnavailable()
|
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
|
2017-09-26 23:27:53 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TravelWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
|
|
|
{
|
2015-03-08 13:07:29 +13:00
|
|
|
if (mDestinationsView->getViewOffset().top + _rel * 0.3f > 0)
|
2012-09-26 18:30:47 +02:00
|
|
|
mDestinationsView->setViewOffset(MyGUI::IntPoint(0, 0));
|
|
|
|
else
|
2015-03-08 13:07:29 +13:00
|
|
|
mDestinationsView->setViewOffset(
|
|
|
|
MyGUI::IntPoint(0, static_cast<int>(mDestinationsView->getViewOffset().top + _rel * 0.3f)));
|
2012-09-26 18:30:47 +02:00
|
|
|
}
|
|
|
|
}
|