Merge branch 'master' of https://github.com/zinnschlag/openmw.git into objectRotationScaling

Conflicts:
	apps/openmw/mwclass/npc.cpp
	apps/openmw/mwscript/docs/vmformat.txt
	apps/openmw/mwworld/worldimp.hpp
actorid
gugus 13 years ago
commit 03f7740474

@ -15,7 +15,7 @@ include (OpenMWMacros)
# Version
set (OPENMW_VERSION_MAJOR 0)
set (OPENMW_VERSION_MINOR 15)
set (OPENMW_VERSION_MINOR 16)
set (OPENMW_VERSION_RELEASE 0)
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")

@ -8,6 +8,7 @@ set(LAUNCHER
playpage.cpp
pluginsmodel.cpp
pluginsview.cpp
filedialog.cpp
launcher.rc
)
@ -22,6 +23,7 @@ set(LAUNCHER_HEADER
playpage.hpp
pluginsmodel.hpp
pluginsview.hpp
filedialog.hpp
)
# Headers that must be pre-processed
@ -34,6 +36,7 @@ set(LAUNCHER_HEADER_MOC
playpage.hpp
pluginsmodel.hpp
pluginsview.hpp
filedialog.hpp
)
source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC})

@ -5,6 +5,7 @@
#include "datafilespage.hpp"
#include "lineedit.hpp"
#include "filedialog.hpp"
#include "naturalsort.hpp"
#include "pluginsmodel.hpp"
#include "pluginsview.hpp"
@ -139,7 +140,7 @@ DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, QWidget *parent)
createActions();
setupConfig();
setupDataFiles();
//setupDataFiles();
}
@ -188,7 +189,7 @@ void DataFilesPage::setupConfig()
}
void DataFilesPage::setupDataFiles()
bool DataFilesPage::setupDataFiles()
{
// We use the Configuration Manager to retrieve the configuration values
boost::program_options::variables_map variables;
@ -203,8 +204,7 @@ void DataFilesPage::setupDataFiles()
mCfgMgr.readConfiguration(variables, desc);
// Put the paths in a boost::filesystem vector to use with Files::Collections
Files::PathContainer dataDirs(variables["data"].as<Files::PathContainer>());
mDataDirs = dataDirs;
mDataDirs = Files::PathContainer(variables["data"].as<Files::PathContainer>());
// std::string local = variables["data-local"].as<std::string>();
// if (!local.empty()) {
@ -212,50 +212,50 @@ void DataFilesPage::setupDataFiles()
// dataDirs.push_back(Files::PathContainer::value_type(local));
// }
if (dataDirs.size()>1)
dataDirs.resize (1);
if (mDataDirs.size()>1)
mDataDirs.resize (1);
mCfgMgr.processPaths(dataDirs);
while (dataDirs.empty()) {
// No valid data files directory found
mCfgMgr.processPaths(mDataDirs);
while (mDataDirs.empty()) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error detecting Morrowind installation");
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Cancel);
msgBox.setText(tr("<br><b>Could not find the Data Files location</b><br><br> \
The directory containing the data files was not found.<br><br> \
Press \"Browse...\" to specify the location manually.<br>"));
The directory containing the data files was not found.<br><br> \
Press \"Browse...\" to specify the location manually.<br>"));
QAbstractButton *dirSelectButton =
msgBox.addButton(tr("B&rowse..."), QMessageBox::ActionRole);
msgBox.addButton(tr("B&rowse..."), QMessageBox::ActionRole);
msgBox.exec();
if (msgBox.clickedButton() == dirSelectButton) {
QString dataDir = QFileDialog::getExistingDirectory(
this, tr("Select Data Files Directory"),
"/home",
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
// Show a custom dir selection dialog which only accepts valid dirs
QString selectedDir = FileDialog::getExistingDirectory(
this, tr("Select Data Files Directory"),
QDir::currentPath(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
// Add the user selected data directory
if (!selectedDir.isEmpty()) {
mDataDirs.push_back(Files::PathContainer::value_type(selectedDir.toStdString()));
mCfgMgr.processPaths(mDataDirs);
} else {
// Cancel from within the dir selection dialog
return false;
}
dataDirs.push_back(Files::PathContainer::value_type(dataDir.toStdString()));
mDataDirs.push_back(Files::PathContainer::value_type(dataDir.toStdString()));
} else {
// Cancel
break;
return false;
}
}
// Check if cancel was clicked because we can't exit from while loop
if (dataDirs.empty()) {
QApplication::exit(1);
return;
}
// Create a file collection for the dataDirs
Files::Collections fileCollections(dataDirs, !variables["fs-strict"].as<bool>());
// Create a file collection for the data dirs
Files::Collections fileCollections(mDataDirs, !variables["fs-strict"].as<bool>());
// First we add all the master files
const Files::MultiDirCollection &esm = fileCollections.getCollection(".esm");
@ -356,6 +356,7 @@ void DataFilesPage::setupDataFiles()
}
readConfig();
return true;
}
void DataFilesPage::createActions()
@ -1057,8 +1058,25 @@ void DataFilesPage::writeConfig(QString profile)
return;
}
QString pathStr = QString::fromStdString(mCfgMgr.getUserPath().string());
QDir userPath(pathStr);
if (!userPath.exists()) {
if (!userPath.mkpath(pathStr)) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error creating OpenMW configuration directory");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not create %0</b><br><br> \
Please make sure you have the right permissions and try again.<br>").arg(pathStr));
msgBox.exec();
qApp->quit();
return;
}
}
// Open the OpenMW config as a QFile
QFile file(QString::fromStdString((mCfgMgr.getUserPath() / "openmw.cfg").string()));
QFile file(pathStr.append("openmw.cfg"));
if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
// File cannot be opened or created
@ -1067,10 +1085,10 @@ void DataFilesPage::writeConfig(QString profile)
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not open or create %0</b><br><br> \
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
msgBox.exec();
qApp->exit(1);
qApp->quit();
return;
}
@ -1098,10 +1116,10 @@ void DataFilesPage::writeConfig(QString profile)
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not write to %0</b><br><br> \
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
Please make sure you have the right permissions and try again.<br>").arg(file.fileName()));
msgBox.exec();
qApp->exit(1);
qApp->quit();
return;
}

@ -34,6 +34,7 @@ public:
ComboBox *mProfilesComboBox;
void writeConfig(QString profile = QString());
bool setupDataFiles();
public slots:
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
@ -92,7 +93,6 @@ private:
void removePlugins(const QModelIndex &index);
void uncheckPlugins();
void createActions();
void setupDataFiles();
void setupConfig();
void readConfig();
void scrollToSelection();

@ -0,0 +1,57 @@
#include "filedialog.hpp"
#include <QDialogButtonBox>
#include <QPushButton>
FileDialog::FileDialog(QWidget *parent)
: QFileDialog(parent)
{
// Remove the default Choose button to prevent it being updated elsewhere
QDialogButtonBox *box = qFindChild<QDialogButtonBox*>(this);
Q_ASSERT(box);
box->removeButton(box->button(QDialogButtonBox::Open));
// Add our own button so we can disable/enable it
mChooseButton = new QPushButton(tr("&Choose"));
mChooseButton->setIcon(QIcon::fromTheme("document-open"));
mChooseButton->setEnabled(false);
box->addButton(mChooseButton, QDialogButtonBox::AcceptRole);
connect(this, SIGNAL(directoryEntered(const QString&)), this, SLOT(updateChooseButton(const QString&)));
emit directoryEntered(QDir::currentPath());
}
QString FileDialog::getExistingDirectory(QWidget *parent,
const QString &caption,
const QString &dir,
Options options)
{
// create a non-native file dialog
FileDialog dialog;
dialog.setFileMode(DirectoryOnly);
dialog.setOptions(options |= QFileDialog::DontUseNativeDialog | QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly);
if (!caption.isEmpty())
dialog.setWindowTitle(caption);
if (!dir.isEmpty())
dialog.setDirectory(dir);
if (dialog.exec() == QDialog::Accepted) {
return dialog.selectedFiles().value(0);
}
return QString();
}
void FileDialog::updateChooseButton(const QString &directory)
{
QDir currentDir = QDir(directory);
currentDir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
currentDir.setNameFilters(QStringList() << "*.esm" << "*.esp");
if (!currentDir.entryList().isEmpty()) {
// There are data files in the current dir
mChooseButton->setEnabled(true);
} else {
mChooseButton->setEnabled(false);
}
}

@ -0,0 +1,28 @@
#ifndef FILEDIALOG_HPP
#define FILEDIALOG_HPP
#include <QFileDialog>
class QPushButton;
class FileDialog : public QFileDialog
{
Q_OBJECT
public:
FileDialog(QWidget *parent = 0);
static QString getExistingDirectory(QWidget *parent = 0,
const QString &caption = QString(),
const QString &dir = QString(),
Options options = ShowDirsOnly);
private slots:
void updateChooseButton(const QString &directory);
private:
QPushButton *mChooseButton;
};
#endif // FILEDIALOG_HPP

@ -1,12 +1,25 @@
#include "graphicspage.hpp"
#include <QtGui>
#include <boost/lexical_cast.hpp>
#include <boost/math/common_factor.hpp>
#include <components/files/configurationmanager.hpp>
#include <components/settings/settings.hpp>
#include "graphicspage.hpp"
#include "naturalsort.hpp"
QString getAspect(int x, int y)
{
int gcd = boost::math::gcd (x, y);
int xaspect = x / gcd;
int yaspect = y / gcd;
// special case: 8 : 5 is usually referred to as 16:10
if (xaspect == 8 && yaspect == 5)
return QString("16:10");
return QString(QString::number(xaspect) + ":" + QString::number(yaspect));
}
GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent)
: QWidget(parent)
, mCfgMgr(cfg)
@ -21,68 +34,41 @@ GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent)
renderSystemLayout->addWidget(rendererLabel, 0, 0, 1, 1);
renderSystemLayout->addWidget(mRendererComboBox, 0, 1, 1, 1);
QVBoxLayout *rendererGroupLayout = new QVBoxLayout(rendererGroup);
rendererGroupLayout->addLayout(renderSystemLayout);
// Display
QGroupBox *displayGroup = new QGroupBox(tr("Display"), this);
mDisplayStackedWidget = new QStackedWidget(displayGroup);
mVSyncCheckBox = new QCheckBox(tr("Vertical Sync"), displayGroup);
mFullScreenCheckBox = new QCheckBox(tr("Full Screen"), displayGroup);
QLabel *antiAliasingLabel = new QLabel(tr("Antialiasing:"), displayGroup);
QLabel *resolutionLabel = new QLabel(tr("Resolution:"), displayGroup);
QVBoxLayout *displayGroupLayout = new QVBoxLayout(displayGroup);
QSpacerItem *vSpacer3 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
mResolutionComboBox = new QComboBox(displayGroup);
mAntiAliasingComboBox = new QComboBox(displayGroup);
displayGroupLayout->addWidget(mDisplayStackedWidget);
displayGroupLayout->addItem(vSpacer3);
QVBoxLayout *rendererGroupLayout = new QVBoxLayout(rendererGroup);
rendererGroupLayout->addLayout(renderSystemLayout);
QGridLayout *displayGroupLayout = new QGridLayout(displayGroup);
displayGroupLayout->addWidget(mVSyncCheckBox, 0, 0, 1, 1);
displayGroupLayout->addWidget(mFullScreenCheckBox, 1, 0, 1, 1);
displayGroupLayout->addWidget(antiAliasingLabel, 2, 0, 1, 1);
displayGroupLayout->addWidget(mAntiAliasingComboBox, 2, 1, 1, 1);
displayGroupLayout->addWidget(resolutionLabel, 3, 0, 1, 1);
displayGroupLayout->addWidget(mResolutionComboBox, 3, 1, 1, 1);
// Layout for the whole page
QVBoxLayout *pageLayout = new QVBoxLayout(this);
QSpacerItem *vSpacer1 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
pageLayout->addWidget(rendererGroup);
pageLayout->addWidget(displayGroup);
pageLayout->addItem(vSpacer1);
connect(mRendererComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(rendererChanged(const QString&)));
createPages();
setupConfig();
setupOgre();
readConfig();
}
void GraphicsPage::createPages()
{
QWidget *main = new QWidget();
QGridLayout *grid = new QGridLayout(main);
mVSyncCheckBox = new QCheckBox(tr("Vertical Sync"), main);
grid->addWidget(mVSyncCheckBox, 0, 0, 1, 1);
mFullScreenCheckBox = new QCheckBox(tr("Full Screen"), main);
grid->addWidget(mFullScreenCheckBox, 1, 0, 1, 1);
QLabel *antiAliasingLabel = new QLabel(tr("Antialiasing:"), main);
mAntiAliasingComboBox = new QComboBox(main);
grid->addWidget(antiAliasingLabel, 2, 0, 1, 1);
grid->addWidget(mAntiAliasingComboBox, 2, 1, 1, 1);
QLabel *resolutionLabel = new QLabel(tr("Resolution:"), main);
mResolutionComboBox = new QComboBox(main);
grid->addWidget(resolutionLabel, 3, 0, 1, 1);
grid->addWidget(mResolutionComboBox, 3, 1, 1, 1);
QSpacerItem *vSpacer1 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding);
grid->addItem(vSpacer1, 4, 0, 1, 1);
mDisplayStackedWidget->addWidget(main);
}
void GraphicsPage::setupConfig()
{
}
void GraphicsPage::setupOgre()
bool GraphicsPage::setupOgre()
{
QString pluginCfg = mCfgMgr.getPluginsConfigPath().string().c_str();
QFile file(pluginCfg);
@ -93,11 +79,11 @@ void GraphicsPage::setupOgre()
try
{
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9)
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9)
mOgre = new Ogre::Root("", "", "./launcherOgre.log");
#else
#else
mOgre = new Ogre::Root(pluginCfg.toStdString(), "", "./launcherOgre.log");
#endif
#endif
}
catch(Ogre::Exception &ex)
{
@ -113,19 +99,17 @@ void GraphicsPage::setupOgre()
msgBox.exec();
qCritical("Error creating Ogre::Root, the error reported was:\n %s", qPrintable(ogreError));
qApp->exit(1);
return;
return false;
}
#ifdef ENABLE_PLUGIN_GL
mGLPlugin = new Ogre::GLPlugin();
mOgre->installPlugin(mGLPlugin);
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
mD3D9Plugin = new Ogre::D3D9Plugin();
mOgre->installPlugin(mD3D9Plugin);
#endif
#ifdef ENABLE_PLUGIN_GL
mGLPlugin = new Ogre::GLPlugin();
mOgre->installPlugin(mGLPlugin);
#endif
#ifdef ENABLE_PLUGIN_Direct3D9
mD3D9Plugin = new Ogre::D3D9Plugin();
mOgre->installPlugin(mD3D9Plugin);
#endif
// Get the available renderers and put them in the combobox
const Ogre::RenderSystemList &renderers = mOgre->getAvailableRenderers();
@ -135,45 +119,47 @@ void GraphicsPage::setupOgre()
mRendererComboBox->addItem((*r)->getName().c_str());
}
int index = mRendererComboBox->findText(QString::fromStdString(Settings::Manager::getString("render system", "Video")));
if ( index != -1) {
mRendererComboBox->setCurrentIndex(index);
}
else
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText("Direct3D9 Rendering Subsystem"));
#else
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText("OpenGL Rendering Subsystem"));
#endif
}
QString openGLName = QString("OpenGL Rendering Subsystem");
QString direct3DName = QString("Direct3D9 Rendering Subsystem");
// Create separate rendersystems
QString openGLName = mRendererComboBox->itemText(mRendererComboBox->findText(QString("OpenGL"), Qt::MatchStartsWith));
QString direct3DName = mRendererComboBox->itemText(mRendererComboBox->findText(QString("Direct3D"), Qt::MatchStartsWith));
mOpenGLRenderSystem = mOgre->getRenderSystemByName(openGLName.toStdString());
mDirect3DRenderSystem = mOgre->getRenderSystemByName(direct3DName.toStdString());
if (!mOpenGLRenderSystem && !mDirect3DRenderSystem) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error creating renderer");
msgBox.setWindowTitle(tr("Error creating renderer"));
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not select a valid render system</b><br><br> \
Please make sure the plugins.cfg file exists and contains a valid rendering plugin.<br>"));
msgBox.exec();
qApp->exit(1);
return;
return false;
}
// Now fill the GUI elements
int index = mRendererComboBox->findText(QString::fromStdString(Settings::Manager::getString("render system", "Video")));
if ( index != -1) {
mRendererComboBox->setCurrentIndex(index);
}
else
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText(direct3DName));
#else
mRendererComboBox->setCurrentIndex(mRendererComboBox->findText(openGLName));
#endif
}
mAntiAliasingComboBox->clear();
mResolutionComboBox->clear();
mAntiAliasingComboBox->addItems(getAvailableOptions(QString("FSAA"), mSelectedRenderSystem));
mResolutionComboBox->addItems(getAvailableOptions(QString("Video Mode"), mSelectedRenderSystem));
mResolutionComboBox->addItems(getAvailableResolutions(mSelectedRenderSystem));
readConfig();
return true;
}
void GraphicsPage::readConfig()
@ -188,9 +174,10 @@ void GraphicsPage::readConfig()
if (aaIndex != -1)
mAntiAliasingComboBox->setCurrentIndex(aaIndex);
std::string resolution = boost::lexical_cast<std::string>(Settings::Manager::getInt("resolution x", "Video"))
+ " x " + boost::lexical_cast<std::string>(Settings::Manager::getInt("resolution y", "Video"));
int resIndex = mResolutionComboBox->findText(QString::fromStdString(resolution));
QString resolution = QString::number(Settings::Manager::getInt("resolution x", "Video"));
resolution.append(" x " + QString::number(Settings::Manager::getInt("resolution y", "Video")));
int resIndex = mResolutionComboBox->findText(resolution, Qt::MatchStartsWith);
if (resIndex != -1)
mResolutionComboBox->setCurrentIndex(resIndex);
}
@ -200,12 +187,14 @@ void GraphicsPage::writeConfig()
Settings::Manager::setBool("vsync", "Video", mVSyncCheckBox->checkState());
Settings::Manager::setBool("fullscreen", "Video", mFullScreenCheckBox->checkState());
Settings::Manager::setString("antialiasing", "Video", mAntiAliasingComboBox->currentText().toStdString());
Settings::Manager::setString("render system", "Video", mRendererComboBox->currentText().toStdString());
// Get the current resolution, but with the tabs replaced with a single space
QString resolution = mResolutionComboBox->currentText().simplified();
QStringList tokens = resolution.split(" ", QString::SkipEmptyParts);
std::string resolution = mResolutionComboBox->currentText().toStdString();
// parse resolution x and y from a string like "800 x 600"
size_t xPos = resolution.find("x");
int resX = boost::lexical_cast<int>(resolution.substr(0, xPos-1));
int resY = boost::lexical_cast<int>(resolution.substr(xPos+2, resolution.size()-(xPos+2)));
int resX = tokens.at(0).toInt();
int resY = tokens.at(2).toInt();
Settings::Manager::setInt("resolution x", "Video", resX);
Settings::Manager::setInt("resolution y", "Video", resY);
}
@ -227,15 +216,69 @@ QStringList GraphicsPage::getAvailableOptions(const QString &key, Ogre::RenderSy
if (strcmp (key.toStdString().c_str(), i->first.c_str()) == 0)
{
if (key == "FSAA" && *opt_it == "0")
result << QString("none");
else
result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified();
result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified();
}
}
}
// Sort ascending
qSort(result.begin(), result.end(), naturalSortLessThanCI);
// Replace the zero option with Off
int index = result.indexOf("MSAA 0");
if (index != -1)
result.replace(index, tr("Off"));
return result;
}
QStringList GraphicsPage::getAvailableResolutions(Ogre::RenderSystem *renderer)
{
QString key ("Video Mode");
QStringList result;
uint row = 0;
Ogre::ConfigOptionMap options = renderer->getConfigOptions();
for (Ogre::ConfigOptionMap::iterator i = options.begin (); i != options.end (); i++, row++)
{
if (key.toStdString() != i->first)
continue;
Ogre::StringVector::iterator opt_it;
uint idx = 0;
for (opt_it = i->second.possibleValues.begin ();
opt_it != i->second.possibleValues.end (); opt_it++, idx++)
{
QString qval = QString::fromStdString(*opt_it).simplified();
// remove extra tokens after the resolution (for example bpp, can be there or not depending on rendersystem)
QStringList tokens = qval.split(" ", QString::SkipEmptyParts);
assert (tokens.size() >= 3);
QString resolutionStr = tokens.at(0) + QString(" x ") + tokens.at(2);
// do not add duplicate resolutions
if (!result.contains(resolutionStr)) {
QString aspect = getAspect(tokens.at(0).toInt(),tokens.at(2).toInt());
if (aspect == QLatin1String("16:9") || aspect == QLatin1String("16:10")) {
resolutionStr.append(tr("\t(Widescreen ") + aspect + ")");
} else if (aspect == QLatin1String("4:3")) {
resolutionStr.append(tr("\t(Standard 4:3)"));
}
result << resolutionStr;
}
}
}
// Sort the resolutions in descending order
qSort(result.begin(), result.end(), naturalSortGreaterThanCI);
return result;
}
@ -247,5 +290,5 @@ void GraphicsPage::rendererChanged(const QString &renderer)
mResolutionComboBox->clear();
mAntiAliasingComboBox->addItems(getAvailableOptions(QString("FSAA"), mSelectedRenderSystem));
mResolutionComboBox->addItems(getAvailableOptions(QString("Video Mode"), mSelectedRenderSystem));
mResolutionComboBox->addItems(getAvailableResolutions(mSelectedRenderSystem));
}

@ -30,6 +30,7 @@ class GraphicsPage : public QWidget
public:
GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent = 0);
bool setupOgre();
void writeConfig();
public slots:
@ -59,10 +60,9 @@ private:
Files::ConfigurationManager &mCfgMgr;
QStringList getAvailableOptions(const QString &key, Ogre::RenderSystem *renderer);
QStringList getAvailableResolutions(Ogre::RenderSystem *renderer);
void createPages();
void setupConfig();
void setupOgre();
void readConfig();
};

@ -1,12 +1,3 @@
/****************************************************************************
**
** Copyright (c) 2007 Trolltech ASA <info@trolltech.com>
**
** Use, modification and distribution is allowed without limitation,
** warranty, liability or support of any kind.
**
****************************************************************************/
#include "lineedit.hpp"
#include <QToolButton>
#include <QStyle>
@ -14,33 +5,33 @@
LineEdit::LineEdit(QWidget *parent)
: QLineEdit(parent)
{
clearButton = new QToolButton(this);
mClearButton = new QToolButton(this);
QPixmap pixmap(":images/clear.png");
clearButton->setIcon(QIcon(pixmap));
clearButton->setIconSize(pixmap.size());
clearButton->setCursor(Qt::ArrowCursor);
clearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
clearButton->hide();
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
mClearButton->setIcon(QIcon(pixmap));
mClearButton->setIconSize(pixmap.size());
mClearButton->setCursor(Qt::ArrowCursor);
mClearButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
mClearButton->hide();
connect(mClearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateCloseButton(const QString&)));
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(clearButton->sizeHint().width() + frameWidth + 1));
setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(mClearButton->sizeHint().width() + frameWidth + 1));
QSize msz = minimumSizeHint();
setMinimumSize(qMax(msz.width(), clearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), clearButton->sizeHint().height() + frameWidth * 2 + 2));
setMinimumSize(qMax(msz.width(), mClearButton->sizeHint().height() + frameWidth * 2 + 2),
qMax(msz.height(), mClearButton->sizeHint().height() + frameWidth * 2 + 2));
}
void LineEdit::resizeEvent(QResizeEvent *)
{
QSize sz = clearButton->sizeHint();
QSize sz = mClearButton->sizeHint();
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
clearButton->move(rect().right() - frameWidth - sz.width(),
mClearButton->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - sz.height())/2);
}
void LineEdit::updateCloseButton(const QString& text)
{
clearButton->setVisible(!text.isEmpty());
mClearButton->setVisible(!text.isEmpty());
}

@ -28,7 +28,7 @@ private slots:
void updateCloseButton(const QString &text);
private:
QToolButton *clearButton;
QToolButton *mClearButton;
};
#endif // LIENEDIT_H

@ -1,7 +1,6 @@
#include <QApplication>
#include <QDir>
#include <QFile>
#include <QtDebug>
#include "maindialog.hpp"
@ -31,8 +30,14 @@ int main(int argc, char *argv[])
QDir::setCurrent(dir.absolutePath());
MainDialog dialog;
return dialog.exec();
MainDialog mainWin;
if (mainWin.setup()) {
mainWin.show();
return app.exec();
}
return 0;
}

@ -7,29 +7,10 @@
MainDialog::MainDialog()
{
// Create the settings manager and load default settings file
const std::string localdefault = mCfgMgr.getLocalPath().string() + "/settings-default.cfg";
const std::string globaldefault = mCfgMgr.getGlobalPath().string() + "/settings-default.cfg";
// prefer local
if (boost::filesystem::exists(localdefault))
mSettings.loadDefault(localdefault);
else if (boost::filesystem::exists(globaldefault))
mSettings.loadDefault(globaldefault);
else
throw std::runtime_error ("No default settings file found! Make sure the file \"settings-default.cfg\" was properly installed.");
// load user settings if they exist, otherwise just load the default settings as user settings
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
if (boost::filesystem::exists(settingspath))
mSettings.loadUser(settingspath);
else if (boost::filesystem::exists(localdefault))
mSettings.loadUser(localdefault);
else if (boost::filesystem::exists(globaldefault))
mSettings.loadUser(globaldefault);
QWidget *centralWidget = new QWidget(this);
setCentralWidget(centralWidget);
mIconWidget = new QListWidget;
mIconWidget = new QListWidget(centralWidget);
mIconWidget->setObjectName("IconWidget");
mIconWidget->setViewMode(QListView::IconMode);
mIconWidget->setWrapping(false);
@ -43,7 +24,7 @@ MainDialog::MainDialog()
mIconWidget->setCurrentRow(0);
mIconWidget->setFlow(QListView::LeftToRight);
QGroupBox *groupBox = new QGroupBox(this);
QGroupBox *groupBox = new QGroupBox(centralWidget);
QVBoxLayout *groupLayout = new QVBoxLayout(groupBox);
mPagesWidget = new QStackedWidget(groupBox);
@ -51,16 +32,15 @@ MainDialog::MainDialog()
QPushButton *playButton = new QPushButton(tr("Play"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(centralWidget);
buttonBox->setStandardButtons(QDialogButtonBox::Close);
buttonBox->addButton(playButton, QDialogButtonBox::AcceptRole);
QVBoxLayout *dialogLayout = new QVBoxLayout(this);
QVBoxLayout *dialogLayout = new QVBoxLayout(centralWidget);
dialogLayout->addWidget(mIconWidget);
dialogLayout->addWidget(groupBox);
dialogLayout->addWidget(buttonBox);
setWindowTitle(tr("OpenMW Launcher"));
setWindowIcon(QIcon(":/images/openmw.png"));
// Remove what's this? button
@ -70,22 +50,22 @@ MainDialog::MainDialog()
// Install the stylesheet font
QFile file;
QFontDatabase fontDatabase;
const QStringList fonts = fontDatabase.families();
// Check if the font is installed
if (!fonts.contains("EB Garamond")) {
QString font = QString::fromStdString((mCfgMgr.getGlobalDataPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
file.setFileName(font);
if (!file.exists()) {
font = QString::fromStdString((mCfgMgr.getLocalPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
font = QString::fromStdString((mCfgMgr.getLocalPath() / "resources/mygui/EBGaramond-Regular.ttf").string());
}
fontDatabase.addApplicationFont(font);
}
// Load the stylesheet
QString config = QString::fromStdString((mCfgMgr.getGlobalDataPath() / "resources/launcher.qss").string());
file.setFileName(config);
@ -99,7 +79,6 @@ MainDialog::MainDialog()
qApp->setStyleSheet(styleSheet);
file.close();
connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
connect(buttonBox, SIGNAL(accepted()), this, SLOT(play()));
@ -170,6 +149,53 @@ void MainDialog::createPages()
}
bool MainDialog::setup()
{
// Create the settings manager and load default settings file
const std::string localdefault = (mCfgMgr.getLocalPath() / "settings-default.cfg").string();
const std::string globaldefault = (mCfgMgr.getGlobalPath() / "settings-default.cfg").string();
// prefer local
if (boost::filesystem::exists(localdefault)) {
mSettings.loadDefault(localdefault);
} else if (boost::filesystem::exists(globaldefault)) {
mSettings.loadDefault(globaldefault);
} else {
QMessageBox msgBox;
msgBox.setWindowTitle("Error reading OpenMW configuration file");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not find %0</b><br><br> \
The problem may be due to an incomplete installation of OpenMW.<br> \
Reinstalling OpenMW may resolve the problem.").arg(QString::fromStdString(globaldefault)));
msgBox.exec();
return false;
}
// load user settings if they exist, otherwise just load the default settings as user settings
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
if (boost::filesystem::exists(settingspath))
mSettings.loadUser(settingspath);
else if (boost::filesystem::exists(localdefault))
mSettings.loadUser(localdefault);
else if (boost::filesystem::exists(globaldefault))
mSettings.loadUser(globaldefault);
// Setup the Graphics page
if (!mGraphicsPage->setupOgre()) {
return false;
}
// Setup the Data Files page
if (!mDataFilesPage->setupDataFiles()) {
return false;
}
return true;
}
void MainDialog::profileChanged(int index)
{
// Just to be sure, should always have a selection
@ -202,7 +228,7 @@ void MainDialog::closeEvent(QCloseEvent *event)
mGraphicsPage->writeConfig();
// Save user settings
const std::string settingspath = mCfgMgr.getUserPath().string() + "/settings.cfg";
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
mSettings.saveUser(settingspath);
event->accept();
@ -214,6 +240,10 @@ void MainDialog::play()
mDataFilesPage->writeConfig();
mGraphicsPage->writeConfig();
// Save user settings
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
mSettings.saveUser(settingspath);
#ifdef Q_WS_WIN
QString game = "./openmw.exe";
QFile file(game);
@ -246,7 +276,7 @@ void MainDialog::play()
if (!info.isExecutable()) {
QMessageBox msgBox;
msgBox.setWindowTitle("Error starting OpenMW");
msgBox.setIcon(QMessageBox::Critical);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<br><b>Could not start OpenMW</b><br><br> \
The OpenMW application is not executable.<br> \
@ -270,6 +300,7 @@ void MainDialog::play()
return;
} else {
close();
qApp->quit();
}
}

@ -1,7 +1,7 @@
#ifndef MAINDIALOG_H
#define MAINDIALOG_H
#include <QDialog>
#include <QMainWindow>
#include <components/files/configurationmanager.hpp>
#include <components/settings/settings.hpp>
@ -17,7 +17,7 @@ class PlayPage;
class GraphicsPage;
class DataFilesPage;
class MainDialog : public QDialog
class MainDialog : public QMainWindow
{
Q_OBJECT
@ -28,6 +28,7 @@ public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
void play();
void profileChanged(int index);
bool setup();
private:
void createIcons();

@ -93,3 +93,13 @@ bool naturalSortLessThanCI( const QString &left, const QString &right )
{
return (naturalCompare( left, right, Qt::CaseInsensitive ) < 0);
}
bool naturalSortGreaterThanCS( const QString &left, const QString &right )
{
return (naturalCompare( left, right, Qt::CaseSensitive ) > 0);
}
bool naturalSortGreaterThanCI( const QString &left, const QString &right )
{
return (naturalCompare( left, right, Qt::CaseInsensitive ) > 0);
}

@ -5,5 +5,7 @@
bool naturalSortLessThanCS( const QString &left, const QString &right );
bool naturalSortLessThanCI( const QString &left, const QString &right );
bool naturalSortGreaterThanCS( const QString &left, const QString &right );
bool naturalSortGreaterThanCI( const QString &left, const QString &right );
#endif
#endif

@ -1,4 +1,3 @@
#include <QDebug>
#include <QSortFilterProxyModel>
#include "pluginsview.hpp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 236 KiB

@ -47,10 +47,10 @@ add_openmw_dir (mwsound
)
add_openmw_dir (mwworld
refdata world physicssystem scene globals class action nullaction actionteleport
refdata worldimp physicssystem scene globals class action nullaction actionteleport
containerstore actiontalk actiontake manualref player cellfunctors
cells localscripts customdata weather inventorystore ptr actionopen actionread
actionequip timestamp actionalchemy
actionequip timestamp actionalchemy cellstore
)
add_openmw_dir (mwclass
@ -64,7 +64,7 @@ add_openmw_dir (mwmechanics
)
add_openmw_dir (mwbase
environment
environment world
)
# Main executable

@ -15,7 +15,6 @@
#include <openengine/gui/manager.hpp>
#include <components/esm/records.hpp>
#include <components/esm_store/cell_store.hpp>
#include <components/bsa/bsa_archive.hpp>
#include <components/esm/esm_reader.hpp>
#include <components/files/fixedpath.hpp>
@ -39,9 +38,10 @@
#include "mwsound/soundmanager.hpp"
#include "mwworld/world.hpp"
#include "mwworld/class.hpp"
#include "mwworld/player.hpp"
#include "mwworld/cellstore.hpp"
#include "mwworld/worldimp.hpp"
#include "mwclass/classes.hpp"
@ -51,6 +51,7 @@
#include "mwmechanics/mechanicsmanager.hpp"
#include "mwbase/environment.hpp"
#include "mwbase/world.hpp"
void OMW::Engine::executeLocalScripts()
@ -126,9 +127,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// update GUI
Ogre::RenderWindow* window = mOgre->getWindow();
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(),
window->getTriangleCount(),
window->getBatchCount());
unsigned int tri, batch;
MWBase::Environment::get().getWorld()->getTriangleBatchCount(tri, batch);
MWBase::Environment::get().getWindowManager()->wmUpdateFps(window->getLastFPS(), tri, batch);
MWBase::Environment::get().getWindowManager()->onFrame(evt.timeSinceLastFrame);
}

@ -9,13 +9,13 @@
#include "../mwsound/soundmanager.hpp"
#include "../mwworld/world.hpp"
#include "../mwdialogue/dialoguemanager.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "world.hpp"
MWBase::Environment *MWBase::Environment::sThis = 0;
MWBase::Environment::Environment()
@ -32,7 +32,7 @@ MWBase::Environment::~Environment()
sThis = 0;
}
void MWBase::Environment::setWorld (MWWorld::World *world)
void MWBase::Environment::setWorld (World *world)
{
mWorld = world;
}
@ -77,7 +77,7 @@ void MWBase::Environment::setFrameDuration (float duration)
mFrameDuration = duration;
}
MWWorld::World *MWBase::Environment::getWorld() const
MWBase::World *MWBase::Environment::getWorld() const
{
assert (mWorld);
return mWorld;

@ -32,13 +32,10 @@ namespace MWInput
struct MWInputManager;
}
namespace MWWorld
namespace MWBase
{
class World;
}
namespace MWBase
{
/// \brief Central hub for mw-subsystems
///
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
@ -49,7 +46,7 @@ namespace MWBase
{
static Environment *sThis;
MWWorld::World *mWorld;
World *mWorld;
MWSound::SoundManager *mSoundManager;
MWScript::ScriptManager *mScriptManager;
MWGui::WindowManager *mWindowManager;
@ -71,7 +68,7 @@ namespace MWBase
~Environment();
void setWorld (MWWorld::World *world);
void setWorld (World *world);
void setSoundManager (MWSound::SoundManager *soundManager);
@ -90,7 +87,7 @@ namespace MWBase
void setFrameDuration (float duration);
///< Set length of current frame in seconds.
MWWorld::World *getWorld() const;
World *getWorld() const;
MWSound::SoundManager *getSoundManager() const;

@ -0,0 +1,245 @@
#ifndef GAME_MWBASE_WORLD_H
#define GAME_MWBASE_WORLD_H
#include <string>
#include <map>
#include <vector>
#include <components/settings/settings.hpp>
#include "../mwworld/globals.hpp"
namespace Ogre
{
class Vector2;
class Vector3;
}
namespace OEngine
{
namespace Render
{
class Fader;
}
}
namespace ESM
{
class ESMReader;
struct Position;
struct Cell;
struct Class;
struct Potion;
}
namespace ESMS
{
struct ESMStore;
}
namespace MWWorld
{
class CellStore;
class Player;
class LocalScripts;
class Ptr;
class TimeStamp;
}
namespace MWBase
{
class World
{
World (const World&);
///< not implemented
World& operator= (const World&);
///< not implemented
public:
enum RenderMode
{
Render_CollisionDebug,
Render_Wireframe,
Render_Pathgrid,
Render_Compositors
};
World() {}
virtual ~World() {}
virtual OEngine::Render::Fader* getFader() = 0;
///< \ŧodo remove this function. Rendering details should not be exposed.
virtual MWWorld::CellStore *getExterior (int x, int y) = 0;
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
virtual void setWaterHeight(const float height) = 0;
virtual void toggleWater() = 0;
virtual void adjustSky() = 0;
virtual void getTriangleBatchCount(unsigned int &triangles, unsigned int &batches) = 0;
virtual void setFallbackValues (const std::map<std::string, std::string>& fallbackMap) = 0;
virtual std::string getFallback (const std::string& key) const = 0;
virtual std::string getFallback (const std::string& key, const std::string& def) const = 0;
virtual MWWorld::Player& getPlayer() = 0;
virtual const ESMS::ESMStore& getStore() const = 0;
virtual ESM::ESMReader& getEsmReader() = 0;
virtual MWWorld::LocalScripts& getLocalScripts() = 0;
virtual bool hasCellChanged() const = 0;
///< Has the player moved to a different cell, since the last frame?
virtual bool isCellExterior() const = 0;
virtual bool isCellQuasiExterior() const = 0;
virtual Ogre::Vector2 getNorthVector (MWWorld::CellStore* cell) = 0;
///< get north vector (OGRE coordinates) for given interior cell
virtual MWWorld::Globals::Data& getGlobalVariable (const std::string& name) = 0;
virtual MWWorld::Globals::Data getGlobalVariable (const std::string& name) const = 0;
virtual char getGlobalVariableType (const std::string& name) const = 0;
///< Return ' ', if there is no global variable with this name.
virtual MWWorld::Ptr getPtr (const std::string& name, bool activeOnly) = 0;
///< Return a pointer to a liveCellRef with the given name.
/// \param activeOnly do non search inactive cells.
virtual MWWorld::Ptr getPtrViaHandle (const std::string& handle) = 0;
///< Return a pointer to a liveCellRef with the given Ogre handle.
/// \todo enable reference in the OGRE scene
virtual void enable (const MWWorld::Ptr& ptr) = 0;
/// \todo disable reference in the OGRE scene
virtual void disable (const MWWorld::Ptr& ptr) = 0;
virtual void advanceTime (double hours) = 0;
///< Advance in-game time.
virtual void setHour (double hour) = 0;
///< Set in-game time hour.
virtual void setMonth (int month) = 0;
///< Set in-game time month.
virtual void setDay (int day) = 0;
///< Set in-game time day.
virtual MWWorld::TimeStamp getTimeStamp() const = 0;
///< Return current in-game time stamp.
virtual bool toggleSky() = 0;
///< \return Resulting mode
virtual void changeWeather(const std::string& region, unsigned int id) = 0;
virtual int getCurrentWeather() const = 0;
virtual int getMasserPhase() const = 0;
virtual int getSecundaPhase() const = 0;
virtual void setMoonColour (bool red) = 0;
virtual float getTimeScaleFactor() const = 0;
virtual void changeToInteriorCell (const std::string& cellName,
const ESM::Position& position) = 0;
///< Move to interior cell.
virtual void changeToExteriorCell (const ESM::Position& position) = 0;
///< Move to exterior cell.
virtual const ESM::Cell *getExterior (const std::string& cellName) const = 0;
///< Return a cell matching the given name or a 0-pointer, if there is no such cell.
virtual void markCellAsUnchanged() = 0;
virtual std::string getFacedHandle() = 0;
///< Return handle of the object the player is looking at
virtual void deleteObject (const MWWorld::Ptr& ptr) = 0;
virtual void moveObject (const MWWorld::Ptr& ptr, float x, float y, float z) = 0;
virtual void indexToPosition (int cellX, int cellY, float &x, float &y, bool centre = false)
const = 0;
///< Convert cell numbers to position.
virtual void positionToIndex (float x, float y, int &cellX, int &cellY) const = 0;
///< Convert position to cell numbers
virtual void doPhysics (const std::vector<std::pair<std::string, Ogre::Vector3> >& actors,
float duration) = 0;
///< Run physics simulation and modify \a world accordingly.
virtual bool toggleCollisionMode() = 0;
///< Toggle collision mode for player. If disabled player object should ignore
/// collisions and gravity.
///< \return Resulting mode
virtual bool toggleRenderMode (RenderMode mode) = 0;
///< Toggle a render mode.
///< \return Resulting mode
virtual std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record)
= 0;
///< Create a new recrod (of type potion) in the ESM store.
/// \return ID, pointer to created record
virtual std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record)
= 0;
///< Create a new recrod (of type class) in the ESM store.
/// \return ID, pointer to created record
virtual const ESM::Cell *createRecord (const ESM::Cell& record) = 0;
///< Create a new recrod (of type cell) in the ESM store.
/// \return ID, pointer to created record
virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
int mode, int number = 1) = 0;
///< Run animation for a MW-reference. Calls to this function for references that are
/// currently not in the rendered scene should be ignored.
///
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
/// \param number How offen the animation should be run
virtual void skipAnimation (const MWWorld::Ptr& ptr) = 0;
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the rendered scene should be ignored.
virtual void update (float duration) = 0;
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
///< place an object into the gameworld at the specified cursor position
/// @param object
/// @param cursor X (relative 0-1)
/// @param cursor Y (relative 0-1)
/// @return true if the object was placed, or false if it was rejected because the position is too far away
virtual void dropObjectOnGround (const MWWorld::Ptr& object) = 0;
virtual bool canPlaceObject (float cursorX, float cursorY) = 0;
///< @return true if it is possible to place on object at specified cursor location
virtual void processChangedSettings (const Settings::CategorySettingVector& settings) = 0;
};
}
#endif

@ -3,18 +3,23 @@
#include <components/esm/loadacti.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld//cellstore.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwbase/environment.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
namespace MWClass
{
void Activator::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
assert (ref->base != NULL);
@ -30,7 +35,7 @@ namespace MWClass
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
@ -44,7 +49,7 @@ namespace MWClass
std::string Activator::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->name;
@ -52,7 +57,7 @@ namespace MWClass
std::string Activator::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->script;
@ -67,7 +72,7 @@ namespace MWClass
bool Activator::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return (ref->base->name != "");
@ -75,7 +80,7 @@ namespace MWClass
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
MWGui::ToolTipInfo info;

@ -3,16 +3,17 @@
#include <components/esm/loadappa.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionalchemy.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
@ -23,7 +24,7 @@ namespace MWClass
{
void Apparatus::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
assert (ref->base != NULL);
@ -39,7 +40,7 @@ namespace MWClass
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
@ -53,7 +54,7 @@ namespace MWClass
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->name;
@ -70,7 +71,7 @@ namespace MWClass
std::string Apparatus::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->script;
@ -78,7 +79,7 @@ namespace MWClass
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->data.value;
@ -103,7 +104,7 @@ namespace MWClass
std::string Apparatus::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->icon;
@ -111,7 +112,7 @@ namespace MWClass
bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return (ref->base->name != "");
@ -119,7 +120,7 @@ namespace MWClass
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
MWGui::ToolTipInfo info;

@ -5,19 +5,21 @@
#include <components/esm/loadskil.hpp>
#include <components/esm/loadgmst.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwsound/soundmanager.hpp"
@ -25,7 +27,7 @@ namespace MWClass
{
void Armor::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
assert (ref->base != NULL);
@ -41,7 +43,7 @@ namespace MWClass
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
const std::string &model = ref->base->model;
@ -54,7 +56,7 @@ namespace MWClass
std::string Armor::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->name;
@ -76,7 +78,7 @@ namespace MWClass
int Armor::getItemMaxHealth (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.health;
@ -84,7 +86,7 @@ namespace MWClass
std::string Armor::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->script;
@ -92,7 +94,7 @@ namespace MWClass
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
std::vector<int> slots;
@ -126,7 +128,7 @@ namespace MWClass
int Armor::getEquipmentSkill (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
std::string typeGmst;
@ -164,7 +166,7 @@ namespace MWClass
int Armor::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.value;
@ -201,7 +203,7 @@ namespace MWClass
std::string Armor::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->icon;
@ -209,7 +211,7 @@ namespace MWClass
bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return (ref->base->name != "");
@ -217,7 +219,7 @@ namespace MWClass
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
MWGui::ToolTipInfo info;
@ -260,7 +262,7 @@ namespace MWClass
std::string Armor::getEnchantment (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->enchant;

@ -3,17 +3,19 @@
#include <components/esm/loadbook.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actionread.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwsound/soundmanager.hpp"
@ -21,7 +23,7 @@ namespace MWClass
{
void Book::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
assert (ref->base != NULL);
@ -37,7 +39,7 @@ namespace MWClass
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
@ -51,7 +53,7 @@ namespace MWClass
std::string Book::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->name;
@ -66,7 +68,7 @@ namespace MWClass
std::string Book::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->script;
@ -74,7 +76,7 @@ namespace MWClass
int Book::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->data.value;
@ -99,7 +101,7 @@ namespace MWClass
std::string Book::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->icon;
@ -107,7 +109,7 @@ namespace MWClass
bool Book::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return (ref->base->name != "");
@ -115,7 +117,7 @@ namespace MWClass
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
MWGui::ToolTipInfo info;
@ -143,7 +145,7 @@ namespace MWClass
std::string Book::getEnchantment (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->enchant;

@ -3,20 +3,21 @@
#include <components/esm/loadclot.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -24,7 +25,7 @@ namespace MWClass
{
void Clothing::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
assert (ref->base != NULL);
@ -40,7 +41,7 @@ namespace MWClass
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
@ -54,7 +55,7 @@ namespace MWClass
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->name;
@ -71,7 +72,7 @@ namespace MWClass
std::string Clothing::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->script;
@ -79,7 +80,7 @@ namespace MWClass
std::pair<std::vector<int>, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
std::vector<int> slots;
@ -119,7 +120,7 @@ namespace MWClass
int Clothing::getEquipmentSkill (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type==ESM::Clothing::Shoes)
@ -130,7 +131,7 @@ namespace MWClass
int Clothing::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->data.value;
@ -145,7 +146,7 @@ namespace MWClass
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
@ -157,7 +158,7 @@ namespace MWClass
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
@ -169,7 +170,7 @@ namespace MWClass
std::string Clothing::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->icon;
@ -177,7 +178,7 @@ namespace MWClass
bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return (ref->base->name != "");
@ -185,7 +186,7 @@ namespace MWClass
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
MWGui::ToolTipInfo info;
@ -213,7 +214,7 @@ namespace MWClass
std::string Clothing::getEnchantment (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->enchant;

@ -3,21 +3,22 @@
#include <components/esm/loadcont.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/customdata.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/actionopen.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwworld/actionopen.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -53,7 +54,7 @@ namespace MWClass
void Container::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
assert (ref->base != NULL);
@ -69,7 +70,7 @@ namespace MWClass
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
@ -117,7 +118,7 @@ namespace MWClass
std::string Container::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->name;
@ -133,7 +134,7 @@ namespace MWClass
std::string Container::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->script;
@ -148,7 +149,7 @@ namespace MWClass
bool Container::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return (ref->base->name != "");
@ -156,7 +157,7 @@ namespace MWClass
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
MWGui::ToolTipInfo info;
@ -182,7 +183,7 @@ namespace MWClass
float Container::getCapacity (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->weight;
@ -192,4 +193,17 @@ namespace MWClass
{
return getContainerStore (ptr).getWeight();
}
void Container::lock (const MWWorld::Ptr& ptr, int lockLevel) const
{
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
}
void Container::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
}
}

@ -44,6 +44,12 @@ namespace MWClass
///< Returns total weight of objects inside this object (including modifications from magic
/// effects). Throws an exception, if the object can't hold other objects.
virtual void lock (const MWWorld::Ptr& ptr, int lockLevel) const;
///< Lock object
virtual void unlock (const MWWorld::Ptr& ptr) const;
///< Unlock object
static void registerSelf();
};
}

@ -13,8 +13,12 @@
#include "../mwworld/actiontalk.hpp"
#include "../mwworld/customdata.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
namespace
{
@ -40,7 +44,7 @@ namespace MWClass
{
std::auto_ptr<CustomData> data (new CustomData);
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref = ptr.get<ESM::Creature>();
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
// creature stats
data->mCreatureStats.mAttributes[0].set (ref->base->data.strength);
@ -57,6 +61,11 @@ namespace MWClass
data->mCreatureStats.mLevel = ref->base->data.level;
data->mCreatureStats.mHello = ref->base->AI.hello;
data->mCreatureStats.mFight = ref->base->AI.fight;
data->mCreatureStats.mFlee = ref->base->AI.flee;
data->mCreatureStats.mAlarm = ref->base->AI.alarm;
// store
ptr.getRefData().setCustomData (data.release());
}
@ -64,7 +73,7 @@ namespace MWClass
std::string Creature::getId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->mId;
@ -78,7 +87,7 @@ namespace MWClass
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
const std::string &model = ref->base->model;
@ -92,7 +101,7 @@ namespace MWClass
std::string Creature::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->name;
@ -121,7 +130,7 @@ namespace MWClass
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->script;
@ -143,7 +152,7 @@ namespace MWClass
MWGui::ToolTipInfo Creature::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
MWGui::ToolTipInfo info;

@ -3,20 +3,21 @@
#include <components/esm/loaddoor.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/actionteleport.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -24,7 +25,7 @@ namespace MWClass
{
void Door::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
assert (ref->base != NULL);
@ -40,7 +41,7 @@ namespace MWClass
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const std::string &model = ref->base->model;
@ -52,7 +53,7 @@ namespace MWClass
std::string Door::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
if (ref->ref.teleport && !ref->ref.destCell.empty()) // TODO doors that lead to exteriors
@ -64,7 +65,7 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const std::string &openSound = ref->base->openSound;
@ -134,7 +135,7 @@ namespace MWClass
std::string Door::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return ref->base->script;
@ -149,7 +150,7 @@ namespace MWClass
bool Door::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return (ref->base->name != "");
@ -157,7 +158,7 @@ namespace MWClass
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
MWGui::ToolTipInfo info;

@ -3,18 +3,19 @@
#include <components/esm/loadingr.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -22,7 +23,7 @@ namespace MWClass
{
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
assert (ref->base != NULL);
@ -38,7 +39,7 @@ namespace MWClass
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
const std::string &model = ref->base->model;
@ -50,7 +51,7 @@ namespace MWClass
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->name;
@ -67,7 +68,7 @@ namespace MWClass
std::string Ingredient::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->script;
@ -75,7 +76,7 @@ namespace MWClass
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->data.value;
@ -100,7 +101,7 @@ namespace MWClass
std::string Ingredient::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->icon;
@ -108,7 +109,7 @@ namespace MWClass
bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return (ref->base->name != "");
@ -116,7 +117,7 @@ namespace MWClass
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
MWGui::ToolTipInfo info;

@ -3,16 +3,16 @@
#include <components/esm/loadligh.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/nullaction.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
@ -20,12 +20,13 @@
#include "../mwsound/soundmanager.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
namespace MWClass
{
void Light::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
assert (ref->base != NULL);
@ -47,7 +48,7 @@ namespace MWClass
void Light::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
assert (ref->base != NULL);
@ -65,7 +66,7 @@ namespace MWClass
std::string Light::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (ref->base->model.empty())
@ -77,7 +78,7 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (!(ref->base->data.flags & ESM::Light::Carry))
@ -91,7 +92,7 @@ namespace MWClass
std::string Light::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->script;
@ -99,7 +100,7 @@ namespace MWClass
std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
std::vector<int> slots;
@ -112,7 +113,7 @@ namespace MWClass
int Light::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->data.value;
@ -138,7 +139,7 @@ namespace MWClass
std::string Light::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->icon;
@ -146,7 +147,7 @@ namespace MWClass
bool Light::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return (ref->base->name != "");
@ -154,7 +155,7 @@ namespace MWClass
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
MWGui::ToolTipInfo info;

@ -3,19 +3,21 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -23,7 +25,7 @@ namespace MWClass
{
void Lockpick::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
assert (ref->base != NULL);
@ -39,7 +41,7 @@ namespace MWClass
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
@ -54,7 +56,7 @@ namespace MWClass
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->name;
@ -71,7 +73,7 @@ namespace MWClass
std::string Lockpick::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->script;
@ -88,7 +90,7 @@ namespace MWClass
int Lockpick::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->data.value;
@ -113,7 +115,7 @@ namespace MWClass
std::string Lockpick::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->icon;
@ -121,7 +123,7 @@ namespace MWClass
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return (ref->base->name != "");
@ -129,7 +131,7 @@ namespace MWClass
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
MWGui::ToolTipInfo info;

@ -5,18 +5,19 @@
#include <components/esm/loadmisc.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -26,7 +27,7 @@ namespace MWClass
{
void Miscellaneous::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
assert (ref->base != NULL);
@ -42,7 +43,7 @@ namespace MWClass
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
@ -56,7 +57,7 @@ namespace MWClass
std::string Miscellaneous::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->name;
@ -73,7 +74,7 @@ namespace MWClass
std::string Miscellaneous::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->script;
@ -81,7 +82,7 @@ namespace MWClass
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->data.value;
@ -96,7 +97,7 @@ namespace MWClass
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
@ -108,7 +109,7 @@ namespace MWClass
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
@ -120,7 +121,7 @@ namespace MWClass
std::string Miscellaneous::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->icon;
@ -128,7 +129,7 @@ namespace MWClass
bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return (ref->base->name != "");
@ -136,7 +137,7 @@ namespace MWClass
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
MWGui::ToolTipInfo info;

@ -9,6 +9,9 @@
#include <components/esm/loadnpc.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwmechanics/movement.hpp"
@ -16,13 +19,15 @@
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/customdata.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwrender/actors.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwbase/environment.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
namespace
{
@ -53,7 +58,7 @@ namespace MWClass
{
std::auto_ptr<CustomData> data (new CustomData);
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref = ptr.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
// NPC stats
if (!ref->base->faction.empty())
@ -70,12 +75,12 @@ namespace MWClass
}
}
// creature stats
if(ref->base->npdt52.gold != -10)
{
for (int i=0; i<27; ++i)
data->mNpcStats.mSkill[i].setBase (ref->base->npdt52.skills[i]);
// creature stats
data->mCreatureStats.mAttributes[0].set (ref->base->npdt52.strength);
data->mCreatureStats.mAttributes[1].set (ref->base->npdt52.intelligence);
data->mCreatureStats.mAttributes[2].set (ref->base->npdt52.willpower);
@ -95,6 +100,11 @@ namespace MWClass
/// \todo do something with npdt12 maybe:p
}
data->mCreatureStats.mHello = ref->base->AI.hello;
data->mCreatureStats.mFight = ref->base->AI.fight;
data->mCreatureStats.mFlee = ref->base->AI.flee;
data->mCreatureStats.mAlarm = ref->base->AI.alarm;
// store
ptr.getRefData().setCustomData (data.release());
}
@ -102,7 +112,7 @@ namespace MWClass
std::string Npc::getId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->mId;
@ -115,14 +125,10 @@ namespace MWClass
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
assert (ref->base != NULL);
std::string headID = ref->base->head;
std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4);
bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_";
@ -130,15 +136,14 @@ namespace MWClass
std::string smodel = "meshes\\base_anim.nif";
if(beast)
smodel = "meshes\\base_animkna.nif";
physics.insertActorPhysics(ptr, smodel);
physics.insertActorPhysics(ptr, smodel);
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
}
std::string Npc::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->name;
@ -182,7 +187,7 @@ namespace MWClass
std::string Npc::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->script;
@ -302,7 +307,7 @@ namespace MWClass
MWGui::ToolTipInfo Npc::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
MWGui::ToolTipInfo info;

@ -3,18 +3,19 @@
#include <components/esm/loadalch.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -22,7 +23,7 @@ namespace MWClass
{
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
assert (ref->base != NULL);
@ -38,7 +39,7 @@ namespace MWClass
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
@ -52,7 +53,7 @@ namespace MWClass
std::string Potion::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->name;
@ -69,7 +70,7 @@ namespace MWClass
std::string Potion::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->script;
@ -77,7 +78,7 @@ namespace MWClass
int Potion::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->data.value;
@ -102,7 +103,7 @@ namespace MWClass
std::string Potion::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->icon;
@ -110,7 +111,7 @@ namespace MWClass
bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return (ref->base->name != "");
@ -118,7 +119,7 @@ namespace MWClass
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
MWGui::ToolTipInfo info;

@ -3,19 +3,21 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -23,7 +25,7 @@ namespace MWClass
{
void Probe::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
assert (ref->base != NULL);
@ -39,7 +41,7 @@ namespace MWClass
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
@ -54,7 +56,7 @@ namespace MWClass
std::string Probe::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->name;
@ -70,7 +72,7 @@ namespace MWClass
std::string Probe::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->script;
@ -87,7 +89,7 @@ namespace MWClass
int Probe::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->data.value;
@ -112,7 +114,7 @@ namespace MWClass
std::string Probe::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->icon;
@ -120,7 +122,7 @@ namespace MWClass
bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return (ref->base->name != "");
@ -128,7 +130,7 @@ namespace MWClass
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
MWGui::ToolTipInfo info;

@ -3,17 +3,19 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -21,7 +23,7 @@ namespace MWClass
{
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
assert (ref->base != NULL);
@ -37,7 +39,7 @@ namespace MWClass
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
@ -51,7 +53,7 @@ namespace MWClass
std::string Repair::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->name;
@ -68,7 +70,7 @@ namespace MWClass
std::string Repair::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->script;
@ -76,7 +78,7 @@ namespace MWClass
int Repair::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->data.value;
@ -101,7 +103,7 @@ namespace MWClass
std::string Repair::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->icon;
@ -109,7 +111,7 @@ namespace MWClass
bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return (ref->base->name != "");
@ -117,7 +119,7 @@ namespace MWClass
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
MWGui::ToolTipInfo info;

@ -4,14 +4,16 @@
#include <components/esm/loadstat.hpp>
#include "../mwworld/ptr.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
namespace MWClass
{
void Static::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Static> *ref =
ptr.get<ESM::Static>();
assert (ref->base != NULL);
@ -27,7 +29,7 @@ namespace MWClass
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Static, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Static> *ref =
ptr.get<ESM::Static>();
assert (ref->base != NULL);

@ -3,20 +3,21 @@
#include <components/esm/loadweap.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/actionequip.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/cellstore.hpp"
#include "../mwworld/physicssystem.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/tooltips.hpp"
#include "../mwrender/objects.hpp"
#include "../mwrender/renderinginterface.hpp"
#include "../mwsound/soundmanager.hpp"
@ -24,7 +25,7 @@ namespace MWClass
{
void Weapon::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
assert (ref->base != NULL);
@ -40,7 +41,7 @@ namespace MWClass
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
@ -54,7 +55,7 @@ namespace MWClass
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->name;
@ -76,7 +77,7 @@ namespace MWClass
int Weapon::getItemMaxHealth (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.health;
@ -84,7 +85,7 @@ namespace MWClass
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->script;
@ -92,7 +93,7 @@ namespace MWClass
std::pair<std::vector<int>, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
std::vector<int> slots;
@ -116,7 +117,7 @@ namespace MWClass
int Weapon::getEquipmentSkill (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
const int size = 12;
@ -146,7 +147,7 @@ namespace MWClass
int Weapon::getValue (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.value;
@ -161,7 +162,7 @@ namespace MWClass
std::string Weapon::getUpSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
@ -207,7 +208,7 @@ namespace MWClass
std::string Weapon::getDownSoundId (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
@ -253,7 +254,7 @@ namespace MWClass
std::string Weapon::getInventoryIcon (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->icon;
@ -261,7 +262,7 @@ namespace MWClass
bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return (ref->base->name != "");
@ -269,7 +270,7 @@ namespace MWClass
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
MWGui::ToolTipInfo info;
@ -351,7 +352,7 @@ namespace MWClass
std::string Weapon::getEnchantment (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->enchant;

@ -10,9 +10,9 @@
#include <components/esm_store/store.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/refdata.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/containerstore.hpp"
@ -121,24 +121,24 @@ namespace
}
template<typename T>
bool checkGlobal (char comp, const std::string& name, T value, MWWorld::World& world)
bool checkGlobal (char comp, const std::string& name, T value)
{
switch (world.getGlobalVariableType (name))
switch (MWBase::Environment::get().getWorld()->getGlobalVariableType (name))
{
case 's':
return selectCompare (comp, world.getGlobalVariable (name).mShort, value);
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mShort, value);
case 'l':
return selectCompare (comp, world.getGlobalVariable (name).mLong, value);
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mLong, value);
case 'f':
return selectCompare (comp, world.getGlobalVariable (name).mFloat, value);
return selectCompare (comp, MWBase::Environment::get().getWorld()->getGlobalVariable (name).mFloat, value);
case ' ':
world.getGlobalVariable (name); // trigger exception
MWBase::Environment::get().getWorld()->getGlobalVariable (name); // trigger exception
break;
default:
@ -309,12 +309,12 @@ namespace MWDialogue
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
{
if (!checkGlobal (comp, toLower (name), select.i, *MWBase::Environment::get().getWorld()))
if (!checkGlobal (comp, toLower (name), select.i))
return false;
}
else if (select.type==ESM::VT_Float)
{
if (!checkGlobal (comp, toLower (name), select.f, *MWBase::Environment::get().getWorld()))
if (!checkGlobal (comp, toLower (name), select.f))
return false;
}
else
@ -392,7 +392,7 @@ namespace MWDialogue
if(select.type==ESM::VT_Int)
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isFaction = int(toLower(npc->base->faction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.i))
return false;
@ -409,7 +409,7 @@ namespace MWDialogue
if(select.type==ESM::VT_Int)
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isClass = int(toLower(npc->base->cls) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.i))
return false;
@ -426,7 +426,7 @@ namespace MWDialogue
if(select.type==ESM::VT_Int)
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isRace = int(toLower(npc->base->race) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.i))
return false;
@ -493,7 +493,7 @@ namespace MWDialogue
if (isCreature)
return false;
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC> *cellRef = actor.get<ESM::NPC>();
if (!cellRef)
return false;
@ -508,7 +508,7 @@ namespace MWDialogue
if (isCreature)
return false;
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *cellRef = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC> *cellRef = actor.get<ESM::NPC>();
if (!cellRef)
return false;
@ -558,7 +558,7 @@ namespace MWDialogue
//check gender
if (!isCreature)
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* npc = actor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
if(npc->base->flags&npc->base->Female)
{
if(static_cast<int> (info.data.gender)==0) return false;
@ -706,7 +706,7 @@ namespace MWDialogue
}
return false;
}
catch (const Compiler::SourceException& error)
catch (const Compiler::SourceException& /* error */)
{
// error has already been reported via error handler
}
@ -771,13 +771,13 @@ namespace MWDialogue
int services = 0;
if (mActor.getTypeName() == typeid(ESM::NPC).name())
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* ref = mActor.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* ref = mActor.get<ESM::NPC>();
if (ref->base->hasAI)
services = ref->base->AI.services;
}
else if (mActor.getTypeName() == typeid(ESM::Creature).name())
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData>* ref = mActor.get<ESM::Creature>();
MWWorld::LiveCellRef<ESM::Creature>* ref = mActor.get<ESM::Creature>();
if (ref->base->hasAI)
services = ref->base->AI.services;
}
@ -843,7 +843,7 @@ namespace MWDialogue
void DialogueManager::goodbyeSelected()
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
}
void DialogueManager::questionAnswered(std::string answere)

@ -2,12 +2,11 @@
#include "journal.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwgui/messagebox.hpp"
#include "../mwworld/world.hpp"
namespace MWDialogue
{
Quest& Journal::getQuest (const std::string& id)
@ -30,14 +29,13 @@ namespace MWDialogue
void Journal::addEntry (const std::string& id, int index)
{
StampedJournalEntry entry =
StampedJournalEntry::makeFromQuest (id, index, *MWBase::Environment::get().getWorld());
StampedJournalEntry entry = StampedJournalEntry::makeFromQuest (id, index);
mJournal.push_back (entry);
Quest& quest = getQuest (id);
quest.addEntry (entry, *MWBase::Environment::get().getWorld()); // we are doing slicing on purpose here
quest.addEntry (entry); // we are doing slicing on purpose here
std::vector<std::string> empty;
std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str;
@ -48,7 +46,7 @@ namespace MWDialogue
{
Quest& quest = getQuest (id);
quest.setIndex (index, *MWBase::Environment::get().getWorld());
quest.setIndex (index);
}
void Journal::addTopic (const std::string& topicId, const std::string& infoId)
@ -63,7 +61,7 @@ namespace MWDialogue
iter = result.first;
}
iter->second.addEntry (JournalEntry (topicId, infoId), *MWBase::Environment::get().getWorld());
iter->second.addEntry (JournalEntry (topicId, infoId));
}
int Journal::getJournalIndex (const std::string& id) const

@ -5,7 +5,8 @@
#include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWDialogue
{
@ -27,16 +28,14 @@ namespace MWDialogue
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
}
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index,
const MWWorld::World& world)
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index)
{
return JournalEntry (topic, idFromIndex (topic, index, world));
return JournalEntry (topic, idFromIndex (topic, index));
}
std::string JournalEntry::idFromIndex (const std::string& topic, int index,
const MWWorld::World& world)
std::string JournalEntry::idFromIndex (const std::string& topic, int index)
{
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (topic);
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
@ -57,13 +56,12 @@ namespace MWDialogue
: JournalEntry (topic, infoId), mDay (day), mMonth (month), mDayOfMonth (dayOfMonth)
{}
StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index,
const MWWorld::World& world)
StampedJournalEntry StampedJournalEntry::makeFromQuest (const std::string& topic, int index)
{
int day = world.getGlobalVariable ("dayspassed").mLong;
int month = world.getGlobalVariable ("day").mLong;
int dayOfMonth = world.getGlobalVariable ("month").mLong;
int day = MWBase::Environment::get().getWorld()->getGlobalVariable ("dayspassed").mLong;
int month = MWBase::Environment::get().getWorld()->getGlobalVariable ("day").mLong;
int dayOfMonth = MWBase::Environment::get().getWorld()->getGlobalVariable ("month").mLong;
return StampedJournalEntry (topic, idFromIndex (topic, index, world), day, month, dayOfMonth);
return StampedJournalEntry (topic, idFromIndex (topic, index), day, month, dayOfMonth);
}
}

@ -8,11 +8,6 @@ namespace ESMS
struct ESMStore;
}
namespace MWWorld
{
class World;
}
namespace MWDialogue
{
/// \brief A quest or dialogue entry
@ -27,11 +22,9 @@ namespace MWDialogue
std::string getText (const ESMS::ESMStore& store) const;
static JournalEntry makeFromQuest (const std::string& topic, int index,
const MWWorld::World& world);
static JournalEntry makeFromQuest (const std::string& topic, int index);
static std::string idFromIndex (const std::string& topic, int index,
const MWWorld::World& world);
static std::string idFromIndex (const std::string& topic, int index);
};
/// \biref A quest entry with a timestamp.
@ -46,8 +39,7 @@ namespace MWDialogue
StampedJournalEntry (const std::string& topic, const std::string& infoId,
int day, int month, int dayOfMonth);
static StampedJournalEntry makeFromQuest (const std::string& topic, int index,
const MWWorld::World& world);
static StampedJournalEntry makeFromQuest (const std::string& topic, int index);
};
}

@ -3,7 +3,8 @@
#include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWDialogue
{
@ -15,9 +16,9 @@ namespace MWDialogue
: Topic (topic), mIndex (0), mFinished (false)
{}
const std::string Quest::getName (const MWWorld::World& world) const
const std::string Quest::getName() const
{
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic);
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
@ -32,9 +33,9 @@ namespace MWDialogue
return mIndex;
}
void Quest::setIndex (int index, const MWWorld::World& world)
void Quest::setIndex (int index)
{
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (mTopic);
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
@ -58,11 +59,11 @@ namespace MWDialogue
return mFinished;
}
void Quest::addEntry (const JournalEntry& entry, const MWWorld::World& world)
void Quest::addEntry (const JournalEntry& entry)
{
int index = -1;
const ESM::Dialogue *dialogue = world.getStore().dialogs.find (entry.mTopic);
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
@ -75,7 +76,7 @@ namespace MWDialogue
if (index==-1)
throw std::runtime_error ("unknown journal entry for topic " + mTopic);
setIndex (index, world);
setIndex (index);
for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter)
if (*iter==entry.mInfoId)

@ -17,17 +17,17 @@ namespace MWDialogue
Quest (const std::string& topic);
const std::string getName (const MWWorld::World& world) const;
const std::string getName() const;
///< May be an empty string
int getIndex() const;
void setIndex (int index, const MWWorld::World& world);
void setIndex (int index);
///< Calling this function with a non-existant index while throw an exception.
bool isFinished() const;
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world);
virtual void addEntry (const JournalEntry& entry);
///< Add entry and adjust index accordingly.
///
/// \note Redundant entries are ignored, but the index is still adjusted.

@ -3,8 +3,6 @@
#include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp"
namespace MWDialogue
{
Topic::Topic()
@ -17,7 +15,7 @@ namespace MWDialogue
Topic::~Topic()
{}
void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world)
void Topic::addEntry (const JournalEntry& entry)
{
if (entry.mTopic!=mTopic)
throw std::runtime_error ("topic does not match: " + mTopic);

@ -6,11 +6,6 @@
#include "journalentry.hpp"
namespace MWWorld
{
class World;
}
namespace MWDialogue
{
/// \brief Collection of seen responses for a topic
@ -34,7 +29,7 @@ namespace MWDialogue
virtual ~Topic();
virtual void addEntry (const JournalEntry& entry, const MWWorld::World& world);
virtual void addEntry (const JournalEntry& entry);
///< Add entry
///
/// \note Redundant entries are ignored.

@ -3,10 +3,12 @@
#include <boost/algorithm/string.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp"
@ -27,7 +29,7 @@ namespace
namespace MWGui
{
AlchemyWindow::AlchemyWindow(WindowManager& parWindowManager)
: WindowBase("openmw_alchemy_window_layout.xml", parWindowManager)
: WindowBase("openmw_alchemy_window.layout", parWindowManager)
, ContainerBase(0)
{
getWidget(mCreateButton, "CreateButton");
@ -70,8 +72,8 @@ namespace MWGui
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{
mWindowManager.popGuiMode();
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Alchemy);
mWindowManager.removeGuiMode(GM_Inventory);
}
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
@ -275,7 +277,7 @@ namespace MWGui
for (MWWorld::ContainerStoreIterator it(store.begin(MWWorld::ContainerStore::Type_Apparatus));
it != store.end(); ++it)
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData>* ref = it->get<ESM::Apparatus>();
MWWorld::LiveCellRef<ESM::Apparatus>* ref = it->get<ESM::Apparatus>();
if (ref->base->data.type == ESM::Apparatus::Albemic
&& (bestAlbemic.isEmpty() || ref->base->data.quality > bestAlbemic.get<ESM::Apparatus>()->base->data.quality))
bestAlbemic = *it;
@ -420,7 +422,7 @@ namespace MWGui
continue;
// add the effects of this ingredient to list of effects
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
MWWorld::LiveCellRef<ESM::Ingredient>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
for (int i=0; i<4; ++i)
{
if (ref->base->data.effectID[i] < 0)

@ -3,6 +3,7 @@
#include "window_base.hpp"
#include "container.hpp"
#include "widgets.hpp"
namespace MWGui
{

@ -10,7 +10,7 @@ using namespace MWGui;
using namespace Widgets;
BirthDialog::BirthDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_birth_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_birth.layout", parWindowManager)
{
// Centre dialog
center();

@ -5,7 +5,7 @@
/*
This file contains the dialog for choosing a birth sign.
Layout is defined by resources/mygui/openmw_chargen_race_layout.xml.
Layout is defined by resources/mygui/openmw_chargen_race.layout.
*/
namespace MWGui

@ -13,7 +13,7 @@
using namespace MWGui;
BookWindow::BookWindow (WindowManager& parWindowManager) :
WindowBase("openmw_book_layout.xml", parWindowManager)
WindowBase("openmw_book.layout", parWindowManager)
{
getWidget(mCloseButton, "CloseButton");
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BookWindow::onCloseButtonClicked);
@ -55,8 +55,7 @@ void BookWindow::open (MWWorld::Ptr book)
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0);
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
mBook.get<ESM::Book>();
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
BookTextParser parser;
std::vector<std::string> results = parser.split(ref->base->text, mLeftPage->getSize().width, mLeftPage->getSize().height);
@ -92,7 +91,7 @@ void BookWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
// no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0);
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Book);
}
void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -102,7 +101,7 @@ void BookWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mBook);
take.execute();
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Book);
}
void BookWindow::onNextPageButtonClicked (MyGUI::Widget* _sender)

@ -708,6 +708,9 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
if (mGenerateClassResultDialog)
mWM->removeDialog(mGenerateClassResultDialog);
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
mPlayerClass = *klass;
mWM->setPlayerClass(mPlayerClass);
if (mCreationStage == CSE_ReviewNext)
{

@ -3,10 +3,12 @@
#include "window_manager.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/world.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwmechanics/stat.hpp"
#include "../mwworld/world.hpp"
#include <components/esm_store/store.hpp>
namespace MWGui
{

@ -19,7 +19,7 @@ using namespace MWGui;
/* GenerateClassResultDialog */
GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_generate_class_result_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
{
// Centre dialog
center();
@ -77,7 +77,7 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
/* PickClassDialog */
PickClassDialog::PickClassDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_class_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_class.layout", parWindowManager)
{
// Centre dialog
center();
@ -283,7 +283,7 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
}
InfoBoxDialog::InfoBoxDialog(WindowManager& parWindowManager)
: WindowBase("openmw_infobox_layout.xml", parWindowManager)
: WindowBase("openmw_infobox.layout", parWindowManager)
, currentButton(-1)
{
getWidget(textBox, "TextBox");
@ -381,7 +381,7 @@ ClassChoiceDialog::ClassChoiceDialog(WindowManager& parWindowManager)
/* CreateClassDialog */
CreateClassDialog::CreateClassDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_create_class_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_create_class.layout", parWindowManager)
, specDialog(nullptr)
, attribDialog(nullptr)
, skillDialog(nullptr)
@ -703,7 +703,7 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
/* SelectSpecializationDialog */
SelectSpecializationDialog::SelectSpecializationDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_select_specialization_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_select_specialization.layout", parWindowManager)
{
// Centre dialog
center();
@ -768,7 +768,7 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
/* SelectAttributeDialog */
SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_select_attribute_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_select_attribute.layout", parWindowManager)
{
// Centre dialog
center();
@ -820,7 +820,7 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
/* SelectSkillDialog */
SelectSkillDialog::SelectSkillDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_select_skill_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_select_skill.layout", parWindowManager)
{
// Centre dialog
center();
@ -916,7 +916,7 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
/* DescriptionDialog */
DescriptionDialog::DescriptionDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_class_description_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_class_description.layout", parWindowManager)
{
// Centre dialog
center();

@ -7,7 +7,7 @@
/*
This file contains the dialogs for choosing a class.
Layout is defined by resources/mygui/openmw_chargen_class_layout.xml.
Layout is defined by resources/mygui/openmw_chargen_class.layout.
*/
namespace MWGui

@ -3,12 +3,12 @@
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
namespace MWGui
{
ConfirmationDialog::ConfirmationDialog(WindowManager& parWindowManager) :
WindowBase("openmw_confirmation_dialog_layout.xml", parWindowManager)
WindowBase("openmw_confirmation_dialog.layout", parWindowManager)
{
getWidget(mMessage, "Message");
getWidget(mOkButton, "OkButton");

@ -3,6 +3,9 @@
#include <algorithm>
#include <components/esm_store/reclists.hpp>
#include <components/esm_store/store.hpp>
#include <components/compiler/exception.hpp>
#include "../mwscript/extensions.hpp"
@ -103,7 +106,7 @@ namespace MWGui
}
Console::Console(int w, int h, const Compiler::Extensions& extensions)
: Layout("openmw_console_layout.xml"),
: Layout("openmw_console.layout"),
mCompilerContext (MWScript::CompilerContext::Type_Console)
{
setCoord(10,10, w-10, h/2);

@ -3,19 +3,23 @@
#include <cmath>
#include <algorithm>
#include <iterator>
#include <assert.h>
#include <cassert>
#include <iostream>
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/player.hpp"
#include "../mwclass/container.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp"
@ -273,7 +277,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
// check the container's Organic flag (if this is a container). container with Organic flag doesn't allow putting items inside
if (mPtr.getTypeName() == typeid(ESM::Container).name())
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData>* ref = mPtr.get<ESM::Container>();
MWWorld::LiveCellRef<ESM::Container>* ref = mPtr.get<ESM::Container>();
if (ref->base->flags & ESM::Container::Organic)
{
// user notification
@ -556,7 +560,7 @@ void ContainerBase::addItem(MWWorld::Ptr item, int count)
{
MWWorld::ContainerStore& containerStore = MWWorld::Class::get(mPtr).getContainerStore(mPtr);
int origCount = item.getRefData().getCount();
int origCount = item.getRefData().getCount();
item.getRefData().setCount(count);
MWWorld::ContainerStoreIterator it = containerStore.add(item);
@ -592,7 +596,7 @@ MWWorld::ContainerStore& ContainerBase::getContainerStore()
ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
: ContainerBase(dragAndDrop)
, WindowBase("openmw_container_window_layout.xml", parWindowManager)
, WindowBase("openmw_container_window.layout", parWindowManager)
{
getWidget(mTakeButton, "TakeButton");
getWidget(mCloseButton, "CloseButton");
@ -612,12 +616,9 @@ ContainerWindow::ContainerWindow(WindowManager& parWindowManager,DragAndDrop* dr
mCloseButton->setCoord(600-20-closeButtonWidth, mCloseButton->getCoord().top, closeButtonWidth, mCloseButton->getCoord().height);
mTakeButton->setCoord(600-20-closeButtonWidth-takeButtonWidth-8, mTakeButton->getCoord().top, takeButtonWidth, mTakeButton->getCoord().height);
int w = MyGUI::RenderManager::getInstance().getViewSize().width;
//int h = MyGUI::RenderManager::getInstance().getViewSize().height;
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &ContainerWindow::onWindowResize);
setCoord(w-600,0,600,300);
setCoord(200,0,600,300);
}
ContainerWindow::~ContainerWindow()
@ -640,7 +641,7 @@ void ContainerWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
if(mDragAndDrop == NULL || !mDragAndDrop->mIsOnDragAndDrop)
{
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
}
}
@ -671,7 +672,7 @@ void ContainerWindow::onTakeAllButtonClicked(MyGUI::Widget* _sender)
containerStore.clear();
MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
}
}

@ -3,12 +3,12 @@
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
namespace MWGui
{
CountDialog::CountDialog(WindowManager& parWindowManager) :
WindowBase("openmw_count_window_layout.xml", parWindowManager)
WindowBase("openmw_count_window.layout", parWindowManager)
{
getWidget(mSlider, "CountSlider");
getWidget(mItemEdit, "ItemEdit");
@ -77,7 +77,7 @@ namespace MWGui
{
if (_sender->getCaption() == "")
return;
unsigned int count;
try
{

@ -43,7 +43,7 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
: WindowBase("openmw_dialogue_window_layout.xml", parWindowManager)
: WindowBase("openmw_dialogue_window.layout", parWindowManager)
, mEnabled(true)
, mShowTrade(false)
{
@ -205,11 +205,14 @@ void addColorInString(std::string& str, const std::string& keyword,std::string c
std::string DialogueWindow::parseText(std::string text)
{
bool separatorReached = false; // only parse topics that are below the separator (this prevents actions like "Barter" that are not topics from getting blue-colored)
for(unsigned int i = 0;i<topicsList->getItemCount();i++)
{
std::string keyWord = topicsList->getItemNameAt(i);
if (keyWord != "")
if (separatorReached && keyWord != "")
addColorInString(text,keyWord,"#686EBA","#B29154");
else
separatorReached = true;
}
return text;
}

@ -19,7 +19,7 @@ namespace MWGui
/*
This file contains the dialouge window
Layout is defined by resources/mygui/openmw_dialogue_window_layout.xml.
Layout is defined by resources/mygui/openmw_dialogue_window.layout.
*/
namespace MWGui

@ -7,11 +7,15 @@
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwgui/widgets.hpp"
#include "inventorywindow.hpp"
#include "window_manager.hpp"
#include "container.hpp"
@ -20,7 +24,7 @@
using namespace MWGui;
HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
: Layout("openmw_hud_layout.xml")
: Layout("openmw_hud.layout")
, health(NULL)
, magicka(NULL)
, stamina(NULL)
@ -143,12 +147,12 @@ void HUD::setFPS(float fps)
fpscounter->setCaption(boost::lexical_cast<std::string>((int)fps));
}
void HUD::setTriangleCount(size_t count)
void HUD::setTriangleCount(unsigned int count)
{
trianglecounter->setCaption(boost::lexical_cast<std::string>(count));
}
void HUD::setBatchCount(size_t count)
void HUD::setBatchCount(unsigned int count)
{
batchcounter->setCaption(boost::lexical_cast<std::string>(count));
}
@ -239,7 +243,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
// drop item into the gameworld
MWWorld::Ptr object = *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>();
MWWorld::World* world = MWBase::Environment::get().getWorld();
MWBase::World* world = MWBase::Environment::get().getWorld();
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
@ -282,7 +286,7 @@ void HUD::onWorldClicked(MyGUI::Widget* _sender)
{
object = MWBase::Environment::get().getWorld()->getPtrViaHandle(handle);
}
catch (std::exception& e)
catch (std::exception& /* e */)
{
return;
}
@ -308,7 +312,7 @@ void HUD::onWorldMouseOver(MyGUI::Widget* _sender, int x, int y)
float mouseX = cursorPosition.left / float(viewSize.width);
float mouseY = cursorPosition.top / float(viewSize.height);
MWWorld::World* world = MWBase::Environment::get().getWorld();
MWBase::World* world = MWBase::Environment::get().getWorld();
// if we can't drop the object at the wanted position, show the "drop on ground" cursor.
bool canDrop = world->canPlaceObject(mouseX, mouseY);

@ -16,8 +16,8 @@ namespace MWGui
void setEffect(const char *img);
void setValue (const std::string& id, const MWMechanics::DynamicStat<int>& value);
void setFPS(float fps);
void setTriangleCount(size_t count);
void setBatchCount(size_t count);
void setTriangleCount(unsigned int count);
void setBatchCount(unsigned int count);
void setBottomLeftVisibility(bool hmsVisible, bool weapVisible, bool spellVisible);
void setBottomRightVisibility(bool effectBoxVisible, bool minimapVisible);
void setFpsLevel(const int level);

@ -3,21 +3,24 @@
#include <cmath>
#include <algorithm>
#include <iterator>
#include <assert.h>
#include <iostream>
#include <cassert>
#include <boost/lexical_cast.hpp>
#include "../mwclass/container.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwclass/container.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "bookwindow.hpp"
@ -42,7 +45,7 @@ namespace MWGui
InventoryWindow::InventoryWindow(WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
: ContainerBase(dragAndDrop)
, WindowPinnableBase("openmw_inventory_window_layout.xml", parWindowManager)
, WindowPinnableBase("openmw_inventory_window.layout", parWindowManager)
, mTrading(false)
{
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);
@ -171,7 +174,7 @@ namespace MWGui
/// \todo scripts
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr);
action->execute();
// this is necessary for books/scrolls: if they are already in the player's inventory,
@ -307,6 +310,9 @@ namespace MWGui
&& (type != typeid(ESM::Potion).name()))
return;
if (MWWorld::Class::get(object).getName(object) == "") // objects without name presented to user can never be picked up
return;
// sound
std::string sound = MWWorld::Class::get(object).getUpSoundId(object);
MWBase::Environment::get().getSoundManager()->playSound(sound, 1, 1);

@ -1,11 +1,14 @@
#include "journalwindow.hpp"
#include "window_manager.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwdialogue/journal.hpp"
#include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp"
namespace
{
struct book
@ -80,7 +83,7 @@ book formatText(std::string text,book mBook,int maxLine, int lineSize)
MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager)
: WindowBase("openmw_journal_layout.xml", parWindowManager)
: WindowBase("openmw_journal.layout", parWindowManager)
, lastPos(0)
, mVisible(false)
{

@ -7,7 +7,7 @@ namespace MWGui
{
public:
MainMenu(int w, int h)
: Layout("openmw_mainmenu_layout.xml")
: Layout("openmw_mainmenu.layout")
{
setCoord(0,0,w,h);
}

@ -155,7 +155,7 @@ void LocalMapBase::setPlayerDir(const float x, const float y)
// ------------------------------------------------------------------------------------------
MapWindow::MapWindow(WindowManager& parWindowManager) :
MWGui::WindowPinnableBase("openmw_map_window_layout.xml", parWindowManager),
MWGui::WindowPinnableBase("openmw_map_window.layout", parWindowManager),
mGlobal(false)
{
setCoord(500,0,320,300);

@ -58,7 +58,7 @@ void MessageBoxManager::onFrame (float frameDuration)
if(mInterMessageBoxe != NULL && mInterMessageBoxe->mMarkedToDelete) {
delete mInterMessageBoxe;
mInterMessageBoxe = NULL;
mWindowManager->popGuiMode();
mWindowManager->removeGuiMode(GM_InterMessageBox);
}
}
@ -86,13 +86,12 @@ void MessageBoxManager::createMessageBox (const std::string& message)
bool MessageBoxManager::createInteractiveMessageBox (const std::string& message, const std::vector<std::string>& buttons)
{
/// \todo Don't write this kind of error message to cout. Either discard the old message box
/// silently or throw an exception.
if(mInterMessageBoxe != NULL) {
std::cout << "there is a MessageBox already" << std::endl;
return false;
}
std::cout << "interactive MessageBox: " << message << " - ";
std::copy (buttons.begin(), buttons.end(), std::ostream_iterator<std::string> (std::cout, ", "));
std::cout << std::endl;
mInterMessageBoxe = new InteractiveMessageBox(*this, message, buttons);
@ -148,7 +147,7 @@ int MessageBoxManager::readPressedButton ()
MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message)
: Layout("openmw_messagebox_layout.xml")
: Layout("openmw_messagebox.layout")
, mMessageBoxManager(parMessageBoxManager)
, cMessage(message)
{
@ -178,7 +177,7 @@ MessageBox::MessageBox(MessageBoxManager& parMessageBoxManager, const std::strin
size.height = mHeight = textSize.height + 20; // this is the padding between the text and the box
mMainWidget->setSize(size);
size.width -= 15; // this is to center the text (see messagebox_layout.xml, Widget type="Edit" position="-2 -3 0 0")
size.width -= 15; // this is to center the text (see messagebox.layout, Widget type="Edit" position="-2 -3 0 0")
mMessageWidget->setSize(size);
}
@ -206,7 +205,7 @@ int MessageBox::getHeight ()
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
: Layout("openmw_interactive_messagebox_layout.xml")
: Layout("openmw_interactive_messagebox.layout")
, mMessageBoxManager(parMessageBoxManager)
, mButtonPressed(-1)
{
@ -266,11 +265,8 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
if(buttonsWidth < fixedWidth)
{
// on one line
std::cout << "on one line" << std::endl;
if(textSize.width + 2*textPadding < buttonsWidth)
{
std::cout << "width = buttonsWidth" << std::endl;
mainWidgetSize.width = buttonsWidth;
}
else
@ -283,13 +279,9 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;
std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl;
std::cout << "left " << absCoord.left << " top " << absCoord.top << std::endl;
mMainWidget->setCoord(absCoord);
mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord messageWidgetCoord;
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
messageWidgetCoord.top = textPadding;
@ -319,7 +311,6 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
else
{
// among each other
if(biggestButtonWidth > textSize.width) {
mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
}
@ -328,8 +319,6 @@ InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxMan
}
mainWidgetSize.height = textSize.height + 2*textPadding + textButtonPadding + buttonHeight * buttons.size() + buttonMainPadding;
std::cout << "biggestButtonWidth " << biggestButtonWidth << " textSize.width " << textSize.width << std::endl;
std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl;
mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord absCoord;
@ -384,7 +373,6 @@ void InteractiveMessageBox::mousePressed (MyGUI::Widget* pressed)
}
index++;
}
std::cout << "Cant be possible :/" << std::endl;
}
int InteractiveMessageBox::readPressedButton ()

@ -17,7 +17,7 @@ using namespace MWGui;
using namespace Widgets;
RaceDialog::RaceDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_race_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_race.layout", parWindowManager)
, genderIndex(0)
, faceIndex(0)
, hairIndex(0)

@ -14,7 +14,7 @@ namespace MWGui
/*
This file contains the dialog for choosing a race.
Layout is defined by resources/mygui/openmw_chargen_race_layout.xml.
Layout is defined by resources/mygui/openmw_chargen_race.layout.
*/
namespace MWGui

@ -1,9 +1,10 @@
#include "referenceinterface.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/player.hpp"
namespace MWGui
{
ReferenceInterface::ReferenceInterface()
@ -11,6 +12,10 @@ namespace MWGui
{
}
ReferenceInterface::~ReferenceInterface()
{
}
void ReferenceInterface::checkReferenceAvailable()
{
if (mPtr.isEmpty())

@ -13,6 +13,7 @@ namespace MWGui
{
public:
ReferenceInterface();
virtual ~ReferenceInterface();
void checkReferenceAvailable(); ///< closes the window, if the MW-reference has become unavailable
@ -22,7 +23,7 @@ namespace MWGui
MWWorld::Ptr mPtr;
private:
MWWorld::Ptr::CellStore* mCurrentPlayerCell;
MWWorld::CellStore* mCurrentPlayerCell;
};
}

@ -20,7 +20,7 @@ using namespace Widgets;
const int ReviewDialog::lineHeight = 18;
ReviewDialog::ReviewDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_review_layout.xml", parWindowManager)
: WindowBase("openmw_chargen_review.layout", parWindowManager)
, lastPos(0)
{
// Centre dialog

@ -12,7 +12,7 @@ namespace MWGui
/*
This file contains the dialog for reviewing the generated character.
Layout is defined by resources/mygui/openmw_chargen_review_layout.xml.
Layout is defined by resources/mygui/openmw_chargen_review.layout.
*/
namespace MWGui

@ -11,7 +11,7 @@
using namespace MWGui;
ScrollWindow::ScrollWindow (WindowManager& parWindowManager) :
WindowBase("openmw_scroll_layout.xml", parWindowManager)
WindowBase("openmw_scroll.layout", parWindowManager)
{
getWidget(mTextView, "TextView");
@ -31,8 +31,7 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
mScroll = scroll;
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
mScroll.get<ESM::Book>();
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
BookTextParser parser;
MyGUI::IntSize size = parser.parse(ref->base->text, mTextView, 390);
@ -56,7 +55,7 @@ void ScrollWindow::onCloseButtonClicked (MyGUI::Widget* _sender)
{
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Scroll);
}
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
@ -66,5 +65,5 @@ void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
MWWorld::ActionTake take(mScroll);
take.execute();
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Scroll);
}

@ -5,12 +5,18 @@
#include <OgreString.h>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/math/common_factor_rt.hpp>
#include <components/settings/settings.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwsound/soundmanager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "window_manager.hpp"
@ -39,12 +45,41 @@ namespace
else
return "Trilinear";
}
void parseResolution (int &x, int &y, const std::string& str)
{
std::vector<std::string> split;
boost::algorithm::split (split, str, boost::is_any_of("@(x"));
assert (split.size() >= 2);
boost::trim(split[0]);
boost::trim(split[1]);
x = boost::lexical_cast<int> (split[0]);
y = boost::lexical_cast<int> (split[1]);
}
bool sortResolutions (std::pair<int, int> left, std::pair<int, int> right)
{
if (left.first == right.first)
return left.second > right.second;
return left.first > right.first;
}
std::string getAspect (int x, int y)
{
int gcd = boost::math::gcd (x, y);
int xaspect = x / gcd;
int yaspect = y / gcd;
// special case: 8 : 5 is usually referred to as 16:10
if (xaspect == 8 && yaspect == 5)
return "16 : 10";
return boost::lexical_cast<std::string>(xaspect) + " : " + boost::lexical_cast<std::string>(yaspect);
}
}
namespace MWGui
{
SettingsWindow::SettingsWindow(WindowManager& parWindowManager) :
WindowBase("openmw_settings_window_layout.xml", parWindowManager)
WindowBase("openmw_settings_window.layout", parWindowManager)
{
getWidget(mOkButton, "OkButton");
getWidget(mResolutionList, "ResolutionList");
@ -99,11 +134,25 @@ namespace MWGui
// fill resolution list
Ogre::RenderSystem* rs = Ogre::Root::getSingleton().getRenderSystem();
const Ogre::StringVector& videoModes = rs->getConfigOptions()["Video Mode"].possibleValues;
Ogre::StringVector videoModes = rs->getConfigOptions()["Video Mode"].possibleValues;
std::vector < std::pair<int, int> > resolutions;
for (Ogre::StringVector::const_iterator it=videoModes.begin();
it!=videoModes.end(); ++it)
{
mResolutionList->addItem(*it);
int resX, resY;
parseResolution (resX, resY, *it);
resolutions.push_back(std::make_pair(resX, resY));
}
std::sort(resolutions.begin(), resolutions.end(), sortResolutions);
for (std::vector < std::pair<int, int> >::const_iterator it=resolutions.begin();
it!=resolutions.end(); ++it)
{
std::string str = boost::lexical_cast<std::string>(it->first) + " x " + boost::lexical_cast<std::string>(it->second)
+ " (" + getAspect(it->first,it->second) + ")";
if (mResolutionList->findItemIndexWith(str) == MyGUI::ITEM_NONE)
mResolutionList->addItem(str);
}
// read settings
@ -155,7 +204,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Settings);
}
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
@ -168,19 +217,13 @@ namespace MWGui
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionAccept);
dialog->eventCancelClicked.clear();
dialog->eventCancelClicked += MyGUI::newDelegate(this, &SettingsWindow::onResolutionAccept);
}
void SettingsWindow::onResolutionAccept()
{
std::string resStr = mResolutionList->getItemNameAt(mResolutionList->getIndexSelected());
size_t xPos = resStr.find("x");
std::string resXStr = resStr.substr(0, xPos-1);
Ogre::StringUtil::trim(resXStr);
std::string resYStr = resStr.substr(xPos+2, resStr.size()-(xPos+2));
Ogre::StringUtil::trim(resYStr);
int resX = boost::lexical_cast<int>(resXStr);
int resY = boost::lexical_cast<int>(resYStr);
int resX, resY;
parseResolution (resX, resY, resStr);
Settings::Manager::setInt("resolution x", "Video", resX);
Settings::Manager::setInt("resolution y", "Video", resY);
@ -217,13 +260,8 @@ namespace MWGui
for (unsigned int i=0; i<mResolutionList->getItemCount(); ++i)
{
std::string resStr = mResolutionList->getItemNameAt(i);
size_t xPos = resStr.find("x");
std::string resXStr = resStr.substr(0, xPos-1);
Ogre::StringUtil::trim(resXStr);
std::string resYStr = resStr.substr(xPos+2, resStr.size()-(xPos+2));
Ogre::StringUtil::trim(resYStr);
int resX = boost::lexical_cast<int>(resXStr);
int resY = boost::lexical_cast<int>(resYStr);
int resX, resY;
parseResolution (resX, resY, resStr);
if (resX == Settings::Manager::getInt("resolution x", "Video")
&& resY == Settings::Manager::getInt("resolution y", "Video"))

@ -4,13 +4,18 @@
#include <boost/lexical_cast.hpp>
#include <boost/format.hpp>
#include "../mwworld/world.hpp"
#include <components/esm_store/store.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwbase/environment.hpp"
#include "../mwmechanics/spells.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/spellsuccess.hpp"
#include "../mwsound/soundmanager.hpp"
#include "window_manager.hpp"
@ -39,7 +44,7 @@ namespace
namespace MWGui
{
SpellWindow::SpellWindow(WindowManager& parWindowManager)
: WindowPinnableBase("openmw_spell_window_layout.xml", parWindowManager)
: WindowPinnableBase("openmw_spell_window.layout", parWindowManager)
, mHeight(0)
, mWidth(0)
{
@ -144,9 +149,11 @@ namespace MWGui
powers.push_back(*it);
it = spellList.erase(it);
}
else if (spell->data.type == ESM::Spell::ST_Ability)
else if (spell->data.type == ESM::Spell::ST_Ability
|| spell->data.type == ESM::Spell::ST_Blight
|| spell->data.type == ESM::Spell::ST_Curse
|| spell->data.type == ESM::Spell::ST_Disease)
{
// abilities are always active and don't show in the spell window.
it = spellList.erase(it);
}
else

@ -6,10 +6,13 @@
#include <boost/lexical_cast.hpp>
#include "../mwmechanics/mechanicsmanager.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/mechanicsmanager.hpp"
#include "window_manager.hpp"
#include "tooltips.hpp"
@ -19,7 +22,7 @@ using namespace MWGui;
const int StatsWindow::lineHeight = 18;
StatsWindow::StatsWindow (WindowManager& parWindowManager)
: WindowPinnableBase("openmw_stats_window_layout.xml", parWindowManager)
: WindowPinnableBase("openmw_stats_window.layout", parWindowManager)
, skillAreaWidget(NULL)
, skillClientWidget(NULL)
, skillScrollerWidget(NULL)
@ -539,7 +542,7 @@ void StatsWindow::updateSkillArea()
skillWidgets[skillWidgets.size()-1-i]->setUserString("ToolTipLayout", "TextToolTip");
skillWidgets[skillWidgets.size()-1-i]->setUserString("Caption_Text", "#{sSkillsMenuReputationHelp}");
}
addValueItem(mWindowManager.getGameSettingString("sBounty", "Bounty"),
boost::lexical_cast<std::string>(static_cast<int>(bounty)), "normal", coord1, coord2);

@ -4,7 +4,7 @@
using namespace MWGui;
TextInputDialog::TextInputDialog(WindowManager& parWindowManager)
: WindowBase("openmw_text_input_layout.xml", parWindowManager)
: WindowBase("openmw_text_input.layout", parWindowManager)
{
// Centre dialog
center();

@ -1,20 +1,24 @@
#include "tooltips.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include <boost/lexical_cast.hpp>
#include <OgreResourceGroupManager.h>
#include <components/settings/settings.hpp>
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/class.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
using namespace MWGui;
using namespace MyGUI;
ToolTips::ToolTips(WindowManager* windowManager) :
Layout("openmw_tooltips.xml")
Layout("openmw_tooltips.layout")
, mGameMode(true)
, mWindowManager(windowManager)
, mFullHelp(false)
@ -77,7 +81,7 @@ void ToolTips::onFrame(float frameDuration)
{
mFocusObject = MWBase::Environment::get().getWorld()->getPtrViaHandle(handle);
}
catch (std::exception& e)
catch (std::exception /* & e */)
{
return;
}
@ -392,7 +396,7 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
/**
* \todo
* the various potion effects should appear in the tooltip depending if the player
* the various potion effects should appear in the tooltip depending if the player
* has enough skill in alchemy to know about the effects of this potion.
*/
@ -564,8 +568,6 @@ void ToolTips::createAttributeToolTip(MyGUI::Widget* widget, int attributeId)
if (attributeId == -1)
return;
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(attributeId);
assert(attr);
std::string icon = ESM::Attribute::attributeIcons[attributeId];
std::string name = ESM::Attribute::gmstAttributeIds[attributeId];
std::string desc = ESM::Attribute::gmstAttributeDescIds[attributeId];

@ -3,7 +3,8 @@
#include <boost/lexical_cast.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/inventorystore.hpp"
#include "../mwworld/manualref.hpp"
#include "../mwsound/soundmanager.hpp"
@ -14,7 +15,7 @@
namespace MWGui
{
TradeWindow::TradeWindow(WindowManager& parWindowManager) :
WindowBase("openmw_trade_window_layout.xml", parWindowManager)
WindowBase("openmw_trade_window.layout", parWindowManager)
, ContainerBase(NULL) // no drag&drop
, mCurrentBalance(0)
{
@ -86,7 +87,7 @@ namespace MWGui
offerButtonWidth,
mOfferButton->getHeight());
setCoord(400, 0, 400, 300);
setCoord(400, 0, 400, 300);
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &TradeWindow::onWindowResize);
}
@ -161,7 +162,7 @@ namespace MWGui
int merchantgold;
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* ref = mPtr.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
else
@ -169,7 +170,7 @@ namespace MWGui
}
else // ESM::Creature
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData>* ref = mPtr.get<ESM::Creature>();
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
}
if (mCurrentBalance > 0 && merchantgold < mCurrentBalance)
@ -212,7 +213,7 @@ namespace MWGui
std::string sound = "Item Gold Up";
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Barter);
}
void TradeWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
@ -222,7 +223,7 @@ namespace MWGui
// now gimme back my stuff!
mWindowManager.getInventoryWindow()->returnBoughtItems(MWWorld::Class::get(mPtr).getContainerStore(mPtr));
mWindowManager.popGuiMode();
mWindowManager.removeGuiMode(GM_Barter);
}
void TradeWindow::updateLabels()
@ -244,7 +245,7 @@ namespace MWGui
int merchantgold;
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* ref = mPtr.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
else
@ -252,7 +253,7 @@ namespace MWGui
}
else // ESM::Creature
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData>* ref = mPtr.get<ESM::Creature>();
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
}
@ -289,13 +290,13 @@ namespace MWGui
int services = 0;
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData>* ref = mPtr.get<ESM::NPC>();
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->hasAI)
services = ref->base->AI.services;
}
else if (mPtr.getTypeName() == typeid(ESM::Creature).name())
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData>* ref = mPtr.get<ESM::Creature>();
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
if (ref->base->hasAI)
services = ref->base->AI.services;
}

@ -26,14 +26,16 @@
#include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/cellstore.hpp"
#include "console.hpp"
#include "journalwindow.hpp"
#include "charactercreation.hpp"
#include <components/settings/settings.hpp>
#include <assert.h>
#include <iostream>
#include <cassert>
#include <iterator>
using namespace MWGui;
@ -82,7 +84,7 @@ WindowManager::WindowManager(
// Set up the GUI system
mGuiManager = new OEngine::GUI::MyGUIManager(mOgre->getWindow(), mOgre->getScene(), false, logpath);
gui = mGuiManager->getGui();
//Register own widgets with MyGUI
MyGUI::FactoryManager::getInstance().registerFactory<DialogueHistory>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWSkill>("Widget");
@ -464,7 +466,7 @@ void WindowManager::onDialogueWindowBye()
//removeDialog(dialogueWindow);
mDialogueWindow->setVisible(false);
}
popGuiMode();
removeGuiMode(GM_Dialogue);
}
void WindowManager::onFrame (float frameDuration)
@ -638,6 +640,9 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
hud->onResChange(x, y);
console->onResChange(x, y);
mSettingsWindow->center();
mAlchemyWindow->center();
mScrollWindow->center();
mBookWindow->center();
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
}
}
@ -677,6 +682,9 @@ void WindowManager::removeGuiMode(GuiMode mode)
++it;
}
bool gameMode = !isGuiMode();
MWBase::Environment::get().getInputManager()->changeInputMode(!gameMode);
updateVisible();
}

@ -22,7 +22,6 @@
#include <openengine/gui/manager.hpp>
#include "../mwmechanics/stat.hpp"
#include "../mwworld/ptr.hpp"
#include "mode.hpp"
@ -39,7 +38,8 @@ namespace Compiler
namespace MWWorld
{
class World;
class Ptr;
class CellStore;
}
namespace MWMechanics
@ -159,7 +159,7 @@ namespace MWGui
MyGUI::Gui* getGui() const { return gui; }
void wmUpdateFps(float fps, size_t triangleCount, size_t batchCount)
void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount)
{
mFPS = fps;
mTriangleCount = triangleCount;
@ -181,7 +181,7 @@ namespace MWGui
void setBounty (int bounty); ///< set the current bounty value
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
void changeCell(MWWorld::Ptr::CellStore* cell); ///< change the active cell
void changeCell(MWWorld::CellStore* cell); ///< change the active cell
void setPlayerPos(const float x, const float y); ///< set player position in map space
void setPlayerDir(const float x, const float y); ///< set player view direction in map space
@ -295,14 +295,14 @@ namespace MWGui
int showFPSLevel;
float mFPS;
size_t mTriangleCount;
size_t mBatchCount;
unsigned int mTriangleCount;
unsigned int mBatchCount;
void onDialogueWindowBye();
/**
* Called when MyGUI tries to retrieve a tag. This usually corresponds to a GMST string,
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
* so this method will retrieve the GMST with the name \a _tag and place the result in \a _result
*/
void onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result);
};

@ -3,9 +3,10 @@
#include <cstdlib>
#include "../mwbase/environment.hpp"
#include <components/esm_store/store.hpp>
#include "../mwworld/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
namespace MWMechanics
{

@ -3,6 +3,8 @@
#include <typeinfo>
#include <OgreVector3.h>
#include <components/esm/loadnpc.hpp>
#include "../mwworld/class.hpp"

@ -5,13 +5,17 @@
#include <vector>
#include <string>
#include "../mwworld/ptr.hpp"
namespace Ogre
{
class Vector3;
}
namespace MWWorld
{
class Ptr;
class CellStore;
}
namespace MWMechanics
{
class Actors
@ -35,7 +39,7 @@ namespace MWMechanics
///
/// \note Ignored, if \a ptr is not a registered actor.
void dropActors (const MWWorld::Ptr::CellStore *cellStore);
void dropActors (const MWWorld::CellStore *cellStore);
///< Deregister all actors in the given cell.
void update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement,

@ -19,6 +19,10 @@ namespace MWMechanics
Spells mSpells;
ActiveSpells mActiveSpells;
MagicEffects mMagicEffects;
int mHello;
int mFight;
int mFlee;
int mAlarm;
};
}

@ -3,14 +3,14 @@
#include <components/esm_store/store.hpp>
#include "../mwgui/window_manager.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/world.hpp"
#include "../mwworld/player.hpp"
#include "../mwgui/window_manager.hpp"
namespace MWMechanics
{
void MechanicsManager::buildPlayer()

@ -15,6 +15,11 @@ namespace Ogre
class Vector3;
}
namespace MWWorld
{
class CellStore;
}
namespace MWMechanics
{
class MechanicsManager
@ -43,7 +48,7 @@ namespace MWMechanics
void removeActor (const MWWorld::Ptr& ptr);
///< Deregister an actor for stats management
void dropActors (const MWWorld::Ptr::CellStore *cellStore);
void dropActors (const MWWorld::CellStore *cellStore);
///< Deregister all actors in the given cell.
void watchActor (const MWWorld::Ptr& ptr);

@ -1,11 +1,12 @@
#include "spells.hpp"
#include <components/esm_store/store.hpp>
#include <components/esm/loadspel.hpp>
#include "../mwbase/environment.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "magiceffects.hpp"

@ -1,9 +1,11 @@
#ifndef MWMECHANICS_SPELLSUCCESS_H
#define MWMECHANICS_SPELLSUCCESS_H
#include "../mwworld/ptr.hpp"
#include "../mwworld/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "npcstats.hpp"

@ -1,7 +1,7 @@
#include "actors.hpp"
#include <OgreSceneNode.h>
#include <OgreSceneNode.h>
#include <OgreSceneManager.h>
using namespace Ogre;

@ -1,26 +1,29 @@
#ifndef _GAME_RENDER_ACTORS_H
#define _GAME_RENDER_ACTORS_H
#include "components/esm_store/cell_store.hpp"
#include <map>
#include <list>
#include <openengine/ogre/renderer.hpp>
#include "components/nifogre/ogre_nif_loader.hpp"
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/actiontalk.hpp"
#include "npcanimation.hpp"
#include "creatureanimation.hpp"
#include <openengine/bullet/physic.hpp>
namespace MWWorld
{
class Ptr;
class CellStore;
}
namespace MWRender{
class Actors{
OEngine::Render::OgreRenderer &mRend;
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
std::map<MWWorld::CellStore *, Ogre::SceneNode *> mCellSceneNodes;
Ogre::SceneNode* mMwRoot;
std::map<MWWorld::Ptr, Animation*> mAllActors;
@ -36,7 +39,7 @@ namespace MWRender{
bool deleteObject (const MWWorld::Ptr& ptr);
///< \return found?
void removeCell(MWWorld::Ptr::CellStore* store);
void removeCell(MWWorld::CellStore* store);
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
int number = 1);

@ -1,5 +1,10 @@
#include "animation.hpp"
#include <OgreHardwarePixelBuffer.h>
#include <OgreSkeletonInstance.h>
#include <OgreEntity.h>
#include <OgreBone.h>
#include <OgreSubMesh.h>
namespace MWRender{
std::map<std::string, int> Animation::mUniqueIDs;

@ -2,6 +2,8 @@
#include <OgreViewport.h>
#include <OgreCompositorManager.h>
#include <OgreCompositorChain.h>
#include <OgreCompositionTargetPass.h>
using namespace MWRender;
@ -69,3 +71,38 @@ void Compositors::removeAll()
mCompositors.clear();
}
bool Compositors::anyCompositorEnabled()
{
for (CompositorMap::iterator it=mCompositors.begin();
it != mCompositors.end(); ++it)
{
if (it->second.first && mEnabled)
return true;
}
return false;
}
void Compositors::countTrianglesBatches(unsigned int &triangles, unsigned int &batches)
{
triangles = 0;
batches = 0;
Ogre::CompositorInstance* c = NULL;
Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain (mViewport);
// accumulate tris & batches from all compositors with all their render targets
for (unsigned int i=0; i < chain->getNumCompositors(); ++i)
{
if (chain->getCompositor(i)->getEnabled())
{
c = chain->getCompositor(i);
for (unsigned int j = 0; j < c->getTechnique()->getNumTargetPasses(); ++j)
{
std::string textureName = c->getTechnique()->getTargetPass(j)->getOutputName();
Ogre::RenderTarget* rt = c->getRenderTarget(textureName);
triangles += rt->getTriangleCount();
batches += rt->getBatchCount();
}
}
}
}

@ -44,6 +44,10 @@ namespace MWRender
*/
void addCompositor (const std::string& name, const int priority);
bool anyCompositorEnabled();
void countTrianglesBatches(unsigned int &triangles, unsigned int &batches);
void removeAll ();
protected:

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save