forked from teamnwah/openmw-tes3coop
Merge branch 'next' into globalmap
This commit is contained in:
commit
7c22690116
203 changed files with 5666 additions and 4221 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,3 +14,4 @@ Makefile
|
|||
makefile
|
||||
data
|
||||
*.kdev4
|
||||
CMakeLists.txt.user
|
||||
|
|
|
@ -15,7 +15,7 @@ include (OpenMWMacros)
|
|||
# Version
|
||||
|
||||
set (OPENMW_VERSION_MAJOR 0)
|
||||
set (OPENMW_VERSION_MINOR 18)
|
||||
set (OPENMW_VERSION_MINOR 19)
|
||||
set (OPENMW_VERSION_RELEASE 0)
|
||||
|
||||
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
@ -659,7 +659,6 @@ if (NOT WIN32 AND NOT DPKG_PROGRAM AND NOT APPLE)
|
|||
#INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "${SYSCONFDIR}" )
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${SYSCONFDIR}" )
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/transparency-overrides.cfg" DESTINATION "${SYSCONFDIR}" )
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/launcher.cfg" DESTINATION "${SYSCONFDIR}" )
|
||||
|
||||
# Install resources
|
||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${DATADIR}" )
|
||||
|
|
|
@ -1213,7 +1213,7 @@ void Record<ESM::Region>::print()
|
|||
template<>
|
||||
void Record<ESM::Script>::print()
|
||||
{
|
||||
std::cout << " Name: " << mData.mData.mName.toString() << std::endl;
|
||||
std::cout << " Name: " << mData.mId << std::endl;
|
||||
|
||||
std::cout << " Num Shorts: " << mData.mData.mNumShorts << std::endl;
|
||||
std::cout << " Num Longs: " << mData.mData.mNumLongs << std::endl;
|
||||
|
|
|
@ -1,42 +1,56 @@
|
|||
set(LAUNCHER
|
||||
datafilespage.cpp
|
||||
graphicspage.cpp
|
||||
lineedit.cpp
|
||||
main.cpp
|
||||
maindialog.cpp
|
||||
naturalsort.cpp
|
||||
playpage.cpp
|
||||
pluginsmodel.cpp
|
||||
pluginsview.cpp
|
||||
filedialog.cpp
|
||||
|
||||
model/datafilesmodel.cpp
|
||||
model/modelitem.cpp
|
||||
model/esm/esmfile.cpp
|
||||
|
||||
utils/filedialog.cpp
|
||||
utils/naturalsort.cpp
|
||||
utils/lineedit.cpp
|
||||
utils/profilescombobox.cpp
|
||||
utils/textinputdialog.cpp
|
||||
|
||||
launcher.rc
|
||||
)
|
||||
|
||||
set(LAUNCHER_HEADER
|
||||
combobox.hpp
|
||||
datafilespage.hpp
|
||||
graphicspage.hpp
|
||||
lineedit.hpp
|
||||
maindialog.hpp
|
||||
naturalsort.hpp
|
||||
playpage.hpp
|
||||
pluginsmodel.hpp
|
||||
pluginsview.hpp
|
||||
filedialog.hpp
|
||||
|
||||
model/datafilesmodel.hpp
|
||||
model/modelitem.hpp
|
||||
model/esm/esmfile.hpp
|
||||
|
||||
utils/lineedit.hpp
|
||||
utils/filedialog.hpp
|
||||
utils/naturalsort.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/textinputdialog.hpp
|
||||
|
||||
)
|
||||
|
||||
# Headers that must be pre-processed
|
||||
set(LAUNCHER_HEADER_MOC
|
||||
combobox.hpp
|
||||
datafilespage.hpp
|
||||
graphicspage.hpp
|
||||
lineedit.hpp
|
||||
maindialog.hpp
|
||||
playpage.hpp
|
||||
pluginsmodel.hpp
|
||||
pluginsview.hpp
|
||||
filedialog.hpp
|
||||
|
||||
model/datafilesmodel.hpp
|
||||
model/modelitem.hpp
|
||||
model/esm/esmfile.hpp
|
||||
|
||||
utils/lineedit.hpp
|
||||
utils/filedialog.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/textinputdialog.hpp
|
||||
)
|
||||
|
||||
source_group(launcher FILES ${LAUNCHER} ${LAUNCHER_HEADER} ${LAUNCHER_HEADER_MOC})
|
||||
|
@ -87,8 +101,6 @@ endif()
|
|||
if (APPLE)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss
|
||||
"${APP_BUNDLE_DIR}/../launcher.qss")
|
||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg
|
||||
"${APP_BUNDLE_DIR}/../launcher.cfg")
|
||||
else()
|
||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss
|
||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/launcher.qss")
|
||||
|
@ -96,9 +108,6 @@ else()
|
|||
# Fallback in case getGlobalDataPath does not point to resources
|
||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.qss
|
||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.qss")
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/files/launcher.cfg
|
||||
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/launcher.cfg")
|
||||
endif()
|
||||
|
||||
if (BUILD_WITH_CODE_COVERAGE)
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#ifndef COMBOBOX_H
|
||||
#define COMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class ComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QString oldText;
|
||||
public:
|
||||
ComboBox(QWidget *parent=0) : QComboBox(parent), oldText()
|
||||
{
|
||||
connect(this,SIGNAL(editTextChanged(const QString&)), this,
|
||||
SLOT(textChangedSlot(const QString&)));
|
||||
connect(this,SIGNAL(currentIndexChanged(const QString&)), this,
|
||||
SLOT(textChangedSlot(const QString&)));
|
||||
}
|
||||
private slots:
|
||||
void textChangedSlot(const QString &newText)
|
||||
{
|
||||
emit textChanged(oldText, newText);
|
||||
oldText = newText;
|
||||
}
|
||||
signals:
|
||||
void textChanged(const QString &oldText, const QString &newText);
|
||||
};
|
||||
#endif
|
File diff suppressed because it is too large
Load diff
|
@ -3,24 +3,20 @@
|
|||
|
||||
#include <QWidget>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "utils/profilescombobox.hpp"
|
||||
#include <components/files/collections.hpp>
|
||||
|
||||
#include "combobox.hpp"
|
||||
|
||||
class QTableWidget;
|
||||
class QStandardItemModel;
|
||||
class QItemSelection;
|
||||
class QItemSelectionModel;
|
||||
class QTableView;
|
||||
class QSortFilterProxyModel;
|
||||
class QStringListModel;
|
||||
class QSettings;
|
||||
class QAction;
|
||||
class QToolBar;
|
||||
class QMenu;
|
||||
class PluginsModel;
|
||||
class PluginsView;
|
||||
class ComboBox;
|
||||
class ProfilesComboBox;
|
||||
class DataFilesModel;
|
||||
|
||||
class TextInputDialog;
|
||||
|
||||
namespace Files { struct ConfigurationManager; }
|
||||
|
||||
|
@ -31,52 +27,51 @@ class DataFilesPage : public QWidget
|
|||
public:
|
||||
DataFilesPage(Files::ConfigurationManager& cfg, QWidget *parent = 0);
|
||||
|
||||
ComboBox *mProfilesComboBox;
|
||||
ProfilesComboBox *mProfilesComboBox;
|
||||
|
||||
void writeConfig(QString profile = QString());
|
||||
bool showDataFilesWarning();
|
||||
bool setupDataFiles();
|
||||
|
||||
public slots:
|
||||
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void setCheckState(QModelIndex index);
|
||||
|
||||
void filterChanged(const QString filter);
|
||||
void showContextMenu(const QPoint &point);
|
||||
void profileChanged(const QString &previous, const QString ¤t);
|
||||
void profileRenamed(const QString &previous, const QString ¤t);
|
||||
void updateOkButton(const QString &text);
|
||||
|
||||
// Action slots
|
||||
void newProfile();
|
||||
void copyProfile();
|
||||
void deleteProfile();
|
||||
void moveUp();
|
||||
void moveDown();
|
||||
void moveTop();
|
||||
void moveBottom();
|
||||
// void moveUp();
|
||||
// void moveDown();
|
||||
// void moveTop();
|
||||
// void moveBottom();
|
||||
void check();
|
||||
void uncheck();
|
||||
void refresh();
|
||||
|
||||
private:
|
||||
QTableWidget *mMastersWidget;
|
||||
PluginsView *mPluginsTable;
|
||||
|
||||
QStandardItemModel *mDataFilesModel;
|
||||
PluginsModel *mPluginsModel;
|
||||
DataFilesModel *mMastersModel;
|
||||
DataFilesModel *mPluginsModel;
|
||||
|
||||
QSortFilterProxyModel *mPluginsProxyModel;
|
||||
QItemSelectionModel *mPluginsSelectModel;
|
||||
|
||||
QTableView *mMastersTable;
|
||||
QTableView *mPluginsTable;
|
||||
|
||||
QToolBar *mProfileToolBar;
|
||||
QMenu *mContextMenu;
|
||||
|
||||
QAction *mNewProfileAction;
|
||||
QAction *mCopyProfileAction;
|
||||
QAction *mDeleteProfileAction;
|
||||
|
||||
QAction *mMoveUpAction;
|
||||
QAction *mMoveDownAction;
|
||||
QAction *mMoveTopAction;
|
||||
QAction *mMoveBottomAction;
|
||||
// QAction *mMoveUpAction;
|
||||
// QAction *mMoveDownAction;
|
||||
// QAction *mMoveTopAction;
|
||||
// QAction *mMoveBottomAction;
|
||||
QAction *mCheckAction;
|
||||
QAction *mUncheckAction;
|
||||
|
||||
|
@ -86,17 +81,14 @@ private:
|
|||
|
||||
QSettings *mLauncherConfig;
|
||||
|
||||
const QStringList checkedPlugins();
|
||||
const QStringList selectedMasters();
|
||||
TextInputDialog *mNewProfileDialog;
|
||||
|
||||
// const QStringList checkedPlugins();
|
||||
// const QStringList selectedMasters();
|
||||
|
||||
void addDataFiles(Files::Collections &fileCollections, const QString &encoding);
|
||||
void addPlugins(const QModelIndex &index);
|
||||
void removePlugins(const QModelIndex &index);
|
||||
void uncheckPlugins();
|
||||
void createActions();
|
||||
void setupConfig();
|
||||
void readConfig();
|
||||
void scrollToSelection();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
#include <components/files/ogreplugin.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "utils/naturalsort.hpp"
|
||||
|
||||
#include "graphicspage.hpp"
|
||||
#include "naturalsort.hpp"
|
||||
|
||||
QString getAspect(int x, int y)
|
||||
{
|
||||
|
@ -280,9 +281,6 @@ QStringList GraphicsPage::getAvailableResolutions(Ogre::RenderSystem *renderer)
|
|||
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")) {
|
||||
|
@ -292,10 +290,11 @@ QStringList GraphicsPage::getAvailableResolutions(Ogre::RenderSystem *renderer)
|
|||
resolutionStr.append(tr("\t(Standard 4:3)"));
|
||||
}
|
||||
|
||||
// do not add duplicate resolutions
|
||||
if (!result.contains(resolutionStr))
|
||||
result << resolutionStr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the resolutions in descending order
|
||||
qSort(result.begin(), result.end(), naturalSortGreaterThanCI);
|
||||
|
|
|
@ -11,7 +11,7 @@ int main(int argc, char *argv[])
|
|||
// Now we make sure the current dir is set to application path
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
#ifdef Q_OS_MAC
|
||||
if (dir.dirName() == "MacOS") {
|
||||
dir.cdUp();
|
||||
dir.cdUp();
|
||||
|
|
|
@ -141,11 +141,11 @@ void MainDialog::createPages()
|
|||
|
||||
connect(mPlayPage->mProfilesComboBox,
|
||||
SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(profileChanged(int)));
|
||||
mDataFilesPage->mProfilesComboBox, SLOT(setCurrentIndex(int)));
|
||||
|
||||
connect(mDataFilesPage->mProfilesComboBox,
|
||||
SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(profileChanged(int)));
|
||||
mPlayPage->mProfilesComboBox, SLOT(setCurrentIndex(int)));
|
||||
|
||||
}
|
||||
|
||||
|
@ -196,23 +196,6 @@ bool MainDialog::setup()
|
|||
return true;
|
||||
}
|
||||
|
||||
void MainDialog::profileChanged(int index)
|
||||
{
|
||||
// Just to be sure, should always have a selection
|
||||
if (!mIconWidget->selectionModel()->hasSelection()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString currentPage = mIconWidget->currentItem()->data(Qt::DisplayRole).toString();
|
||||
if (currentPage == QLatin1String("Play")) {
|
||||
mDataFilesPage->mProfilesComboBox->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
if (currentPage == QLatin1String("Data Files")) {
|
||||
mPlayPage->mProfilesComboBox->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
if (!current)
|
||||
|
@ -244,10 +227,10 @@ void MainDialog::play()
|
|||
const std::string settingspath = (mCfgMgr.getUserPath() / "settings.cfg").string();
|
||||
mSettings.saveUser(settingspath);
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#ifdef Q_OS_WIN
|
||||
QString game = "./openmw.exe";
|
||||
QFile file(game);
|
||||
#elif defined(Q_WS_MAC)
|
||||
#elif defined(Q_OS_MAC)
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
QString game = dir.absoluteFilePath("openmw");
|
||||
QFile file(game);
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
public slots:
|
||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
void play();
|
||||
void profileChanged(int index);
|
||||
bool setup();
|
||||
|
||||
private:
|
||||
|
|
474
apps/launcher/model/datafilesmodel.cpp
Normal file
474
apps/launcher/model/datafilesmodel.cpp
Normal file
|
@ -0,0 +1,474 @@
|
|||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
|
||||
#include "esm/esmfile.hpp"
|
||||
|
||||
#include "../utils/naturalsort.hpp"
|
||||
|
||||
#include "datafilesmodel.hpp"
|
||||
|
||||
DataFilesModel::DataFilesModel(QObject *parent) :
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
mEncoding = QString("win1252");
|
||||
}
|
||||
|
||||
DataFilesModel::~DataFilesModel()
|
||||
{
|
||||
}
|
||||
|
||||
void DataFilesModel::setEncoding(const QString &encoding)
|
||||
{
|
||||
mEncoding = encoding;
|
||||
}
|
||||
|
||||
void DataFilesModel::setCheckState(const QModelIndex &index, Qt::CheckState state)
|
||||
{
|
||||
setData(index, state, Qt::CheckStateRole);
|
||||
}
|
||||
|
||||
Qt::CheckState DataFilesModel::checkState(const QModelIndex &index)
|
||||
{
|
||||
EsmFile *file = item(index.row());
|
||||
return mCheckStates[file->fileName()];
|
||||
}
|
||||
|
||||
int DataFilesModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : 9;
|
||||
}
|
||||
|
||||
int DataFilesModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return parent.isValid() ? 0 : mFiles.count();
|
||||
}
|
||||
|
||||
|
||||
bool DataFilesModel::moveRow(int oldrow, int row, const QModelIndex &parent)
|
||||
{
|
||||
if (oldrow < 0 || row < 0 || oldrow == row)
|
||||
return false;
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
//emit beginMoveRows(parent, oldrow, oldrow, parent, row);
|
||||
mFiles.swap(oldrow, row);
|
||||
//emit endInsertRows();
|
||||
emit layoutChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariant DataFilesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
EsmFile *file = item(index.row());
|
||||
|
||||
if (!file)
|
||||
return QVariant();
|
||||
|
||||
const int column = index.column();
|
||||
|
||||
switch (role) {
|
||||
case Qt::DisplayRole: {
|
||||
|
||||
switch (column) {
|
||||
case 0:
|
||||
return file->fileName();
|
||||
case 1:
|
||||
return file->author();
|
||||
case 2:
|
||||
return QString("%1 kB").arg(int((file->size() + 1023) / 1024));
|
||||
case 3:
|
||||
//return file->modified().toString(Qt::TextDate);
|
||||
return file->modified().toString(Qt::ISODate);
|
||||
case 4:
|
||||
return file->accessed().toString(Qt::TextDate);
|
||||
case 5:
|
||||
return file->version();
|
||||
case 6:
|
||||
return file->path();
|
||||
case 7:
|
||||
return file->masters().join(", ");
|
||||
case 8:
|
||||
return file->description();
|
||||
}
|
||||
}
|
||||
|
||||
case Qt::TextAlignmentRole: {
|
||||
switch (column) {
|
||||
case 0:
|
||||
case 1:
|
||||
return Qt::AlignLeft + Qt::AlignVCenter;
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
return Qt::AlignRight + Qt::AlignVCenter;
|
||||
default:
|
||||
return Qt::AlignLeft + Qt::AlignVCenter;
|
||||
}
|
||||
}
|
||||
|
||||
case Qt::CheckStateRole: {
|
||||
if (column != 0)
|
||||
return QVariant();
|
||||
return mCheckStates[file->fileName()];
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
{
|
||||
if (column != 0)
|
||||
return QVariant();
|
||||
|
||||
if (file->version() == 0.0f)
|
||||
return QVariant(); // Data not set
|
||||
|
||||
QString tooltip =
|
||||
QString("<b>Author:</b> %1<br/> \
|
||||
<b>Version:</b> %2<br/> \
|
||||
<br/><b>Description:</b><br/>%3<br/> \
|
||||
<br/><b>Dependencies: </b>%4<br/>")
|
||||
.arg(file->author())
|
||||
.arg(QString::number(file->version()))
|
||||
.arg(file->description())
|
||||
.arg(file->masters().join(", "));
|
||||
|
||||
|
||||
return tooltip;
|
||||
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Qt::ItemFlags DataFilesModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
EsmFile *file = item(index.row());
|
||||
|
||||
if (!file)
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
if (mAvailableFiles.contains(file->fileName())) {
|
||||
if (index.column() == 0) {
|
||||
return Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
} else {
|
||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||
}
|
||||
} else {
|
||||
if (index.column() == 0) {
|
||||
return Qt::ItemIsUserCheckable | Qt::ItemIsSelectable;
|
||||
} else {
|
||||
return Qt::NoItemFlags | Qt::ItemIsSelectable;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QVariant DataFilesModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
if (orientation == Qt::Horizontal) {
|
||||
switch (section) {
|
||||
case 0: return tr("Name");
|
||||
case 1: return tr("Author");
|
||||
case 2: return tr("Size");
|
||||
case 3: return tr("Modified");
|
||||
case 4: return tr("Accessed");
|
||||
case 5: return tr("Version");
|
||||
case 6: return tr("Path");
|
||||
case 7: return tr("Masters");
|
||||
case 8: return tr("Description");
|
||||
}
|
||||
} else {
|
||||
// Show row numbers
|
||||
return ++section;
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool DataFilesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
|
||||
if (role == Qt::CheckStateRole) {
|
||||
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
QString name = item(index.row())->fileName();
|
||||
mCheckStates[name] = static_cast<Qt::CheckState>(value.toInt());
|
||||
|
||||
emit checkedItemsChanged(checkedItems(), uncheckedItems());
|
||||
emit layoutChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DataFilesModel::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
// TODO: Make this more efficient
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
QList<EsmFile *> sortedFiles;
|
||||
|
||||
QMultiMap<QString, QString> timestamps;
|
||||
|
||||
foreach (EsmFile *file, mFiles)
|
||||
timestamps.insert(file->modified().toString(Qt::ISODate), file->fileName());
|
||||
|
||||
QMapIterator<QString, QString> ti(timestamps);
|
||||
|
||||
while (ti.hasNext()) {
|
||||
ti.next();
|
||||
|
||||
QModelIndex index = indexFromItem(findItem(ti.value()));
|
||||
|
||||
if (!index.isValid())
|
||||
continue;
|
||||
|
||||
EsmFile *file = item(index.row());
|
||||
|
||||
if (!file)
|
||||
continue;
|
||||
|
||||
sortedFiles.append(file);
|
||||
}
|
||||
|
||||
mFiles.clear();
|
||||
mFiles = sortedFiles;
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
void DataFilesModel::addFile(EsmFile *file)
|
||||
{
|
||||
emit beginInsertRows(QModelIndex(), mFiles.count(), mFiles.count());
|
||||
mFiles.append(file);
|
||||
emit endInsertRows();
|
||||
}
|
||||
|
||||
void DataFilesModel::addMasters(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
dir.setNameFilters(QStringList(QLatin1String("*.esp")));
|
||||
|
||||
// Read the dependencies from the plugins
|
||||
foreach (const QString &path, dir.entryList()) {
|
||||
try {
|
||||
ESM::ESMReader fileReader;
|
||||
fileReader.setEncoding(mEncoding.toStdString());
|
||||
fileReader.open(dir.absoluteFilePath(path).toStdString());
|
||||
|
||||
ESM::ESMReader::MasterList mlist = fileReader.getMasters();
|
||||
|
||||
for (unsigned int i = 0; i < mlist.size(); ++i) {
|
||||
QString master = QString::fromStdString(mlist[i].name);
|
||||
|
||||
// Add the plugin to the internal dependency map
|
||||
mDependencies[master].append(path);
|
||||
|
||||
// Don't add esps
|
||||
if (master.endsWith(".esp", Qt::CaseInsensitive))
|
||||
continue;
|
||||
|
||||
QFileInfo info(dir.absoluteFilePath(master));
|
||||
|
||||
EsmFile *file = new EsmFile(master);
|
||||
file->setDates(info.lastModified(), info.lastRead());
|
||||
|
||||
// Add the master to the table
|
||||
if (findItem(master) == 0)
|
||||
addFile(file);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch(std::runtime_error &e) {
|
||||
// An error occurred while reading the .esp
|
||||
qWarning() << "Error reading esp: " << e.what();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// See if the masters actually exist in the filesystem
|
||||
dir.setNameFilters(QStringList(QLatin1String("*.esm")));
|
||||
|
||||
foreach (const QString &path, dir.entryList()) {
|
||||
QFileInfo info(dir.absoluteFilePath(path));
|
||||
|
||||
if (findItem(path) == 0) {
|
||||
EsmFile *file = new EsmFile(path);
|
||||
file->setDates(info.lastModified(), info.lastRead());
|
||||
|
||||
addFile(file);
|
||||
}
|
||||
|
||||
// Make the master selectable
|
||||
mAvailableFiles.append(path);
|
||||
}
|
||||
}
|
||||
|
||||
void DataFilesModel::addPlugins(const QString &path)
|
||||
{
|
||||
QDir dir(path);
|
||||
dir.setNameFilters(QStringList(QLatin1String("*.esp")));
|
||||
|
||||
foreach (const QString &path, dir.entryList()) {
|
||||
QFileInfo info(dir.absoluteFilePath(path));
|
||||
EsmFile *file = new EsmFile(path);
|
||||
|
||||
try {
|
||||
ESM::ESMReader fileReader;
|
||||
fileReader.setEncoding(mEncoding.toStdString());
|
||||
fileReader.open(dir.absoluteFilePath(path).toStdString());
|
||||
|
||||
ESM::ESMReader::MasterList mlist = fileReader.getMasters();
|
||||
QStringList masters;
|
||||
|
||||
for (unsigned int i = 0; i < mlist.size(); ++i) {
|
||||
QString master = QString::fromStdString(mlist[i].name);
|
||||
masters.append(master);
|
||||
|
||||
// Add the plugin to the internal dependency map
|
||||
mDependencies[master].append(path);
|
||||
}
|
||||
|
||||
file->setAuthor(QString::fromStdString(fileReader.getAuthor()));
|
||||
file->setSize(info.size());
|
||||
file->setDates(info.lastModified(), info.lastRead());
|
||||
file->setVersion(fileReader.getFVer());
|
||||
file->setPath(info.absoluteFilePath());
|
||||
file->setMasters(masters);
|
||||
file->setDescription(QString::fromStdString(fileReader.getDesc()));
|
||||
|
||||
|
||||
// Put the file in the table
|
||||
addFile(file);
|
||||
} catch(std::runtime_error &e) {
|
||||
// An error occurred while reading the .esp
|
||||
qWarning() << "Error reading esp: " << e.what();
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QModelIndex DataFilesModel::indexFromItem(EsmFile *item) const
|
||||
{
|
||||
if (item)
|
||||
return createIndex(mFiles.indexOf(item), 0);
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
EsmFile* DataFilesModel::findItem(const QString &name)
|
||||
{
|
||||
QList<EsmFile *>::ConstIterator it;
|
||||
QList<EsmFile *>::ConstIterator itEnd = mFiles.constEnd();
|
||||
|
||||
int i = 0;
|
||||
for (it = mFiles.constBegin(); it != itEnd; ++it) {
|
||||
EsmFile *file = item(i);
|
||||
++i;
|
||||
|
||||
if (name == file->fileName())
|
||||
return file;
|
||||
}
|
||||
|
||||
// Not found
|
||||
return 0;
|
||||
}
|
||||
|
||||
EsmFile* DataFilesModel::item(int row) const
|
||||
{
|
||||
if (row >= 0 && row < mFiles.count())
|
||||
return mFiles.at(row);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList DataFilesModel::checkedItems()
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
QList<EsmFile *>::ConstIterator it;
|
||||
QList<EsmFile *>::ConstIterator itEnd = mFiles.constEnd();
|
||||
|
||||
int i = 0;
|
||||
for (it = mFiles.constBegin(); it != itEnd; ++it) {
|
||||
EsmFile *file = item(i);
|
||||
++i;
|
||||
|
||||
QString name = file->fileName();
|
||||
|
||||
// Only add the items that are in the checked list and available
|
||||
if (mCheckStates[name] == Qt::Checked && mAvailableFiles.contains(name))
|
||||
list << name;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void DataFilesModel::uncheckAll()
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
mCheckStates.clear();
|
||||
emit layoutChanged();
|
||||
}
|
||||
|
||||
QStringList DataFilesModel::uncheckedItems()
|
||||
{
|
||||
QStringList list;
|
||||
QStringList checked = checkedItems();
|
||||
|
||||
QList<EsmFile *>::ConstIterator it;
|
||||
QList<EsmFile *>::ConstIterator itEnd = mFiles.constEnd();
|
||||
|
||||
int i = 0;
|
||||
for (it = mFiles.constBegin(); it != itEnd; ++it) {
|
||||
EsmFile *file = item(i);
|
||||
++i;
|
||||
|
||||
// Add the items that are not in the checked list
|
||||
if (!checked.contains(file->fileName()))
|
||||
list << file->fileName();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void DataFilesModel::slotcheckedItemsChanged(const QStringList &checkedItems, const QStringList &unCheckedItems)
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
|
||||
QStringList list;
|
||||
|
||||
foreach (const QString &file, checkedItems) {
|
||||
list << mDependencies[file];
|
||||
}
|
||||
|
||||
foreach (const QString &file, unCheckedItems) {
|
||||
foreach (const QString &remove, mDependencies[file]) {
|
||||
list.removeAll(remove);
|
||||
}
|
||||
}
|
||||
|
||||
mAvailableFiles.clear();
|
||||
mAvailableFiles.append(list);
|
||||
|
||||
emit layoutChanged();
|
||||
}
|
71
apps/launcher/model/datafilesmodel.hpp
Normal file
71
apps/launcher/model/datafilesmodel.hpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
#ifndef DATAFILESMODEL_HPP
|
||||
#define DATAFILESMODEL_HPP
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
|
||||
|
||||
class EsmFile;
|
||||
|
||||
class DataFilesModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DataFilesModel(QObject *parent = 0);
|
||||
virtual ~DataFilesModel();
|
||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
bool moveRow(int oldrow, int row, const QModelIndex &parent = QModelIndex());
|
||||
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
|
||||
|
||||
inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const
|
||||
{ return QAbstractTableModel::index(row, column, parent); }
|
||||
|
||||
void setEncoding(const QString &encoding);
|
||||
|
||||
void addFile(EsmFile *file);
|
||||
|
||||
void addMasters(const QString &path);
|
||||
void addPlugins(const QString &path);
|
||||
|
||||
void uncheckAll();
|
||||
|
||||
QStringList checkedItems();
|
||||
QStringList uncheckedItems();
|
||||
|
||||
Qt::CheckState checkState(const QModelIndex &index);
|
||||
void setCheckState(const QModelIndex &index, Qt::CheckState state);
|
||||
|
||||
QModelIndex indexFromItem(EsmFile *item) const;
|
||||
EsmFile* findItem(const QString &name);
|
||||
EsmFile* item(int row) const;
|
||||
|
||||
signals:
|
||||
void checkedItemsChanged(const QStringList checkedItems, const QStringList unCheckedItems);
|
||||
|
||||
public slots:
|
||||
void slotcheckedItemsChanged(const QStringList &checkedItems, const QStringList &unCheckedItems);
|
||||
|
||||
private:
|
||||
QList<EsmFile *> mFiles;
|
||||
QStringList mAvailableFiles;
|
||||
|
||||
QHash<QString, QStringList> mDependencies;
|
||||
QHash<QString, Qt::CheckState> mCheckStates;
|
||||
|
||||
QString mEncoding;
|
||||
|
||||
};
|
||||
|
||||
#endif // DATAFILESMODEL_HPP
|
50
apps/launcher/model/esm/esmfile.cpp
Normal file
50
apps/launcher/model/esm/esmfile.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "esmfile.hpp"
|
||||
|
||||
EsmFile::EsmFile(QString fileName, ModelItem *parent)
|
||||
: ModelItem(parent)
|
||||
{
|
||||
mFileName = fileName;
|
||||
mSize = 0;
|
||||
mVersion = 0.0f;
|
||||
}
|
||||
|
||||
void EsmFile::setFileName(const QString &fileName)
|
||||
{
|
||||
mFileName = fileName;
|
||||
}
|
||||
|
||||
void EsmFile::setAuthor(const QString &author)
|
||||
{
|
||||
mAuthor = author;
|
||||
}
|
||||
|
||||
void EsmFile::setSize(const int size)
|
||||
{
|
||||
mSize = size;
|
||||
}
|
||||
|
||||
void EsmFile::setDates(const QDateTime &modified, const QDateTime &accessed)
|
||||
{
|
||||
mModified = modified;
|
||||
mAccessed = accessed;
|
||||
}
|
||||
|
||||
void EsmFile::setVersion(float version)
|
||||
{
|
||||
mVersion = version;
|
||||
}
|
||||
|
||||
void EsmFile::setPath(const QString &path)
|
||||
{
|
||||
mPath = path;
|
||||
}
|
||||
|
||||
void EsmFile::setMasters(const QStringList &masters)
|
||||
{
|
||||
mMasters = masters;
|
||||
}
|
||||
|
||||
void EsmFile::setDescription(const QString &description)
|
||||
{
|
||||
mDescription = description;
|
||||
}
|
54
apps/launcher/model/esm/esmfile.hpp
Normal file
54
apps/launcher/model/esm/esmfile.hpp
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef ESMFILE_HPP
|
||||
#define ESMFILE_HPP
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QStringList>
|
||||
|
||||
#include "../modelitem.hpp"
|
||||
|
||||
class EsmFile : public ModelItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString filename READ fileName)
|
||||
|
||||
public:
|
||||
EsmFile(QString fileName = QString(), ModelItem *parent = 0);
|
||||
|
||||
~EsmFile()
|
||||
{}
|
||||
|
||||
void setFileName(const QString &fileName);
|
||||
void setAuthor(const QString &author);
|
||||
void setSize(const int size);
|
||||
void setDates(const QDateTime &modified, const QDateTime &accessed);
|
||||
void setVersion(const float version);
|
||||
void setPath(const QString &path);
|
||||
void setMasters(const QStringList &masters);
|
||||
void setDescription(const QString &description);
|
||||
|
||||
inline QString fileName() { return mFileName; }
|
||||
inline QString author() { return mAuthor; }
|
||||
inline int size() { return mSize; }
|
||||
inline QDateTime modified() { return mModified; }
|
||||
inline QDateTime accessed() { return mAccessed; }
|
||||
inline float version() { return mVersion; }
|
||||
inline QString path() { return mPath; }
|
||||
inline QStringList masters() { return mMasters; }
|
||||
inline QString description() { return mDescription; }
|
||||
|
||||
|
||||
private:
|
||||
QString mFileName;
|
||||
QString mAuthor;
|
||||
int mSize;
|
||||
QDateTime mModified;
|
||||
QDateTime mAccessed;
|
||||
float mVersion;
|
||||
QString mPath;
|
||||
QStringList mMasters;
|
||||
QString mDescription;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
57
apps/launcher/model/modelitem.cpp
Normal file
57
apps/launcher/model/modelitem.cpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include "modelitem.hpp"
|
||||
|
||||
ModelItem::ModelItem(ModelItem *parent)
|
||||
: mParentItem(parent)
|
||||
, QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ModelItem::~ModelItem()
|
||||
{
|
||||
qDeleteAll(mChildItems);
|
||||
}
|
||||
|
||||
|
||||
ModelItem *ModelItem::parent()
|
||||
{
|
||||
return mParentItem;
|
||||
}
|
||||
|
||||
int ModelItem::row() const
|
||||
{
|
||||
if (mParentItem)
|
||||
return 1;
|
||||
//return mParentItem->childRow(const_cast<ModelItem*>(this));
|
||||
//return mParentItem->mChildItems.indexOf(const_cast<ModelItem*>(this));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int ModelItem::childCount() const
|
||||
{
|
||||
return mChildItems.count();
|
||||
}
|
||||
|
||||
int ModelItem::childRow(ModelItem *child) const
|
||||
{
|
||||
Q_ASSERT(child);
|
||||
|
||||
return mChildItems.indexOf(child);
|
||||
}
|
||||
|
||||
ModelItem *ModelItem::child(int row)
|
||||
{
|
||||
return mChildItems.value(row);
|
||||
}
|
||||
|
||||
|
||||
void ModelItem::appendChild(ModelItem *item)
|
||||
{
|
||||
mChildItems.append(item);
|
||||
}
|
||||
|
||||
void ModelItem::removeChild(int row)
|
||||
{
|
||||
mChildItems.removeAt(row);
|
||||
}
|
32
apps/launcher/model/modelitem.hpp
Normal file
32
apps/launcher/model/modelitem.hpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#ifndef MODELITEM_HPP
|
||||
#define MODELITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
|
||||
class ModelItem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ModelItem(ModelItem *parent = 0);
|
||||
~ModelItem();
|
||||
|
||||
ModelItem *parent();
|
||||
int row() const;
|
||||
|
||||
int childCount() const;
|
||||
int childRow(ModelItem *child) const;
|
||||
ModelItem *child(int row);
|
||||
|
||||
void appendChild(ModelItem *child);
|
||||
void removeChild(int row);
|
||||
|
||||
//virtual bool acceptChild(ModelItem *child);
|
||||
|
||||
protected:
|
||||
ModelItem *mParentItem;
|
||||
QList<ModelItem*> mChildItems;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,149 +0,0 @@
|
|||
#include <QMimeData>
|
||||
#include <QBitArray>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "pluginsmodel.hpp"
|
||||
|
||||
PluginsModel::PluginsModel(QObject *parent) : QStandardItemModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void decodeDataRecursive(QDataStream &stream, QStandardItem *item)
|
||||
{
|
||||
int colCount, childCount;
|
||||
stream >> *item;
|
||||
stream >> colCount >> childCount;
|
||||
item->setColumnCount(colCount);
|
||||
|
||||
int childPos = childCount;
|
||||
|
||||
while(childPos > 0) {
|
||||
childPos--;
|
||||
QStandardItem *child = new QStandardItem();
|
||||
decodeDataRecursive(stream, child);
|
||||
item->setChild( childPos / colCount, childPos % colCount, child);
|
||||
}
|
||||
}
|
||||
|
||||
bool PluginsModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent)
|
||||
{
|
||||
// Code largely based on QStandardItemModel::dropMimeData
|
||||
|
||||
// check if the action is supported
|
||||
if (!data || !(action == Qt::CopyAction || action == Qt::MoveAction))
|
||||
return false;
|
||||
|
||||
// check if the format is supported
|
||||
QString format = QLatin1String("application/x-qstandarditemmodeldatalist");
|
||||
if (!data->hasFormat(format))
|
||||
return QAbstractItemModel::dropMimeData(data, action, row, column, parent);
|
||||
|
||||
if (row > rowCount(parent))
|
||||
row = rowCount(parent);
|
||||
if (row == -1)
|
||||
row = rowCount(parent);
|
||||
if (column == -1)
|
||||
column = 0;
|
||||
|
||||
// decode and insert
|
||||
QByteArray encoded = data->data(format);
|
||||
QDataStream stream(&encoded, QIODevice::ReadOnly);
|
||||
|
||||
|
||||
//code based on QAbstractItemModel::decodeData
|
||||
// adapted to work with QStandardItem
|
||||
int top = std::numeric_limits<int>::max();
|
||||
int left = std::numeric_limits<int>::max();
|
||||
int bottom = 0;
|
||||
int right = 0;
|
||||
QVector<int> rows, columns;
|
||||
QVector<QStandardItem *> items;
|
||||
|
||||
while (!stream.atEnd()) {
|
||||
int r, c;
|
||||
QStandardItem *item = new QStandardItem();
|
||||
stream >> r >> c;
|
||||
decodeDataRecursive(stream, item);
|
||||
|
||||
rows.append(r);
|
||||
columns.append(c);
|
||||
items.append(item);
|
||||
top = qMin(r, top);
|
||||
left = qMin(c, left);
|
||||
bottom = qMax(r, bottom);
|
||||
right = qMax(c, right);
|
||||
}
|
||||
|
||||
// insert the dragged items into the table, use a bit array to avoid overwriting items,
|
||||
// since items from different tables can have the same row and column
|
||||
int dragRowCount = 0;
|
||||
int dragColumnCount = right - left + 1;
|
||||
|
||||
// Compute the number of continuous rows upon insertion and modify the rows to match
|
||||
QVector<int> rowsToInsert(bottom + 1);
|
||||
for (int i = 0; i < rows.count(); ++i)
|
||||
rowsToInsert[rows.at(i)] = 1;
|
||||
for (int i = 0; i < rowsToInsert.count(); ++i) {
|
||||
if (rowsToInsert[i] == 1){
|
||||
rowsToInsert[i] = dragRowCount;
|
||||
++dragRowCount;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < rows.count(); ++i)
|
||||
rows[i] = top + rowsToInsert[rows[i]];
|
||||
|
||||
QBitArray isWrittenTo(dragRowCount * dragColumnCount);
|
||||
|
||||
// make space in the table for the dropped data
|
||||
int colCount = columnCount(parent);
|
||||
if (colCount < dragColumnCount + column) {
|
||||
insertColumns(colCount, dragColumnCount + column - colCount, parent);
|
||||
colCount = columnCount(parent);
|
||||
}
|
||||
insertRows(row, dragRowCount, parent);
|
||||
|
||||
row = qMax(0, row);
|
||||
column = qMax(0, column);
|
||||
|
||||
QStandardItem *parentItem = itemFromIndex (parent);
|
||||
if (!parentItem)
|
||||
parentItem = invisibleRootItem();
|
||||
|
||||
QVector<QPersistentModelIndex> newIndexes(items.size());
|
||||
// set the data in the table
|
||||
for (int j = 0; j < items.size(); ++j) {
|
||||
int relativeRow = rows.at(j) - top;
|
||||
int relativeColumn = columns.at(j) - left;
|
||||
int destinationRow = relativeRow + row;
|
||||
int destinationColumn = relativeColumn + column;
|
||||
int flat = (relativeRow * dragColumnCount) + relativeColumn;
|
||||
// if the item was already written to, or we just can't fit it in the table, create a new row
|
||||
if (destinationColumn >= colCount || isWrittenTo.testBit(flat)) {
|
||||
destinationColumn = qBound(column, destinationColumn, colCount - 1);
|
||||
destinationRow = row + dragRowCount;
|
||||
insertRows(row + dragRowCount, 1, parent);
|
||||
flat = (dragRowCount * dragColumnCount) + relativeColumn;
|
||||
isWrittenTo.resize(++dragRowCount * dragColumnCount);
|
||||
}
|
||||
if (!isWrittenTo.testBit(flat)) {
|
||||
newIndexes[j] = index(destinationRow, destinationColumn, parentItem->index());
|
||||
isWrittenTo.setBit(flat);
|
||||
}
|
||||
}
|
||||
|
||||
for(int k = 0; k < newIndexes.size(); k++) {
|
||||
if (newIndexes.at(k).isValid()) {
|
||||
parentItem->setChild(newIndexes.at(k).row(), newIndexes.at(k).column(), items.at(k));
|
||||
} else {
|
||||
delete items.at(k);
|
||||
}
|
||||
}
|
||||
|
||||
// The important part, tell the view what is dropped
|
||||
emit indexesDropped(newIndexes);
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef PLUGINSMODEL_H
|
||||
#define PLUGINSMODEL_H
|
||||
|
||||
#include <QStandardItemModel>
|
||||
|
||||
class PluginsModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PluginsModel(QObject *parent = 0);
|
||||
~PluginsModel() {};
|
||||
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||||
|
||||
signals:
|
||||
void indexesDropped(QVector<QPersistentModelIndex> indexes);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,41 +0,0 @@
|
|||
#include <QSortFilterProxyModel>
|
||||
|
||||
#include "pluginsview.hpp"
|
||||
|
||||
PluginsView::PluginsView(QWidget *parent) : QTableView(parent)
|
||||
{
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setAlternatingRowColors(true);
|
||||
setDragEnabled(true);
|
||||
setDragDropMode(QAbstractItemView::InternalMove);
|
||||
setDropIndicatorShown(true);
|
||||
setDragDropOverwriteMode(false);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
}
|
||||
|
||||
void PluginsView::startDrag(Qt::DropActions supportedActions)
|
||||
{
|
||||
selectionModel()->select( selectionModel()->selection(),
|
||||
QItemSelectionModel::Select | QItemSelectionModel::Rows );
|
||||
QAbstractItemView::startDrag( supportedActions );
|
||||
}
|
||||
|
||||
void PluginsView::setModel(QSortFilterProxyModel *model)
|
||||
{
|
||||
QTableView::setModel(model);
|
||||
|
||||
qRegisterMetaType< QVector<QPersistentModelIndex> >();
|
||||
|
||||
connect(model->sourceModel(), SIGNAL(indexesDropped(QVector<QPersistentModelIndex>)),
|
||||
this, SLOT(selectIndexes(QVector<QPersistentModelIndex>)), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void PluginsView::selectIndexes( QVector<QPersistentModelIndex> aIndexes )
|
||||
{
|
||||
selectionModel()->clearSelection();
|
||||
foreach( QPersistentModelIndex pIndex, aIndexes )
|
||||
selectionModel()->select( pIndex, QItemSelectionModel::Select | QItemSelectionModel::Rows );
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef PLUGINSVIEW_H
|
||||
#define PLUGINSVIEW_H
|
||||
|
||||
#include <QTableView>
|
||||
|
||||
#include "pluginsmodel.hpp"
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
|
||||
class PluginsView : public QTableView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PluginsView(QWidget *parent = 0);
|
||||
|
||||
PluginsModel* model() const
|
||||
{ return qobject_cast<PluginsModel*>(QAbstractItemView::model()); }
|
||||
|
||||
void startDrag(Qt::DropActions supportedActions);
|
||||
void setModel(QSortFilterProxyModel *model);
|
||||
|
||||
public slots:
|
||||
void selectIndexes(QVector<QPersistentModelIndex> aIndexes);
|
||||
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QVector<QPersistentModelIndex>)
|
||||
|
||||
#endif
|
52
apps/launcher/utils/profilescombobox.cpp
Normal file
52
apps/launcher/utils/profilescombobox.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
#include <QRegExpValidator>
|
||||
#include <QLineEdit>
|
||||
#include <QString>
|
||||
|
||||
#include "profilescombobox.hpp"
|
||||
|
||||
ProfilesComboBox::ProfilesComboBox(QWidget *parent) :
|
||||
QComboBox(parent)
|
||||
{
|
||||
mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
||||
|
||||
setEditable(true);
|
||||
setValidator(mValidator);
|
||||
setCompleter(0);
|
||||
|
||||
connect(this, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(slotIndexChanged(int)));
|
||||
connect(lineEdit(), SIGNAL(returnPressed()), this,
|
||||
SLOT(slotReturnPressed()));
|
||||
}
|
||||
|
||||
void ProfilesComboBox::setEditEnabled(bool editable)
|
||||
{
|
||||
if (!editable)
|
||||
return setEditable(false);
|
||||
|
||||
// Reset the completer and validator
|
||||
setEditable(true);
|
||||
setValidator(mValidator);
|
||||
setCompleter(0);
|
||||
}
|
||||
|
||||
void ProfilesComboBox::slotReturnPressed()
|
||||
{
|
||||
QString current = currentText();
|
||||
QString previous = itemText(currentIndex());
|
||||
|
||||
if (findText(current) != -1)
|
||||
return;
|
||||
|
||||
setItemText(currentIndex(), current);
|
||||
emit(profileRenamed(previous, current));
|
||||
}
|
||||
|
||||
void ProfilesComboBox::slotIndexChanged(int index)
|
||||
{
|
||||
if (index == -1)
|
||||
return;
|
||||
|
||||
emit(profileChanged(mOldProfile, currentText()));
|
||||
mOldProfile = itemText(index);
|
||||
}
|
30
apps/launcher/utils/profilescombobox.hpp
Normal file
30
apps/launcher/utils/profilescombobox.hpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef PROFILESCOMBOBOX_HPP
|
||||
#define PROFILESCOMBOBOX_HPP
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class QString;
|
||||
|
||||
class QRegExpValidator;
|
||||
|
||||
class ProfilesComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProfilesComboBox(QWidget *parent = 0);
|
||||
void setEditEnabled(bool editable);
|
||||
|
||||
signals:
|
||||
void profileChanged(const QString &previous, const QString ¤t);
|
||||
void profileRenamed(const QString &oldName, const QString &newName);
|
||||
|
||||
private slots:
|
||||
void slotReturnPressed();
|
||||
void slotIndexChanged(int index);
|
||||
|
||||
private:
|
||||
QString mOldProfile;
|
||||
QRegExpValidator *mValidator;
|
||||
};
|
||||
|
||||
#endif // PROFILESCOMBOBOX_HPP
|
61
apps/launcher/utils/textinputdialog.cpp
Normal file
61
apps/launcher/utils/textinputdialog.cpp
Normal file
|
@ -0,0 +1,61 @@
|
|||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QValidator>
|
||||
|
||||
#include "lineedit.hpp"
|
||||
|
||||
#include "textinputdialog.hpp"
|
||||
|
||||
TextInputDialog::TextInputDialog(const QString& title, const QString &text, QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
mButtonBox = new QDialogButtonBox(this);
|
||||
mButtonBox->addButton(QDialogButtonBox::Ok);
|
||||
mButtonBox->addButton(QDialogButtonBox::Cancel);
|
||||
|
||||
setMaximumHeight(height());
|
||||
setOkButtonEnabled(false);
|
||||
setModal(true);
|
||||
|
||||
// Messageboxes on mac have no title
|
||||
#ifndef Q_OS_MAC
|
||||
setWindowTitle(title);
|
||||
#else
|
||||
Q_UNUSED(title);
|
||||
#endif
|
||||
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(text);
|
||||
|
||||
// Line edit
|
||||
QValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore
|
||||
mLineEdit = new LineEdit(this);
|
||||
mLineEdit->setValidator(validator);
|
||||
mLineEdit->setCompleter(0);
|
||||
|
||||
QVBoxLayout *dialogLayout = new QVBoxLayout(this);
|
||||
dialogLayout->addWidget(label);
|
||||
dialogLayout->addWidget(mLineEdit);
|
||||
dialogLayout->addWidget(mButtonBox);
|
||||
|
||||
connect(mButtonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(mButtonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
int TextInputDialog::exec()
|
||||
{
|
||||
mLineEdit->clear();
|
||||
mLineEdit->setFocus();
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
void TextInputDialog::setOkButtonEnabled(bool enabled)
|
||||
{
|
||||
|
||||
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
|
||||
okButton->setEnabled(enabled);
|
||||
}
|
28
apps/launcher/utils/textinputdialog.hpp
Normal file
28
apps/launcher/utils/textinputdialog.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef TEXTINPUTDIALOG_HPP
|
||||
#define TEXTINPUTDIALOG_HPP
|
||||
|
||||
#include <QDialog>
|
||||
//#include "lineedit.hpp"
|
||||
|
||||
class QDialogButtonBox;
|
||||
class LineEdit;
|
||||
|
||||
class TextInputDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TextInputDialog(const QString& title, const QString &text, QWidget *parent = 0);
|
||||
inline LineEdit *lineEdit() { return mLineEdit; }
|
||||
void setOkButtonEnabled(bool enabled);
|
||||
|
||||
LineEdit *mLineEdit;
|
||||
|
||||
int exec();
|
||||
|
||||
private:
|
||||
QDialogButtonBox *mButtonBox;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // TEXTINPUTDIALOG_HPP
|
|
@ -53,6 +53,7 @@ add_openmw_dir (mwworld
|
|||
containerstore actiontalk actiontake manualref player cellfunctors
|
||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||
esmstore store recordcmp
|
||||
)
|
||||
|
||||
add_openmw_dir (mwclass
|
||||
|
|
|
@ -101,7 +101,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||
MWBase::Environment::get().getWorld()->doPhysics (movement, mEnvironment.getFrameDuration());
|
||||
|
||||
// update world
|
||||
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame);
|
||||
MWBase::Environment::get().getWorld()->update (evt.timeSinceLastFrame, MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||
|
||||
// update GUI
|
||||
Ogre::RenderWindow* window = mOgre->getWindow();
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace MWBase
|
|||
virtual void setPlayerName (const std::string& name) = 0;
|
||||
///< Set player name.
|
||||
|
||||
virtual void setPlayerRace (const std::string& id, bool male) = 0;
|
||||
virtual void setPlayerRace (const std::string& id, bool male, const std::string &head, const std::string &hair) = 0;
|
||||
///< Set player race.
|
||||
|
||||
virtual void setPlayerBirthsign (const std::string& id) = 0;
|
||||
|
@ -77,6 +77,12 @@ namespace MWBase
|
|||
virtual void restoreDynamicStats() = 0;
|
||||
///< If the player is sleeping, this should be called every hour.
|
||||
|
||||
virtual int getBarterOffer(const MWWorld::Ptr& ptr,int basePrice, bool buying) = 0;
|
||||
///< This is used by every service to determine the price of objects given the trading skills of the player and NPC.
|
||||
|
||||
virtual int getDerivedDisposition(const MWWorld::Ptr& ptr) = 0;
|
||||
///< Calculate the diposition of an NPC toward the player.
|
||||
|
||||
virtual int countDeaths (const std::string& id) const = 0;
|
||||
///< Return the number of deaths for actors with the given ID.
|
||||
};
|
||||
|
|
|
@ -29,11 +29,7 @@ namespace ESM
|
|||
struct Class;
|
||||
struct Potion;
|
||||
struct Spell;
|
||||
}
|
||||
|
||||
namespace ESMS
|
||||
{
|
||||
struct ESMStore;
|
||||
struct NPC;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
|
@ -48,6 +44,7 @@ namespace MWWorld
|
|||
class LocalScripts;
|
||||
class Ptr;
|
||||
class TimeStamp;
|
||||
class ESMStore;
|
||||
}
|
||||
|
||||
namespace MWBase
|
||||
|
@ -104,7 +101,7 @@ namespace MWBase
|
|||
|
||||
virtual MWWorld::Player& getPlayer() = 0;
|
||||
|
||||
virtual const ESMS::ESMStore& getStore() const = 0;
|
||||
virtual const MWWorld::ESMStore& getStore() const = 0;
|
||||
|
||||
virtual ESM::ESMReader& getEsmReader() = 0;
|
||||
|
||||
|
@ -234,24 +231,28 @@ namespace MWBase
|
|||
///< Toggle a render mode.
|
||||
///< \return Resulting mode
|
||||
|
||||
virtual std::pair<std::string, const ESM::Potion *> createRecord (const ESM::Potion& record)
|
||||
virtual 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
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual std::pair<std::string, const ESM::Spell *> createRecord (const ESM::Spell& record)
|
||||
virtual const ESM::Spell *createRecord (const ESM::Spell& record)
|
||||
= 0;
|
||||
///< Create a new recrod (of type spell) in the ESM store.
|
||||
/// \return ID, pointer to created record
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual std::pair<std::string, const ESM::Class *> createRecord (const ESM::Class& record)
|
||||
virtual 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
|
||||
/// \return 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
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual const ESM::NPC *createRecord(const ESM::NPC &record) = 0;
|
||||
///< Create a new recrod (of type npc) in the ESM store.
|
||||
/// \return pointer to created record
|
||||
|
||||
virtual void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName,
|
||||
int mode, int number = 1) = 0;
|
||||
|
@ -265,7 +266,7 @@ namespace MWBase
|
|||
///< 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 void update (float duration, bool paused) = 0;
|
||||
|
||||
virtual bool placeObject(const MWWorld::Ptr& object, float cursorX, float cursorY) = 0;
|
||||
///< place an object into the gameworld at the specified cursor position
|
||||
|
|
|
@ -30,18 +30,17 @@ namespace MWClass
|
|||
void Activator::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Activator::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -53,7 +52,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
std::string Activator::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -61,7 +60,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
void Activator::registerSelf()
|
||||
|
@ -76,7 +75,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -85,11 +84,11 @@ namespace MWClass
|
|||
ptr.get<ESM::Activator>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
|
||||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
info.text = text;
|
||||
|
||||
return info;
|
||||
|
@ -101,6 +100,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Activator> *ref =
|
||||
ptr.get<ESM::Activator>();
|
||||
|
||||
return MWWorld::Ptr(&cell.activators.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mActivators.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,18 +33,17 @@ namespace MWClass
|
|||
void Apparatus::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Apparatus::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -56,7 +55,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -75,7 +74,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -83,7 +82,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Apparatus::registerSelf()
|
||||
|
@ -108,7 +107,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -116,7 +115,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -125,17 +124,17 @@ namespace MWClass
|
|||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
info.text = text;
|
||||
|
||||
|
@ -154,6 +153,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
|
||||
ptr.get<ESM::Apparatus>();
|
||||
|
||||
return MWWorld::Ptr(&cell.appas.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mAppas.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,18 +36,17 @@ namespace MWClass
|
|||
void Armor::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Armor::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -59,7 +58,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -82,7 +81,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mData.mHealth;
|
||||
return ref->mBase->mData.mHealth;
|
||||
}
|
||||
|
||||
std::string Armor::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -90,7 +89,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -118,7 +117,7 @@ namespace MWClass
|
|||
};
|
||||
|
||||
for (int i=0; i<size; ++i)
|
||||
if (sMapping[i][0]==ref->base->mData.mType)
|
||||
if (sMapping[i][0]==ref->mBase->mData.mType)
|
||||
{
|
||||
slots.push_back (int (sMapping[i][1]));
|
||||
break;
|
||||
|
@ -134,7 +133,7 @@ namespace MWClass
|
|||
|
||||
std::string typeGmst;
|
||||
|
||||
switch (ref->base->mData.mType)
|
||||
switch (ref->mBase->mData.mType)
|
||||
{
|
||||
case ESM::Armor::Helmet: typeGmst = "iHelmWeight"; break;
|
||||
case ESM::Armor::Cuirass: typeGmst = "iCuirassWeight"; break;
|
||||
|
@ -152,14 +151,17 @@ namespace MWClass
|
|||
if (typeGmst.empty())
|
||||
return -1;
|
||||
|
||||
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->getInt();
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->getFloat()>=
|
||||
ref->base->mData.mWeight)
|
||||
float iWeight = gmst.find (typeGmst)->getInt();
|
||||
|
||||
if (iWeight * gmst.find ("fLightMaxMod")->getFloat()>=
|
||||
ref->mBase->mData.mWeight)
|
||||
return ESM::Skill::LightArmor;
|
||||
|
||||
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->getFloat()>=
|
||||
ref->base->mData.mWeight)
|
||||
if (iWeight * gmst.find ("fMedMaxMod")->getFloat()>=
|
||||
ref->mBase->mData.mWeight)
|
||||
return ESM::Skill::MediumArmor;
|
||||
|
||||
return ESM::Skill::HeavyArmor;
|
||||
|
@ -170,7 +172,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Armor::registerSelf()
|
||||
|
@ -207,7 +209,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -215,7 +217,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -224,8 +226,8 @@ namespace MWClass
|
|||
ptr.get<ESM::Armor>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
|
@ -239,20 +241,20 @@ namespace MWClass
|
|||
else
|
||||
typeText = "#{sHeavy}";
|
||||
|
||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->base->mData.mArmor);
|
||||
text += "\n#{sArmorRating}: " + MWGui::ToolTips::toString(ref->mBase->mData.mArmor);
|
||||
|
||||
/// \todo store the current armor health somewhere
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight) + " (" + typeText + ")";
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight) + " (" + typeText + ")";
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.enchant = ref->base->mEnchant;
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -264,7 +266,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return ref->base->mEnchant;
|
||||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -282,6 +284,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||
ptr.get<ESM::Armor>();
|
||||
|
||||
return MWWorld::Ptr(&cell.armors.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mArmors.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,18 +32,17 @@ namespace MWClass
|
|||
void Book::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Book::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -55,7 +54,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -70,7 +69,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Book::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -78,7 +77,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Book::registerSelf()
|
||||
|
@ -103,7 +102,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Book::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -111,7 +110,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -120,20 +119,20 @@ namespace MWClass
|
|||
ptr.get<ESM::Book>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.enchant = ref->base->mEnchant;
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -145,7 +144,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return ref->base->mEnchant;
|
||||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -159,6 +158,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref =
|
||||
ptr.get<ESM::Book>();
|
||||
|
||||
return MWWorld::Ptr(&cell.books.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mBooks.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,17 @@ namespace MWClass
|
|||
void Clothing::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Clothing::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -57,7 +56,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -75,7 +74,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -85,7 +84,7 @@ namespace MWClass
|
|||
|
||||
std::vector<int> slots;
|
||||
|
||||
if (ref->base->mData.mType==ESM::Clothing::Ring)
|
||||
if (ref->mBase->mData.mType==ESM::Clothing::Ring)
|
||||
{
|
||||
slots.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
|
||||
slots.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
|
||||
|
@ -108,7 +107,7 @@ namespace MWClass
|
|||
};
|
||||
|
||||
for (int i=0; i<size; ++i)
|
||||
if (sMapping[i][0]==ref->base->mData.mType)
|
||||
if (sMapping[i][0]==ref->mBase->mData.mType)
|
||||
{
|
||||
slots.push_back (int (sMapping[i][1]));
|
||||
break;
|
||||
|
@ -123,7 +122,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->mData.mType==ESM::Clothing::Shoes)
|
||||
if (ref->mBase->mData.mType==ESM::Clothing::Shoes)
|
||||
return ESM::Skill::Unarmored;
|
||||
|
||||
return -1;
|
||||
|
@ -134,7 +133,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Clothing::registerSelf()
|
||||
|
@ -149,7 +148,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->mData.mType == 8)
|
||||
if (ref->mBase->mData.mType == 8)
|
||||
{
|
||||
return std::string("Item Ring Up");
|
||||
}
|
||||
|
@ -161,7 +160,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->mData.mType == 8)
|
||||
if (ref->mBase->mData.mType == 8)
|
||||
{
|
||||
return std::string("Item Ring Down");
|
||||
}
|
||||
|
@ -173,7 +172,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -181,7 +180,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -190,20 +189,20 @@ namespace MWClass
|
|||
ptr.get<ESM::Clothing>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.enchant = ref->base->mEnchant;
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -215,7 +214,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return ref->base->mEnchant;
|
||||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -233,6 +232,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
return MWWorld::Ptr(&cell.clothes.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mClothes.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,18 +65,17 @@ namespace MWClass
|
|||
void Container::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Container::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -95,9 +94,15 @@ namespace MWClass
|
|||
bool needKey = ptr.getCellRef().mLockLevel>0;
|
||||
bool hasKey = false;
|
||||
std::string keyName;
|
||||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
keyName = MWWorld::Class::get(*it).getName(*it);
|
||||
|
@ -143,7 +148,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
|
@ -159,7 +164,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
void Container::registerSelf()
|
||||
|
@ -174,7 +179,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -183,17 +188,17 @@ namespace MWClass
|
|||
ptr.get<ESM::Container>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName;
|
||||
info.caption = ref->mBase->mName;
|
||||
|
||||
std::string text;
|
||||
if (ref->ref.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
|
||||
if (ref->ref.mTrap != "")
|
||||
if (ref->mRef.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->mRef.mLockLevel);
|
||||
if (ref->mRef.mTrap != "")
|
||||
text += "\n#{sTrapped}";
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -206,7 +211,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return ref->base->mWeight;
|
||||
return ref->mBase->mWeight;
|
||||
}
|
||||
|
||||
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||
|
@ -233,6 +238,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Container> *ref =
|
||||
ptr.get<ESM::Container>();
|
||||
|
||||
return MWWorld::Ptr(&cell.containers.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mContainers.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,28 +48,28 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
// creature stats
|
||||
data->mCreatureStats.getAttribute(0).set (ref->base->mData.mStrength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->base->mData.mIntelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->base->mData.mWillpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->base->mData.mAgility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->base->mData.mSpeed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->base->mData.mEndurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->base->mData.mPersonality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->base->mData.mLuck);
|
||||
data->mCreatureStats.setHealth (ref->base->mData.mHealth);
|
||||
data->mCreatureStats.setMagicka (ref->base->mData.mMana);
|
||||
data->mCreatureStats.setFatigue (ref->base->mData.mFatigue);
|
||||
data->mCreatureStats.getAttribute(0).set (ref->mBase->mData.mStrength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->mBase->mData.mIntelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->mBase->mData.mWillpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->mBase->mData.mAgility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->mBase->mData.mSpeed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->mBase->mData.mEndurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->mBase->mData.mPersonality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->mBase->mData.mLuck);
|
||||
data->mCreatureStats.setHealth (ref->mBase->mData.mHealth);
|
||||
data->mCreatureStats.setMagicka (ref->mBase->mData.mMana);
|
||||
data->mCreatureStats.setFatigue (ref->mBase->mData.mFatigue);
|
||||
|
||||
data->mCreatureStats.setLevel(ref->base->mData.mLevel);
|
||||
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
||||
|
||||
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->base->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
|
||||
data->mCreatureStats.setHello(ref->mBase->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->mBase->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->mBase->mAiData.mAlarm);
|
||||
|
||||
// spells
|
||||
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
|
||||
iter!=ref->base->mSpells.mList.end(); ++iter)
|
||||
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
|
||||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// store
|
||||
|
@ -82,7 +82,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->mId;
|
||||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -94,9 +94,8 @@ namespace MWClass
|
|||
void Creature::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()){
|
||||
physics.insertActorPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addActor(ptr);
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor (ptr);
|
||||
}
|
||||
|
||||
|
@ -104,9 +103,9 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
assert (ref->base != NULL);
|
||||
assert (ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -118,7 +117,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
|
||||
|
@ -150,7 +149,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
bool Creature::isEssential (const MWWorld::Ptr& ptr) const
|
||||
|
@ -158,7 +157,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->base->mFlags & ESM::Creature::Essential;
|
||||
return ref->mBase->mFlags & ESM::Creature::Essential;
|
||||
}
|
||||
|
||||
void Creature::registerSelf()
|
||||
|
@ -181,11 +180,11 @@ namespace MWClass
|
|||
ptr.get<ESM::Creature>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName;
|
||||
info.caption = ref->mBase->mName;
|
||||
|
||||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
info.text = text;
|
||||
|
||||
return info;
|
||||
|
@ -219,6 +218,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return MWWorld::Ptr(&cell.creatures.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mCreatures.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,18 +35,17 @@ namespace MWClass
|
|||
void Door::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Door::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -58,10 +57,10 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
if (ref->ref.mTeleport && !ref->ref.mDestCell.empty()) // TODO doors that lead to exteriors
|
||||
return ref->ref.mDestCell;
|
||||
if (ref->mRef.mTeleport && !ref->mRef.mDestCell.empty()) // TODO doors that lead to exteriors
|
||||
return ref->mRef.mDestCell;
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -70,8 +69,8 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
const std::string &openSound = ref->base->mOpenSound;
|
||||
//const std::string &closeSound = ref->base->closeSound;
|
||||
const std::string &openSound = ref->mBase->mOpenSound;
|
||||
//const std::string &closeSound = ref->mBase->closeSound;
|
||||
const std::string lockedSound = "LockedDoor";
|
||||
const std::string trapActivationSound = "Disarm Trap Fail";
|
||||
|
||||
|
@ -81,9 +80,15 @@ namespace MWClass
|
|||
bool needKey = ptr.getCellRef().mLockLevel>0;
|
||||
bool hasKey = false;
|
||||
std::string keyName;
|
||||
|
||||
// make key id lowercase
|
||||
std::string keyId = ptr.getCellRef().mKey;
|
||||
std::transform(keyId.begin(), keyId.end(), keyId.begin(), ::tolower);
|
||||
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
|
||||
{
|
||||
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
|
||||
std::string refId = it->getCellRef().mRefID;
|
||||
std::transform(refId.begin(), refId.end(), refId.begin(), ::tolower);
|
||||
if (refId == keyId)
|
||||
{
|
||||
hasKey = true;
|
||||
keyName = MWWorld::Class::get(*it).getName(*it);
|
||||
|
@ -113,13 +118,13 @@ namespace MWClass
|
|||
return action;
|
||||
}
|
||||
|
||||
if (ref->ref.mTeleport)
|
||||
if (ref->mRef.mTeleport)
|
||||
{
|
||||
// teleport door
|
||||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||
{
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.mDestCell, ref->ref.mDoorDest));
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->mRef.mDestCell, ref->mRef.mDoorDest));
|
||||
|
||||
action->setSound(openSound);
|
||||
|
||||
|
@ -171,7 +176,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
void Door::registerSelf()
|
||||
|
@ -186,7 +191,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -195,31 +200,32 @@ namespace MWClass
|
|||
ptr.get<ESM::Door>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName;
|
||||
info.caption = ref->mBase->mName;
|
||||
|
||||
std::string text;
|
||||
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
if (ref->ref.mTeleport)
|
||||
if (ref->mRef.mTeleport)
|
||||
{
|
||||
std::string dest;
|
||||
if (ref->ref.mDestCell != "")
|
||||
if (ref->mRef.mDestCell != "")
|
||||
{
|
||||
// door leads to an interior, use interior name as tooltip
|
||||
dest = ref->ref.mDestCell;
|
||||
dest = ref->mRef.mDestCell;
|
||||
}
|
||||
else
|
||||
{
|
||||
// door leads to exterior, use cell name (if any), otherwise translated region name
|
||||
int x,y;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.mDoorDest.pos[0], ref->ref.mDoorDest.pos[1], x, y);
|
||||
const ESM::Cell* cell = store.cells.findExt(x,y);
|
||||
MWBase::Environment::get().getWorld()->positionToIndex (ref->mRef.mDoorDest.pos[0], ref->mRef.mDoorDest.pos[1], x, y);
|
||||
const ESM::Cell* cell = store.get<ESM::Cell>().find(x,y);
|
||||
if (cell->mName != "")
|
||||
dest = cell->mName;
|
||||
else
|
||||
{
|
||||
const ESM::Region* region = store.regions.search(cell->mRegion);
|
||||
const ESM::Region* region =
|
||||
store.get<ESM::Region>().find(cell->mRegion);
|
||||
dest = region->mName;
|
||||
}
|
||||
}
|
||||
|
@ -227,13 +233,13 @@ namespace MWClass
|
|||
text += "\n"+dest;
|
||||
}
|
||||
|
||||
if (ref->ref.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
|
||||
if (ref->ref.mTrap != "")
|
||||
if (ref->mRef.mLockLevel > 0)
|
||||
text += "\n#{sLockLevel}: " + MWGui::ToolTips::toString(ref->mRef.mLockLevel);
|
||||
if (ref->mRef.mTrap != "")
|
||||
text += "\n#{sTrapped}";
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
@ -246,6 +252,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Door> *ref =
|
||||
ptr.get<ESM::Door>();
|
||||
|
||||
return MWWorld::Ptr(&cell.doors.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mDoors.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->mId;
|
||||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -41,18 +41,17 @@ namespace MWClass
|
|||
void Ingredient::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Ingredient::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -82,7 +81,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -90,7 +89,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,7 +124,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -133,7 +132,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -142,28 +141,28 @@ namespace MWClass
|
|||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
MWGui::Widgets::SpellEffectList list;
|
||||
for (int i=0; i<4; ++i)
|
||||
{
|
||||
if (ref->base->mData.mEffectID[i] < 0)
|
||||
if (ref->mBase->mData.mEffectID[i] < 0)
|
||||
continue;
|
||||
MWGui::Widgets::SpellEffectParams params;
|
||||
params.mEffectID = ref->base->mData.mEffectID[i];
|
||||
params.mAttribute = ref->base->mData.mAttributes[i];
|
||||
params.mSkill = ref->base->mData.mSkills[i];
|
||||
params.mEffectID = ref->mBase->mData.mEffectID[i];
|
||||
params.mAttribute = ref->mBase->mData.mAttributes[i];
|
||||
params.mSkill = ref->mBase->mData.mSkills[i];
|
||||
list.push_back(params);
|
||||
}
|
||||
info.effects = list;
|
||||
|
@ -179,6 +178,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
|
||||
ptr.get<ESM::Ingredient>();
|
||||
|
||||
return MWWorld::Ptr(&cell.ingreds.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mIngreds.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,9 +27,9 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->base != NULL);
|
||||
assert (ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
|
||||
MWRender::Objects& objects = renderingInterface.getObjects();
|
||||
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
|
||||
|
@ -37,11 +37,11 @@ namespace MWClass
|
|||
if (!model.empty())
|
||||
objects.insertMesh(ptr, "meshes\\" + model);
|
||||
|
||||
const int color = ref->base->mData.mColor;
|
||||
const int color = ref->mBase->mData.mColor;
|
||||
const float r = ((color >> 0) & 0xFF) / 255.0f;
|
||||
const float g = ((color >> 8) & 0xFF) / 255.0f;
|
||||
const float b = ((color >> 16) & 0xFF) / 255.0f;
|
||||
const float radius = float (ref->base->mData.mRadius);
|
||||
const float radius = float (ref->mBase->mData.mRadius);
|
||||
objects.insertLight (ptr, r, g, b, radius);
|
||||
}
|
||||
|
||||
|
@ -49,25 +49,24 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->base != NULL);
|
||||
assert (ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, "meshes\\" + model);
|
||||
}
|
||||
if (!ref->base->mSound.empty()) {
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
|
||||
if (!ref->mBase->mSound.empty())
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||
}
|
||||
|
||||
std::string Light::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
assert (ref->base != NULL);
|
||||
assert (ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -79,10 +78,10 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
if (ref->base->mModel.empty())
|
||||
if (ref->mBase->mModel.empty())
|
||||
return "";
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -91,7 +90,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
|
||||
if (!(ref->mBase->mData.mFlags & ESM::Light::Carry))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||
|
@ -106,7 +105,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -116,7 +115,7 @@ namespace MWClass
|
|||
|
||||
std::vector<int> slots;
|
||||
|
||||
if (ref->base->mData.mFlags & ESM::Light::Carry)
|
||||
if (ref->mBase->mData.mFlags & ESM::Light::Carry)
|
||||
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft));
|
||||
|
||||
return std::make_pair (slots, false);
|
||||
|
@ -127,7 +126,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Light::registerSelf()
|
||||
|
@ -153,7 +152,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Light::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -161,7 +160,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -170,17 +169,17 @@ namespace MWClass
|
|||
ptr.get<ESM::Light>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -203,6 +202,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Light> *ref =
|
||||
ptr.get<ESM::Light>();
|
||||
|
||||
return MWWorld::Ptr(&cell.lights.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mLights.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,17 @@ namespace MWClass
|
|||
void Lockpick::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Lockpick::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -57,7 +56,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -75,7 +74,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -92,7 +91,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Lockpick::registerSelf()
|
||||
|
@ -117,7 +116,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -125,7 +124,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -134,21 +133,21 @@ namespace MWClass
|
|||
ptr.get<ESM::Tool>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
/// \todo store remaining uses somewhere
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -171,6 +170,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Tool> *ref =
|
||||
ptr.get<ESM::Tool>();
|
||||
|
||||
return MWWorld::Ptr(&cell.lockpicks.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mLockpicks.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,18 +37,17 @@ namespace MWClass
|
|||
void Miscellaneous::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -60,7 +59,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -78,7 +77,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -86,7 +85,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Miscellaneous::registerSelf()
|
||||
|
@ -101,7 +100,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
|
||||
if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGold")->getString())
|
||||
{
|
||||
return std::string("Item Gold Up");
|
||||
}
|
||||
|
@ -113,7 +112,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
|
||||
if (ref->mBase->mName == MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGold")->getString())
|
||||
{
|
||||
return std::string("Item Gold Down");
|
||||
}
|
||||
|
@ -125,7 +124,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -133,7 +132,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -143,13 +142,13 @@ namespace MWClass
|
|||
|
||||
MWGui::ToolTipInfo info;
|
||||
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
int count = ptr.getRefData().getCount();
|
||||
|
||||
bool isGold = (ref->base->mName == store.gameSettings.find("sGold")->getString());
|
||||
bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
|
||||
if (isGold && count == 1)
|
||||
count = ref->base->mData.mValue;
|
||||
count = ref->mBase->mData.mValue;
|
||||
|
||||
std::string countString;
|
||||
if (!isGold)
|
||||
|
@ -157,12 +156,12 @@ namespace MWClass
|
|||
else // gold displays its count also if it's 1.
|
||||
countString = " (" + boost::lexical_cast<std::string>(count) + ")";
|
||||
|
||||
info.caption = ref->base->mName + countString;
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + countString;
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
if (ref->ref.mSoul != "")
|
||||
if (ref->mRef.mSoul != "")
|
||||
{
|
||||
const ESM::Creature *creature = store.creatures.search(ref->ref.mSoul);
|
||||
const ESM::Creature *creature = store.get<ESM::Creature>().find(ref->mRef.mSoul);
|
||||
info.caption += " (" + creature->mName + ")";
|
||||
}
|
||||
|
||||
|
@ -170,13 +169,13 @@ namespace MWClass
|
|||
|
||||
if (!isGold)
|
||||
{
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
}
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -189,10 +188,10 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::Ptr newPtr;
|
||||
|
||||
const ESMS::ESMStore &store =
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.find("sGold")->getString()) {
|
||||
if (MWWorld::Class::get(ptr).getName(ptr) == store.get<ESM::GameSetting>().find("sGold")->getString()) {
|
||||
int goldAmount = ptr.getRefData().getCount();
|
||||
|
||||
std::string base = "Gold_001";
|
||||
|
@ -210,11 +209,11 @@ namespace MWClass
|
|||
MWWorld::ManualRef newRef(store, base);
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
newRef.getPtr().get<ESM::Miscellaneous>();
|
||||
newPtr = MWWorld::Ptr(&cell.miscItems.insert(*ref), &cell);
|
||||
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
|
||||
} else {
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
newPtr = MWWorld::Ptr(&cell.miscItems.insert(*ref), &cell);
|
||||
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
|
||||
}
|
||||
return newPtr;
|
||||
}
|
||||
|
|
|
@ -62,39 +62,40 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
// NPC stats
|
||||
if (!ref->base->mFaction.empty())
|
||||
if (!ref->mBase->mFaction.empty())
|
||||
{
|
||||
std::string faction = ref->base->mFaction;
|
||||
std::string faction = ref->mBase->mFaction;
|
||||
boost::algorithm::to_lower(faction);
|
||||
if(ref->base->mNpdt52.mGold != -10)
|
||||
if(ref->mBase->mNpdt52.mGold != -10)
|
||||
{
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt52.mRank;
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->mBase->mNpdt52.mRank;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt12.mRank;
|
||||
data->mNpcStats.getFactionRanks()[faction] = (int)ref->mBase->mNpdt12.mRank;
|
||||
}
|
||||
}
|
||||
|
||||
// creature stats
|
||||
if(ref->base->mNpdt52.mGold != -10)
|
||||
if(ref->mBase->mNpdt52.mGold != -10)
|
||||
{
|
||||
for (int i=0; i<27; ++i)
|
||||
data->mNpcStats.getSkill (i).setBase (ref->base->mNpdt52.mSkills[i]);
|
||||
data->mNpcStats.getSkill (i).setBase (ref->mBase->mNpdt52.mSkills[i]);
|
||||
|
||||
data->mCreatureStats.getAttribute(0).set (ref->base->mNpdt52.mStrength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->base->mNpdt52.mIntelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->base->mNpdt52.mWillpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->base->mNpdt52.mAgility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->base->mNpdt52.mSpeed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->base->mNpdt52.mEndurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->base->mNpdt52.mPersonality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->base->mNpdt52.mLuck);
|
||||
data->mCreatureStats.setHealth (ref->base->mNpdt52.mHealth);
|
||||
data->mCreatureStats.setMagicka (ref->base->mNpdt52.mMana);
|
||||
data->mCreatureStats.setFatigue (ref->base->mNpdt52.mFatigue);
|
||||
data->mCreatureStats.getAttribute(0).set (ref->mBase->mNpdt52.mStrength);
|
||||
data->mCreatureStats.getAttribute(1).set (ref->mBase->mNpdt52.mIntelligence);
|
||||
data->mCreatureStats.getAttribute(2).set (ref->mBase->mNpdt52.mWillpower);
|
||||
data->mCreatureStats.getAttribute(3).set (ref->mBase->mNpdt52.mAgility);
|
||||
data->mCreatureStats.getAttribute(4).set (ref->mBase->mNpdt52.mSpeed);
|
||||
data->mCreatureStats.getAttribute(5).set (ref->mBase->mNpdt52.mEndurance);
|
||||
data->mCreatureStats.getAttribute(6).set (ref->mBase->mNpdt52.mPersonality);
|
||||
data->mCreatureStats.getAttribute(7).set (ref->mBase->mNpdt52.mLuck);
|
||||
data->mCreatureStats.setHealth (ref->mBase->mNpdt52.mHealth);
|
||||
data->mCreatureStats.setMagicka (ref->mBase->mNpdt52.mMana);
|
||||
data->mCreatureStats.setFatigue (ref->mBase->mNpdt52.mFatigue);
|
||||
|
||||
data->mCreatureStats.setLevel(ref->base->mNpdt52.mLevel);
|
||||
data->mCreatureStats.setLevel(ref->mBase->mNpdt52.mLevel);
|
||||
data->mNpcStats.setDisposition(ref->mBase->mNpdt52.mDisposition);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -108,14 +109,14 @@ namespace MWClass
|
|||
data->mCreatureStats.setLevel (1);
|
||||
}
|
||||
|
||||
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->base->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
|
||||
data->mCreatureStats.setHello(ref->mBase->mAiData.mHello);
|
||||
data->mCreatureStats.setFight(ref->mBase->mAiData.mFight);
|
||||
data->mCreatureStats.setFlee(ref->mBase->mAiData.mFlee);
|
||||
data->mCreatureStats.setAlarm(ref->mBase->mAiData.mAlarm);
|
||||
|
||||
// spells
|
||||
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
|
||||
iter!=ref->base->mSpells.mList.end(); ++iter)
|
||||
for (std::vector<std::string>::const_iterator iter (ref->mBase->mSpells.mList.begin());
|
||||
iter!=ref->mBase->mSpells.mList.end(); ++iter)
|
||||
data->mCreatureStats.getSpells().add (*iter);
|
||||
|
||||
// store
|
||||
|
@ -128,7 +129,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->mId;
|
||||
return ref->mBase->mId;
|
||||
}
|
||||
|
||||
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -138,7 +139,7 @@ namespace MWClass
|
|||
|
||||
void Npc::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
physics.insertActorPhysics(ptr, getModel(ptr));
|
||||
physics.addActor(ptr);
|
||||
MWBase::Environment::get().getMechanicsManager()->addActor(ptr);
|
||||
}
|
||||
|
||||
|
@ -146,9 +147,9 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
std::string headID = ref->base->mHead;
|
||||
std::string headID = ref->mBase->mHead;
|
||||
|
||||
int end = headID.find_last_of("head_") - 4;
|
||||
std::string bodyRaceID = headID.substr(0, end);
|
||||
|
@ -170,7 +171,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
|
||||
|
@ -217,7 +218,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
void Npc::setForceStance (const MWWorld::Ptr& ptr, Stance stance, bool force) const
|
||||
|
@ -325,7 +326,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->base->mFlags & ESM::NPC::Essential;
|
||||
return ref->mBase->mFlags & ESM::NPC::Essential;
|
||||
}
|
||||
|
||||
void Npc::registerSelf()
|
||||
|
@ -347,11 +348,11 @@ namespace MWClass
|
|||
ptr.get<ESM::NPC>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName;
|
||||
info.caption = ref->mBase->mName;
|
||||
|
||||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
info.text = text;
|
||||
|
||||
return info;
|
||||
|
@ -395,8 +396,10 @@ namespace MWClass
|
|||
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
|
||||
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
|
||||
ref->base->mClass);
|
||||
const ESM::Class *class_ =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find (
|
||||
ref->mBase->mClass
|
||||
);
|
||||
|
||||
stats.useSkill (skill, *class_, usageType);
|
||||
}
|
||||
|
@ -413,6 +416,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return MWWorld::Ptr(&cell.npcs.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mNpcs.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,17 @@ namespace MWClass
|
|||
void Potion::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Potion::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -57,7 +56,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -76,7 +75,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Potion::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -84,7 +83,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Potion::registerSelf()
|
||||
|
@ -109,7 +108,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -117,7 +116,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -126,20 +125,20 @@ namespace MWClass
|
|||
ptr.get<ESM::Potion>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->mEffects);
|
||||
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->mBase->mEffects);
|
||||
info.isPotion = true;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -157,7 +156,7 @@ namespace MWClass
|
|||
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> action (
|
||||
new MWWorld::ActionApply (actor, ref->base->mId));
|
||||
new MWWorld::ActionApply (actor, ref->mBase->mId));
|
||||
|
||||
action->setSound ("Drink");
|
||||
|
||||
|
@ -170,6 +169,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
return MWWorld::Ptr(&cell.potions.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mPotions.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,17 @@ namespace MWClass
|
|||
void Probe::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Probe::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -57,7 +56,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
|
@ -74,7 +73,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -91,7 +90,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Probe::registerSelf()
|
||||
|
@ -116,7 +115,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -124,7 +123,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -133,21 +132,21 @@ namespace MWClass
|
|||
ptr.get<ESM::Probe>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
/// \todo store remaining uses somewhere
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -170,6 +169,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Probe> *ref =
|
||||
ptr.get<ESM::Probe>();
|
||||
|
||||
return MWWorld::Ptr(&cell.probes.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mProbes.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,18 +32,17 @@ namespace MWClass
|
|||
void Repair::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Repair::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -55,7 +54,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -73,7 +72,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
int Repair::getValue (const MWWorld::Ptr& ptr) const
|
||||
|
@ -81,7 +80,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Repair::registerSelf()
|
||||
|
@ -106,7 +105,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -114,7 +113,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -123,21 +122,21 @@ namespace MWClass
|
|||
ptr.get<ESM::Repair>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
||||
/// \todo store remaining uses somewhere
|
||||
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->base->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sUses}: " + MWGui::ToolTips::toString(ref->mBase->mData.mUses);
|
||||
text += "\n#{sQuality}: " + MWGui::ToolTips::toString(ref->mBase->mData.mQuality);
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -151,6 +150,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Repair> *ref =
|
||||
ptr.get<ESM::Repair>();
|
||||
|
||||
return MWWorld::Ptr(&cell.repairs.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mRepairs.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,18 +24,17 @@ namespace MWClass
|
|||
void Static::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Static::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -60,6 +59,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Static> *ref =
|
||||
ptr.get<ESM::Static>();
|
||||
|
||||
return MWWorld::Ptr(&cell.statics.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mStatics.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,18 +34,17 @@ namespace MWClass
|
|||
void Weapon::insertObject(const MWWorld::Ptr& ptr, MWWorld::PhysicsSystem& physics) const
|
||||
{
|
||||
const std::string model = getModel(ptr);
|
||||
if(!model.empty()) {
|
||||
physics.insertObjectPhysics(ptr, model);
|
||||
}
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr);
|
||||
}
|
||||
|
||||
std::string Weapon::getModel(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
assert(ref->base != NULL);
|
||||
assert(ref->mBase != NULL);
|
||||
|
||||
const std::string &model = ref->base->mModel;
|
||||
const std::string &model = ref->mBase->mModel;
|
||||
if (!model.empty()) {
|
||||
return "meshes\\" + model;
|
||||
}
|
||||
|
@ -57,7 +56,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mName;
|
||||
return ref->mBase->mName;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -80,7 +79,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mData.mHealth;
|
||||
return ref->mBase->mData.mHealth;
|
||||
}
|
||||
|
||||
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -88,7 +87,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mScript;
|
||||
return ref->mBase->mScript;
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const
|
||||
|
@ -99,12 +98,12 @@ namespace MWClass
|
|||
std::vector<int> slots;
|
||||
bool stack = false;
|
||||
|
||||
if (ref->base->mData.mType==ESM::Weapon::Arrow || ref->base->mData.mType==ESM::Weapon::Bolt)
|
||||
if (ref->mBase->mData.mType==ESM::Weapon::Arrow || ref->mBase->mData.mType==ESM::Weapon::Bolt)
|
||||
{
|
||||
slots.push_back (int (MWWorld::InventoryStore::Slot_Ammunition));
|
||||
stack = true;
|
||||
}
|
||||
else if (ref->base->mData.mType==ESM::Weapon::MarksmanThrown)
|
||||
else if (ref->mBase->mData.mType==ESM::Weapon::MarksmanThrown)
|
||||
{
|
||||
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
|
||||
stack = true;
|
||||
|
@ -139,7 +138,7 @@ namespace MWClass
|
|||
};
|
||||
|
||||
for (int i=0; i<size; ++i)
|
||||
if (sMapping[i][0]==ref->base->mData.mType)
|
||||
if (sMapping[i][0]==ref->mBase->mData.mType)
|
||||
return sMapping[i][1];
|
||||
|
||||
return -1;
|
||||
|
@ -150,7 +149,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mData.mValue;
|
||||
return ref->mBase->mData.mValue;
|
||||
}
|
||||
|
||||
void Weapon::registerSelf()
|
||||
|
@ -165,7 +164,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
int type = ref->base->mData.mType;
|
||||
int type = ref->mBase->mData.mType;
|
||||
// Ammo
|
||||
if (type == 12 || type == 13)
|
||||
{
|
||||
|
@ -211,7 +210,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
int type = ref->base->mData.mType;
|
||||
int type = ref->mBase->mData.mType;
|
||||
// Ammo
|
||||
if (type == 12 || type == 13)
|
||||
{
|
||||
|
@ -257,7 +256,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mIcon;
|
||||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const
|
||||
|
@ -265,7 +264,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return (ref->base->mName != "");
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
|
||||
|
@ -274,15 +273,15 @@ namespace MWClass
|
|||
ptr.get<ESM::Weapon>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->base->mIcon;
|
||||
info.caption = ref->mBase->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
std::string text;
|
||||
|
||||
// weapon type & damage. arrows / bolts don't have his info.
|
||||
if (ref->base->mData.mType < 12)
|
||||
if (ref->mBase->mData.mType < 12)
|
||||
{
|
||||
text += "\n#{sType} ";
|
||||
|
||||
|
@ -300,49 +299,49 @@ namespace MWClass
|
|||
mapping[ESM::Weapon::MarksmanCrossbow] = std::make_pair("sSkillMarksman", "");
|
||||
mapping[ESM::Weapon::MarksmanThrown] = std::make_pair("sSkillMarksman", "");
|
||||
|
||||
std::string type = mapping[ref->base->mData.mType].first;
|
||||
std::string oneOrTwoHanded = mapping[ref->base->mData.mType].second;
|
||||
std::string type = mapping[ref->mBase->mData.mType].first;
|
||||
std::string oneOrTwoHanded = mapping[ref->mBase->mData.mType].second;
|
||||
|
||||
text += store.gameSettings.find(type)->getString() +
|
||||
((oneOrTwoHanded != "") ? ", " + store.gameSettings.find(oneOrTwoHanded)->getString() : "");
|
||||
text += store.get<ESM::GameSetting>().find(type)->getString() +
|
||||
((oneOrTwoHanded != "") ? ", " + store.get<ESM::GameSetting>().find(oneOrTwoHanded)->getString() : "");
|
||||
|
||||
// weapon damage
|
||||
if (ref->base->mData.mType >= 9)
|
||||
if (ref->mBase->mData.mType >= 9)
|
||||
{
|
||||
// marksman
|
||||
text += "\n#{sAttack}: "
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mChop[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mChop[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Chop
|
||||
text += "\n#{sChop}: "
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mChop[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mChop[1]));
|
||||
// Slash
|
||||
text += "\n#{sSlash}: "
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[1]));
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mSlash[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mSlash[1]));
|
||||
// Thrust
|
||||
text += "\n#{sThrust}: "
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[1]));
|
||||
+ MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mThrust[0]))
|
||||
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->mBase->mData.mThrust[1]));
|
||||
}
|
||||
}
|
||||
|
||||
/// \todo store the current weapon health somewhere
|
||||
if (ref->base->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
|
||||
if (ref->mBase->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
|
||||
text += "\n#{sCondition}: " + MWGui::ToolTips::toString(ref->mBase->mData.mHealth);
|
||||
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, "#{sValue}");
|
||||
text += "\n#{sWeight}: " + MWGui::ToolTips::toString(ref->mBase->mData.mWeight);
|
||||
text += MWGui::ToolTips::getValueString(ref->mBase->mData.mValue, "#{sValue}");
|
||||
|
||||
info.enchant = ref->base->mEnchant;
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mRef.mOwner, "Owner");
|
||||
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
|
||||
}
|
||||
|
||||
info.text = text;
|
||||
|
@ -355,7 +354,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return ref->base->mEnchant;
|
||||
return ref->mBase->mEnchant;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const
|
||||
|
@ -373,6 +372,6 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||
ptr.get<ESM::Weapon>();
|
||||
|
||||
return MWWorld::Ptr(&cell.weapons.insert(*ref), &cell);
|
||||
return MWWorld::Ptr(&cell.mWeapons.insert(*ref), &cell);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
#include <components/esm/loaddial.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
|
@ -19,6 +17,7 @@
|
|||
#include "../mwworld/refdata.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwgui/dialogue.hpp"
|
||||
|
||||
|
@ -84,14 +83,15 @@ namespace
|
|||
|
||||
template<typename T>
|
||||
bool checkLocal (char comp, const std::string& name, T value, const MWWorld::Ptr& actor,
|
||||
const ESMS::ESMStore& store)
|
||||
const MWWorld::ESMStore& store)
|
||||
{
|
||||
std::string scriptName = MWWorld::Class::get (actor).getScript (actor);
|
||||
|
||||
if (scriptName.empty())
|
||||
return false; // no script
|
||||
|
||||
const ESM::Script *script = store.scripts.find (scriptName);
|
||||
const ESM::Script *script =
|
||||
store.get<ESM::Script>().find (scriptName);
|
||||
|
||||
int i = 0;
|
||||
|
||||
|
@ -391,7 +391,7 @@ namespace MWDialogue
|
|||
if(select.mType==ESM::VT_Int)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isFaction = int(toLower(npc->base->mFaction) == toLower(name));
|
||||
int isFaction = int(toLower(npc->mBase->mFaction) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isFaction,select.mI))
|
||||
return false;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ namespace MWDialogue
|
|||
if(select.mType==ESM::VT_Int)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isClass = int(toLower(npc->base->mClass) == toLower(name));
|
||||
int isClass = int(toLower(npc->mBase->mClass) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isClass,select.mI))
|
||||
return false;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ namespace MWDialogue
|
|||
if(select.mType==ESM::VT_Int)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
int isRace = int(toLower(npc->base->mRace) == toLower(name));
|
||||
int isRace = int(toLower(npc->mBase->mRace) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isRace,select.mI))
|
||||
return false;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ namespace MWDialogue
|
|||
case 'B'://not Cell
|
||||
if(select.mType==ESM::VT_Int)
|
||||
{
|
||||
int isCell = int(toLower(actor.getCell()->cell->mName) == toLower(name));
|
||||
int isCell = int(toLower(actor.getCell()->mCell->mName) == toLower(name));
|
||||
if(selectCompare<int,int>(comp,!isCell,select.mI))
|
||||
return false;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ namespace MWDialogue
|
|||
if (!cellRef)
|
||||
return false;
|
||||
|
||||
if (toLower (info.mRace)!=toLower (cellRef->base->mRace))
|
||||
if (toLower (info.mRace)!=toLower (cellRef->mBase->mRace))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -511,7 +511,7 @@ namespace MWDialogue
|
|||
if (!cellRef)
|
||||
return false;
|
||||
|
||||
if (toLower (info.mClass)!=toLower (cellRef->base->mClass))
|
||||
if (toLower (info.mClass)!=toLower (cellRef->mBase->mClass))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -557,7 +557,7 @@ namespace MWDialogue
|
|||
if (!isCreature)
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
|
||||
if(npc->base->mFlags & npc->base->Female)
|
||||
if(npc->mBase->mFlags & npc->mBase->Female)
|
||||
{
|
||||
if(static_cast<int> (info.mData.mGender)==0) return false;
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ namespace MWDialogue
|
|||
|
||||
// check cell
|
||||
if (!info.mCell.empty())
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mName != info.mCell)
|
||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->mCell->mName != info.mCell)
|
||||
return false;
|
||||
|
||||
// TODO check DATAstruct
|
||||
|
@ -590,10 +590,14 @@ namespace MWDialogue
|
|||
mCompilerContext.setExtensions (&extensions);
|
||||
mDialogueMap.clear();
|
||||
mActorKnownTopics.clear();
|
||||
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||
|
||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||
|
||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||
for (; it != dialogs.end(); ++it)
|
||||
{
|
||||
mDialogueMap[toLower(it->first)] = it->second;
|
||||
mDialogueMap[toLower(it->mId)] = *it;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,16 +646,17 @@ namespace MWDialogue
|
|||
|
||||
//greeting
|
||||
bool greetingFound = false;
|
||||
//ESMS::RecListT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||
|
||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||
for (; it != dialogs.end(); ++it)
|
||||
{
|
||||
ESM::Dialogue ndialogue = it->second;
|
||||
if(ndialogue.mType == ESM::Dialogue::Greeting)
|
||||
if(it->mType == ESM::Dialogue::Greeting)
|
||||
{
|
||||
if (greetingFound) break;
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
|
||||
iter!=it->second.mInfo.end(); ++iter)
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (it->mInfo.begin());
|
||||
iter!=it->mInfo.end(); ++iter)
|
||||
{
|
||||
if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true))
|
||||
{
|
||||
|
@ -665,7 +670,7 @@ namespace MWDialogue
|
|||
win->addText(iter->mResponse);
|
||||
executeScript(iter->mResultScript);
|
||||
greetingFound = true;
|
||||
mLastTopic = it->first;
|
||||
mLastTopic = it->mId;
|
||||
mLastDialogue = *iter;
|
||||
break;
|
||||
}
|
||||
|
@ -742,22 +747,26 @@ namespace MWDialogue
|
|||
mChoice = -1;
|
||||
mActorKnownTopics.clear();
|
||||
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
|
||||
ESMS::RecListCaseT<ESM::Dialogue>::MapType dialogueList = MWBase::Environment::get().getWorld()->getStore().dialogs.list;
|
||||
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
|
||||
|
||||
const MWWorld::Store<ESM::Dialogue> &dialogs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
|
||||
|
||||
|
||||
MWWorld::Store<ESM::Dialogue>::iterator it = dialogs.begin();
|
||||
for (; it != dialogs.end(); ++it)
|
||||
{
|
||||
ESM::Dialogue ndialogue = it->second;
|
||||
if(ndialogue.mType == ESM::Dialogue::Topic)
|
||||
if(it->mType == ESM::Dialogue::Topic)
|
||||
{
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
|
||||
iter!=it->second.mInfo.end(); ++iter)
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (it->mInfo.begin());
|
||||
iter!=it->mInfo.end(); ++iter)
|
||||
{
|
||||
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
|
||||
{
|
||||
mActorKnownTopics.push_back(toLower(it->first));
|
||||
mActorKnownTopics.push_back(toLower(it->mId));
|
||||
//does the player know the topic?
|
||||
if(mKnownTopics.find(toLower(it->first)) != mKnownTopics.end())
|
||||
if(mKnownTopics.find(toLower(it->mId)) != mKnownTopics.end())
|
||||
{
|
||||
keywordList.push_back(it->first);
|
||||
keywordList.push_back(it->mId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -770,14 +779,14 @@ namespace MWDialogue
|
|||
if (mActor.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mActor.get<ESM::NPC>();
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
if (ref->mBase->mHasAI)
|
||||
services = ref->mBase->mAiData.mServices;
|
||||
}
|
||||
else if (mActor.getTypeName() == typeid(ESM::Creature).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mActor.get<ESM::Creature>();
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
if (ref->mBase->mHasAI)
|
||||
services = ref->mBase->mAiData.mServices;
|
||||
}
|
||||
|
||||
int windowServices = 0;
|
||||
|
@ -795,7 +804,7 @@ namespace MWDialogue
|
|||
|| services & ESM::NPC::Misc)
|
||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
||||
|
||||
if( !mActor.get<ESM::NPC>()->base->mTransport.empty())
|
||||
if(mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->mTransport.empty())
|
||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
||||
|
||||
if (services & ESM::NPC::Spells)
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
JournalEntry::JournalEntry() {}
|
||||
|
@ -16,9 +16,10 @@ namespace MWDialogue
|
|||
: mTopic (topic), mInfoId (infoId)
|
||||
{}
|
||||
|
||||
std::string JournalEntry::getText (const ESMS::ESMStore& store) const
|
||||
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
|
||||
{
|
||||
const ESM::Dialogue *dialogue = store.dialogs.find (mTopic);
|
||||
const ESM::Dialogue *dialogue =
|
||||
store.get<ESM::Dialogue>().find (mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -35,7 +36,8 @@ namespace MWDialogue
|
|||
|
||||
std::string JournalEntry::idFromIndex (const std::string& topic, int index)
|
||||
{
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (topic);
|
||||
const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (topic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace ESMS
|
||||
namespace MWWorld
|
||||
{
|
||||
struct ESMStore;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace MWDialogue
|
|||
|
||||
JournalEntry (const std::string& topic, const std::string& infoId);
|
||||
|
||||
std::string getText (const ESMS::ESMStore& store) const;
|
||||
std::string getText (const MWWorld::ESMStore& store) const;
|
||||
|
||||
static JournalEntry makeFromQuest (const std::string& topic, int index);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "journalimp.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "quest.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -18,7 +18,8 @@ namespace MWDialogue
|
|||
|
||||
const std::string Quest::getName() const
|
||||
{
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
|
||||
const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -35,7 +36,8 @@ namespace MWDialogue
|
|||
|
||||
void Quest::setIndex (int index)
|
||||
{
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (mTopic);
|
||||
const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -63,7 +65,8 @@ namespace MWDialogue
|
|||
{
|
||||
int index = -1;
|
||||
|
||||
const ESM::Dialogue *dialogue = MWBase::Environment::get().getWorld()->getStore().dialogs.find (entry.mTopic);
|
||||
const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (entry.mTopic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "topic.hpp"
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
|
|
|
@ -132,6 +132,8 @@ namespace MWGui
|
|||
openContainer (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()); // this sets mPtr
|
||||
setFilter (ContainerBase::Filter_Ingredients);
|
||||
|
||||
mNameEdit->setCaption("");
|
||||
|
||||
mAlchemy.setAlchemist (mPtr);
|
||||
|
||||
int index = 0;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "components/esm_store/store.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -48,6 +48,7 @@ BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager)
|
|||
getWidget(okButton, "OKButton");
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
|
||||
okButton->setEnabled(false);
|
||||
|
||||
updateBirths();
|
||||
updateSpells();
|
||||
|
@ -82,6 +83,9 @@ void BirthDialog::setBirthId(const std::string &birthId)
|
|||
if (boost::iequals(*mBirthList->getItemDataAt<std::string>(i), birthId))
|
||||
{
|
||||
mBirthList->setIndexSelected(i);
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -93,6 +97,8 @@ void BirthDialog::setBirthId(const std::string &birthId)
|
|||
|
||||
void BirthDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mBirthList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
eventDone(this);
|
||||
}
|
||||
|
||||
|
@ -106,6 +112,10 @@ void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
|
|||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
|
||||
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(mCurrentBirthId, *birthId))
|
||||
return;
|
||||
|
@ -120,19 +130,18 @@ void BirthDialog::updateBirths()
|
|||
{
|
||||
mBirthList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::Store<ESM::BirthSign> &signs =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
|
||||
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator it = store.birthSigns.list.begin();
|
||||
ESMS::RecListT<ESM::BirthSign>::MapType::const_iterator end = store.birthSigns.list.end();
|
||||
int index = 0;
|
||||
|
||||
// sort by name
|
||||
std::vector < std::pair<std::string, const ESM::BirthSign*> > birthSigns;
|
||||
for (; it!=end; ++it)
|
||||
|
||||
MWWorld::Store<ESM::BirthSign>::iterator it = signs.begin();
|
||||
for (; it != signs.end(); ++it)
|
||||
{
|
||||
std::string id = it->first;
|
||||
const ESM::BirthSign* sign = &it->second;
|
||||
birthSigns.push_back(std::make_pair(id, sign));
|
||||
birthSigns.push_back(std::make_pair(it->mId, &(*it)));
|
||||
}
|
||||
std::sort(birthSigns.begin(), birthSigns.end(), sortBirthSigns);
|
||||
|
||||
|
@ -160,8 +169,11 @@ void BirthDialog::updateSpells()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::BirthSign *birth =
|
||||
store.get<ESM::BirthSign>().find(mCurrentBirthId);
|
||||
|
||||
std::string texturePath = std::string("textures\\") + birth->mTexture;
|
||||
fixTexturePath(texturePath);
|
||||
|
@ -174,7 +186,7 @@ void BirthDialog::updateSpells()
|
|||
for (; it != end; ++it)
|
||||
{
|
||||
const std::string &spellId = *it;
|
||||
const ESM::Spell *spell = store.spells.search(spellId);
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().search(spellId);
|
||||
if (!spell)
|
||||
continue; // Skip spells which cannot be found
|
||||
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
|
||||
|
@ -190,11 +202,17 @@ void BirthDialog::updateSpells()
|
|||
}
|
||||
|
||||
int i = 0;
|
||||
struct{ const std::vector<std::string> &spells; const char *label; } categories[3] = {
|
||||
|
||||
struct {
|
||||
const std::vector<std::string> &spells;
|
||||
const char *label;
|
||||
}
|
||||
categories[3] = {
|
||||
{abilities, "sBirthsignmenu1"},
|
||||
{powers, "sPowers"},
|
||||
{spells, "sBirthsignmenu2"}
|
||||
};
|
||||
|
||||
for (int category = 0; category < 3; ++category)
|
||||
{
|
||||
if (!categories[category].spells.empty())
|
||||
|
|
|
@ -60,7 +60,7 @@ void BookWindow::open (MWWorld::Ptr book)
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
|
||||
|
||||
BookTextParser parser;
|
||||
std::vector<std::string> results = parser.split(ref->base->mText, mLeftPage->getSize().width, mLeftPage->getSize().height);
|
||||
std::vector<std::string> results = parser.split(ref->mBase->mText, mLeftPage->getSize().width, mLeftPage->getSize().height);
|
||||
|
||||
int i=0;
|
||||
for (std::vector<std::string>::iterator it=results.begin();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "review.hpp"
|
||||
#include "dialogue.hpp"
|
||||
#include "mode.hpp"
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
|
@ -232,6 +233,7 @@ void CharacterCreation::spawnDialog(const char id)
|
|||
mBirthSignDialog = 0;
|
||||
mBirthSignDialog = new BirthDialog(*mWM);
|
||||
mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen);
|
||||
mBirthSignDialog->setBirthId(mPlayerBirthSignId);
|
||||
mBirthSignDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogDone);
|
||||
mBirthSignDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onBirthSignDialogBack);
|
||||
mBirthSignDialog->setVisible(true);
|
||||
|
@ -356,7 +358,9 @@ void CharacterCreation::onPickClassDialogDone(WindowBase* parWindow)
|
|||
const std::string &classId = mPickClassDialog->getClassId();
|
||||
if (!classId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
|
||||
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(classId);
|
||||
|
||||
const ESM::Class *klass =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(classId);
|
||||
if (klass)
|
||||
{
|
||||
mPlayerClass = *klass;
|
||||
|
@ -456,9 +460,16 @@ void CharacterCreation::onRaceDialogBack()
|
|||
{
|
||||
if (mRaceDialog)
|
||||
{
|
||||
mPlayerRaceId = mRaceDialog->getRaceId();
|
||||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
const ESM::NPC &data = mRaceDialog->getResult();
|
||||
mPlayerRaceId = data.mId;
|
||||
if (!mPlayerRaceId.empty()) {
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(
|
||||
data.mId,
|
||||
data.isMale(),
|
||||
data.mHead,
|
||||
data.mHair
|
||||
);
|
||||
}
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
@ -471,10 +482,18 @@ void CharacterCreation::onRaceDialogDone(WindowBase* parWindow)
|
|||
{
|
||||
if (mRaceDialog)
|
||||
{
|
||||
mPlayerRaceId = mRaceDialog->getRaceId();
|
||||
mWM->setValue("race", mPlayerRaceId);
|
||||
if (!mPlayerRaceId.empty())
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(mPlayerRaceId, mRaceDialog->getGender() == RaceDialog::GM_Male);
|
||||
const ESM::NPC &data = mRaceDialog->getResult();
|
||||
mPlayerRaceId = data.mRace;
|
||||
if (!mPlayerRaceId.empty()) {
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(
|
||||
data.mRace,
|
||||
data.isMale(),
|
||||
data.mHead,
|
||||
data.mHair
|
||||
);
|
||||
}
|
||||
mWM->getInventoryWindow()->rebuildAvatar();
|
||||
|
||||
mWM->removeDialog(mRaceDialog);
|
||||
mRaceDialog = 0;
|
||||
}
|
||||
|
@ -556,6 +575,7 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
|
|||
klass.mData.mSkills[i][1] = majorSkills[i];
|
||||
klass.mData.mSkills[i][0] = minorSkills[i];
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
|
||||
mPlayerClass = klass;
|
||||
mWM->setPlayerClass(klass);
|
||||
|
@ -728,7 +748,10 @@ void CharacterCreation::onGenerateClassDone(WindowBase* parWindow)
|
|||
mGenerateClassResultDialog = 0;
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
|
||||
const ESM::Class *klass = MWBase::Environment::get().getWorld()->getStore().classes.find(mGenerateClass);
|
||||
|
||||
const ESM::Class *klass =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mGenerateClass);
|
||||
|
||||
mPlayerClass = *klass;
|
||||
mWM->setPlayerClass(mPlayerClass);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CHARACTER_CREATION_HPP
|
||||
#define CHARACTER_CREATION_HPP
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -50,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
|
|||
{
|
||||
mCurrentClassId = classId;
|
||||
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
|
||||
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->mName);
|
||||
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mCurrentClassId)->mName);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
@ -104,6 +104,7 @@ PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager)
|
|||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
|
||||
okButton->setEnabled(false);
|
||||
|
||||
updateClasses();
|
||||
updateStats();
|
||||
|
@ -137,6 +138,9 @@ void PickClassDialog::setClassId(const std::string &classId)
|
|||
if (boost::iequals(*mClassList->getItemDataAt<std::string>(i), classId))
|
||||
{
|
||||
mClassList->setIndexSelected(i);
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +152,8 @@ void PickClassDialog::setClassId(const std::string &classId)
|
|||
|
||||
void PickClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mClassList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
eventDone(this);
|
||||
}
|
||||
|
||||
|
@ -161,6 +167,10 @@ void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
|
|||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
|
||||
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(mCurrentClassId, *classId))
|
||||
return;
|
||||
|
@ -175,20 +185,18 @@ void PickClassDialog::updateClasses()
|
|||
{
|
||||
mClassList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator it = store.classes.list.begin();
|
||||
ESMS::RecListT<ESM::Class>::MapType::const_iterator end = store.classes.list.end();
|
||||
int index = 0;
|
||||
for (; it != end; ++it)
|
||||
MWWorld::Store<ESM::Class>::iterator it = store.get<ESM::Class>().begin();
|
||||
for (; it != store.get<ESM::Class>().end(); ++it)
|
||||
{
|
||||
const ESM::Class &klass = it->second;
|
||||
bool playable = (klass.mData.mIsPlayable != 0);
|
||||
bool playable = (it->mData.mIsPlayable != 0);
|
||||
if (!playable) // Only display playable classes
|
||||
continue;
|
||||
|
||||
const std::string &id = it->first;
|
||||
mClassList->addItem(klass.mName, id);
|
||||
const std::string &id = it->mId;
|
||||
mClassList->addItem(it->mName, id);
|
||||
if (boost::iequals(id, mCurrentClassId))
|
||||
mClassList->setIndexSelected(index);
|
||||
++index;
|
||||
|
@ -199,8 +207,8 @@ void PickClassDialog::updateStats()
|
|||
{
|
||||
if (mCurrentClassId.empty())
|
||||
return;
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Class *klass = store.classes.search(mCurrentClassId);
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Class *klass = store.get<ESM::Class>().search(mCurrentClassId);
|
||||
if (!klass)
|
||||
return;
|
||||
|
||||
|
@ -641,6 +649,8 @@ void CreateClassDialog::onDescriptionEntered(WindowBase* parWindow)
|
|||
|
||||
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(getName().size() <= 0)
|
||||
return;
|
||||
eventDone(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
#include <algorithm>
|
||||
#include <fstream>
|
||||
|
||||
#include <components/esm_store/reclists.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include <components/compiler/exception.hpp>
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwscript/extensions.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -93,12 +92,12 @@ namespace MWGui
|
|||
scanner.listKeywords (mNames);
|
||||
|
||||
// identifier
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
for (ESMS::RecListList::const_iterator iter (store.recLists.begin());
|
||||
iter!=store.recLists.end(); ++iter)
|
||||
for (MWWorld::ESMStore::iterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
iter->second->listIdentifier (mNames);
|
||||
it->second->listIdentifier (mNames);
|
||||
}
|
||||
|
||||
// sort
|
||||
|
|
|
@ -127,10 +127,13 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
|
|||
|
||||
if (isInventory())
|
||||
{
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
// the player is trying to sell an item, check if the merchant accepts it
|
||||
// also, don't allow selling gold (let's be better than Morrowind at this, can we?)
|
||||
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object) ||
|
||||
MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
|
||||
MWWorld::Class::get(object).getName(object) == gmst.find("sGold")->getString())
|
||||
{
|
||||
// user notification "i don't buy this item"
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
|
@ -274,7 +277,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
|
|||
if (mPtr.getTypeName() == typeid(ESM::Container).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Container>* ref = mPtr.get<ESM::Container>();
|
||||
if (ref->base->mFlags & ESM::Container::Organic)
|
||||
if (ref->mBase->mFlags & ESM::Container::Organic)
|
||||
{
|
||||
// user notification
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MGUI_CONTAINER_H
|
||||
#define MGUI_CONTAINER_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "window_base.hpp"
|
||||
#include "referenceinterface.hpp"
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "dialogue_history.hpp"
|
||||
#include "widgets.hpp"
|
||||
|
@ -50,7 +51,7 @@ std::string::size_type find_str_ci(const std::string& str, const std::string& su
|
|||
|
||||
DialogueWindow::DialogueWindow(MWBase::WindowManager& parWindowManager)
|
||||
: WindowBase("openmw_dialogue_window.layout", parWindowManager)
|
||||
, mEnabled(true)
|
||||
, mEnabled(false)
|
||||
, mServices(0)
|
||||
{
|
||||
// Centre dialog
|
||||
|
@ -127,33 +128,36 @@ void DialogueWindow::onSelectTopic(std::string topic)
|
|||
{
|
||||
if (!mEnabled) return;
|
||||
|
||||
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString())
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
if (topic == gmst.find("sBarter")->getString())
|
||||
{
|
||||
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
|
||||
mWindowManager.pushGuiMode(GM_Barter);
|
||||
mWindowManager.getTradeWindow()->startTrade(mPtr);
|
||||
}
|
||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString())
|
||||
else if (topic == gmst.find("sSpells")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_SpellBuying);
|
||||
mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
|
||||
}
|
||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sTravel")->getString())
|
||||
else if (topic == gmst.find("sTravel")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Travel);
|
||||
mWindowManager.getTravelWindow()->startTravel(mPtr);
|
||||
}
|
||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellMakingMenuTitle")->getString())
|
||||
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_SpellCreation);
|
||||
mWindowManager.startSpellMaking (mPtr);
|
||||
}
|
||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString())
|
||||
else if (topic == gmst.find("sEnchanting")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Enchanting);
|
||||
mWindowManager.startEnchanting (mPtr);
|
||||
}
|
||||
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sServiceTrainingTitle")->getString())
|
||||
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
||||
{
|
||||
mWindowManager.pushGuiMode(GM_Training);
|
||||
mWindowManager.startTraining (mPtr);
|
||||
|
@ -170,7 +174,7 @@ void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName)
|
|||
setTitle(npcName);
|
||||
|
||||
mTopicsList->clear();
|
||||
mHistory->eraseText(0,mHistory->getTextLength());
|
||||
mHistory->setCaption("");
|
||||
updateOptions();
|
||||
}
|
||||
|
||||
|
@ -180,23 +184,26 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
|||
|
||||
bool anyService = mServices > 0;
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
if (mServices & Service_Trade)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sBarter")->getString());
|
||||
mTopicsList->addItem(gmst.find("sBarter")->getString());
|
||||
|
||||
if (mServices & Service_BuySpells)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpells")->getString());
|
||||
mTopicsList->addItem(gmst.find("sSpells")->getString());
|
||||
|
||||
if (mServices & Service_Travel)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sTravel")->getString());
|
||||
mTopicsList->addItem(gmst.find("sTravel")->getString());
|
||||
|
||||
if (mServices & Service_CreateSpells)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sSpellmakingMenuTitle")->getString());
|
||||
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
||||
|
||||
if (mServices & Service_Enchant)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sEnchanting")->getString());
|
||||
// if (mServices & Service_Enchant)
|
||||
// mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
||||
|
||||
if (mServices & Service_Training)
|
||||
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sServiceTrainingTitle")->getString());
|
||||
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
||||
|
||||
if (anyService)
|
||||
mTopicsList->addSeparator();
|
||||
|
@ -293,15 +300,18 @@ void DialogueWindow::updateOptions()
|
|||
mTopicsList->clear();
|
||||
mHistory->eraseText(0, mHistory->getTextLength());
|
||||
|
||||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(40);
|
||||
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr));
|
||||
mDispositionText->eraseText(0, mDispositionText->getTextLength());
|
||||
mDispositionText->addText("#B29154"+std::string("40/100")+"#B29154");
|
||||
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100")+"#B29154");
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueWindow::goodbye()
|
||||
{
|
||||
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGoodbye")->getString());
|
||||
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sGoodbye")->getString());
|
||||
mTopicsList->setEnabled(false);
|
||||
mEnabled = false;
|
||||
}
|
||||
|
@ -310,3 +320,14 @@ void DialogueWindow::onReferenceUnavailable()
|
|||
{
|
||||
mWindowManager.removeGuiMode(GM_Dialogue);
|
||||
}
|
||||
|
||||
void DialogueWindow::onFrame()
|
||||
{
|
||||
if(mEnabled && mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
mDispositionBar->setProgressRange(100);
|
||||
mDispositionBar->setProgressPosition(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr));
|
||||
mDispositionText->eraseText(0, mDispositionText->getTextLength());
|
||||
mDispositionText->addText("#B29154"+boost::lexical_cast<std::string>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr))+std::string("/100")+"#B29154");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace MWGui
|
|||
void addTitle(std::string text);
|
||||
void askQuestion(std::string question);
|
||||
void goodbye();
|
||||
void onFrame();
|
||||
|
||||
// make sure to call these before setKeywords()
|
||||
void setServices(int services) { mServices = services; }
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
|
|
@ -341,7 +341,9 @@ void HUD::onResChange(int width, int height)
|
|||
|
||||
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
|
||||
std::string spellName = spell->mName;
|
||||
if (spellName != mSpellName && mSpellVisible)
|
||||
{
|
||||
|
@ -361,7 +363,9 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
|||
mSpellBox->setUserString("Spell", spellId);
|
||||
|
||||
// use the icon of the first effect
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
|
||||
const ESM::MagicEffect* effect =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
||||
|
||||
std::string icon = effect->mIcon;
|
||||
int slashPos = icon.find("\\");
|
||||
icon.insert(slashPos+1, "b_");
|
||||
|
|
|
@ -28,6 +28,10 @@ namespace MWGui
|
|||
|
||||
MWWorld::Ptr getAvatarSelectedItem(int x, int y);
|
||||
|
||||
void rebuildAvatar() {
|
||||
mPreview.rebuild();
|
||||
}
|
||||
|
||||
protected:
|
||||
MyGUI::Widget* mAvatar;
|
||||
MyGUI::ImageBox* mAvatarImage;
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
|
||||
#include <components/esm_store/reclists.hpp>
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
|
||||
|
@ -110,7 +108,8 @@ namespace MWGui
|
|||
|
||||
void LevelupDialog::open()
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
|
@ -121,17 +120,13 @@ namespace MWGui
|
|||
|
||||
setAttributeValues();
|
||||
|
||||
const ESM::NPC *playerData = player.get<ESM::NPC>()->mBase;
|
||||
|
||||
// set class image
|
||||
const ESM::Class& playerClass = MWBase::Environment::get().getWorld ()->getPlayer ().getClass ();
|
||||
// retrieve the ID to this class
|
||||
std::string classId;
|
||||
std::map<std::string, ESM::Class> list = MWBase::Environment::get().getWorld()->getStore ().classes.list;
|
||||
for (std::map<std::string, ESM::Class>::iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
if (playerClass.mName == it->second.mName)
|
||||
classId = it->first;
|
||||
}
|
||||
mClassImage->setImageTexture ("textures\\levelup\\" + classId + ".dds");
|
||||
const ESM::Class *cls =
|
||||
world->getStore().get<ESM::Class>().find(playerData->mClass);
|
||||
|
||||
mClassImage->setImageTexture ("textures\\levelup\\" + cls->mId + ".dds");
|
||||
|
||||
/// \todo replace this with INI-imported texts
|
||||
int level = creatureStats.getLevel ()+1;
|
||||
|
|
|
@ -29,8 +29,11 @@ namespace
|
|||
|
||||
bool sortSpells(const std::string& left, const std::string& right)
|
||||
{
|
||||
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
|
||||
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
|
||||
const MWWorld::Store<ESM::Spell> &spells =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
|
||||
|
||||
const ESM::Spell* a = spells.find(left);
|
||||
const ESM::Spell* b = spells.find(right);
|
||||
|
||||
int cmp = a->mName.compare(b->mName);
|
||||
return cmp < 0;
|
||||
|
@ -234,9 +237,15 @@ namespace MWGui
|
|||
|
||||
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
|
||||
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
// use the icon of the first effect
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(spellId);
|
||||
|
||||
const ESM::MagicEffect* effect =
|
||||
esmStore.get<ESM::MagicEffect>().find(spell->mEffects.mList.front().mEffectID);
|
||||
|
||||
std::string path = effect->mIcon;
|
||||
int slashPos = path.find("\\");
|
||||
path.insert(slashPos+1, "b_");
|
||||
|
@ -434,11 +443,14 @@ namespace MWGui
|
|||
spellList.push_back(*it);
|
||||
}
|
||||
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
std::vector<std::string> powers;
|
||||
std::vector<std::string>::iterator it = spellList.begin();
|
||||
while (it != spellList.end())
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
if (spell->mData.mType == ESM::Spell::ST_Power)
|
||||
{
|
||||
powers.push_back(*it);
|
||||
|
@ -465,7 +477,9 @@ namespace MWGui
|
|||
if (enchantId != "")
|
||||
{
|
||||
// only add items with "Cast once" or "Cast on use"
|
||||
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
|
||||
const ESM::Enchantment* enchant =
|
||||
esmStore.get<ESM::Enchantment>().find(enchantId);
|
||||
|
||||
int type = enchant->mData.mType;
|
||||
if (type != ESM::Enchantment::CastOnce
|
||||
&& type != ESM::Enchantment::WhenUsed)
|
||||
|
@ -487,7 +501,7 @@ namespace MWGui
|
|||
|
||||
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->mName);
|
||||
|
@ -504,7 +518,7 @@ namespace MWGui
|
|||
addGroup("#{sSpells}", "");
|
||||
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->mName);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -80,6 +80,7 @@ RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
|
|||
getWidget(okButton, "OKButton");
|
||||
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
|
||||
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
|
||||
okButton->setEnabled(false);
|
||||
|
||||
updateRaces();
|
||||
updateSkills();
|
||||
|
@ -121,6 +122,9 @@ void RaceDialog::setRaceId(const std::string &raceId)
|
|||
if (boost::iequals(*mRaceList->getItemDataAt<std::string>(i), raceId))
|
||||
{
|
||||
mRaceList->setIndexSelected(i);
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +153,8 @@ void RaceDialog::close()
|
|||
|
||||
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mRaceList->getIndexSelected() == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
eventDone(this);
|
||||
}
|
||||
|
||||
|
@ -200,11 +206,37 @@ void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index)
|
|||
if (_index == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->setEnabled(true);
|
||||
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
|
||||
if (boost::iequals(mCurrentRaceId, *raceId))
|
||||
return;
|
||||
|
||||
mCurrentRaceId = *raceId;
|
||||
|
||||
ESM::NPC record = mPreview->getPrototype();
|
||||
record.mRace = mCurrentRaceId;
|
||||
record.setIsMale(mGenderIndex == 0);
|
||||
|
||||
std::string prefix =
|
||||
"b_n_" + mCurrentRaceId + ((record.isMale()) ? "_m_" : "_f_");
|
||||
|
||||
record.mHead = prefix + "head_01";
|
||||
record.mHair = prefix + "hair_01";
|
||||
|
||||
const MWWorld::Store<ESM::BodyPart> &parts =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>();
|
||||
|
||||
if (parts.search(record.mHair) == 0) {
|
||||
record.mHair = prefix + "hair01";
|
||||
}
|
||||
|
||||
mFaceIndex = 0;
|
||||
mHairIndex = 0;
|
||||
|
||||
mPreview->setPrototype(record);
|
||||
|
||||
updateSkills();
|
||||
updateSpellPowers();
|
||||
}
|
||||
|
@ -215,20 +247,20 @@ void RaceDialog::updateRaces()
|
|||
{
|
||||
mRaceList->removeAllItems();
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::Store<ESM::Race> &races =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>();
|
||||
|
||||
|
||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator it = store.races.list.begin();
|
||||
ESMS::RecListT<ESM::Race>::MapType::const_iterator end = store.races.list.end();
|
||||
int index = 0;
|
||||
for (; it != end; ++it)
|
||||
MWWorld::Store<ESM::Race>::iterator it = races.begin();
|
||||
for (; it != races.end(); ++it)
|
||||
{
|
||||
const ESM::Race &race = it->second;
|
||||
bool playable = race.mData.mFlags & ESM::Race::Playable;
|
||||
bool playable = it->mData.mFlags & ESM::Race::Playable;
|
||||
if (!playable) // Only display playable races
|
||||
continue;
|
||||
|
||||
mRaceList->addItem(race.mName, it->first);
|
||||
if (boost::iequals(it->first, mCurrentRaceId))
|
||||
mRaceList->addItem(it->mName, it->mId);
|
||||
if (boost::iequals(it->mId, mCurrentRaceId))
|
||||
mRaceList->setIndexSelected(index);
|
||||
++index;
|
||||
}
|
||||
|
@ -249,8 +281,8 @@ void RaceDialog::updateSkills()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.races.find(mCurrentRaceId);
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId);
|
||||
int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
|
@ -287,8 +319,8 @@ void RaceDialog::updateSpellPowers()
|
|||
const int lineHeight = 18;
|
||||
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), 18);
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.races.find(mCurrentRaceId);
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Race *race = store.get<ESM::Race>().find(mCurrentRaceId);
|
||||
|
||||
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();
|
||||
std::vector<std::string>::const_iterator end = race->mPowers.mList.end();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <boost/array.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwrender/characterpreview.hpp"
|
||||
|
||||
|
@ -34,6 +34,7 @@ namespace MWGui
|
|||
GM_Female
|
||||
};
|
||||
|
||||
const ESM::NPC &getResult() const { return mPreview->getPrototype(); }
|
||||
const std::string &getRaceId() const { return mCurrentRaceId; }
|
||||
Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; }
|
||||
// getFace()
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -108,7 +108,9 @@ void ReviewDialog::setPlayerName(const std::string &name)
|
|||
void ReviewDialog::setRace(const std::string &raceId)
|
||||
{
|
||||
mRaceId = raceId;
|
||||
const ESM::Race *race = MWBase::Environment::get().getWorld()->getStore().races.search(mRaceId);
|
||||
|
||||
const ESM::Race *race =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().search(mRaceId);
|
||||
if (race)
|
||||
{
|
||||
ToolTips::createRaceToolTip(mRaceWidget, race);
|
||||
|
@ -126,7 +128,9 @@ void ReviewDialog::setClass(const ESM::Class& class_)
|
|||
void ReviewDialog::setBirthSign(const std::string& signId)
|
||||
{
|
||||
mBirthSignId = signId;
|
||||
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
|
||||
|
||||
const ESM::BirthSign *sign =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().search(mBirthSignId);
|
||||
if (sign)
|
||||
{
|
||||
mBirthSignWidget->setCaption(sign->mName);
|
||||
|
@ -281,7 +285,7 @@ void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId
|
|||
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
|
||||
continue;
|
||||
assert(skillId >= 0 && skillId < ESM::Skill::Length);
|
||||
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
|
||||
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
||||
const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second;
|
||||
float base = stat.getBase();
|
||||
float modified = stat.getModified();
|
||||
|
|
|
@ -36,7 +36,7 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
|
|||
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
|
||||
|
||||
BookTextParser parser;
|
||||
MyGUI::IntSize size = parser.parse(ref->base->mText, mTextView, 390);
|
||||
MyGUI::IntSize size = parser.parse(ref->mBase->mText, mTextView, 390);
|
||||
|
||||
if (size.height > mTextView->getSize().height)
|
||||
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
@ -49,8 +50,12 @@ namespace MWGui
|
|||
|
||||
void SpellBuyingWindow::addSpell(const std::string& spellId)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
int price = spell->mData.mCost*MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellValueMult")->getFloat();
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
int price = spell->mData.mCost*store.get<ESM::GameSetting>().find("fSpellValueMult")->getFloat();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MyGUI::Button* toAdd =
|
||||
mSpellsView->createWidget<MyGUI::Button>(
|
||||
|
@ -63,7 +68,6 @@ namespace MWGui
|
|||
);
|
||||
|
||||
mCurrentY += sLineHeight;
|
||||
/// \todo price adjustment depending on merchantile skill
|
||||
|
||||
toAdd->setUserData(price);
|
||||
toAdd->setCaptionWithReplacing(spell->mName+" - "+boost::lexical_cast<std::string>(price)+"#{sgp}");
|
||||
|
@ -97,7 +101,8 @@ namespace MWGui
|
|||
|
||||
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (*iter);
|
||||
|
||||
if (spell->mData.mType!=ESM::Spell::ST_Spell)
|
||||
continue; // don't try to sell diseases, curses or powers
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
|
@ -29,8 +29,11 @@ namespace
|
|||
|
||||
bool sortMagicEffects (short id1, short id2)
|
||||
{
|
||||
return MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id1))->getString()
|
||||
< MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(ESM::MagicEffect::effectIdToString (id2))->getString();
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
return gmst.find(ESM::MagicEffect::effectIdToString (id1))->getString()
|
||||
< gmst.find(ESM::MagicEffect::effectIdToString (id2))->getString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +109,8 @@ namespace MWGui
|
|||
|
||||
void EditEffectDialog::editEffect (ESM::ENAMstruct effect)
|
||||
{
|
||||
const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effect.mEffectID);
|
||||
const ESM::MagicEffect* magicEffect =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
|
||||
|
||||
setMagicEffect(magicEffect);
|
||||
|
||||
|
@ -291,6 +295,7 @@ namespace MWGui
|
|||
void SpellCreationDialog::startSpellMaking (MWWorld::Ptr actor)
|
||||
{
|
||||
mPtr = actor;
|
||||
mNameEdit->setCaption("");
|
||||
|
||||
startEditing();
|
||||
}
|
||||
|
@ -332,12 +337,12 @@ namespace MWGui
|
|||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
|
||||
std::pair<std::string, const ESM::Spell*> result = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
|
||||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
|
||||
MWMechanics::Spells& spells = stats.getSpells();
|
||||
spells.add (result.first);
|
||||
spells.add (spell->mId);
|
||||
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0);
|
||||
|
||||
|
@ -359,16 +364,23 @@ namespace MWGui
|
|||
{
|
||||
float y = 0;
|
||||
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||
{
|
||||
float x = 0.5 * it->mMagnMin + it->mMagnMax;
|
||||
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID);
|
||||
const ESM::MagicEffect* effect =
|
||||
store.get<ESM::MagicEffect>().find(it->mEffectID);
|
||||
|
||||
x *= 0.1 * effect->mData.mBaseCost;
|
||||
x *= 1 + it->mDuration;
|
||||
x += 0.05 * std::max(1, it->mArea) * effect->mData.mBaseCost;
|
||||
|
||||
float fEffectCostMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fEffectCostMult")->getFloat();
|
||||
float fEffectCostMult =
|
||||
store.get<ESM::GameSetting>().find("fEffectCostMult")->getFloat();
|
||||
|
||||
y += x * fEffectCostMult;
|
||||
y = std::max(1.f,y);
|
||||
|
||||
|
@ -385,10 +397,10 @@ namespace MWGui
|
|||
|
||||
mMagickaCost->setCaption(boost::lexical_cast<std::string>(int(y)));
|
||||
|
||||
float fSpellMakingValueMult = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fSpellMakingValueMult")->getFloat();
|
||||
float fSpellMakingValueMult =
|
||||
store.get<ESM::GameSetting>().find("fSpellMakingValueMult")->getFloat();
|
||||
|
||||
/// \todo mercantile
|
||||
int price = int(y) * fSpellMakingValueMult;
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,int(y) * fSpellMakingValueMult,true);
|
||||
|
||||
mPriceLabel->setCaption(boost::lexical_cast<std::string>(int(price)));
|
||||
|
||||
|
@ -423,7 +435,8 @@ namespace MWGui
|
|||
|
||||
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(*it);
|
||||
|
||||
// only normal spells count
|
||||
if (spell->mData.mType != ESM::Spell::ST_Spell)
|
||||
|
@ -443,14 +456,14 @@ namespace MWGui
|
|||
|
||||
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
|
||||
{
|
||||
mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(
|
||||
mAvailableEffectsList->addItem(MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
|
||||
ESM::MagicEffect::effectIdToString (*it))->getString());
|
||||
}
|
||||
mAvailableEffectsList->adjustSize ();
|
||||
|
||||
for (std::vector<short>::const_iterator it = knownEffects.begin(); it != knownEffects.end(); ++it)
|
||||
{
|
||||
std::string name = MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find(
|
||||
std::string name = MWBase::Environment::get().getWorld ()->getStore ().get<ESM::GameSetting>().find(
|
||||
ESM::MagicEffect::effectIdToString (*it))->getString();
|
||||
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
|
||||
w->setUserData(*it);
|
||||
|
@ -516,7 +529,8 @@ namespace MWGui
|
|||
}
|
||||
}
|
||||
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(effectId);
|
||||
const ESM::MagicEffect* effect =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
|
||||
|
||||
mAddEffectDialog.newEffect (effect);
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -26,8 +26,11 @@ namespace
|
|||
{
|
||||
bool sortSpells(const std::string& left, const std::string& right)
|
||||
{
|
||||
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
|
||||
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
|
||||
const MWWorld::Store<ESM::Spell> &spells =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
|
||||
|
||||
const ESM::Spell* a = spells.find(left);
|
||||
const ESM::Spell* b = spells.find(right);
|
||||
|
||||
int cmp = a->mName.compare(b->mName);
|
||||
return cmp < 0;
|
||||
|
@ -139,11 +142,15 @@ namespace MWGui
|
|||
spellList.push_back(*it);
|
||||
}
|
||||
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
std::vector<std::string> powers;
|
||||
std::vector<std::string>::iterator it = spellList.begin();
|
||||
while (it != spellList.end())
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
|
||||
if (spell->mData.mType == ESM::Spell::ST_Power)
|
||||
{
|
||||
powers.push_back(*it);
|
||||
|
@ -170,7 +177,9 @@ namespace MWGui
|
|||
if (enchantId != "")
|
||||
{
|
||||
// only add items with "Cast once" or "Cast on use"
|
||||
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
|
||||
const ESM::Enchantment* enchant =
|
||||
esmStore.get<ESM::Enchantment>().find(enchantId);
|
||||
|
||||
int type = enchant->mData.mType;
|
||||
if (type != ESM::Enchantment::CastOnce
|
||||
&& type != ESM::Enchantment::WhenUsed)
|
||||
|
@ -191,7 +200,7 @@ namespace MWGui
|
|||
|
||||
for (std::vector<std::string>::const_iterator it = powers.begin(); it != powers.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->mName);
|
||||
|
@ -211,7 +220,7 @@ namespace MWGui
|
|||
addGroup("#{sSpells}", "#{sCostChance}");
|
||||
for (std::vector<std::string>::const_iterator it = spellList.begin(); it != spellList.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
|
||||
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(*it);
|
||||
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
|
||||
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
|
||||
t->setCaption(spell->mName);
|
||||
|
@ -244,7 +253,8 @@ namespace MWGui
|
|||
{
|
||||
MWWorld::Ptr item = *it;
|
||||
|
||||
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(MWWorld::Class::get(item).getEnchantment(item));
|
||||
const ESM::Enchantment* enchant =
|
||||
esmStore.get<ESM::Enchantment>().find(MWWorld::Class::get(item).getEnchantment(item));
|
||||
|
||||
// check if the item is currently equipped (will display in a different color)
|
||||
bool equipped = false;
|
||||
|
@ -378,7 +388,9 @@ namespace MWGui
|
|||
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||
{
|
||||
// delete spell, if allowed
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
|
||||
if (spell->mData.mFlags & ESM::Spell::F_Always
|
||||
|| spell->mData.mType == ESM::Spell::ST_Power)
|
||||
{
|
||||
|
|
|
@ -54,10 +54,10 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
|||
{ 0, 0 }
|
||||
};
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
for (int i=0; names[i][0]; ++i)
|
||||
{
|
||||
setText (names[i][0], store.gameSettings.find (names[i][1])->getString());
|
||||
setText (names[i][0], store.get<ESM::GameSetting>().find (names[i][1])->getString());
|
||||
}
|
||||
|
||||
getWidget(mSkillView, "SkillView");
|
||||
|
@ -67,7 +67,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
|
|||
for (int i = 0; i < ESM::Skill::Length; ++i)
|
||||
{
|
||||
mSkillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
|
||||
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, nullptr));
|
||||
mSkillWidgetMap.insert(std::pair<int, MyGUI::TextBox*>(i, (MyGUI::TextBox*)nullptr));
|
||||
}
|
||||
|
||||
MyGUI::WindowPtr t = static_cast<MyGUI::WindowPtr>(mMainWidget);
|
||||
|
@ -253,7 +253,10 @@ void StatsWindow::onFrame ()
|
|||
|
||||
setFactions(PCstats.getFactionRanks());
|
||||
|
||||
setBirthSign(MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
|
||||
const std::string &signId =
|
||||
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
|
||||
|
||||
setBirthSign(signId);
|
||||
|
||||
if (mChanged)
|
||||
updateSkillArea();
|
||||
|
@ -357,18 +360,22 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
|
|||
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
|
||||
continue;
|
||||
assert(skillId >= 0 && skillId < ESM::Skill::Length);
|
||||
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
|
||||
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
||||
const MWMechanics::Stat<float> &stat = mSkillValues.find(skillId)->second;
|
||||
float base = stat.getBase();
|
||||
float modified = stat.getModified();
|
||||
int progressPercent = (modified - float(static_cast<int>(modified))) * 100;
|
||||
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);
|
||||
assert(skill);
|
||||
|
||||
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
||||
|
||||
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
|
||||
const ESM::Attribute* attr =
|
||||
esmStore.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
||||
assert(attr);
|
||||
|
||||
std::string state = "normal";
|
||||
|
@ -422,10 +429,14 @@ void StatsWindow::updateSkillArea()
|
|||
if (!mMiscSkills.empty())
|
||||
addSkills(mMiscSkills, "sSkillClassMisc", "Misc Skills", coord1, coord2);
|
||||
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::ESMStore &store = world->getStore();
|
||||
const ESM::NPC *player =
|
||||
world->getPlayer().getPlayer().get<ESM::NPC>()->mBase;
|
||||
|
||||
// race tooltip
|
||||
const ESM::Race* playerRace = store.races.find (MWBase::Environment::get().getWorld()->getPlayer().getRace());
|
||||
const ESM::Race* playerRace = store.get<ESM::Race>().find(player->mRace);
|
||||
|
||||
MyGUI::Widget* raceWidget;
|
||||
getWidget(raceWidget, "RaceText");
|
||||
ToolTips::createRaceToolTip(raceWidget, playerRace);
|
||||
|
@ -434,11 +445,14 @@ void StatsWindow::updateSkillArea()
|
|||
|
||||
// class tooltip
|
||||
MyGUI::Widget* classWidget;
|
||||
const ESM::Class& playerClass = MWBase::Environment::get().getWorld()->getPlayer().getClass();
|
||||
|
||||
const ESM::Class *playerClass =
|
||||
store.get<ESM::Class>().find(player->mClass);
|
||||
|
||||
getWidget(classWidget, "ClassText");
|
||||
ToolTips::createClassToolTip(classWidget, playerClass);
|
||||
ToolTips::createClassToolTip(classWidget, *playerClass);
|
||||
getWidget(classWidget, "Class_str");
|
||||
ToolTips::createClassToolTip(classWidget, playerClass);
|
||||
ToolTips::createClassToolTip(classWidget, *playerClass);
|
||||
|
||||
if (!mFactions.empty())
|
||||
{
|
||||
|
@ -450,7 +464,8 @@ void StatsWindow::updateSkillArea()
|
|||
FactionList::const_iterator end = mFactions.end();
|
||||
for (FactionList::const_iterator it = mFactions.begin(); it != end; ++it)
|
||||
{
|
||||
const ESM::Faction *faction = store.factions.find(it->first);
|
||||
const ESM::Faction *faction =
|
||||
store.get<ESM::Faction>().find(it->first);
|
||||
MyGUI::Widget* w = addItem(faction->mName, coord1, coord2);
|
||||
|
||||
std::string text;
|
||||
|
@ -464,8 +479,8 @@ void StatsWindow::updateSkillArea()
|
|||
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->mRanks[it->second+1];
|
||||
|
||||
ESM::RankData rankData = faction->mData.mRankData[it->second+1];
|
||||
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute1);
|
||||
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute2);
|
||||
const ESM::Attribute* attr1 = store.get<ESM::Attribute>().find(faction->mData.mAttribute1);
|
||||
const ESM::Attribute* attr2 = store.get<ESM::Attribute>().find(faction->mData.mAttribute2);
|
||||
assert(attr1 && attr2);
|
||||
|
||||
text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)
|
||||
|
@ -501,7 +516,8 @@ void StatsWindow::updateSkillArea()
|
|||
addSeparator(coord1, coord2);
|
||||
|
||||
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
|
||||
const ESM::BirthSign *sign = store.birthSigns.find(mBirthSignId);
|
||||
const ESM::BirthSign *sign =
|
||||
store.get<ESM::BirthSign>().find(mBirthSignId);
|
||||
MyGUI::Widget* w = addItem(sign->mName, coord1, coord2);
|
||||
|
||||
ToolTips::createBirthsignToolTip(w, mBirthSignId);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_STATS_WINDOW_H
|
||||
#define MWGUI_STATS_WINDOW_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
|
|
@ -179,7 +179,9 @@ void ToolTips::onFrame(float frameDuration)
|
|||
else if (type == "Spell")
|
||||
{
|
||||
ToolTipInfo info;
|
||||
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
|
||||
|
||||
const ESM::Spell *spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(focus->getUserString("Spell"));
|
||||
info.caption = spell->mName;
|
||||
Widgets::SpellEffectList effects;
|
||||
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
|
||||
|
@ -364,11 +366,14 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
|
|||
if (text.size() > 0 && text[0] == '\n')
|
||||
text.erase(0, 1);
|
||||
|
||||
if(caption.size() > 0 && isalnum(caption[0]))
|
||||
caption[0] = toupper(caption[0]);
|
||||
|
||||
const ESM::Enchantment* enchant = 0;
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
if (info.enchant != "")
|
||||
{
|
||||
enchant = store.enchants.search(info.enchant);
|
||||
enchant = store.get<ESM::Enchantment>().find(info.enchant);
|
||||
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
|
||||
text += "\n#{sItemCastOnce}";
|
||||
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
|
||||
|
@ -571,10 +576,15 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
|
|||
if (skillId == -1)
|
||||
return;
|
||||
|
||||
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
|
||||
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const std::string &skillNameId = ESM::Skill::sSkillNameIds[skillId];
|
||||
const ESM::Skill* skill = store.get<ESM::Skill>().find(skillId);
|
||||
assert(skill);
|
||||
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
|
||||
|
||||
const ESM::Attribute* attr =
|
||||
store.get<ESM::Attribute>().find(skill->mData.mAttribute);
|
||||
assert(attr);
|
||||
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
|
||||
|
||||
|
@ -607,12 +617,14 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
|
|||
widget->setUserString("Caption_CenteredCaption", name);
|
||||
std::string specText;
|
||||
// get all skills of this specialisation
|
||||
std::map<int, ESM::Skill> skills = MWBase::Environment::get().getWorld()->getStore().skills.list;
|
||||
for (std::map<int, ESM::Skill>::const_iterator it = skills.begin();
|
||||
it != skills.end(); ++it)
|
||||
const MWWorld::Store<ESM::Skill> &skills =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
|
||||
|
||||
MWWorld::Store<ESM::Skill>::iterator it = skills.begin();
|
||||
for (; it != skills.end(); ++it)
|
||||
{
|
||||
if (it->second.mData.mSpecialization == specId)
|
||||
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.mIndex] + "}";
|
||||
if (it->mData.mSpecialization == specId)
|
||||
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->mIndex] + "}";
|
||||
}
|
||||
widget->setUserString("Caption_CenteredCaptionText", specText);
|
||||
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
|
||||
|
@ -621,7 +633,10 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
|
|||
|
||||
void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string& birthsignId)
|
||||
{
|
||||
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.find(birthsignId);
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::BirthSign *sign = store.get<ESM::BirthSign>().find(birthsignId);
|
||||
|
||||
widget->setUserString("ToolTipType", "Layout");
|
||||
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
|
||||
|
@ -640,7 +655,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
|
|||
for (; it != end; ++it)
|
||||
{
|
||||
const std::string &spellId = *it;
|
||||
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().search(spellId);
|
||||
if (!spell)
|
||||
continue; // Skip spells which cannot be found
|
||||
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
|
||||
|
@ -655,7 +670,11 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
|
|||
spells.push_back(spellId);
|
||||
}
|
||||
|
||||
struct{ const std::vector<std::string> &spells; std::string label; } categories[3] = {
|
||||
struct {
|
||||
const std::vector<std::string> &spells;
|
||||
std::string label;
|
||||
}
|
||||
categories[3] = {
|
||||
{abilities, "sBirthsignmenu1"},
|
||||
{powers, "sPowers"},
|
||||
{spells, "sBirthsignmenu2"}
|
||||
|
@ -672,7 +691,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
|
|||
|
||||
const std::string &spellId = *it;
|
||||
|
||||
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().find(spellId);
|
||||
text += "\n#BF9959" + spell->mName;
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +730,8 @@ void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playe
|
|||
|
||||
void ToolTips::createMagicEffectToolTip(MyGUI::Widget* widget, short id)
|
||||
{
|
||||
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld ()->getStore ().magicEffects.find(id);
|
||||
const ESM::MagicEffect* effect =
|
||||
MWBase::Environment::get().getWorld ()->getStore ().get<ESM::MagicEffect>().find(id);
|
||||
const std::string &name = ESM::MagicEffect::effectIdToString (id);
|
||||
|
||||
std::string icon = effect->mIcon;
|
||||
|
|
|
@ -6,10 +6,16 @@
|
|||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
#include "../mwworld/manualref.hpp"
|
||||
|
||||
#include "../mwmechanics/creaturestats.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
|
||||
namespace MWGui
|
||||
|
@ -52,6 +58,8 @@ namespace MWGui
|
|||
|
||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onCancelButtonClicked);
|
||||
mOfferButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onOfferButtonClicked);
|
||||
mIncreaseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onIncreaseButtonClicked);
|
||||
mDecreaseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onDecreaseButtonClicked);
|
||||
|
||||
setCoord(400, 0, 400, 300);
|
||||
|
||||
|
@ -63,6 +71,7 @@ namespace MWGui
|
|||
setTitle(MWWorld::Class::get(actor).getName(actor));
|
||||
|
||||
mCurrentBalance = 0;
|
||||
mCurrentMerchantOffer = 0;
|
||||
|
||||
mWindowManager.getInventoryWindow()->startTrade();
|
||||
|
||||
|
@ -107,10 +116,14 @@ namespace MWGui
|
|||
bool goldFound = false;
|
||||
MWWorld::Ptr gold;
|
||||
MWWorld::ContainerStore& playerStore = mWindowManager.getInventoryWindow()->getContainerStore();
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
for (MWWorld::ContainerStoreIterator it = playerStore.begin();
|
||||
it != playerStore.end(); ++it)
|
||||
{
|
||||
if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.find("sGold")->getString())
|
||||
if (MWWorld::Class::get(*it).getName(*it) == gmst.find("sGold")->getString())
|
||||
{
|
||||
goldFound = true;
|
||||
gold = *it;
|
||||
|
@ -131,6 +144,9 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::onOfferButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
// were there any items traded at all?
|
||||
MWWorld::ContainerStore& playerBought = mWindowManager.getInventoryWindow()->getBoughtItems();
|
||||
MWWorld::ContainerStore& merchantBought = getBoughtItems();
|
||||
|
@ -156,15 +172,15 @@ namespace MWGui
|
|||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
|
||||
if (ref->base->mNpdt52.mGold == -10)
|
||||
merchantgold = ref->base->mNpdt12.mGold;
|
||||
if (ref->mBase->mNpdt52.mGold == -10)
|
||||
merchantgold = ref->mBase->mNpdt12.mGold;
|
||||
else
|
||||
merchantgold = ref->base->mNpdt52.mGold;
|
||||
merchantgold = ref->mBase->mNpdt52.mGold;
|
||||
}
|
||||
else // ESM::Creature
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||
merchantgold = ref->base->mData.mGold;
|
||||
merchantgold = ref->mBase->mData.mGold;
|
||||
}
|
||||
if (mCurrentBalance > 0 && merchantgold < mCurrentBalance)
|
||||
{
|
||||
|
@ -174,6 +190,56 @@ namespace MWGui
|
|||
return;
|
||||
}
|
||||
|
||||
if(mCurrentBalance > mCurrentMerchantOffer)
|
||||
{
|
||||
//if npc is a creature: reject (no haggle)
|
||||
if (mPtr.getTypeName() != typeid(ESM::NPC).name())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("#{sNotifyMessage9}", std::vector<std::string>());
|
||||
return;
|
||||
}
|
||||
|
||||
int a = abs(mCurrentMerchantOffer);
|
||||
int b = abs(mCurrentBalance);
|
||||
int d = 0;
|
||||
if (mCurrentMerchantOffer<0) d = int(100 * (a - b) / a);
|
||||
else d = int(100 * (b - a) / a);
|
||||
|
||||
float clampedDisposition = std::max<int>(0,std::min<int>(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr)),100));
|
||||
|
||||
MWMechanics::NpcStats sellerSkill = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
|
||||
MWMechanics::CreatureStats sellerStats = MWWorld::Class::get(mPtr).getCreatureStats(mPtr);
|
||||
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
MWMechanics::NpcStats playerSkill = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
|
||||
MWMechanics::CreatureStats playerStats = MWWorld::Class::get(playerPtr).getCreatureStats(playerPtr);
|
||||
|
||||
float a1 = std::min(playerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100.f);
|
||||
float b1 = std::min(0.1f * playerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||
float c1 = std::min(0.2f * playerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
||||
float d1 = std::min(sellerSkill.getSkill(ESM::Skill::Mercantile).getModified(), 100.f);
|
||||
float e1 = std::min(0.1f * sellerStats.getAttribute(ESM::Attribute::Luck).getModified(), 10.f);
|
||||
float f1 = std::min(0.2f * sellerStats.getAttribute(ESM::Attribute::Personality).getModified(), 10.f);
|
||||
|
||||
float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
||||
float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm();
|
||||
float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat();
|
||||
if (mCurrentMerchantOffer<0) x += abs(int(pcTerm - npcTerm));
|
||||
else x += abs(int(npcTerm - pcTerm));
|
||||
|
||||
int roll = std::rand()%100 + 1;
|
||||
if(roll > x) //trade refused
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->
|
||||
messageBox("#{sNotifyMessage9}", std::vector<std::string>());
|
||||
/// \todo adjust npc temporary disposition by iBarterSuccessDisposition or iBarterFailDisposition
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// \todo adjust npc temporary disposition by iBarterSuccessDisposition or iBarterFailDisposition
|
||||
|
||||
// success! make the item transfer.
|
||||
transferBoughtItems();
|
||||
mWindowManager.getInventoryWindow()->transferBoughtItems();
|
||||
|
@ -198,6 +264,20 @@ namespace MWGui
|
|||
mWindowManager.removeGuiMode(GM_Barter);
|
||||
}
|
||||
|
||||
void TradeWindow::onIncreaseButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mCurrentBalance<=-1) mCurrentBalance -= 1;
|
||||
if(mCurrentBalance>=1) mCurrentBalance += 1;
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
void TradeWindow::onDecreaseButtonClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
if(mCurrentBalance<-1) mCurrentBalance += 1;
|
||||
if(mCurrentBalance>1) mCurrentBalance -= 1;
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
void TradeWindow::updateLabels()
|
||||
{
|
||||
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + boost::lexical_cast<std::string>(mWindowManager.getInventoryWindow()->getPlayerGold()));
|
||||
|
@ -217,15 +297,15 @@ namespace MWGui
|
|||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
|
||||
if (ref->base->mNpdt52.mGold == -10)
|
||||
merchantgold = ref->base->mNpdt12.mGold;
|
||||
if (ref->mBase->mNpdt52.mGold == -10)
|
||||
merchantgold = ref->mBase->mNpdt12.mGold;
|
||||
else
|
||||
merchantgold = ref->base->mNpdt52.mGold;
|
||||
merchantgold = ref->mBase->mNpdt52.mGold;
|
||||
}
|
||||
else // ESM::Creature
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||
merchantgold = ref->base->mData.mGold;
|
||||
merchantgold = ref->mBase->mData.mGold;
|
||||
}
|
||||
|
||||
mMerchantGold->setCaptionWithReplacing("#{sSellerGold} " + boost::lexical_cast<std::string>(merchantgold));
|
||||
|
@ -261,14 +341,14 @@ namespace MWGui
|
|||
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
if (ref->mBase->mHasAI)
|
||||
services = ref->mBase->mAiData.mServices;
|
||||
}
|
||||
else if (mPtr.getTypeName() == typeid(ESM::Creature).name())
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
|
||||
if (ref->base->mHasAI)
|
||||
services = ref->base->mAiData.mServices;
|
||||
if (ref->mBase->mHasAI)
|
||||
services = ref->mBase->mAiData.mServices;
|
||||
}
|
||||
|
||||
/// \todo what about potions, there doesn't seem to be a flag for them??
|
||||
|
@ -316,19 +396,17 @@ namespace MWGui
|
|||
|
||||
void TradeWindow::sellToNpc(MWWorld::Ptr item, int count)
|
||||
{
|
||||
/// \todo price adjustment depending on merchantile skill
|
||||
|
||||
mCurrentBalance -= MWWorld::Class::get(item).getValue(item) * count;
|
||||
|
||||
mCurrentBalance -= MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
|
||||
mCurrentMerchantOffer -= MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,true);
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
void TradeWindow::buyFromNpc(MWWorld::Ptr item, int count)
|
||||
{
|
||||
/// \todo price adjustment depending on merchantile skill
|
||||
|
||||
mCurrentBalance += MWWorld::Class::get(item).getValue(item) * count;
|
||||
|
||||
mCurrentBalance += MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
|
||||
mCurrentMerchantOffer += MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count,false);
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
|
|
|
@ -55,11 +55,14 @@ namespace MWGui
|
|||
MyGUI::TextBox* mMerchantGold;
|
||||
|
||||
int mCurrentBalance;
|
||||
int mCurrentMerchantOffer;
|
||||
|
||||
void onWindowResize(MyGUI::Window* _sender);
|
||||
void onFilterChanged(MyGUI::Widget* _sender);
|
||||
void onOfferButtonClicked(MyGUI::Widget* _sender);
|
||||
void onCancelButtonClicked(MyGUI::Widget* _sender);
|
||||
void onIncreaseButtonClicked(MyGUI::Widget* _sender);
|
||||
void onDecreaseButtonClicked(MyGUI::Widget* _sender);
|
||||
|
||||
// don't show items that the NPC has equipped in his trade-window.
|
||||
virtual bool ignoreEquippedItems() { return true; }
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
|
||||
|
@ -73,10 +74,13 @@ namespace MWGui
|
|||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
for (int i=0; i<3; ++i)
|
||||
{
|
||||
/// \todo mercantile skill
|
||||
int price = pcStats.getSkill (bestSkills[i].first).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt ();
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer
|
||||
(mPtr,pcStats.getSkill (bestSkills[i].first).getBase() * gmst.find("iTrainingMod")->getInt (),true);
|
||||
|
||||
std::string skin = (price > mWindowManager.getInventoryWindow ()->getPlayerGold ()) ? "SandTextGreyedOut" : "SandTextButton";
|
||||
|
||||
|
@ -113,8 +117,11 @@ namespace MWGui
|
|||
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ();
|
||||
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
|
||||
|
||||
/// \todo mercantile skill
|
||||
int price = pcStats.getSkill (skillId).getBase() * MWBase::Environment::get().getWorld ()->getStore ().gameSettings.find("iTrainingMod")->getInt ();
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
if (mWindowManager.getInventoryWindow()->getPlayerGold()<price)
|
||||
return;
|
||||
|
@ -128,8 +135,9 @@ namespace MWGui
|
|||
|
||||
// increase skill
|
||||
MWWorld::LiveCellRef<ESM::NPC> *playerRef = player.get<ESM::NPC>();
|
||||
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
|
||||
playerRef->base->mClass);
|
||||
|
||||
const ESM::Class *class_ =
|
||||
store.get<ESM::Class>().find(playerRef->mBase->mClass);
|
||||
pcStats.increaseSkill (skillId, *class_, true);
|
||||
|
||||
// remove gold
|
||||
|
|
|
@ -54,21 +54,25 @@ namespace MWGui
|
|||
{
|
||||
int price = 0;
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
if(interior)
|
||||
{
|
||||
price = MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fMagesGuildTravel")->getFloat();
|
||||
price = gmst.find("fMagesGuildTravel")->getFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
ESM::Position PlayerPos = player.getRefData().getPosition();
|
||||
float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2) );
|
||||
price = d/MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fTravelMult")->getFloat();
|
||||
price = d/gmst.find("fTravelMult")->getFloat();
|
||||
}
|
||||
|
||||
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
|
||||
|
||||
MyGUI::Button* toAdd = mDestinationsView->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SandTextButton", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
|
||||
mCurrentY += sLineHeight;
|
||||
/// \todo price adjustment depending on merchantile skill
|
||||
if(interior)
|
||||
toAdd->setUserString("interior","y");
|
||||
else
|
||||
|
@ -104,15 +108,15 @@ namespace MWGui
|
|||
|
||||
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
|
||||
|
||||
for(unsigned int i = 0;i<mPtr.get<ESM::NPC>()->base->mTransport.size();i++)
|
||||
for(unsigned int i = 0;i<mPtr.get<ESM::NPC>()->mBase->mTransport.size();i++)
|
||||
{
|
||||
std::string cellname = mPtr.get<ESM::NPC>()->base->mTransport[i].mCellName;
|
||||
std::string cellname = mPtr.get<ESM::NPC>()->mBase->mTransport[i].mCellName;
|
||||
bool interior = true;
|
||||
int x,y;
|
||||
MWBase::Environment::get().getWorld()->positionToIndex(mPtr.get<ESM::NPC>()->base->mTransport[i].mPos.pos[0],
|
||||
mPtr.get<ESM::NPC>()->base->mTransport[i].mPos.pos[1],x,y);
|
||||
if(cellname == "") {cellname = MWBase::Environment::get().getWorld()->getExterior(x,y)->cell->mName; interior= false;}
|
||||
addDestination(cellname,mPtr.get<ESM::NPC>()->base->mTransport[i].mPos,interior);
|
||||
MWBase::Environment::get().getWorld()->positionToIndex(mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[0],
|
||||
mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos.pos[1],x,y);
|
||||
if(cellname == "") {cellname = MWBase::Environment::get().getWorld()->getExterior(x,y)->mCell->mName; interior= false;}
|
||||
addDestination(cellname,mPtr.get<ESM::NPC>()->mBase->mTransport[i].mPos,interior);
|
||||
}
|
||||
|
||||
updateLabels();
|
||||
|
@ -142,7 +146,7 @@ namespace MWGui
|
|||
cell = MWBase::Environment::get().getWorld()->getExterior(x,y);
|
||||
ESM::Position PlayerPos = player.getRefData().getPosition();
|
||||
float d = sqrt( pow(pos.pos[0] - PlayerPos.pos[0],2) + pow(pos.pos[1] - PlayerPos.pos[1],2) + pow(pos.pos[2] - PlayerPos.pos[2],2) );
|
||||
int time = int(d /MWBase::Environment::get().getWorld()->getStore().gameSettings.find("fTravelTimeMult")->getFloat());
|
||||
int time = int(d /MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fTravelTimeMult")->getFloat());
|
||||
for(int i = 0;i < time;i++)
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager ()->restoreDynamicStats ();
|
||||
|
|
|
@ -120,9 +120,10 @@ namespace MWGui
|
|||
int hour = MWBase::Environment::get().getWorld ()->getTimeStamp ().getHour ();
|
||||
bool pm = hour >= 12;
|
||||
if (hour >= 13) hour -= 12;
|
||||
if (hour == 0) hour = 12;
|
||||
|
||||
std::string dateTimeText =
|
||||
boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getDay ()+1) + " "
|
||||
boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getDay ()) + " "
|
||||
+ month + " (#{sDay} " + boost::lexical_cast<std::string>(MWBase::Environment::get().getWorld ()->getTimeStamp ().getDay ()+1)
|
||||
+ ") " + boost::lexical_cast<std::string>(hour) + " " + (pm ? "#{sSaveMenuHelp05}" : "#{sSaveMenuHelp04}");
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "components/esm_store/store.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
|
@ -228,8 +228,10 @@ void MWSpell::setSpellId(const std::string &spellId)
|
|||
|
||||
void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI::WidgetPtr creator, MyGUI::IntCoord &coord, int flags)
|
||||
{
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Spell *spell = store.spells.search(mId);
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
|
||||
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
|
||||
|
||||
MWSpellEffectPtr effect = nullptr;
|
||||
|
@ -259,8 +261,10 @@ void MWSpell::updateWidgets()
|
|||
{
|
||||
if (mSpellNameWidget && mWindowManager)
|
||||
{
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::Spell *spell = store.spells.search(mId);
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::Spell *spell = store.get<ESM::Spell>().search(mId);
|
||||
if (spell)
|
||||
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
|
||||
else
|
||||
|
@ -386,8 +390,14 @@ void MWSpellEffect::setSpellEffect(const SpellEffectParams& params)
|
|||
|
||||
void MWSpellEffect::updateWidgets()
|
||||
{
|
||||
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const ESM::MagicEffect *magicEffect = store.magicEffects.search(mEffectParams.mEffectID);
|
||||
if (!mWindowManager)
|
||||
return;
|
||||
|
||||
const MWWorld::ESMStore &store =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
const ESM::MagicEffect *magicEffect =
|
||||
store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);
|
||||
|
||||
assert(magicEffect);
|
||||
assert(mWindowManager);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef MWGUI_WIDGETS_H
|
||||
#define MWGUI_WIDGETS_H
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include <MyGUI.h>
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ WindowManager::WindowManager(
|
|||
, mSpellCreationDialog(NULL)
|
||||
, mEnchantingDialog(NULL)
|
||||
, mTrainingWindow(NULL)
|
||||
, mPlayerClass()
|
||||
, mPlayerName()
|
||||
, mPlayerRaceId()
|
||||
, mPlayerAttributes()
|
||||
|
@ -499,8 +498,7 @@ void WindowManager::setValue (const std::string& id, int value)
|
|||
|
||||
void WindowManager::setPlayerClass (const ESM::Class &class_)
|
||||
{
|
||||
mPlayerClass = class_;
|
||||
mStatsWindow->setValue("class", mPlayerClass.mName);
|
||||
mStatsWindow->setValue("class", class_.mName);
|
||||
}
|
||||
|
||||
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
|
||||
|
@ -554,7 +552,9 @@ int WindowManager::readPressedButton ()
|
|||
|
||||
std::string WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
|
||||
{
|
||||
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
|
||||
const ESM::GameSetting *setting =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().search(id);
|
||||
|
||||
if (setting && setting->mType == ESM::VT_String)
|
||||
return setting->getString();
|
||||
return default_;
|
||||
|
@ -582,6 +582,8 @@ void WindowManager::onFrame (float frameDuration)
|
|||
mDragAndDrop->mDraggedWidget->setPosition(MyGUI::InputManager::getInstance().getMousePosition());
|
||||
}
|
||||
|
||||
mDialogueWindow->onFrame();
|
||||
|
||||
mInventoryWindow->onFrame();
|
||||
|
||||
mStatsWindow->onFrame();
|
||||
|
@ -604,17 +606,18 @@ void WindowManager::onFrame (float frameDuration)
|
|||
|
||||
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||
{
|
||||
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
|
||||
if (cell->mCell->isExterior())
|
||||
{
|
||||
std::string name;
|
||||
if (cell->cell->mName != "")
|
||||
if (cell->mCell->mName != "")
|
||||
{
|
||||
name = cell->cell->mName;
|
||||
mMap->addVisitedLocation (name, cell->cell->getGridX (), cell->cell->getGridY ());
|
||||
name = cell->mCell->mName;
|
||||
mMap->addVisitedLocation (name, cell->mCell->getGridX (), cell->mCell->getGridY ());
|
||||
}
|
||||
else
|
||||
{
|
||||
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->mRegion);
|
||||
const ESM::Region* region =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Region>().search(cell->mCell->mRegion);
|
||||
if (region)
|
||||
name = region->mName;
|
||||
else
|
||||
|
@ -628,15 +631,15 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
|||
|
||||
mMap->setCellPrefix("Cell");
|
||||
mHud->setCellPrefix("Cell");
|
||||
mMap->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
|
||||
mHud->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
|
||||
mMap->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() );
|
||||
mHud->setActiveCell( cell->mCell->getGridX(), cell->mCell->getGridY() );
|
||||
}
|
||||
else
|
||||
{
|
||||
mMap->setCellName( cell->cell->mName );
|
||||
mHud->setCellName( cell->cell->mName );
|
||||
mMap->setCellPrefix( cell->cell->mName );
|
||||
mHud->setCellPrefix( cell->cell->mName );
|
||||
mMap->setCellName( cell->mCell->mName );
|
||||
mHud->setCellName( cell->mCell->mName );
|
||||
mMap->setCellPrefix( cell->mCell->mName );
|
||||
mHud->setCellPrefix( cell->mCell->mName );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -719,7 +722,9 @@ void WindowManager::setDragDrop(bool dragDrop)
|
|||
|
||||
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
|
||||
{
|
||||
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.find(_tag);
|
||||
const ESM::GameSetting *setting =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(_tag);
|
||||
|
||||
if (setting && setting->mType == ESM::VT_String)
|
||||
_result = setting->getString();
|
||||
else
|
||||
|
@ -771,6 +776,13 @@ void WindowManager::pushGuiMode(GuiMode mode)
|
|||
if (mode==GM_Inventory && mAllowed==GW_None)
|
||||
return;
|
||||
|
||||
|
||||
// If this mode already exists somewhere in the stack, just bring it to the front.
|
||||
if (std::find(mGuiModes.begin(), mGuiModes.end(), mode) != mGuiModes.end())
|
||||
{
|
||||
mGuiModes.erase(std::find(mGuiModes.begin(), mGuiModes.end(), mode));
|
||||
}
|
||||
|
||||
mGuiModes.push_back(mode);
|
||||
|
||||
bool gameMode = !isGuiMode();
|
||||
|
@ -810,7 +822,10 @@ void WindowManager::removeGuiMode(GuiMode mode)
|
|||
void WindowManager::setSelectedSpell(const std::string& spellId, int successChancePercent)
|
||||
{
|
||||
mHud->setSelectedSpell(spellId, successChancePercent);
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
|
||||
|
||||
const ESM::Spell* spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
|
||||
|
||||
mSpellWindow->setTitle(spell->mName);
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,6 @@ namespace MWGui
|
|||
|
||||
/// \todo get rid of this stuff. Move it to the respective UI element classes, if needed.
|
||||
// Various stats about player as needed by window manager
|
||||
ESM::Class mPlayerClass;
|
||||
std::string mPlayerName;
|
||||
std::string mPlayerRaceId;
|
||||
std::map<int, MWMechanics::Stat<int> > mPlayerAttributes;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <OIS/OISInputManager.h>
|
||||
#include <OISInputManager.h>
|
||||
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace OIS
|
|||
class InputManager;
|
||||
}
|
||||
|
||||
#include <OIS/OISKeyboard.h>
|
||||
#include <OIS/OISMouse.h>
|
||||
#include <OISKeyboard.h>
|
||||
#include <OISMouse.h>
|
||||
|
||||
#include <extern/oics/ICSChannelListener.h>
|
||||
#include <extern/oics/ICSInputControlSystem.h>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <components/esm/loadmgef.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -86,7 +86,7 @@ namespace MWMechanics
|
|||
if (effects.second)
|
||||
{
|
||||
const ESM::MagicEffect *magicEffect =
|
||||
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||
iter->mEffectID);
|
||||
|
||||
if (iter->mDuration==0)
|
||||
|
@ -114,18 +114,18 @@ namespace MWMechanics
|
|||
std::pair<ESM::EffectList, bool> ActiveSpells::getEffectList (const std::string& id) const
|
||||
{
|
||||
if (const ESM::Spell *spell =
|
||||
MWBase::Environment::get().getWorld()->getStore().spells.search (id))
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search (id))
|
||||
return std::make_pair (spell->mEffects, false);
|
||||
|
||||
if (const ESM::Potion *potion =
|
||||
MWBase::Environment::get().getWorld()->getStore().potions.search (id))
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>().search (id))
|
||||
return std::make_pair (potion->mEffects, false);
|
||||
|
||||
if (const ESM::Ingredient *ingredient =
|
||||
MWBase::Environment::get().getWorld()->getStore().ingreds.search (id))
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Ingredient>().search (id))
|
||||
{
|
||||
const ESM::MagicEffect *magicEffect =
|
||||
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (
|
||||
ingredient->mData.mEffectID[0]);
|
||||
|
||||
ESM::ENAMstruct effect;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <components/esm/loadnpc.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/inventorystore.hpp"
|
||||
|
@ -101,11 +101,11 @@ namespace MWMechanics
|
|||
health.setCurrent (health.getCurrent() + 0.1 * endurance);
|
||||
stats.setHealth (health);
|
||||
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
||||
float fFatigueReturnBase = store.gameSettings.find("fFatigueReturnBase")->getFloat ();
|
||||
float fFatigueReturnMult = store.gameSettings.find("fFatigueReturnMult")->getFloat ();
|
||||
float fEndFatigueMult = store.gameSettings.find("fEndFatigueMult")->getFloat ();
|
||||
float fFatigueReturnBase = store.get<ESM::GameSetting>().find("fFatigueReturnBase")->getFloat ();
|
||||
float fFatigueReturnMult = store.get<ESM::GameSetting>().find("fFatigueReturnMult")->getFloat ();
|
||||
float fEndFatigueMult = store.get<ESM::GameSetting>().find("fEndFatigueMult")->getFloat ();
|
||||
|
||||
float capacity = MWWorld::Class::get(ptr).getCapacity(ptr);
|
||||
float encumbrance = MWWorld::Class::get(ptr).getEncumbrance(ptr);
|
||||
|
@ -122,7 +122,7 @@ namespace MWMechanics
|
|||
|
||||
if (!stunted)
|
||||
{
|
||||
float fRestMagicMult = store.gameSettings.find("fRestMagicMult")->getFloat ();
|
||||
float fRestMagicMult = store.get<ESM::GameSetting>().find("fRestMagicMult")->getFloat ();
|
||||
|
||||
DynamicStat<float> magicka = stats.getMagicka();
|
||||
magicka.setCurrent (magicka.getCurrent()
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#include <components/esm/loadgmst.hpp>
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
|
@ -38,11 +38,11 @@ std::set<MWMechanics::EffectKey> MWMechanics::Alchemy::listEffects() const
|
|||
const MWWorld::LiveCellRef<ESM::Ingredient> *ingredient = iter->get<ESM::Ingredient>();
|
||||
|
||||
for (int i=0; i<4; ++i)
|
||||
if (ingredient->base->mData.mEffectID[i]!=-1)
|
||||
if (ingredient->mBase->mData.mEffectID[i]!=-1)
|
||||
{
|
||||
EffectKey key (
|
||||
ingredient->base->mData.mEffectID[i], ingredient->base->mData.mSkills[i]!=-1 ?
|
||||
ingredient->base->mData.mSkills[i] : ingredient->base->mData.mAttributes[i]);
|
||||
ingredient->mBase->mData.mEffectID[i], ingredient->mBase->mData.mSkills[i]!=-1 ?
|
||||
ingredient->mBase->mData.mSkills[i] : ingredient->mBase->mData.mAttributes[i]);
|
||||
|
||||
++effects[key];
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ void MWMechanics::Alchemy::applyTools (int flags, float& value) const
|
|||
else
|
||||
return;
|
||||
|
||||
float toolQuality = setup==1 || setup==2 ? mTools[tool].get<ESM::Apparatus>()->base->mData.mQuality : 0;
|
||||
float toolQuality = setup==1 || setup==2 ? mTools[tool].get<ESM::Apparatus>()->mBase->mData.mQuality : 0;
|
||||
float calcinatorQuality = setup==1 || setup==3 ?
|
||||
mTools[ESM::Apparatus::Calcinator].get<ESM::Apparatus>()->base->mData.mQuality : 0;
|
||||
mTools[ESM::Apparatus::Calcinator].get<ESM::Apparatus>()->mBase->mData.mQuality : 0;
|
||||
|
||||
float quality = 1;
|
||||
|
||||
|
@ -130,30 +130,30 @@ void MWMechanics::Alchemy::updateEffects()
|
|||
// general alchemy factor
|
||||
float x = getChance();
|
||||
|
||||
x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->base->mData.mQuality;
|
||||
x *= MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionStrengthMult")->getFloat();
|
||||
x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->mBase->mData.mQuality;
|
||||
x *= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionStrengthMult")->getFloat();
|
||||
|
||||
// value
|
||||
mValue = static_cast<int> (
|
||||
x * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("iAlchemyMod")->getFloat());
|
||||
x * MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("iAlchemyMod")->getFloat());
|
||||
|
||||
// build quantified effect list
|
||||
for (std::set<EffectKey>::const_iterator iter (effects.begin()); iter!=effects.end(); ++iter)
|
||||
{
|
||||
const ESM::MagicEffect *magicEffect =
|
||||
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (iter->mId);
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find (iter->mId);
|
||||
|
||||
if (magicEffect->mData.mBaseCost<=0)
|
||||
throw std::runtime_error ("invalid base cost for magic effect " + iter->mId);
|
||||
|
||||
float fPotionT1MagMul =
|
||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionT1MagMult")->getFloat();
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1MagMult")->getFloat();
|
||||
|
||||
if (fPotionT1MagMul<=0)
|
||||
throw std::runtime_error ("invalid gmst: fPotionT1MagMul");
|
||||
|
||||
float fPotionT1DurMult =
|
||||
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fPotionT1DurMult")->getFloat();
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find ("fPotionT1DurMult")->getFloat();
|
||||
|
||||
if (fPotionT1DurMult<=0)
|
||||
throw std::runtime_error ("invalid gmst: fPotionT1DurMult");
|
||||
|
@ -192,18 +192,20 @@ void MWMechanics::Alchemy::updateEffects()
|
|||
|
||||
const ESM::Potion *MWMechanics::Alchemy::getRecord() const
|
||||
{
|
||||
for (ESMS::RecListWithIDT<ESM::Potion>::MapType::const_iterator iter (
|
||||
MWBase::Environment::get().getWorld()->getStore().potions.list.begin());
|
||||
iter!=MWBase::Environment::get().getWorld()->getStore().potions.list.end(); ++iter)
|
||||
const MWWorld::Store<ESM::Potion> &potions =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>();
|
||||
|
||||
MWWorld::Store<ESM::Potion>::iterator iter = potions.begin();
|
||||
for (; iter != potions.end(); ++iter)
|
||||
{
|
||||
if (iter->second.mEffects.mList.size()!=mEffects.size())
|
||||
if (iter->mEffects.mList.size() != mEffects.size())
|
||||
continue;
|
||||
|
||||
bool mismatch = false;
|
||||
|
||||
for (int i=0; i<static_cast<int> (iter->second.mEffects.mList.size()); ++iter)
|
||||
for (int i=0; i<static_cast<int> (iter->mEffects.mList.size()); ++iter)
|
||||
{
|
||||
const ESM::ENAMstruct& first = iter->second.mEffects.mList[i];
|
||||
const ESM::ENAMstruct& first = iter->mEffects.mList[i];
|
||||
const ESM::ENAMstruct& second = mEffects[i];
|
||||
|
||||
if (first.mEffectID!=second.mEffectID ||
|
||||
|
@ -221,7 +223,7 @@ const ESM::Potion *MWMechanics::Alchemy::getRecord() const
|
|||
}
|
||||
|
||||
if (!mismatch)
|
||||
return &iter->second;
|
||||
return &(*iter);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -258,7 +260,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
|
|||
|
||||
for (TIngredientsIterator iter (beginIngredients()); iter!=endIngredients(); ++iter)
|
||||
if (!iter->isEmpty())
|
||||
newRecord.mData.mWeight += iter->get<ESM::Ingredient>()->base->mData.mWeight;
|
||||
newRecord.mData.mWeight += iter->get<ESM::Ingredient>()->mBase->mData.mWeight;
|
||||
|
||||
newRecord.mData.mWeight /= countIngredients();
|
||||
|
||||
|
@ -277,7 +279,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
|
|||
|
||||
newRecord.mEffects.mList = mEffects;
|
||||
|
||||
record = MWBase::Environment::get().getWorld()->createRecord (newRecord).second;
|
||||
record = MWBase::Environment::get().getWorld()->createRecord (newRecord);
|
||||
}
|
||||
|
||||
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
||||
|
@ -332,13 +334,13 @@ void MWMechanics::Alchemy::setAlchemist (const MWWorld::Ptr& npc)
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Apparatus>* ref = iter->get<ESM::Apparatus>();
|
||||
|
||||
int type = ref->base->mData.mType;
|
||||
int type = ref->mBase->mData.mType;
|
||||
|
||||
if (type<0 || type>=static_cast<int> (mTools.size()))
|
||||
throw std::runtime_error ("invalid apparatus type");
|
||||
|
||||
if (!mTools[type].isEmpty())
|
||||
if (ref->base->mData.mQuality<=mTools[type].get<ESM::Apparatus>()->base->mData.mQuality)
|
||||
if (ref->mBase->mData.mQuality<=mTools[type].get<ESM::Apparatus>()->mBase->mData.mQuality)
|
||||
continue;
|
||||
|
||||
mTools[type] = *iter;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <components/esm_store/store.hpp>
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -41,10 +41,11 @@ namespace MWMechanics
|
|||
|
||||
float normalised = max==0 ? 1 : std::max (0.0f, static_cast<float> (current)/max);
|
||||
|
||||
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
return store.gameSettings.find ("fFatigueBase")->getFloat()
|
||||
- store.gameSettings.find ("fFatigueMult")->getFloat() * (1-normalised);
|
||||
return gmst.find ("fFatigueBase")->getFloat()
|
||||
- gmst.find ("fFatigueMult")->getFloat() * (1-normalised);
|
||||
}
|
||||
|
||||
const Stat<int> &CreatureStats::getAttribute(int index) const
|
||||
|
@ -231,4 +232,14 @@ namespace MWMechanics
|
|||
mDead = false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CreatureStats::hasCommonDisease() const
|
||||
{
|
||||
return mSpells.hasCommonDisease();
|
||||
}
|
||||
|
||||
bool CreatureStats::hasBlightDisease() const
|
||||
{
|
||||
return mSpells.hasBlightDisease();
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue