Conflicts:
	apps/openmw/mwdialogue/filter.cpp
	apps/openmw/mwgui/waitdialog.cpp
deque
scrawl 11 years ago
commit b47b2b84f3

@ -119,6 +119,7 @@ set(OENGINE_OGRE
)
set(OENGINE_GUI
${LIBDIR}/openengine/gui/loglistener.cpp
${LIBDIR}/openengine/gui/manager.cpp
${LIBDIR}/openengine/gui/layout.hpp
)
@ -224,6 +225,9 @@ endif ()
set(BOOST_COMPONENTS system filesystem program_options)
if(WIN32)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
endif(WIN32)
IF(BOOST_STATIC)
set(Boost_USE_STATIC_LIBS ON)

@ -41,11 +41,11 @@ Launcher::MainDialog::MainDialog(QWidget *parent)
// Check if the font is installed
if (!fonts.contains("EB Garamond")) {
QString font = QString::fromStdString(mCfgMgr.getGlobalDataPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf");
QString font = QString::fromUtf8(mCfgMgr.getGlobalDataPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
file.setFileName(font);
if (!file.exists()) {
font = QString::fromStdString(mCfgMgr.getLocalPath().string()) + QString("resources/mygui/EBGaramond-Regular.ttf");
font = QString::fromUtf8(mCfgMgr.getLocalPath().string().c_str()) + QString("resources/mygui/EBGaramond-Regular.ttf");
}
fontDatabase.addApplicationFont(font);
@ -243,7 +243,7 @@ bool Launcher::MainDialog::showFirstRunDialog()
}
// Create the file if it doesn't already exist, else the importer will fail
QString path = QString::fromStdString(mCfgMgr.getUserConfigPath().string()) + QString("openmw.cfg");
QString path = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str()) + QString("openmw.cfg");
QFile file(path);
if (!file.exists()) {
@ -358,7 +358,7 @@ bool Launcher::MainDialog::setupLauncherSettings()
{
mLauncherSettings.setMultiValueEnabled(true);
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QStringList paths;
paths.append(QString("launcher.cfg"));
@ -464,8 +464,8 @@ bool Launcher::expansions(Launcher::UnshieldThread& cd)
bool Launcher::MainDialog::setupGameSettings()
{
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string());
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
// Load the user config file first, separately
// So we can write it properly, uncontaminated
@ -594,7 +594,7 @@ bool Launcher::MainDialog::setupGameSettings()
while(expansions(cd));
selectedFile = QString::fromStdString(cd.GetMWEsmPath());
selectedFile = QString::fromUtf8(cd.GetMWEsmPath().c_str());
}
#endif // WIN32
@ -615,8 +615,8 @@ bool Launcher::MainDialog::setupGraphicsSettings()
{
mGraphicsSettings.setMultiValueEnabled(false);
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
QString globalPath = QString::fromStdString(mCfgMgr.getGlobalPath().string());
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
QFile localDefault(QString("settings-default.cfg"));
QFile globalDefault(globalPath + QString("settings-default.cfg"));
@ -702,7 +702,7 @@ bool Launcher::MainDialog::writeSettings()
mGraphicsPage->saveSettings();
mDataFilesPage->saveSettings();
QString userPath = QString::fromStdString(mCfgMgr.getUserConfigPath().string());
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
QDir dir(userPath);
if (!dir.exists()) {

@ -45,7 +45,8 @@ void Launcher::GameSettings::validatePaths()
Files::PathContainer dataDirs;
foreach (const QString &path, paths) {
dataDirs.push_back(Files::PathContainer::value_type(path.toStdString()));
QByteArray bytes = path.toUtf8();
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
}
// Parse the data dirs to convert the tokenized paths
@ -53,7 +54,7 @@ void Launcher::GameSettings::validatePaths()
mDataDirs.clear();
for (Files::PathContainer::iterator it = dataDirs.begin(); it != dataDirs.end(); ++it) {
QString path = QString::fromStdString(it->string());
QString path = QString::fromUtf8(it->string().c_str());
path.remove(QChar('\"'));
QDir dir(path);
@ -68,12 +69,13 @@ void Launcher::GameSettings::validatePaths()
return;
dataDirs.clear();
dataDirs.push_back(Files::PathContainer::value_type(local.toStdString()));
QByteArray bytes = local.toUtf8();
dataDirs.push_back(Files::PathContainer::value_type(std::string(bytes.constData(), bytes.length())));
mCfgMgr.processPaths(dataDirs);
if (!dataDirs.empty()) {
QString path = QString::fromStdString(dataDirs.front().string());
QString path = QString::fromUtf8(dataDirs.front().string().c_str());
path.remove(QChar('\"'));
QDir dir(path);

@ -1,6 +1,6 @@
#include "unshieldthread.hpp"
#include <fstream>
#include <boost/filesystem/fstream.hpp>
#include <components/misc/stringops.hpp>
namespace bfs = boost::filesystem;
@ -49,7 +49,7 @@ namespace
std::string read_to_string(const bfs::path& path)
{
std::ifstream strstream(path.c_str(), std::ios::in | std::ios::binary);
bfs::ifstream strstream(path, std::ios::in | std::ios::binary);
std::string str;
strstream.seekg(0, std::ios::end);
@ -201,7 +201,7 @@ namespace
add_setting("Archives", "Archive 1", "Bloodmoon.bsa", ini);
}
std::ofstream inistream(ini_path.c_str());
bfs::ofstream inistream((ini_path));
inistream << ini;
inistream.close();
}

@ -1,6 +1,5 @@
#include "importer.hpp"
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
#include <iostream>
#include <string>
#include <map>
@ -9,6 +8,10 @@
#include <sstream>
#include <components/misc/stringops.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
namespace bfs = boost::filesystem;
MwIniImporter::MwIniImporter()
: mVerbose(false)
@ -661,7 +664,7 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
std::string section("");
MwIniImporter::multistrmap map;
boost::iostreams::stream<boost::iostreams::file_source>file(filename.c_str());
bfs::ifstream file((bfs::path(filename)));
ToUTF8::Utf8Encoder encoder(mEncoding);
std::string line;
@ -674,6 +677,10 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
line = line.substr(0, line.length()-1);
}
if(line.empty()) {
continue;
}
if(line[0] == '[') {
int pos = line.find(']');
if(pos < 2) {
@ -690,10 +697,6 @@ MwIniImporter::multistrmap MwIniImporter::loadIniFile(const std::string& filenam
line = line.substr(0,comment_pos);
}
if(line.empty()) {
continue;
}
int pos = line.find("=");
if(pos < 1) {
continue;
@ -720,7 +723,7 @@ MwIniImporter::multistrmap MwIniImporter::loadCfgFile(const std::string& filenam
std::cout << "load cfg file: " << filename << std::endl;
MwIniImporter::multistrmap map;
boost::iostreams::stream<boost::iostreams::file_source>file(filename.c_str());
bfs::ifstream file((bfs::path(filename)));
std::string line;
while (std::getline(file, line)) {
@ -858,7 +861,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini) co
}
}
void MwIniImporter::writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, const multistrmap &cfg) {
void MwIniImporter::writeToFile(std::ostream &out, const multistrmap &cfg) {
for(multistrmap::const_iterator it=cfg.begin(); it != cfg.end(); ++it) {
for(std::vector<std::string>::const_iterator entry=it->second.begin(); entry != it->second.end(); ++entry) {

@ -1,12 +1,11 @@
#ifndef MWINIIMPORTER_IMPORTER
#define MWINIIMPORTER_IMPORTER 1
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
#include <string>
#include <map>
#include <vector>
#include <exception>
#include <iosfwd>
#include <components/to_utf8/to_utf8.hpp>
@ -24,7 +23,7 @@ class MwIniImporter {
void mergeFallback(multistrmap &cfg, const multistrmap &ini) const;
void importGameFiles(multistrmap &cfg, const multistrmap &ini) const;
void importArchives(multistrmap &cfg, const multistrmap &ini) const;
static void writeToFile(boost::iostreams::stream<boost::iostreams::file_sink> &out, const multistrmap &cfg);
static void writeToFile(std::ostream &out, const multistrmap &cfg);
private:
static void insertMultistrmap(multistrmap &cfg, const std::string& key, const std::string& value);

@ -1,14 +1,58 @@
#include "importer.hpp"
#include <iostream>
#include <string>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
namespace bpo = boost::program_options;
namespace bfs = boost::filesystem;
#ifndef _WIN32
int main(int argc, char *argv[]) {
#else
// Include on Windows only
#include <boost/locale.hpp>
class utf8argv
{
public:
utf8argv(int argc, wchar_t *wargv[])
{
args.reserve(argc);
argv = new const char *[argc];
for (int i = 0; i < argc; ++i) {
args.push_back(boost::locale::conv::utf_to_utf<char>(wargv[i]));
argv[i] = args.back().c_str();
}
}
~utf8argv() { delete[] argv; }
char **get() const { return const_cast<char **>(argv); }
private:
const char **argv;
std::vector<std::string> args;
};
/* The only way to pass Unicode on Winodws with CLI is to use wide
characters interface which presents UTF-16 encoding. The rest of
OpenMW application stack assumes UTF-8 encoding, therefore this
conversion.
For boost::filesystem::path::imbue see components/files/windowspath.cpp
*/
int wmain(int argc, wchar_t *wargv[]) {
utf8argv converter(argc, wargv);
char **argv = converter.get();
boost::filesystem::path::imbue(boost::locale::generator().generate(""));
#endif
bpo::options_description desc("Syntax: mwiniimporter <options> inifile configfile\nAllowed options");
bpo::positional_options_description p_desc;
desc.add_options()
@ -94,7 +138,7 @@ int main(int argc, char *argv[]) {
}
std::cout << "write to: " << outputFile << std::endl;
boost::iostreams::stream<boost::iostreams::file_sink> file(outputFile);
bfs::ofstream file((bfs::path(outputFile)));
importer.writeToFile(file, cfg);
return 0;

@ -145,6 +145,10 @@ if(WIN32)
endif(WIN32)
set(BOOST_COMPONENTS system filesystem program_options thread wave)
if(WIN32)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
endif(WIN32)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)

@ -27,7 +27,9 @@ void CSMDoc::OpenSaveStage::perform (int stage, Messages& messages)
{
mState.start (mDocument, mProjectFile);
mState.getStream().open ((mProjectFile ? mState.getPath() : mState.getTmpPath()).string().c_str());
mState.getStream().open (
mProjectFile ? mState.getPath() : mState.getTmpPath(),
std::ios::binary);
if (!mState.getStream().is_open())
throw std::runtime_error ("failed to open stream for saving");
@ -260,4 +262,4 @@ void CSMDoc::FinalSavingStage::perform (int stage, Messages& messages)
mDocument.getUndoStack().setClean();
}
}
}

@ -47,7 +47,7 @@ const boost::filesystem::path& CSMDoc::SavingState::getTmpPath() const
return mTmpPath;
}
std::ofstream& CSMDoc::SavingState::getStream()
boost::filesystem::ofstream& CSMDoc::SavingState::getStream()
{
return mStream;
}
@ -60,4 +60,4 @@ ESM::ESMWriter& CSMDoc::SavingState::getWriter()
bool CSMDoc::SavingState::isProjectFile() const
{
return mProjectFile;
}
}

@ -4,6 +4,7 @@
#include <fstream>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <components/esm/esmwriter.hpp>
@ -20,7 +21,7 @@ namespace CSMDoc
boost::filesystem::path mPath;
boost::filesystem::path mTmpPath;
ToUTF8::Utf8Encoder mEncoder;
std::ofstream mStream;
boost::filesystem::ofstream mStream;
ESM::ESMWriter mWriter;
boost::filesystem::path mProjectPath;
bool mProjectFile;
@ -39,7 +40,7 @@ namespace CSMDoc
const boost::filesystem::path& getTmpPath() const;
std::ofstream& getStream();
boost::filesystem::ofstream& getStream();
ESM::ESMWriter& getWriter();
@ -50,4 +51,4 @@ namespace CSMDoc
}
#endif
#endif

@ -83,6 +83,10 @@ add_openmw_dir (mwbase
# Main executable
set(BOOST_COMPONENTS system filesystem program_options thread wave)
if(WIN32)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
endif(WIN32)
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
IF(OGRE_STATIC)

@ -236,7 +236,7 @@ void OMW::Engine::addArchive (const std::string& archive) {
// Set resource dir
void OMW::Engine::setResourceDir (const boost::filesystem::path& parResDir)
{
mResDir = boost::filesystem::system_complete(parResDir);
mResDir = parResDir;
}
// Set start cell name (only interiors for now)
@ -492,11 +492,11 @@ void OMW::Engine::activate()
MWScript::InterpreterContext interpreterContext (&ptr.getRefData().getLocals(), ptr);
boost::shared_ptr<MWWorld::Action> action =
MWWorld::Class::get (ptr).activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
ptr.getClass().activate (ptr, MWBase::Environment::get().getWorld()->getPlayerPtr());
interpreterContext.activate (ptr, action);
std::string script = MWWorld::Class::get (ptr).getScript (ptr);
std::string script = ptr.getClass().getScript (ptr);
MWBase::Environment::get().getWorld()->breakInvisibility(MWBase::Environment::get().getWorld()->getPlayerPtr());

@ -108,7 +108,7 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
{
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfActivator");

@ -295,7 +295,7 @@ namespace MWClass
return std::make_pair(0, "#{sInventoryMessage1}");
// slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
if (slots_.first.empty())
return std::make_pair(0, "");

@ -61,7 +61,7 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfItem");

@ -233,7 +233,7 @@ namespace MWClass
std::pair<int, std::string> Clothing::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
{
// slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
if (slots_.first.empty())
return std::make_pair(0, "");

@ -112,7 +112,7 @@ namespace MWClass
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfContainer");
@ -127,7 +127,7 @@ namespace MWClass
const std::string trapActivationSound = "Disarm Trap Fail";
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
MWWorld::InventoryStore& invStore = player.getClass().getInventoryStore(player);
bool needKey = ptr.getCellRef().mLockLevel > 0;
bool hasKey = false;
@ -143,7 +143,7 @@ namespace MWClass
if (refId == keyId)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);
keyName = it->getClass().getName(*it);
}
}

@ -277,7 +277,7 @@ namespace MWClass
if (!weapon.isEmpty())
{
const bool weaphashealth = get(weapon).hasItemHealth(weapon);
const bool weaphashealth = weapon.getClass().hasItemHealth(weapon);
const unsigned char *attack = NULL;
if(type == ESM::Weapon::AT_Chop)
attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
@ -354,7 +354,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(MWWorld::Class::get(object).getId(object));
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
{
@ -444,7 +444,7 @@ namespace MWClass
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
{
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfCreature");

@ -99,7 +99,7 @@ namespace MWClass
const std::string lockedSound = "LockedDoor";
const std::string trapActivationSound = "Disarm Trap Fail";
MWWorld::ContainerStore &invStore = get(actor).getContainerStore(actor);
MWWorld::ContainerStore &invStore = actor.getClass().getContainerStore(actor);
bool needKey = ptr.getCellRef().mLockLevel > 0;
bool hasKey = false;
@ -115,7 +115,7 @@ namespace MWClass
if (refId == keyId)
{
hasKey = true;
keyName = get(*it).getName(*it);
keyName = it->getClass().getName(*it);
}
}

@ -153,7 +153,7 @@ namespace MWClass
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
static const float fWortChanceValue =

@ -250,7 +250,7 @@ namespace MWClass
std::pair<int, std::string> Light::canBeEquipped(const MWWorld::Ptr &ptr, const MWWorld::Ptr &npc) const
{
MWWorld::InventoryStore& invStore = MWWorld::Class::get(npc).getInventoryStore(npc);
MWWorld::InventoryStore& invStore = npc.getClass().getInventoryStore(npc);
MWWorld::ContainerStoreIterator weapon = invStore.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if(weapon == invStore.end())

@ -484,10 +484,10 @@ namespace MWClass
if(victim.isEmpty()) // Didn't hit anything
return;
const MWWorld::Class &othercls = MWWorld::Class::get(victim);
const MWWorld::Class &othercls = victim.getClass();
if(!othercls.isActor()) // Can't hit non-actors
return;
MWMechanics::CreatureStats &otherstats = victim.getClass().getCreatureStats(victim);
MWMechanics::CreatureStats &otherstats = othercls.getCreatureStats(victim);
if(otherstats.isDead()) // Can't hit dead actors
return;
@ -496,7 +496,7 @@ namespace MWClass
int weapskill = ESM::Skill::HandToHand;
if(!weapon.isEmpty())
weapskill = get(weapon).getEquipmentSkill(weapon);
weapskill = weapon.getClass().getEquipmentSkill(weapon);
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
@ -511,7 +511,7 @@ namespace MWClass
MWMechanics::NpcStats &stats = getNpcStats(ptr);
if(!weapon.isEmpty())
{
const bool weaphashealth = get(weapon).hasItemHealth(weapon);
const bool weaphashealth = weapon.getClass().hasItemHealth(weapon);
const unsigned char *attack = NULL;
if(type == ESM::Weapon::AT_Chop)
attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
@ -637,7 +637,7 @@ namespace MWClass
}
if(!object.isEmpty())
getCreatureStats(ptr).setLastHitObject(get(object).getId(object));
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
if(!attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
{
@ -716,9 +716,9 @@ namespace MWClass
inv.unequipItem(armor, ptr);
if (ptr.getRefData().getHandle() == "player")
skillUsageSucceeded(ptr, get(armor).getEquipmentSkill(armor), 0);
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
switch(get(armor).getEquipmentSkill(armor))
switch(armor.getClass().getEquipmentSkill(armor))
{
case ESM::Skill::LightArmor:
sndMgr->playSound3D(ptr, "Light Armor Hit", 1.0f, 1.0f);
@ -802,7 +802,7 @@ namespace MWClass
if(ptr.getRefData().getHandle() == "player")
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfNPC");
@ -814,7 +814,7 @@ namespace MWClass
}
if(getCreatureStats(ptr).isDead())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
if(get(ptr).getCreatureStats(ptr).isHostile())
if(ptr.getClass().getCreatureStats(ptr).isHostile())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction("#{sActorInCombat}"));
if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak))
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr)); // stealing
@ -943,7 +943,7 @@ namespace MWClass
if (fallHeight >= fallDistanceMin)
{
const float acrobaticsSkill = MWWorld::Class::get(ptr).getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
const float acrobaticsSkill = ptr.getClass().getNpcStats (ptr).getSkill(ESM::Skill::Acrobatics).getModified();
const NpcCustomData *npcdata = static_cast<const NpcCustomData*>(ptr.getRefData().getCustomData());
const float jumpSpellBonus = npcdata->mNpcStats.getMagicEffects().get(ESM::MagicEffect::Jump).mMagnitude;
const float fallAcroBase = gmst.find("fFallAcroBase")->getFloat();
@ -1107,7 +1107,7 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Armor> *ref = it->get<ESM::Armor>();
int armorSkillType = MWWorld::Class::get(*it).getEquipmentSkill(*it);
int armorSkillType = it->getClass().getEquipmentSkill(*it);
int armorSkill = stats.getSkill(armorSkillType).getModified();
if(ref->mBase->mData.mWeight == 0)
@ -1177,7 +1177,7 @@ namespace MWClass
if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name())
return "FootBareLeft";
switch(Class::get(*boots).getEquipmentSkill(*boots))
switch(boots->getClass().getEquipmentSkill(*boots))
{
case ESM::Skill::LightArmor:
return "FootLightLeft";
@ -1204,7 +1204,7 @@ namespace MWClass
if(boots == inv.end() || boots->getTypeName() != typeid(ESM::Armor).name())
return "FootBareRight";
switch(Class::get(*boots).getEquipmentSkill(*boots))
switch(boots->getClass().getEquipmentSkill(*boots))
{
case ESM::Skill::LightArmor:
return "FootLightRight";

@ -133,7 +133,7 @@ namespace MWClass
// hide effects the player doesnt know about
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
int i=0;
static const float fWortChanceValue =

@ -392,7 +392,7 @@ namespace MWClass
if (ptr.getCellRef().mCharge == 0)
return std::make_pair(0, "#{sInventoryMessage1}");
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(ptr).getEquipmentSlots(ptr);
std::pair<std::vector<int>, bool> slots_ = ptr.getClass().getEquipmentSlots(ptr);
if (slots_.first.empty())
return std::make_pair (0, "");

@ -134,13 +134,13 @@ namespace MWDialogue
mActor = actor;
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (actor).getCreatureStats (actor);
MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats (actor);
mTalkedTo = creatureStats.hasTalkedToPlayer();
mActorKnownTopics.clear();
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->startDialogue(actor, MWWorld::Class::get (actor).getName (actor));
win->startDialogue(actor, actor.getClass().getName (actor));
//setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
updateTopics();
@ -194,7 +194,7 @@ namespace MWDialogue
Compiler::Locals locals;
std::string actorScript = MWWorld::Class::get (mActor).getScript (mActor);
std::string actorScript = mActor.getClass().getScript (mActor);
if (!actorScript.empty())
{
@ -435,7 +435,7 @@ namespace MWDialogue
// Apply disposition change to NPC's base disposition
if (mActor.getClass().isNpc())
{
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mActor).getNpcStats(mActor);
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
}
mPermanentDispositionChange = 0;

@ -25,7 +25,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
// actor id
if (!info.mActor.empty())
{
if ( !Misc::StringUtils::ciEqual(info.mActor, MWWorld::Class::get (mActor).getId (mActor)))
if ( !Misc::StringUtils::ciEqual(info.mActor, mActor.getClass().getId (mActor)))
return false;
}
else if (isCreature)
@ -64,7 +64,7 @@ bool MWDialogue::Filter::testActor (const ESM::DialInfo& info) const
if (isCreature)
return false;
MWMechanics::NpcStats& stats = MWWorld::Class::get (mActor).getNpcStats (mActor);
MWMechanics::NpcStats& stats = mActor.getClass().getNpcStats (mActor);
std::map<std::string, int>::iterator iter = stats.getFactionRanks().find ( Misc::StringUtils::lowerCase (info.mFaction));
if (iter==stats.getFactionRanks().end())
@ -98,7 +98,7 @@ bool MWDialogue::Filter::testPlayer (const ESM::DialInfo& info) const
// check player faction
if (!info.mPcFaction.empty())
{
MWMechanics::NpcStats& stats = MWWorld::Class::get (player).getNpcStats (player);
MWMechanics::NpcStats& stats = player.getClass().getNpcStats (player);
std::map<std::string,int>::iterator iter = stats.getFactionRanks().find (Misc::StringUtils::lowerCase (info.mPcFaction));
if(iter==stats.getFactionRanks().end())
@ -182,7 +182,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
case SelectWrapper::Function_Local:
{
std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor);
std::string scriptName = mActor.getClass().getScript (mActor);
if (scriptName.empty())
return false; // no script
@ -220,8 +220,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
float ratio = MWWorld::Class::get (player).getCreatureStats (player).getHealth().getCurrent() /
MWWorld::Class::get (player).getCreatureStats (player).getHealth().getModified();
float ratio = player.getClass().getCreatureStats (player).getHealth().getCurrent() /
player.getClass().getCreatureStats (player).getHealth().getModified();
return select.selectCompare (static_cast<int>(ratio*100));
}
@ -230,7 +230,7 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
float value = MWWorld::Class::get (player).getCreatureStats (player).
float value = player.getClass().getCreatureStats (player).
getDynamic (select.getArgument()).getCurrent();
return select.selectCompare (value);
@ -238,8 +238,8 @@ bool MWDialogue::Filter::testSelectStructNumeric (const SelectWrapper& select) c
case SelectWrapper::Function_HealthPercent:
{
float ratio = MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getCurrent() /
MWWorld::Class::get (mActor).getCreatureStats (mActor).getHealth().getModified();
float ratio = mActor.getClass().getCreatureStats (mActor).getHealth().getCurrent() /
mActor.getClass().getCreatureStats (mActor).getHealth().getModified();
return select.selectCompare (ratio);
}
@ -262,7 +262,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_Item:
{
MWWorld::ContainerStore& store = MWWorld::Class::get (player).getContainerStore (player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore (player);
return store.count(select.getName());
}
@ -277,29 +277,29 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_AiSetting:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAiSetting (
return mActor.getClass().getCreatureStats (mActor).getAiSetting (
(MWMechanics::CreatureStats::AiSetting)select.getArgument()).getModified();
case SelectWrapper::Function_PcAttribute:
return MWWorld::Class::get (player).getCreatureStats (player).
return player.getClass().getCreatureStats (player).
getAttribute (select.getArgument()).getModified();
case SelectWrapper::Function_PcSkill:
return static_cast<int> (MWWorld::Class::get (player).
return static_cast<int> (player.getClass().
getNpcStats (player).getSkill (select.getArgument()).getModified());
case SelectWrapper::Function_FriendlyHit:
{
int hits = MWWorld::Class::get (mActor).getCreatureStats (mActor).getFriendlyHits();
int hits = mActor.getClass().getCreatureStats (mActor).getFriendlyHits();
return hits>4 ? 4 : hits;
}
case SelectWrapper::Function_PcLevel:
return MWWorld::Class::get (player).getCreatureStats (player).getLevel();
return player.getClass().getCreatureStats (player).getLevel();
case SelectWrapper::Function_PcGender:
@ -307,7 +307,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_PcClothingModifier:
{
MWWorld::InventoryStore& store = MWWorld::Class::get (player).getInventoryStore (player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore (player);
int value = 0;
@ -316,7 +316,7 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
MWWorld::ContainerStoreIterator slot = store.getSlot (i);
if (slot!=store.end())
value += MWWorld::Class::get (*slot).getValue (*slot);
value += slot->getClass().getValue (*slot);
}
return value;
@ -324,15 +324,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_PcCrimeLevel:
return MWWorld::Class::get (player).getNpcStats (player).getBounty();
return player.getClass().getNpcStats (player).getBounty();
case SelectWrapper::Function_RankRequirement:
{
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
return 0;
std::string faction =
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
int rank = getFactionRank (player, faction);
@ -352,11 +352,11 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_Level:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getLevel();
return mActor.getClass().getCreatureStats (mActor).getLevel();
case SelectWrapper::Function_PCReputation:
return MWWorld::Class::get (player).getNpcStats (player).getReputation();
return player.getClass().getNpcStats (player).getReputation();
case SelectWrapper::Function_Weather:
@ -364,15 +364,15 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_Reputation:
return MWWorld::Class::get (mActor).getNpcStats (mActor).getReputation();
return mActor.getClass().getNpcStats (mActor).getReputation();
case SelectWrapper::Function_FactionRankDiff:
{
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
return 0;
std::pair<std::string, int> faction =
*MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin();
*mActor.getClass().getNpcStats (mActor).getFactionRanks().begin();
int rank = getFactionRank (player, faction.first);
@ -381,25 +381,25 @@ int MWDialogue::Filter::getSelectStructInteger (const SelectWrapper& select) con
case SelectWrapper::Function_WerewolfKills:
return MWWorld::Class::get (player).getNpcStats (player).getWerewolfKills();
return player.getClass().getNpcStats (player).getWerewolfKills();
case SelectWrapper::Function_RankLow:
case SelectWrapper::Function_RankHigh:
{
bool low = select.getFunction()==SelectWrapper::Function_RankLow;
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
return 0;
std::string factionId =
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
int value = 0;
const ESM::Faction& faction =
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);
MWMechanics::NpcStats& playerStats = MWWorld::Class::get (player).getNpcStats (player);
MWMechanics::NpcStats& playerStats = player.getClass().getNpcStats (player);
for (std::vector<ESM::Faction::Reaction>::const_iterator iter (faction.mReactions.begin());
iter!=faction.mReactions.end(); ++iter)
@ -428,7 +428,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_NotId:
return !Misc::StringUtils::ciEqual(MWWorld::Class::get (mActor).getId (mActor), select.getName());
return !Misc::StringUtils::ciEqual(mActor.getClass().getId (mActor), select.getName());
case SelectWrapper::Function_NotFaction:
@ -448,7 +448,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_NotLocal:
{
std::string scriptName = MWWorld::Class::get (mActor).getScript (mActor);
std::string scriptName = mActor.getClass().getScript (mActor);
if (scriptName.empty())
// This actor has no attached script, so there is no local variable
@ -481,36 +481,36 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_SameFaction:
return MWWorld::Class::get (mActor).getNpcStats (mActor).isSameFaction (
MWWorld::Class::get (player).getNpcStats (player));
return mActor.getClass().getNpcStats (mActor).isSameFaction (
player.getClass().getNpcStats (player));
case SelectWrapper::Function_PcCommonDisease:
return MWWorld::Class::get (player).getCreatureStats (player).hasCommonDisease();
return player.getClass().getCreatureStats (player).hasCommonDisease();
case SelectWrapper::Function_PcBlightDisease:
return MWWorld::Class::get (player).getCreatureStats (player).hasBlightDisease();
return player.getClass().getCreatureStats (player).hasBlightDisease();
case SelectWrapper::Function_PcCorprus:
return MWWorld::Class::get (player).getCreatureStats (player).
return player.getClass().getCreatureStats (player).
getMagicEffects().get (ESM::MagicEffect::Corprus).mMagnitude!=0;
case SelectWrapper::Function_PcExpelled:
{
if (MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().empty())
if (mActor.getClass().getNpcStats (mActor).getFactionRanks().empty())
return false;
std::string faction =
MWWorld::Class::get (mActor).getNpcStats (mActor).getFactionRanks().begin()->first;
mActor.getClass().getNpcStats (mActor).getFactionRanks().begin()->first;
return player.getClass().getNpcStats(player).getExpelled(faction);
}
case SelectWrapper::Function_PcVampire:
return MWWorld::Class::get (player).getCreatureStats(player).getMagicEffects().
return player.getClass().getCreatureStats(player).getMagicEffects().
get(ESM::MagicEffect::Vampirism).mMagnitude > 0;
case SelectWrapper::Function_TalkedToPc:
@ -519,7 +519,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_Alarmed:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).isAlarmed();
return mActor.getClass().getCreatureStats (mActor).isAlarmed();
case SelectWrapper::Function_Detected:
@ -527,7 +527,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_Attacked:
return MWWorld::Class::get (mActor).getCreatureStats (mActor).getAttacked();
return mActor.getClass().getCreatureStats (mActor).getAttacked();
case SelectWrapper::Function_ShouldAttack:
@ -539,7 +539,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
case SelectWrapper::Function_Werewolf:
return MWWorld::Class::get (mActor).getNpcStats (mActor).isWerewolf();
return mActor.getClass().getNpcStats (mActor).isWerewolf();
default:
@ -549,7 +549,7 @@ bool MWDialogue::Filter::getSelectStructBoolean (const SelectWrapper& select) co
int MWDialogue::Filter::getFactionRank (const MWWorld::Ptr& actor, const std::string& factionId) const
{
MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor);
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor);
std::map<std::string, int>::const_iterator iter = stats.getFactionRanks().find (factionId);
@ -565,13 +565,13 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements (const MWWorld::Ptr& ac
if (rank<0 || rank>=10)
throw std::runtime_error ("rank index out of range");
if (!MWWorld::Class::get (actor).getNpcStats (actor).hasSkillsForRank (factionId, rank))
if (!actor.getClass().getNpcStats (actor).hasSkillsForRank (factionId, rank))
return false;
const ESM::Faction& faction =
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);
MWMechanics::CreatureStats& stats = MWWorld::Class::get (actor).getCreatureStats (actor);
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats (actor);
return stats.getAttribute (faction.mData.mAttribute[0]).getBase()>=faction.mData.mRankData[rank].mAttribute1 &&
stats.getAttribute (faction.mData.mAttribute[1]).getBase()>=faction.mData.mRankData[rank].mAttribute2;
@ -583,7 +583,7 @@ bool MWDialogue::Filter::hasFactionRankReputationRequirements (const MWWorld::Pt
if (rank<0 || rank>=10)
throw std::runtime_error ("rank index out of range");
MWMechanics::NpcStats& stats = MWWorld::Class::get (actor).getNpcStats (actor);
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats (actor);
const ESM::Faction& faction =
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find (factionId);

@ -19,7 +19,7 @@ namespace
std::string getIconPath(MWWorld::Ptr ptr)
{
std::string path = std::string("icons\\");
path += MWWorld::Class::get(ptr).getInventoryIcon(ptr);
path += ptr.getClass().getInventoryIcon(ptr);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -174,7 +174,7 @@ namespace MWGui
{
update();
std::string sound = MWWorld::Class::get(item).getUpSoundId(item);
std::string sound = item.getClass().getUpSoundId(item);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
}
}

@ -47,7 +47,7 @@ namespace
void updatePlayerHealth()
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
npcStats.updateHealth();
}
}
@ -220,7 +220,7 @@ namespace MWGui
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
mReviewDialog->setHealth ( stats.getHealth() );
mReviewDialog->setMagicka( stats.getMagicka() );

@ -61,7 +61,7 @@ void CompanionWindow::onItemSelected(int index)
if (count > 1 && !shift)
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count);
dialog->open(object.getClass().getName(object), "#{sTake}", count);
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::dragItem);
}
@ -92,7 +92,7 @@ void CompanionWindow::open(const MWWorld::Ptr& npc)
mSortModel = new SortFilterItemModel(mModel);
mItemView->setModel(mSortModel);
setTitle(MWWorld::Class::get(npc).getName(npc));
setTitle(npc.getClass().getName(npc));
}
void CompanionWindow::onFrame()
@ -104,22 +104,22 @@ void CompanionWindow::updateEncumbranceBar()
{
if (mPtr.isEmpty())
return;
float capacity = MWWorld::Class::get(mPtr).getCapacity(mPtr);
float encumbrance = MWWorld::Class::get(mPtr).getEncumbrance(mPtr);
float capacity = mPtr.getClass().getCapacity(mPtr);
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
mEncumbranceBar->setValue(encumbrance, capacity);
if (mPtr.getTypeName() != typeid(ESM::NPC).name())
mProfitLabel->setCaption("");
else
{
MWMechanics::NpcStats& stats = MWWorld::Class::get(mPtr).getNpcStats(mPtr);
MWMechanics::NpcStats& stats = mPtr.getClass().getNpcStats(mPtr);
mProfitLabel->setCaptionWithReplacing("#{sProfitValue} " + boost::lexical_cast<std::string>(stats.getProfit()));
}
}
void CompanionWindow::onCloseButtonClicked(MyGUI::Widget* _sender)
{
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit() < 0)
if (mPtr.getTypeName() == typeid(ESM::NPC).name() && mPtr.getClass().getNpcStats(mPtr).getProfit() < 0)
{
std::vector<std::string> buttons;
buttons.push_back("#{sCompanionWarningButtonOne}");
@ -135,8 +135,8 @@ void CompanionWindow::onMessageBoxButtonClicked(int button)
{
if (button == 0)
{
mPtr.getRefData().getLocals().setVarByInt(MWWorld::Class::get(mPtr).getScript(mPtr),
"minimumProfit", MWWorld::Class::get(mPtr).getNpcStats(mPtr).getProfit());
mPtr.getRefData().getLocals().setVarByInt(mPtr.getClass().getScript(mPtr),
"minimumProfit", mPtr.getClass().getNpcStats(mPtr).getProfit());
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Companion);
MWBase::Environment::get().getDialogueManager()->startDialogue (mPtr);

@ -1,5 +1,8 @@
#include "console.hpp"
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <components/compiler/exception.hpp>
#include <components/compiler/extensions0.hpp>
@ -194,7 +197,8 @@ namespace MWGui
void Console::executeFile (const std::string& path)
{
std::ifstream stream (path.c_str());
namespace bfs = boost::filesystem;
bfs::ifstream stream ((bfs::path(path)));
if (!stream.is_open())
printError ("failed to open file: " + path);

@ -37,7 +37,7 @@ namespace MWGui
mIsOnDragAndDrop = true;
mDragAndDropWidget->setVisible(true);
std::string sound = MWWorld::Class::get(mItem.mBase).getUpSoundId(mItem.mBase);
std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
if (mSourceSortModel)
@ -47,7 +47,7 @@ namespace MWGui
}
std::string path = std::string("icons\\");
path += MWWorld::Class::get(mItem.mBase).getInventoryIcon(mItem.mBase);
path += mItem.mBase.getClass().getInventoryIcon(mItem.mBase);
MyGUI::ImageBox* baseWidget = mDragAndDropWidget->createWidget<MyGUI::ImageBox>
("ImageBox", MyGUI::IntCoord(0, 0, 42, 42), MyGUI::Align::Default);
mDraggedWidget = baseWidget;
@ -76,7 +76,7 @@ namespace MWGui
void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
{
std::string sound = MWWorld::Class::get(mItem.mBase).getDownSoundId(mItem.mBase);
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
mDragAndDropWidget->setVisible(false);
@ -155,7 +155,7 @@ namespace MWGui
if (count > 1 && !shift)
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
dialog->open(MWWorld::Class::get(object).getName(object), "#{sTake}", count);
dialog->open(object.getClass().getName(object), "#{sTake}", count);
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::dragItem);
}
@ -177,8 +177,8 @@ namespace MWGui
{
// check that we don't exceed container capacity
MWWorld::Ptr item = mDragAndDrop->mItem.mBase;
float weight = MWWorld::Class::get(item).getWeight(item) * mDragAndDrop->mDraggedCount;
if (MWWorld::Class::get(mPtr).getCapacity(mPtr) < MWWorld::Class::get(mPtr).getEncumbrance(mPtr) + weight)
float weight = item.getClass().getWeight(item) * mDragAndDrop->mDraggedCount;
if (mPtr.getClass().getCapacity(mPtr) < mPtr.getClass().getEncumbrance(mPtr) + weight)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sContentsMessage3}");
return;
@ -227,7 +227,7 @@ namespace MWGui
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
// or we end up using a possibly invalid model.
setTitle(MWWorld::Class::get(container).getName(container));
setTitle(container.getClass().getName(container));
}
void ContainerWindow::onKeyPressed(MyGUI::Widget *_sender, MyGUI::KeyCode _key, MyGUI::Char _char)
@ -284,7 +284,7 @@ namespace MWGui
{
// play the sound of the first object
MWWorld::Ptr item = mModel->getItem(i).mBase;
std::string sound = MWWorld::Class::get(item).getUpSoundId(item);
std::string sound = item.getClass().getUpSoundId(item);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
}
@ -306,7 +306,7 @@ namespace MWGui
{
onTakeAllButtonClicked(mTakeButton);
if (MWWorld::Class::get(mPtr).isPersistent(mPtr))
if (mPtr.getClass().isPersistent(mPtr))
MWBase::Environment::get().getWindowManager()->messageBox("#{sDisposeCorpseFail}");
else
MWBase::Environment::get().getWorld()->deleteObject(mPtr);

@ -85,7 +85,7 @@ void ContainerItemModel::removeItem (const ItemStack& item, size_t count)
for (std::vector<MWWorld::Ptr>::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
{
MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source);
MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
@ -120,7 +120,7 @@ void ContainerItemModel::update()
mItems.clear();
for (std::vector<MWWorld::Ptr>::iterator source = mItemSources.begin(); source != mItemSources.end(); ++source)
{
MWWorld::ContainerStore& store = MWWorld::Class::get(*source).getContainerStore(*source);
MWWorld::ContainerStore& store = source->getClass().getContainerStore(*source);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{

@ -386,8 +386,8 @@ namespace MWGui
mTopicLinks.clear();
mKeywordSearch.clear();
bool isCompanion = !MWWorld::Class::get(mPtr).getScript(mPtr).empty()
&& mPtr.getRefData().getLocals().getIntVar(MWWorld::Class::get(mPtr).getScript(mPtr), "companion");
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name();

@ -119,7 +119,7 @@ namespace MWGui
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(soulgem).getInventoryIcon(soulgem);
path += soulgem.getClass().getInventoryIcon(soulgem);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -164,7 +164,7 @@ namespace MWGui
MyGUI::ImageBox* image = mItemBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -207,7 +207,7 @@ namespace MWGui
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");

@ -348,7 +348,7 @@ namespace MWGui
void HUD::onWeaponClicked(MyGUI::Widget* _sender)
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
if (player.getClass().getNpcStats(player).isWerewolf())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
return;
@ -360,7 +360,7 @@ namespace MWGui
void HUD::onMagicClicked(MyGUI::Widget* _sender)
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
if (player.getClass().getNpcStats(player).isWerewolf())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sWerewolfRefusal}");
return;
@ -443,7 +443,7 @@ namespace MWGui
void HUD::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)
{
std::string itemName = MWWorld::Class::get(item).getName(item);
std::string itemName = item.getClass().getName(item);
if (itemName != mSpellName && mSpellVisible)
{
mWeaponSpellTimer = 5.0f;
@ -466,7 +466,7 @@ namespace MWGui
, MyGUI::Align::Stretch);
std::string path = std::string("icons\\");
path+=MWWorld::Class::get(item).getInventoryIcon(item);
path+=item.getClass().getInventoryIcon(item);
Widgets::fixTexturePath(path);
itemBox->setImageTexture(path);
itemBox->setNeedMouseFocus(false);
@ -474,7 +474,7 @@ namespace MWGui
void HUD::setSelectedWeapon(const MWWorld::Ptr& item, int durabilityPercent)
{
std::string itemName = MWWorld::Class::get(item).getName(item);
std::string itemName = item.getClass().getName(item);
if (itemName != mWeaponName && mWeaponVisible)
{
mWeaponSpellTimer = 5.0f;
@ -493,10 +493,10 @@ namespace MWGui
MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0));
std::string path = std::string("icons\\");
path+=MWWorld::Class::get(item).getInventoryIcon(item);
path+=item.getClass().getInventoryIcon(item);
Widgets::fixTexturePath(path);
if (MWWorld::Class::get(item).getEnchantment(item) != "")
if (item.getClass().getEnchantment(item) != "")
{
mWeapImage->setImageTexture("textures\\menu_icon_magic_mini.dds");
MyGUI::ImageBox* itemBox = mWeapImage->createWidgetReal<MyGUI::ImageBox>("ImageBox", MyGUI::FloatCoord(0,0,1,1)
@ -545,7 +545,7 @@ namespace MWGui
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf())
if (player.getClass().getNpcStats(player).isWerewolf())
mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds");
else
mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds");
@ -636,7 +636,7 @@ namespace MWGui
void HUD::updateEnemyHealthBar()
{
MWMechanics::CreatureStats& stats = MWWorld::Class::get(mEnemy).getCreatureStats(mEnemy);
MWMechanics::CreatureStats& stats = mEnemy.getClass().getCreatureStats(mEnemy);
mEnemyHealth->setProgressRange(100);
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)

@ -50,7 +50,7 @@ MWWorld::Ptr InventoryItemModel::copyItem (const ItemStack& item, size_t count,
void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
{
MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor);
MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor);
int removed = store.remove(item.mBase, count, mActor);
if (removed == 0)
@ -77,7 +77,7 @@ MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, I
void InventoryItemModel::update()
{
MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor);
MWWorld::ContainerStore& store = mActor.getClass().getContainerStore(mActor);
mItems.clear();

@ -162,7 +162,7 @@ namespace MWGui
}
const ItemStack& item = mTradeModel->getItem(index);
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
MWWorld::Ptr object = item.mBase;
int count = item.mCount;
@ -184,7 +184,7 @@ namespace MWGui
{
// check if merchant accepts item
int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices();
if (!MWWorld::Class::get(object).canSell(object, services))
if (!object.getClass().canSell(object, services))
{
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->
@ -197,7 +197,7 @@ namespace MWGui
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
std::string message = mTrading ? "#{sQuanityMenuMessage01}" : "#{sTake}";
dialog->open(MWWorld::Class::get(object).getName(object), message, count);
dialog->open(object.getClass().getName(object), message, count);
dialog->eventOkClicked.clear();
if (mTrading)
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem);
@ -223,7 +223,7 @@ namespace MWGui
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
if (item.mType == ItemStack::Type_Equipped)
{
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
MWWorld::Ptr newStack = *invStore.unequipItem(item.mBase, mPtr);
// The unequipped item was re-stacked. We have to update the index
@ -259,7 +259,7 @@ namespace MWGui
{
ensureSelectedItemUnequipped();
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
if (item.mType == ItemStack::Type_Barter)
@ -382,7 +382,7 @@ namespace MWGui
if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0)
{
boost::shared_ptr<MWWorld::Action> action = MWWorld::Class::get(ptr).use(ptr);
boost::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
@ -447,7 +447,7 @@ namespace MWGui
if (slot == -1)
return MWWorld::Ptr();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
if(invStore.getSlot(slot) != invStore.end())
{
MWWorld::Ptr item = *invStore.getSlot(slot);
@ -466,8 +466,8 @@ namespace MWGui
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
float capacity = MWWorld::Class::get(player).getCapacity(player);
float encumbrance = MWWorld::Class::get(player).getEncumbrance(player);
float capacity = player.getClass().getCapacity(player);
float encumbrance = player.getClass().getEncumbrance(player);
mEncumbranceBar->setValue(encumbrance, capacity);
}
@ -498,9 +498,9 @@ namespace MWGui
mAvatarImage->setImageTile(MyGUI::IntSize(std::min(512, size.width), std::min(1024, size.height)));
mArmorRating->setCaptionWithReplacing ("#{sArmor}: "
+ boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
+ boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
if (mArmorRating->getTextSize().width > mArmorRating->getSize().width)
mArmorRating->setCaptionWithReplacing (boost::lexical_cast<std::string>(static_cast<int>(MWWorld::Class::get(mPtr).getArmorRating(mPtr))));
mArmorRating->setCaptionWithReplacing (boost::lexical_cast<std::string>(static_cast<int>(mPtr.getClass().getArmorRating(mPtr))));
}
}
@ -534,7 +534,7 @@ namespace MWGui
&& (type != typeid(ESM::Potion).name()))
return;
if (MWWorld::Class::get(object).getName(object) == "") // objects without name presented to user can never be picked up
if (object.getClass().getName(object) == "") // objects without name presented to user can never be picked up
return;
int count = object.getRefData().getCount();

@ -13,7 +13,7 @@ namespace MWGui
, mType(Type_Normal)
, mBase(base)
{
if (MWWorld::Class::get(base).getEnchantment(base) != "")
if (base.getClass().getEnchantment(base) != "")
mFlags |= Flag_Enchanted;
}

@ -81,7 +81,7 @@ void ItemView::update()
/// \todo performance improvement: don't create/destroy all the widgets everytime the container window changes size, only reposition them
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item.mBase).getInventoryIcon(item.mBase);
path += item.mBase.getClass().getInventoryIcon(item.mBase);
// background widget (for the "equipped" frame and magic item background image)
bool isMagic = (item.mFlags & ItemStack::Flag_Enchanted);

@ -61,8 +61,8 @@ namespace MWGui
void LevelupDialog::setAttributeValues()
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
for (int i=0; i<8; ++i)
{
@ -117,8 +117,8 @@ namespace MWGui
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(player).getCreatureStats (player);
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::CreatureStats& creatureStats = player.getClass().getCreatureStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
mSpentAttributes.clear();
resetCoins();
@ -172,7 +172,7 @@ namespace MWGui
void LevelupDialog::onOkButtonClicked (MyGUI::Widget* sender)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
if (mSpentAttributes.size() < 3)
MWBase::Environment::get().getWindowManager ()->messageBox("#{sNotifyMessage36}");

@ -39,19 +39,19 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
iter!=store.end(); ++iter)
{
if (MWWorld::Class::get(*iter).hasItemHealth(*iter))
if (iter->getClass().hasItemHealth(*iter))
{
int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter);
int maxDurability = iter->getClass().getItemMaxHealth(*iter);
int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge;
if (maxDurability == durability)
continue;
int basePrice = MWWorld::Class::get(*iter).getValue(*iter);
int basePrice = iter->getClass().getValue(*iter);
float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fRepairMult")->getFloat();
@ -64,7 +64,7 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
std::string name = MWWorld::Class::get(*iter).getName(*iter)
std::string name = iter->getClass().getName(*iter)
+ " - " + boost::lexical_cast<std::string>(price)
+ MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("sgp")->getString();;
@ -114,7 +114,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
{
// repair
MWWorld::Ptr item = *sender->getUserData<MWWorld::Ptr>();
item.getCellRef().mCharge = MWWorld::Class::get(item).getItemMaxHealth(item);
item.getCellRef().mCharge = item.getClass().getItemMaxHealth(item);
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1);

@ -166,7 +166,7 @@ namespace MWGui
frame->eventMouseButtonClick += MyGUI::newDelegate(this, &QuickKeysMenu::onQuickKeyButtonClicked);
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -200,7 +200,7 @@ namespace MWGui
MyGUI::ImageBox* image = frame->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(5, 5, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -265,7 +265,7 @@ namespace MWGui
QuickKeyType type = *button->getUserData<QuickKeyType>();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
if (type == Type_Item || type == Type_MagicItem)
{
@ -290,7 +290,7 @@ namespace MWGui
{
// No replacement was found
MWBase::Environment::get().getWindowManager ()->messageBox (
"#{sQuickMenu5} " + MWWorld::Class::get(item).getName(item));
"#{sQuickMenu5} " + item.getClass().getName(item));
return;
}
}
@ -330,7 +330,7 @@ namespace MWGui
assert(it != store.end());
// equip, if it can be equipped
if (!MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
if (!item.getClass().getEquipmentSlots(item).first.empty())
{
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item);
}
@ -522,8 +522,8 @@ namespace MWGui
const int spellHeight = 18;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
/// \todo lots of copy&pasted code from SpellWindow
@ -566,7 +566,7 @@ namespace MWGui
std::vector<MWWorld::Ptr> items;
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
{
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
std::string enchantId = it->getClass().getEnchantment(*it);
if (enchantId != "")
{
// only add items with "Cast once" or "Cast on use"
@ -645,7 +645,7 @@ namespace MWGui
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(MWWorld::Class::get(item).getName(item));
t->setCaption(item.getClass().getName(item));
t->setTextAlign(MyGUI::Align::Left);
t->setUserData(item);
t->setUserString("ToolTipType", "ItemPtr");

@ -41,7 +41,7 @@ void Recharge::open()
void Recharge::start (const MWWorld::Ptr &item)
{
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -85,7 +85,7 @@ void Recharge::updateView()
int currentY = 0;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
for (MWWorld::ContainerStoreIterator iter (store.begin());
iter!=store.end(); ++iter)
{
@ -99,14 +99,14 @@ void Recharge::updateView()
MyGUI::TextBox* text = mView->createWidget<MyGUI::TextBox> (
"SandText", MyGUI::IntCoord(8, currentY, mView->getWidth()-8, 18), MyGUI::Align::Default);
text->setCaption(MWWorld::Class::get(*iter).getName(*iter));
text->setCaption(iter->getClass().getName(*iter));
text->setNeedMouseFocus(false);
currentY += 19;
MyGUI::ImageBox* icon = mView->createWidget<MyGUI::ImageBox> (
"ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
path += iter->getClass().getInventoryIcon(*iter);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");

@ -40,7 +40,7 @@ void Repair::startRepairItem(const MWWorld::Ptr &item)
mRepair.setTool(item);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(item).getInventoryIcon(item);
path += item.getClass().getInventoryIcon(item);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");
@ -90,28 +90,28 @@ void Repair::updateRepairView()
int currentY = 0;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
int categories = MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Armor;
for (MWWorld::ContainerStoreIterator iter (store.begin(categories));
iter!=store.end(); ++iter)
{
if (MWWorld::Class::get(*iter).hasItemHealth(*iter))
if (iter->getClass().hasItemHealth(*iter))
{
int maxDurability = MWWorld::Class::get(*iter).getItemMaxHealth(*iter);
int maxDurability = iter->getClass().getItemMaxHealth(*iter);
int durability = (iter->getCellRef().mCharge == -1) ? maxDurability : iter->getCellRef().mCharge;
if (maxDurability == durability)
continue;
MyGUI::TextBox* text = mRepairView->createWidget<MyGUI::TextBox> (
"SandText", MyGUI::IntCoord(8, currentY, mRepairView->getWidth()-8, 18), MyGUI::Align::Default);
text->setCaption(MWWorld::Class::get(*iter).getName(*iter));
text->setCaption(iter->getClass().getName(*iter));
text->setNeedMouseFocus(false);
currentY += 19;
MyGUI::ImageBox* icon = mRepairView->createWidget<MyGUI::ImageBox> (
"ImageBox", MyGUI::IntCoord(16, currentY, 32, 32), MyGUI::Align::Default);
std::string path = std::string("icons\\");
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
path += iter->getClass().getInventoryIcon(*iter);
int pos = path.rfind(".");
path.erase(pos);
path.append(".dds");

@ -47,8 +47,8 @@ namespace
if (left.mBase.getTypeName() == right.mBase.getTypeName())
{
int cmp = MWWorld::Class::get(left.mBase).getName(left.mBase).compare(
MWWorld::Class::get(right.mBase).getName(right.mBase));
int cmp = left.mBase.getClass().getName(left.mBase).compare(
right.mBase.getClass().getName(right.mBase));
return cmp < 0;
}
else

@ -83,7 +83,7 @@ namespace MWGui
mPtr = actor;
clearSpells();
MWMechanics::Spells& merchantSpells = MWWorld::Class::get (actor).getCreatureStats (actor).getSpells();
MWMechanics::Spells& merchantSpells = actor.getClass().getCreatureStats (actor).getSpells();
for (MWMechanics::Spells::TIterator iter = merchantSpells.begin(); iter!=merchantSpells.end(); ++iter)
{
@ -107,7 +107,7 @@ namespace MWGui
bool SpellBuyingWindow::playerHasSpell(const std::string &id)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::Spells& playerSpells = MWWorld::Class::get (player).getCreatureStats (player).getSpells();
MWMechanics::Spells& playerSpells = player.getClass().getCreatureStats (player).getSpells();
for (MWMechanics::Spells::TIterator it = playerSpells.begin(); it != playerSpells.end(); ++it)
{
if (Misc::StringUtils::ciEqual(id, it->first))
@ -121,7 +121,7 @@ namespace MWGui
int price = *_sender->getUserData<int>();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
spells.add (mSpellsWidgetMap.find(_sender)->second);
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);

@ -353,7 +353,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
spells.add (spell->mId);
@ -445,7 +445,7 @@ namespace MWGui
// get the list of magic effects that are known to the player
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
std::vector<short> knownEffects;

@ -40,14 +40,14 @@ namespace MWGui
// TODO: Tracking add/remove/expire would be better than force updating every frame
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
EffectSourceVisitor visitor;
// permanent item enchantments & permanent spells
visitor.mIsPermanent = true;
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
store.visitEffectSources(visitor);
stats.getSpells().visitEffectSources(visitor);

@ -84,8 +84,8 @@ namespace MWGui
// retrieve all player spells, divide them into Powers and Spells and sort them
std::vector<std::string> spellList;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
for (MWMechanics::Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
@ -122,7 +122,7 @@ namespace MWGui
std::vector<MWWorld::Ptr> items;
for (MWWorld::ContainerStoreIterator it(store.begin()); it != store.end(); ++it)
{
std::string enchantId = MWWorld::Class::get(*it).getEnchantment(*it);
std::string enchantId = it->getClass().getEnchantment(*it);
if (enchantId != "")
{
// only add items with "Cast once" or "Cast on use"
@ -203,7 +203,7 @@ namespace MWGui
MWWorld::Ptr item = *it;
const ESM::Enchantment* enchant =
esmStore.get<ESM::Enchantment>().find(MWWorld::Class::get(item).getEnchantment(item));
esmStore.get<ESM::Enchantment>().find(item.getClass().getEnchantment(item));
// check if the item is currently equipped (will display in a different color)
bool equipped = false;
@ -218,7 +218,7 @@ namespace MWGui
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(MWWorld::Class::get(item).getName(item));
t->setCaption(item.getClass().getName(item));
t->setTextAlign(MyGUI::Align::Left);
t->setUserData(item);
t->setUserString("ToolTipType", "ItemPtr");
@ -300,7 +300,7 @@ namespace MWGui
void SpellWindow::onEnchantedItemSelected(MyGUI::Widget* _sender)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
MWWorld::Ptr item = *_sender->getUserData<MWWorld::Ptr>();
// retrieve ContainerStoreIterator to the item
@ -316,7 +316,7 @@ namespace MWGui
// equip, if it can be equipped and is not already equipped
if (_sender->getUserString("Equipped") == "false"
&& !MWWorld::Class::get(item).getEquipmentSlots(item).first.empty())
&& !item.getClass().getEquipmentSlots(item).first.empty())
{
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->useItem(item);
}
@ -330,7 +330,7 @@ namespace MWGui
{
std::string spellId = _sender->getUserString("Spell");
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
MWWorld::InventoryStore& store = player.getClass().getInventoryStore(player);
if (MyGUI::InputManager::getInstance().isShiftPressed())
{
@ -384,7 +384,7 @@ namespace MWGui
void SpellWindow::onDeleteSpellAccept()
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell() == mSpellToDelete)

@ -228,7 +228,7 @@ namespace MWGui
NoDrop::onFrame(dt);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
// level progress
MyGUI::Widget* levelWidget;
@ -459,7 +459,7 @@ namespace MWGui
addSeparator(coord1, coord2);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::NpcStats &PCstats = MWWorld::Class::get(player).getNpcStats(player);
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
const std::set<std::string> &expelled = PCstats.getExpelled();
addGroup(MWBase::Environment::get().getWindowManager()->getGameSettingString("sFaction", "Faction"), coord1, coord2);

@ -89,7 +89,7 @@ namespace MWGui
if (mFocusObject.isEmpty ())
return;
const MWWorld::Class& objectclass = MWWorld::Class::get (mFocusObject);
const MWWorld::Class& objectclass = mFocusObject.getClass();
MyGUI::IntSize tooltipSize;
if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console))
@ -305,7 +305,7 @@ namespace MWGui
MyGUI::IntSize tooltipSize;
const MWWorld::Class& object = MWWorld::Class::get (mFocusObject);
const MWWorld::Class& object = mFocusObject.getClass();
if (!object.hasToolTip(mFocusObject))
{
mDynamicToolTipBox->setVisible(false);

@ -138,7 +138,7 @@ namespace MWGui
int services = 0;
if (!mMerchant.isEmpty())
services = MWWorld::Class::get(mMerchant).getServices(mMerchant);
services = mMerchant.getClass().getServices(mMerchant);
mItems.clear();
// add regular items
@ -150,7 +150,7 @@ namespace MWGui
MWWorld::Ptr base = item.mBase;
if(Misc::StringUtils::ciEqual(base.getCellRef().mRefID, MWWorld::ContainerStore::sGoldId))
continue;
if(!MWWorld::Class::get(base).canSell(base, services))
if(!base.getClass().canSell(base, services))
continue;
// Bound items may not be bought
@ -164,7 +164,7 @@ namespace MWGui
if(mMerchant.getClass().hasInventoryStore(mMerchant))
{
bool isEquipped = false;
MWWorld::InventoryStore& store = MWWorld::Class::get(mMerchant).getInventoryStore(mMerchant);
MWWorld::InventoryStore& store = mMerchant.getClass().getInventoryStore(mMerchant);
for (int slot=0; slot<MWWorld::InventoryStore::Slots; ++slot)
{
MWWorld::ContainerStoreIterator equipped = store.getSlot(slot);

@ -102,7 +102,7 @@ namespace MWGui
// Careful here. setTitle may cause size updates, causing itemview redraw, so make sure to do it last
// or we end up using a possibly invalid model.
setTitle(MWWorld::Class::get(actor).getName(actor));
setTitle(actor.getClass().getName(actor));
onFilterChanged(mFilterAll);
}
@ -133,7 +133,7 @@ namespace MWGui
int TradeWindow::getMerchantServices()
{
return MWWorld::Class::get(mPtr).getServices(mPtr);
return mPtr.getClass().getServices(mPtr);
}
void TradeWindow::onItemSelected (int index)
@ -150,7 +150,7 @@ namespace MWGui
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
std::string message = "#{sQuanityMenuMessage02}";
dialog->open(MWWorld::Class::get(object).getName(object), message, count);
dialog->open(object.getClass().getName(object), message, count);
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &TradeWindow::sellItem);
mItemToSell = mSortModel->mapToSource(index);
@ -165,7 +165,7 @@ namespace MWGui
void TradeWindow::sellItem(MyGUI::Widget* sender, int count)
{
const ItemStack& item = mTradeModel->getItem(mItemToSell);
std::string sound = MWWorld::Class::get(item.mBase).getDownSoundId(item.mBase);
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();
@ -208,7 +208,7 @@ namespace MWGui
void TradeWindow::addOrRemoveGold(int amount, const MWWorld::Ptr& actor)
{
MWWorld::ContainerStore& store = MWWorld::Class::get(actor).getContainerStore(actor);
MWWorld::ContainerStore& store = actor.getClass().getContainerStore(actor);
if (amount > 0)
{
@ -442,7 +442,7 @@ namespace MWGui
void TradeWindow::sellToNpc(const MWWorld::Ptr& item, int count, bool boughtItem)
{
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, boughtItem);
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, boughtItem);
mCurrentBalance += diff;
mCurrentMerchantOffer += diff;
@ -452,7 +452,7 @@ namespace MWGui
void TradeWindow::buyFromNpc(const MWWorld::Ptr& item, int count, bool soldItem)
{
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, MWWorld::Class::get(item).getValue(item) * count, !soldItem);
int diff = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr, item.getClass().getValue(item) * count, !soldItem);
mCurrentBalance -= diff;
mCurrentMerchantOffer -= diff;

@ -44,7 +44,7 @@ namespace MWGui
mPlayerGold->setCaptionWithReplacing("#{sGold}: " + boost::lexical_cast<std::string>(playerGold));
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats (actor);
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats (actor);
// NPC can train you in his best 3 skills
std::vector< std::pair<int, int> > bestSkills;
@ -73,7 +73,7 @@ namespace MWGui
MyGUI::EnumeratorWidgetPtr widgets = mTrainingOptions->getEnumerator ();
MyGUI::Gui::getInstance ().destroyWidgets (widgets);
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
@ -115,7 +115,7 @@ namespace MWGui
int skillId = *sender->getUserData<int>();
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::NpcStats& pcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats (player);
const MWWorld::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
@ -123,7 +123,7 @@ namespace MWGui
int price = pcStats.getSkill (skillId).getBase() * store.get<ESM::GameSetting>().find("iTrainingMod")->getInt ();
price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mPtr,price,true);
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(mPtr).getNpcStats (mPtr);
MWMechanics::NpcStats& npcStats = mPtr.getClass().getNpcStats (mPtr);
if (npcStats.getSkill (skillId).getBase () <= pcStats.getSkill (skillId).getBase ())
{
MWBase::Environment::get().getWindowManager()->messageBox ("#{sServiceTrainingWords}");

@ -161,7 +161,7 @@ namespace MWGui
MWBase::Environment::get().getWorld()->changeToExteriorCell(pos);
}
MWWorld::Class::get(player).adjustPosition(player);
player.getClass().adjustPosition(player);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Travel);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Dialogue);
MWBase::Environment::get().getWorld ()->getFader ()->fadeOut(0);

@ -172,11 +172,11 @@ namespace MWGui
void WaitDialog::setCanRest (bool canRest)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
bool full = (stats.getFatigue().getCurrent() >= stats.getFatigue().getModified())
&& (stats.getHealth().getCurrent() >= stats.getHealth().getModified())
&& (stats.getMagicka().getCurrent() >= stats.getMagicka().getModified());
MWMechanics::NpcStats& npcstats = MWWorld::Class::get(player).getNpcStats(player);
MWMechanics::NpcStats& npcstats = player.getClass().getNpcStats(player);
bool werewolf = npcstats.isWerewolf();
mUntilHealedButton->setVisible(canRest && !full);
@ -223,7 +223,7 @@ namespace MWGui
stopWaiting();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::NpcStats &pcstats = MWWorld::Class::get(player).getNpcStats(player);
const MWMechanics::NpcStats &pcstats = player.getClass().getNpcStats(player);
// trigger levelup if possible
const MWWorld::Store<ESM::GameSetting> &gmst =

@ -1027,20 +1027,20 @@ namespace MWGui
{
mSelectedSpell = "";
const ESM::Enchantment* ench = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>()
.find(MWWorld::Class::get(item).getEnchantment(item));
.find(item.getClass().getEnchantment(item));
int chargePercent = (item.getCellRef().mEnchantmentCharge == -1) ? 100
: (item.getCellRef().mEnchantmentCharge / static_cast<float>(ench->mData.mCharge) * 100);
mHud->setSelectedEnchantItem(item, chargePercent);
mSpellWindow->setTitle(MWWorld::Class::get(item).getName(item));
mSpellWindow->setTitle(item.getClass().getName(item));
}
void WindowManager::setSelectedWeapon(const MWWorld::Ptr& item)
{
int durabilityPercent = (item.getCellRef().mCharge == -1) ? 100
: (item.getCellRef().mCharge / static_cast<float>(MWWorld::Class::get(item).getItemMaxHealth(item)) * 100);
: (item.getCellRef().mCharge / static_cast<float>(item.getClass().getItemMaxHealth(item)) * 100);
mHud->setSelectedWeapon(item, durabilityPercent);
mInventoryWindow->setTitle(MWWorld::Class::get(item).getName(item));
mInventoryWindow->setTitle(item.getClass().getName(item));
}
void WindowManager::unsetSelectedSpell()

@ -172,7 +172,7 @@ namespace MWInput
if (action == A_Use)
{
MWWorld::Class::get(mPlayer->getPlayer()).getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).setAttackingOrSpell(currentValue);
}
if (currentValue == 1)
@ -359,7 +359,7 @@ namespace MWInput
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
mOverencumberedMessageDelay -= dt;
if (MWWorld::Class::get(player).getEncumbrance(player) >= MWWorld::Class::get(player).getCapacity(player))
if (player.getClass().getEncumbrance(player) >= player.getClass().getCapacity(player))
{
mPlayer->setAutoMove (false);
if (mOverencumberedMessageDelay <= 0)
@ -664,7 +664,7 @@ namespace MWInput
return;
// Not allowed if no spell selected
MWWorld::InventoryStore& inventory = MWWorld::Class::get(mPlayer->getPlayer()).getInventoryStore(mPlayer->getPlayer());
MWWorld::InventoryStore& inventory = mPlayer->getPlayer().getClass().getInventoryStore(mPlayer->getPlayer());
if (MWBase::Environment::get().getWindowManager()->getSelectedSpell().empty() &&
inventory.getSelectedEnchantItem() == inventory.end())
return;

@ -187,7 +187,7 @@ namespace MWMechanics
void Actors::engageCombat (const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2, bool againstPlayer)
{
CreatureStats& creatureStats = MWWorld::Class::get(actor1).getCreatureStats(actor1);
CreatureStats& creatureStats = actor1.getClass().getCreatureStats(actor1);
if (againstPlayer && creatureStats.isHostile()) return; // already fighting against player
@ -244,13 +244,13 @@ namespace MWMechanics
void Actors::adjustMagicEffects (const MWWorld::Ptr& creature)
{
CreatureStats& creatureStats = MWWorld::Class::get (creature).getCreatureStats (creature);
CreatureStats& creatureStats = creature.getClass().getCreatureStats (creature);
MagicEffects now = creatureStats.getSpells().getMagicEffects();
if (creature.getTypeName()==typeid (ESM::NPC).name())
{
MWWorld::InventoryStore& store = MWWorld::Class::get (creature).getInventoryStore (creature);
MWWorld::InventoryStore& store = creature.getClass().getInventoryStore (creature);
now += store.getMagicEffects();
}
@ -265,7 +265,7 @@ namespace MWMechanics
void Actors::calculateDynamicStats (const MWWorld::Ptr& ptr)
{
CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
int strength = creatureStats.getAttribute(ESM::Attribute::Strength).getBase();
int intelligence = creatureStats.getAttribute(ESM::Attribute::Intelligence).getBase();
@ -333,7 +333,7 @@ namespace MWMechanics
void Actors::calculateCreatureStatModifiers (const MWWorld::Ptr& ptr, float duration)
{
CreatureStats &creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
CreatureStats &creatureStats = ptr.getClass().getCreatureStats(ptr);
const MagicEffects &effects = creatureStats.getMagicEffects();
// attributes
@ -600,7 +600,7 @@ namespace MWMechanics
void Actors::calculateNpcStatModifiers (const MWWorld::Ptr& ptr)
{
NpcStats &npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
NpcStats &npcStats = ptr.getClass().getNpcStats(ptr);
const MagicEffects &effects = npcStats.getMagicEffects();
// skills
@ -656,7 +656,7 @@ namespace MWMechanics
{
bool isPlayer = ptr.getRefData().getHandle()=="player";
MWWorld::InventoryStore &inventoryStore = MWWorld::Class::get(ptr).getInventoryStore(ptr);
MWWorld::InventoryStore &inventoryStore = ptr.getClass().getInventoryStore(ptr);
MWWorld::ContainerStoreIterator heldIter =
inventoryStore.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
/**
@ -678,7 +678,7 @@ namespace MWMechanics
{
if (torch != inventoryStore.end())
{
if (!MWWorld::Class::get (ptr).getCreatureStats (ptr).isHostile())
if (!ptr.getClass().getCreatureStats (ptr).isHostile())
{
// For non-hostile NPCs, unequip whatever is in the left slot in favor of a light.
if (heldIter != inventoryStore.end() && heldIter->getTypeName() != typeid(ESM::Light).name())
@ -755,8 +755,8 @@ namespace MWMechanics
if (ptr != player && ptr.getClass().isNpc())
{
// get stats of witness
CreatureStats& creatureStats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
NpcStats& npcStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr);
NpcStats& npcStats = ptr.getClass().getNpcStats(ptr);
if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.isHostile())
{
@ -824,7 +824,7 @@ namespace MWMechanics
void Actors::addActor (const MWWorld::Ptr& ptr, bool updateImmediately)
{
// erase previous death events since we are currently only tracking them while in an active cell
MWWorld::Class::get(ptr).getCreatureStats(ptr).clearHasDied();
ptr.getClass().getCreatureStats(ptr).clearHasDied();
removeActor(ptr);
@ -964,7 +964,7 @@ namespace MWMechanics
// Kill dead actors, update some variables
for(PtrControllerMap::iterator iter(mActors.begin()); iter != mActors.end(); ++iter)
{
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
const MWWorld::Class &cls = iter->first.getClass();
CreatureStats &stats = cls.getCreatureStats(iter->first);
//KnockedOutOneFrameLogic
@ -1137,7 +1137,7 @@ namespace MWMechanics
std::list<MWWorld::Ptr> list;
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++)
{
const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
const MWWorld::Class &cls = iter->first.getClass();
CreatureStats &stats = cls.getCreatureStats(iter->first);
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow)
{
@ -1158,7 +1158,7 @@ namespace MWMechanics
neighbors); //only care about those within the alarm disance
for(std::vector<MWWorld::Ptr>::iterator iter(neighbors.begin());iter != neighbors.end();iter++)
{
const MWWorld::Class &cls = MWWorld::Class::get(*iter);
const MWWorld::Class &cls = iter->getClass();
CreatureStats &stats = cls.getCreatureStats(*iter);
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat)
{

@ -32,7 +32,7 @@ bool MWMechanics::AiActivate::execute (const MWWorld::Ptr& actor,float duration)
if(distance(dest, pos.pos[0], pos.pos[1], pos.pos[2]) < 200) { //Stop when you get close
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
MWWorld::Ptr target = MWBase::Environment::get().getWorld()->getPtr(mObjectId,false);
MWWorld::Class::get(target).activate(target,actor).get()->execute(actor); //Arrest player
target.getClass().activate(target,actor).get()->execute(actor); //Arrest player
return true;
}
else {

@ -63,7 +63,7 @@ bool MWMechanics::AiAvoidDoor::execute (const MWWorld::Ptr& actor,float duration
MWBase::Environment::get().getMechanicsManager()->getActorsInRange(Ogre::Vector3(pos.pos[0],pos.pos[1],pos.pos[2]),100,actors);
for(std::vector<MWWorld::Ptr>::iterator it = actors.begin(); it != actors.end(); it++) {
if(*it != MWBase::Environment::get().getWorld()->getPlayerPtr()) { //Not the player
MWMechanics::AiSequence& seq = MWWorld::Class::get(*it).getCreatureStats(*it).getAiSequence();
MWMechanics::AiSequence& seq = it->getClass().getCreatureStats(*it).getAiSequence();
if(seq.getTypeId() != MWMechanics::AiPackage::TypeIdAvoidDoor) { //Only add it once
seq.stack(MWMechanics::AiAvoidDoor(mDoorPtr),*it);
}

@ -97,7 +97,7 @@ namespace MWMechanics
{
// Stop moving if the player is to far away
MWBase::Environment::get().getMechanicsManager()->playAnimationGroup(actor, "idle3", 0, 1);
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
mMaxDist = 330;
}

@ -572,7 +572,7 @@ namespace MWMechanics
void AiWander::stopWalking(const MWWorld::Ptr& actor)
{
mPathFinder.clearPath();
MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 0;
actor.getClass().getMovementSettings(actor).mPosition[1] = 0;
}
void AiWander::playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect)

@ -292,13 +292,13 @@ void MWMechanics::Alchemy::addPotion (const std::string& name)
void MWMechanics::Alchemy::increaseSkill()
{
MWWorld::Class::get (mAlchemist).skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0);
mAlchemist.getClass().skillUsageSucceeded (mAlchemist, ESM::Skill::Alchemy, 0);
}
float MWMechanics::Alchemy::getChance() const
{
const CreatureStats& creatureStats = MWWorld::Class::get (mAlchemist).getCreatureStats (mAlchemist);
const NpcStats& npcStats = MWWorld::Class::get (mAlchemist).getNpcStats (mAlchemist);
const CreatureStats& creatureStats = mAlchemist.getClass().getCreatureStats (mAlchemist);
const NpcStats& npcStats = mAlchemist.getClass().getNpcStats (mAlchemist);
return
(npcStats.getSkill (ESM::Skill::Alchemy).getModified() +
@ -331,7 +331,7 @@ void MWMechanics::Alchemy::setAlchemist (const MWWorld::Ptr& npc)
mEffects.clear();
MWWorld::ContainerStore& store = MWWorld::Class::get (npc).getContainerStore (npc);
MWWorld::ContainerStore& store = npc.getClass().getContainerStore (npc);
for (MWWorld::ContainerStoreIterator iter (store.begin (MWWorld::ContainerStore::Type_Apparatus));
iter!=store.end(); ++iter)

@ -459,7 +459,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
if(!mAnimation)
return;
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
const MWWorld::Class &cls = mPtr.getClass();
if(cls.isActor())
{
/* Accumulate along X/Y only for now, until we can figure out how we should
@ -549,7 +549,7 @@ bool CharacterController::updateCreatureState()
bool CharacterController::updateWeaponState()
{
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
const MWWorld::Class &cls = mPtr.getClass();
CreatureStats &stats = cls.getCreatureStats(mPtr);
WeaponType weaptype = WeapType_None;
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
@ -601,8 +601,8 @@ bool CharacterController::updateWeaponState()
if(weapon != inv.end() && !(weaptype == WeapType_None && mWeaponType == WeapType_Spell))
{
std::string soundid = (weaptype == WeapType_None) ?
MWWorld::Class::get(*weapon).getDownSoundId(*weapon) :
MWWorld::Class::get(*weapon).getUpSoundId(*weapon);
weapon->getClass().getDownSoundId(*weapon) :
weapon->getClass().getUpSoundId(*weapon);
if(!soundid.empty())
{
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
@ -983,7 +983,7 @@ bool CharacterController::updateWeaponState()
void CharacterController::update(float duration)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
const MWWorld::Class &cls = mPtr.getClass();
Ogre::Vector3 movement(0.0f);
updateVisibility();

@ -52,7 +52,7 @@ namespace MWMechanics
bool Enchanting::create()
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
ESM::Enchantment enchantment;
enchantment.mData.mCharge = getGemCharge();
@ -67,7 +67,7 @@ namespace MWMechanics
if(getEnchantChance()<std::rand()/static_cast<double> (RAND_MAX)*100)
return false;
MWWorld::Class::get (mEnchanter).skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2);
mEnchanter.getClass().skillUsageSucceeded (mEnchanter, ESM::Skill::Enchant, 2);
}
if(mCastStyle==ESM::Enchantment::ConstantEffect)
@ -84,7 +84,7 @@ namespace MWMechanics
// Apply the enchantment
const ESM::Enchantment *enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord (enchantment);
MWWorld::Class::get(newItemPtr).applyEnchantment(newItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName);
newItemPtr.getClass().applyEnchantment(newItemPtr, enchantmentPtr->mId, getGemCharge(), mNewItemName);
// Add the new item to player inventory and remove the old one
store.remove(mOldItemPtr, 1, player);
@ -212,7 +212,7 @@ namespace MWMechanics
const float enchantCost = getEnchantPoints();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::NpcStats &stats = MWWorld::Class::get(player).getNpcStats(player);
MWMechanics::NpcStats &stats = player.getClass().getNpcStats(player);
int eSkill = stats.getSkill(ESM::Skill::Enchant).getModified();
/*
@ -277,7 +277,7 @@ namespace MWMechanics
float Enchanting::getEnchantChance() const
{
const NpcStats& npcStats = MWWorld::Class::get (mEnchanter).getNpcStats (mEnchanter);
const NpcStats& npcStats = mEnchanter.getClass().getNpcStats (mEnchanter);
float chance1 = (npcStats.getSkill (ESM::Skill::Enchant).getModified() +
(0.25 * npcStats.getAttribute (ESM::Attribute::Intelligence).getModified())
@ -295,7 +295,7 @@ namespace MWMechanics
void Enchanting::payForEnchantment() const
{
const MWWorld::Ptr& player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
store.remove(MWWorld::ContainerStore::sGoldId, getEnchantPrice(), player);
}

@ -49,8 +49,8 @@ namespace MWMechanics
{
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
MWMechanics::NpcStats& npcStats = MWWorld::Class::get (ptr).getNpcStats (ptr);
MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats (ptr);
MWMechanics::NpcStats& npcStats = ptr.getClass().getNpcStats (ptr);
const ESM::NPC *player = ptr.get<ESM::NPC>()->mBase;
@ -215,7 +215,7 @@ namespace MWMechanics
void MechanicsManager::add(const MWWorld::Ptr& ptr)
{
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
mActors.addActor(ptr);
else
mObjects.addObject(ptr);
@ -234,7 +234,7 @@ namespace MWMechanics
if(old == mWatched)
mWatched = ptr;
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
mActors.updateActor(old, ptr);
else
mObjects.updateObject(old, ptr);
@ -475,13 +475,13 @@ namespace MWMechanics
int MechanicsManager::getDerivedDisposition(const MWWorld::Ptr& ptr)
{
const MWMechanics::NpcStats& npcSkill = MWWorld::Class::get(ptr).getNpcStats(ptr);
const MWMechanics::NpcStats& npcSkill = ptr.getClass().getNpcStats(ptr);
float x = npcSkill.getBaseDisposition();
MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>();
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::LiveCellRef<ESM::NPC>* player = playerPtr.get<ESM::NPC>();
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
if (Misc::StringUtils::ciEqual(npc->mBase->mRace, player->mBase->mRace))
x += MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fDispRaceMod")->getFloat();
@ -547,10 +547,10 @@ namespace MWMechanics
if (ptr.getTypeName() == typeid(ESM::Creature).name())
return basePrice;
const MWMechanics::NpcStats &sellerStats = MWWorld::Class::get(ptr).getNpcStats(ptr);
const MWMechanics::NpcStats &sellerStats = ptr.getClass().getNpcStats(ptr);
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
// I suppose the temporary disposition change _has_ to be considered here,
// otherwise one would get different prices when exiting and re-entering the dialogue window...
@ -592,10 +592,10 @@ namespace MWMechanics
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(npc).getNpcStats(npc);
MWMechanics::NpcStats& npcStats = npc.getClass().getNpcStats(npc);
MWWorld::Ptr playerPtr = MWBase::Environment::get().getWorld()->getPlayerPtr();
const MWMechanics::NpcStats &playerStats = MWWorld::Class::get(playerPtr).getNpcStats(playerPtr);
const MWMechanics::NpcStats &playerStats = playerPtr.getClass().getNpcStats(playerPtr);
float persTerm = playerStats.getAttribute(ESM::Attribute::Personality).getModified()
/ gmst.find("fPersonalityMod")->getFloat();
@ -739,27 +739,27 @@ namespace MWMechanics
void MechanicsManager::forceStateUpdate(const MWWorld::Ptr &ptr)
{
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
mActors.forceStateUpdate(ptr);
}
void MechanicsManager::playAnimationGroup(const MWWorld::Ptr& ptr, const std::string& groupName, int mode, int number)
{
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
mActors.playAnimationGroup(ptr, groupName, mode, number);
else
mObjects.playAnimationGroup(ptr, groupName, mode, number);
}
void MechanicsManager::skipAnimation(const MWWorld::Ptr& ptr)
{
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
mActors.skipAnimation(ptr);
else
mObjects.skipAnimation(ptr);
}
bool MechanicsManager::checkAnimationPlaying(const MWWorld::Ptr& ptr, const std::string &groupName)
{
if(MWWorld::Class::get(ptr).isActor())
if(ptr.getClass().isActor())
return mActors.checkAnimationPlaying(ptr, groupName);
else
return false;

@ -31,8 +31,8 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
int uses = (mTool.getCellRef().mCharge != -1) ? mTool.getCellRef().mCharge : ref->mBase->mData.mUses;
mTool.getCellRef().mCharge = uses-1;
MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats(player);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
float fatigueTerm = stats.getFatigueTerm();
int pcStrength = stats.getAttribute(ESM::Attribute::Strength).getModified();
@ -55,15 +55,15 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
// repair by 'y' points
itemToRepair.getCellRef().mCharge += y;
itemToRepair.getCellRef().mCharge = std::min(itemToRepair.getCellRef().mCharge,
MWWorld::Class::get(itemToRepair).getItemMaxHealth(itemToRepair));
itemToRepair.getClass().getItemMaxHealth(itemToRepair));
// set the OnPCRepair variable on the item's script
std::string script = MWWorld::Class::get(itemToRepair).getScript(itemToRepair);
std::string script = itemToRepair.getClass().getScript(itemToRepair);
if(script != "")
itemToRepair.getRefData().getLocals().setVarByInt(script, "onpcrepair", 1);
// increase skill
MWWorld::Class::get(player).skillUsageSucceeded(player, ESM::Skill::Armorer, 0);
player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0);
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1);
MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}");
@ -78,14 +78,14 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
if (mTool.getCellRef().mCharge == 0)
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player);
MWWorld::ContainerStore& store = player.getClass().getContainerStore(player);
store.remove(mTool, 1, player);
std::string message = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("sNotifyMessage51")->getString();
MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % MWWorld::Class::get(mTool).getName(mTool)).str());
MWBase::Environment::get().getWindowManager()->messageBox((boost::format(message) % mTool.getClass().getName(mTool)).str());
// try to find a new tool of the same ID
for (MWWorld::ContainerStoreIterator iter (store.begin());

@ -18,8 +18,8 @@ namespace MWMechanics
Security::Security(const MWWorld::Ptr &actor)
: mActor(actor)
{
CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor);
NpcStats& npcStats = MWWorld::Class::get(actor).getNpcStats(actor);
CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
NpcStats& npcStats = actor.getClass().getNpcStats(actor);
mAgility = creatureStats.getAttribute(ESM::Attribute::Agility).getModified();
mLuck = creatureStats.getAttribute(ESM::Attribute::Luck).getModified();
mSecuritySkill = npcStats.getSkill(ESM::Skill::Security).getModified();
@ -51,10 +51,10 @@ namespace MWMechanics
int roll = static_cast<float> (std::rand()) / RAND_MAX * 100;
if (roll <= x)
{
MWWorld::Class::get(lock).unlock(lock);
lock.getClass().unlock(lock);
resultMessage = "#{sLockSuccess}";
resultSound = "Open Lock";
MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 1);
mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 1);
}
else
resultMessage = "#{sLockFail}";
@ -97,7 +97,7 @@ namespace MWMechanics
resultSound = "Disarm Trap";
resultMessage = "#{sTrapSuccess}";
MWWorld::Class::get(mActor).skillUsageSucceeded(mActor, ESM::Skill::Security, 0);
mActor.getClass().skillUsageSucceeded(mActor, ESM::Skill::Security, 0);
}
else
resultMessage = "#{sTrapFail}";

@ -118,7 +118,7 @@ namespace MWRender
0, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
float scale=1.f;
MWWorld::Class::get(mCharacter).adjustScale(mCharacter, scale);
mCharacter.getClass().adjustScale(mCharacter, scale);
mNode->setScale(Ogre::Vector3(scale));
mCamera->setPosition(mPosition * mNode->getScale());

@ -237,7 +237,7 @@ void NpcAnimation::updateNpcBase()
void NpcAnimation::updateParts()
{
mAlpha = 1.f;
const MWWorld::Class &cls = MWWorld::Class::get(mPtr);
const MWWorld::Class &cls = mPtr.getClass();
MWWorld::InventoryStore &inv = cls.getInventoryStore(mPtr);
NpcType curType = Type_Normal;
@ -668,12 +668,12 @@ void NpcAnimation::showWeapons(bool showWeapon)
mShowWeapons = showWeapon;
if(showWeapon)
{
MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
MWWorld::InventoryStore &inv = mPtr.getClass().getInventoryStore(mPtr);
MWWorld::ContainerStoreIterator weapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
if(weapon != inv.end())
{
Ogre::Vector3 glowColor = getEnchantmentColor(*weapon);
std::string mesh = MWWorld::Class::get(*weapon).getModel(*weapon);
std::string mesh = weapon->getClass().getModel(*weapon);
addOrReplaceIndividualPart(ESM::PRT_Weapon, MWWorld::InventoryStore::Slot_CarriedRight, 1,
mesh, !weapon->getClass().getEnchantment(*weapon).empty(), &glowColor);
@ -701,13 +701,13 @@ void NpcAnimation::showWeapons(bool showWeapon)
void NpcAnimation::showCarriedLeft(bool show)
{
mShowCarriedLeft = show;
MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
MWWorld::InventoryStore &inv = mPtr.getClass().getInventoryStore(mPtr);
MWWorld::ContainerStoreIterator iter = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
if(show && iter != inv.end())
{
Ogre::Vector3 glowColor = getEnchantmentColor(*iter);
std::string mesh = MWWorld::Class::get(*iter).getModel(*iter);
std::string mesh = iter->getClass().getModel(*iter);
if (addOrReplaceIndividualPart(ESM::PRT_Shield, MWWorld::InventoryStore::Slot_CarriedLeft, 1,
mesh, !iter->getClass().getEnchantment(*iter).empty(), &glowColor))
{

@ -249,7 +249,7 @@ void RenderingManager::cellAdded (MWWorld::CellStore *store)
void RenderingManager::addObject (const MWWorld::Ptr& ptr){
const MWWorld::Class& class_ =
MWWorld::Class::get (ptr);
ptr.getClass();
class_.insertObjectRendering(ptr, *this);
}
@ -279,7 +279,7 @@ void RenderingManager::rotateObject(const MWWorld::Ptr &ptr)
mCamera->rotateCamera(-rot, false);
Ogre::Quaternion newo = Ogre::Quaternion(Ogre::Radian(rot.z), Ogre::Vector3::NEGATIVE_UNIT_Z);
if(!MWWorld::Class::get(ptr).isActor())
if(!ptr.getClass().isActor())
newo = Ogre::Quaternion(Ogre::Radian(rot.x), Ogre::Vector3::NEGATIVE_UNIT_X) *
Ogre::Quaternion(Ogre::Radian(rot.y), Ogre::Vector3::NEGATIVE_UNIT_Y) * newo;
ptr.getRefData().getBaseNode()->setOrientation(newo);
@ -294,7 +294,7 @@ RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &
Ogre::SceneNode *parent = child->getParentSceneNode();
parent->removeChild(child);
if (MWWorld::Class::get(old).isActor()) {
if (old.getClass().isActor()) {
mActors->updateObjectCell(old, cur);
} else {
mObjects->updateObjectCell(old, cur);
@ -314,7 +314,7 @@ void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
NpcAnimation *anim = NULL;
if(ptr.getRefData().getHandle() == "player")
anim = mPlayerAnimation;
else if(MWWorld::Class::get(ptr).isActor())
else if(ptr.getClass().isActor())
anim = dynamic_cast<NpcAnimation*>(mActors->getAnimation(ptr));
if(anim)
{
@ -337,7 +337,7 @@ void RenderingManager::update (float duration, bool paused)
MWWorld::Ptr player = world->getPlayerPtr();
int blind = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude;
int blind = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::Blind).mMagnitude;
mRendering.getFader()->setFactor(std::max(0.f, 1.f-(blind / 100.f)));
setAmbientMode();
@ -599,7 +599,7 @@ void RenderingManager::setAmbientColour(const Ogre::ColourValue& colour)
mAmbientColor = colour;
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int nightEye = MWWorld::Class::get(player).getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude;
int nightEye = player.getClass().getCreatureStats(player).getMagicEffects().get(ESM::MagicEffect::NightEye).mMagnitude;
Ogre::ColourValue final = colour;
final += Ogre::ColourValue(0.7,0.7,0.7,0) * std::min(1.f, (nightEye/100.f));

@ -47,7 +47,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiActivate activatePackage(objectID);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(activatePackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(activatePackage, ptr);
std::cout << "AiActivate" << std::endl;
}
};
@ -74,7 +74,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiTravel travelPackage(x, y, z);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(travelPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(travelPackage, ptr);
std::cout << "AiTravel: " << x << ", " << y << ", " << z << std::endl;
}
@ -108,7 +108,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiEscort escortPackage(actorID, duration, x, y, z);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
std::cout << "AiEscort: " << x << ", " << y << ", " << z << ", " << duration
<< std::endl;
@ -146,7 +146,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiEscort escortPackage(actorID, cellID, duration, x, y, z);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(escortPackage, ptr);
std::cout << "AiEscort: " << x << ", " << y << ", " << z << ", " << duration
<< std::endl;
@ -162,7 +162,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value = MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().isPackageDone();
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats (ptr).getAiSequence().isPackageDone();
runtime.push (value);
}
@ -210,7 +210,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiWander wanderPackage(range, duration, time, idleList, repeat);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(wanderPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(wanderPackage, ptr);
}
};
@ -225,7 +225,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (
runtime.push(ptr.getClass().getCreatureStats (ptr).getAiSetting (
(MWMechanics::CreatureStats::AiSetting)mIndex).getModified());
}
};
@ -245,8 +245,8 @@ namespace MWScript
MWMechanics::CreatureStats::AiSetting setting
= MWMechanics::CreatureStats::AiSetting(mIndex);
MWWorld::Class::get (ptr).getCreatureStats (ptr).setAiSetting (setting,
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSetting (setting).getBase() + value);
ptr.getClass().getCreatureStats (ptr).setAiSetting (setting,
ptr.getClass().getCreatureStats (ptr).getAiSetting (setting).getBase() + value);
}
};
template<class R>
@ -298,7 +298,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiFollow followPackage(actorID, duration, x, y ,z);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(followPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(followPackage, ptr);
std::cout << "AiFollow: " << actorID << ", " << x << ", " << y << ", " << z << ", " << duration
<< std::endl;
@ -336,7 +336,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i) runtime.pop();
MWMechanics::AiFollow followPackage(actorID, cellID, duration, x, y ,z);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().stack(followPackage, ptr);
ptr.getClass().getCreatureStats (ptr).getAiSequence().stack(followPackage, ptr);
std::cout << "AiFollow: " << actorID << ", " << x << ", " << y << ", " << z << ", " << duration
<< std::endl;
}
@ -351,7 +351,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value = MWWorld::Class::get (ptr).getCreatureStats (ptr).getAiSequence().getLastRunTypeId();
Interpreter::Type_Integer value = ptr.getClass().getCreatureStats (ptr).getAiSequence().getLastRunTypeId();
runtime.push (value);
}
@ -411,7 +411,7 @@ namespace MWScript
std::string testedTargetId = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
const MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor);
const MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
std::string currentTargetId;
bool targetsAreEqual = false;
@ -447,7 +447,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr actor = R()(runtime);
MWMechanics::CreatureStats& creatureStats = MWWorld::Class::get(actor).getCreatureStats(actor);
MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
creatureStats.getAiSequence().stopCombat();
creatureStats.setHostile(false);
}

@ -45,7 +45,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->getPtr (id, false);
script = MWWorld::Class::get (ptr).getScript (ptr);
script = ptr.getClass().getScript (ptr);
reference = true;
}

@ -117,7 +117,7 @@ namespace MWScript
if (count == 0)
return;
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
std::string itemName;
for (MWWorld::ContainerStoreIterator iter(store.begin()); iter != store.end(); ++iter)
@ -231,7 +231,7 @@ namespace MWScript
throw std::runtime_error ("armor index out of range");
}
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr);
MWWorld::ContainerStoreIterator it = invStore.getSlot (slot);
if (it == invStore.end() || it->getTypeName () != typeid(ESM::Armor).name())
@ -240,7 +240,7 @@ namespace MWScript
return;
}
int skill = MWWorld::Class::get(*it).getEquipmentSkill (*it) ;
int skill = it->getClass().getEquipmentSkill (*it) ;
if (skill == ESM::Skill::HeavyArmor)
runtime.push(2);
else if (skill == ESM::Skill::MediumArmor)
@ -264,7 +264,7 @@ namespace MWScript
std::string item = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr);
for (int slot = 0; slot < MWWorld::InventoryStore::Slots; ++slot)
{
MWWorld::ContainerStoreIterator it = invStore.getSlot (slot);
@ -290,7 +290,7 @@ namespace MWScript
const std::string &name = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr);
for (MWWorld::ContainerStoreIterator it = invStore.begin(MWWorld::ContainerStore::Type_Miscellaneous);
it != invStore.end(); ++it)
{
@ -314,7 +314,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
MWWorld::InventoryStore& invStore = MWWorld::Class::get(ptr).getInventoryStore (ptr);
MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore (ptr);
MWWorld::ContainerStoreIterator it = invStore.getSlot (MWWorld::InventoryStore::Slot_CarriedRight);
if (it == invStore.end() || it->getTypeName () != typeid(ESM::Weapon).name())
{

@ -149,7 +149,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation () + value);
ptr.getClass().getNpcStats (ptr).setReputation (ptr.getClass().getNpcStats (ptr).getReputation () + value);
}
};
@ -164,7 +164,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get(ptr).getNpcStats (ptr).setReputation (value);
ptr.getClass().getNpcStats (ptr).setReputation (value);
}
};
@ -177,7 +177,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getReputation ());
runtime.push (ptr.getClass().getNpcStats (ptr).getReputation ());
}
};
@ -192,7 +192,7 @@ namespace MWScript
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).isSameFaction (MWWorld::Class::get(player).getNpcStats (player)));
runtime.push (ptr.getClass().getNpcStats (ptr).isSameFaction (player.getClass().getNpcStats (player)));
}
};

@ -66,7 +66,7 @@ namespace MWScript
{
const MWWorld::Ptr ptr = getReference (id, false);
id = MWWorld::Class::get (ptr).getScript (ptr);
id = ptr.getClass().getScript (ptr);
ptr.getRefData().setLocals (
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().find (id));
@ -86,7 +86,7 @@ namespace MWScript
{
const MWWorld::Ptr ptr = getReference (id, false);
id = MWWorld::Class::get (ptr).getScript (ptr);
id = ptr.getClass().getScript (ptr);
ptr.getRefData().setLocals (
*MWBase::Environment::get().getWorld()->getStore().get<ESM::Script>().find (id));
@ -263,7 +263,7 @@ namespace MWScript
std::string InterpreterContext::getNPCRank() const
{
std::map<std::string, int> ranks = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks();
std::map<std::string, int> ranks = mReference.getClass().getNpcStats (mReference).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.begin();
MWBase::World *world = MWBase::Environment::get().getWorld();
@ -299,9 +299,9 @@ namespace MWScript
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first;
std::string factionId = mReference.getClass().getNpcStats (mReference).getFactionRanks().begin()->first;
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int> ranks = player.getClass().getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.find(factionId);
int rank = -1;
if (it != ranks.end())
@ -326,9 +326,9 @@ namespace MWScript
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
std::string factionId = MWWorld::Class::get (mReference).getNpcStats (mReference).getFactionRanks().begin()->first;
std::string factionId = mReference.getClass().getNpcStats (mReference).getFactionRanks().begin()->first;
std::map<std::string, int> ranks = MWWorld::Class::get (player).getNpcStats (player).getFactionRanks();
std::map<std::string, int> ranks = player.getClass().getNpcStats (player).getFactionRanks();
std::map<std::string, int>::const_iterator it = ranks.find(factionId);
int rank = -1;
if (it != ranks.end())
@ -353,7 +353,7 @@ namespace MWScript
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
return MWWorld::Class::get (player).getNpcStats (player).getBounty();
return player.getClass().getNpcStats (player).getBounty();
}
std::string InterpreterContext::getCurrentCellName() const

@ -142,7 +142,7 @@ namespace MWScript
runtime.pop();
}
MWWorld::Class::get (ptr).lock (ptr, lockLevel);
ptr.getClass().lock (ptr, lockLevel);
}
};
@ -155,7 +155,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
MWWorld::Class::get (ptr).unlock (ptr);
ptr.getClass().unlock (ptr);
}
};
@ -345,7 +345,7 @@ namespace MWScript
if(key < 0 || key > 32767 || *end != '\0')
key = ESM::MagicEffect::effectStringToId(effect);
runtime.push(MWWorld::Class::get(ptr).getCreatureStats(ptr).getMagicEffects().get(
runtime.push(ptr.getClass().getCreatureStats(ptr).getMagicEffects().get(
MWMechanics::EffectKey(key)).mMagnitude > 0);
}
};
@ -389,7 +389,7 @@ namespace MWScript
for (unsigned int i=0; i<arg0; ++i)
runtime.pop();
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
{
if (::Misc::StringUtils::ciEqual(it->getCellRef().mSoul, soul))
@ -424,7 +424,7 @@ namespace MWScript
if (amount == 0)
return;
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
int toRemove = amount;
@ -457,7 +457,7 @@ namespace MWScript
std::string soul = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWWorld::ContainerStore& store = MWWorld::Class::get (ptr).getContainerStore (ptr);
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore (ptr);
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
@ -481,7 +481,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(MWWorld::Class::get(ptr).getCreatureStats (ptr).getAttacked ());
runtime.push(ptr.getClass().getCreatureStats (ptr).getAttacked ());
}
};
@ -522,7 +522,7 @@ namespace MWScript
std::string id = runtime.getStringLiteral(runtime[0].mInteger);
runtime.pop();
runtime.push(MWWorld::Class::get(ptr).getCreatureStats(ptr).getActiveSpells().isSpellActive(id));
runtime.push(ptr.getClass().getCreatureStats(ptr).getActiveSpells().isSpellActive(id));
}
};
@ -621,7 +621,7 @@ namespace MWScript
std::string objectID = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWMechanics::CreatureStats &stats = MWWorld::Class::get(ptr).getCreatureStats(ptr);
MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr);
runtime.push(::Misc::StringUtils::ciEqual(objectID, stats.getLastHitObject()));
}
};
@ -657,7 +657,7 @@ namespace MWScript
{
std::stringstream str;
const std::string script = MWWorld::Class::get(ptr).getScript(ptr);
const std::string script = ptr.getClass().getScript(ptr);
if(script.empty())
str<< ptr.getCellRef().mRefID<<" ("<<ptr.getRefData().getHandle()<<") does not have a script.";
else

@ -31,7 +31,7 @@ namespace
{
std::string getDialogueActorFaction(MWWorld::Ptr actor)
{
const MWMechanics::NpcStats &stats = MWWorld::Class::get (actor).getNpcStats (actor);
const MWMechanics::NpcStats &stats = actor.getClass().getNpcStats (actor);
if (stats.getFactionRanks().empty())
throw std::runtime_error (
@ -55,7 +55,7 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value =
MWWorld::Class::get (ptr)
ptr.getClass()
.getCreatureStats (ptr)
.getLevel();
@ -75,7 +75,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get (ptr)
ptr.getClass()
.getCreatureStats (ptr)
.setLevel(value);
}
@ -95,7 +95,7 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value =
MWWorld::Class::get (ptr)
ptr.getClass()
.getCreatureStats (ptr)
.getAttribute(mIndex)
.getModified();
@ -142,7 +142,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWMechanics::AttributeValue attribute = MWWorld::Class::get(ptr)
MWMechanics::AttributeValue attribute = ptr.getClass()
.getCreatureStats(ptr)
.getAttribute(mIndex);
@ -165,13 +165,13 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Float value;
if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr))
if (mIndex==0 && ptr.getClass().hasItemHealth (ptr))
{
// health is a special case
value = MWWorld::Class::get (ptr).getItemMaxHealth (ptr);
value = ptr.getClass().getItemMaxHealth (ptr);
} else {
value =
MWWorld::Class::get(ptr)
ptr.getClass()
.getCreatureStats(ptr)
.getDynamic(mIndex)
.getCurrent();
@ -196,13 +196,13 @@ namespace MWScript
Interpreter::Type_Float value = runtime[0].mFloat;
runtime.pop();
MWMechanics::DynamicStat<float> stat (MWWorld::Class::get (ptr).getCreatureStats (ptr)
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
.getDynamic (mIndex));
stat.setModified (value, 0);
stat.setCurrent(value);
MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat);
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
}
};
@ -222,18 +222,18 @@ namespace MWScript
Interpreter::Type_Float diff = runtime[0].mFloat;
runtime.pop();
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent();
MWMechanics::DynamicStat<float> stat (MWWorld::Class::get (ptr).getCreatureStats (ptr)
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
.getDynamic (mIndex));
stat.setModified (diff + stat.getModified(), 0);
stat.setCurrent (diff + current);
MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat);
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
}
};
@ -253,16 +253,16 @@ namespace MWScript
Interpreter::Type_Float diff = runtime[0].mFloat;
runtime.pop();
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
Interpreter::Type_Float current = stats.getDynamic(mIndex).getCurrent();
MWMechanics::DynamicStat<float> stat (MWWorld::Class::get (ptr).getCreatureStats (ptr)
MWMechanics::DynamicStat<float> stat (ptr.getClass().getCreatureStats (ptr)
.getDynamic (mIndex));
stat.setCurrent (diff + current);
MWWorld::Class::get (ptr).getCreatureStats (ptr).setDynamic (mIndex, stat);
ptr.getClass().getCreatureStats (ptr).setDynamic (mIndex, stat);
}
};
@ -279,7 +279,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr);
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats (ptr);
Interpreter::Type_Float value = 0;
@ -327,7 +327,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWMechanics::NpcStats& stats = MWWorld::Class::get (ptr).getNpcStats (ptr);
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats (ptr);
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
@ -386,7 +386,7 @@ namespace MWScript
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
runtime.push (static_cast <Interpreter::Type_Float> (MWWorld::Class::get (player).getNpcStats (player).getBounty()));
runtime.push (static_cast <Interpreter::Type_Float> (player.getClass().getNpcStats (player).getBounty()));
}
};
@ -399,7 +399,7 @@ namespace MWScript
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat);
player.getClass().getNpcStats (player).setBounty(runtime[0].mFloat);
runtime.pop();
}
};
@ -413,7 +413,7 @@ namespace MWScript
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::Ptr player = world->getPlayerPtr();
MWWorld::Class::get (player).getNpcStats (player).setBounty(runtime[0].mFloat + MWWorld::Class::get (player).getNpcStats (player).getBounty());
player.getClass().getNpcStats (player).setBounty(runtime[0].mFloat + player.getClass().getNpcStats (player).getBounty());
runtime.pop();
}
};
@ -433,7 +433,7 @@ namespace MWScript
// make sure a spell with this ID actually exists.
MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find (id);
MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().add (id);
ptr.getClass().getCreatureStats (ptr).getSpells().add (id);
}
};
@ -449,7 +449,7 @@ namespace MWScript
std::string id = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().remove (id);
ptr.getClass().getCreatureStats (ptr).getSpells().remove (id);
MWBase::WindowManager *wm = MWBase::Environment::get().getWindowManager();
@ -473,7 +473,7 @@ namespace MWScript
std::string spellid = runtime.getStringLiteral (runtime[0].mInteger);
runtime.pop();
MWWorld::Class::get (ptr).getCreatureStats (ptr).getActiveSpells().removeEffects(spellid);
ptr.getClass().getCreatureStats (ptr).getActiveSpells().removeEffects(spellid);
}
};
@ -489,7 +489,7 @@ namespace MWScript
Interpreter::Type_Integer effectId = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get (ptr).getCreatureStats (ptr).getActiveSpells().purgeEffect(effectId);
ptr.getClass().getCreatureStats (ptr).getActiveSpells().purgeEffect(effectId);
}
};
@ -509,8 +509,8 @@ namespace MWScript
Interpreter::Type_Integer value = 0;
for (MWMechanics::Spells::TIterator iter (
MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().begin());
iter!=MWWorld::Class::get (ptr).getCreatureStats (ptr).getSpells().end(); ++iter)
ptr.getClass().getCreatureStats (ptr).getSpells().begin());
iter!=ptr.getClass().getCreatureStats (ptr).getSpells().end(); ++iter)
if (iter->first==id)
{
value = 1;
@ -544,9 +544,9 @@ namespace MWScript
if(factionID != "")
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) == player.getClass().getNpcStats(player).getFactionRanks().end())
{
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0;
player.getClass().getNpcStats(player).getFactionRanks()[factionID] = 0;
}
}
}
@ -575,13 +575,13 @@ namespace MWScript
if(factionID != "")
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) == MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) == player.getClass().getNpcStats(player).getFactionRanks().end())
{
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = 0;
player.getClass().getNpcStats(player).getFactionRanks()[factionID] = 0;
}
else
{
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] +1;
player.getClass().getNpcStats(player).getFactionRanks()[factionID] = player.getClass().getNpcStats(player).getFactionRanks()[factionID] +1;
}
}
}
@ -610,9 +610,9 @@ namespace MWScript
if(factionID != "")
{
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end())
{
MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] = MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID] -1;
player.getClass().getNpcStats(player).getFactionRanks()[factionID] = player.getClass().getNpcStats(player).getFactionRanks()[factionID] -1;
}
}
}
@ -635,22 +635,22 @@ namespace MWScript
}
else
{
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
}
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
}
::Misc::StringUtils::toLower(factionID);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
if(factionID!="")
{
if(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().find(factionID) != MWWorld::Class::get(player).getNpcStats(player).getFactionRanks().end())
if(player.getClass().getNpcStats(player).getFactionRanks().find(factionID) != player.getClass().getNpcStats(player).getFactionRanks().end())
{
runtime.push(MWWorld::Class::get(player).getNpcStats(player).getFactionRanks()[factionID]);
runtime.push(player.getClass().getNpcStats(player).getFactionRanks()[factionID]);
}
else
{
@ -676,8 +676,8 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get (ptr).getNpcStats (ptr).setBaseDisposition
(MWWorld::Class::get (ptr).getNpcStats (ptr).getBaseDisposition() + value);
ptr.getClass().getNpcStats (ptr).setBaseDisposition
(ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value);
}
};
@ -693,7 +693,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
MWWorld::Class::get (ptr).getNpcStats (ptr).setBaseDisposition (value);
ptr.getClass().getNpcStats (ptr).setBaseDisposition (value);
}
};
@ -739,8 +739,8 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty())
factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first;
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
if (factionId.empty())
@ -750,7 +750,7 @@ namespace MWScript
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
runtime.push (
MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId));
player.getClass().getNpcStats (player).getFactionReputation (factionId));
}
};
@ -775,8 +775,8 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty())
factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first;
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
if (factionId.empty())
@ -785,7 +785,7 @@ namespace MWScript
::Misc::StringUtils::toLower (factionId);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId, value);
player.getClass().getNpcStats (player).setFactionReputation (factionId, value);
}
};
@ -810,8 +810,8 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
if (!MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().empty())
factionId = MWWorld::Class::get (ptr).getNpcStats (ptr).getFactionRanks().begin()->first;
if (!ptr.getClass().getNpcStats (ptr).getFactionRanks().empty())
factionId = ptr.getClass().getNpcStats (ptr).getFactionRanks().begin()->first;
}
if (factionId.empty())
@ -820,8 +820,8 @@ namespace MWScript
::Misc::StringUtils::toLower (factionId);
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWWorld::Class::get (player).getNpcStats (player).setFactionReputation (factionId,
MWWorld::Class::get (player).getNpcStats (player).getFactionReputation (factionId)+
player.getClass().getNpcStats (player).setFactionReputation (factionId,
player.getClass().getNpcStats (player).getFactionReputation (factionId)+
value);
}
};
@ -835,7 +835,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasCommonDisease());
runtime.push (ptr.getClass().getCreatureStats (ptr).hasCommonDisease());
}
};
@ -848,7 +848,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push (MWWorld::Class::get (ptr).getCreatureStats (ptr).hasBlightDisease());
runtime.push (ptr.getClass().getCreatureStats (ptr).hasBlightDisease());
}
};
@ -880,7 +880,7 @@ namespace MWScript
{
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld ()->getPlayerPtr();
runtime.push (MWWorld::Class::get(ptr).getNpcStats (ptr).getWerewolfKills ());
runtime.push (ptr.getClass().getNpcStats (ptr).getWerewolfKills ());
}
};
@ -901,13 +901,13 @@ namespace MWScript
}
else
{
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
}
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
}
::Misc::StringUtils::toLower(factionID);
@ -939,13 +939,13 @@ namespace MWScript
else
{
MWWorld::Ptr ptr = R()(runtime);
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
}
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
@ -972,13 +972,13 @@ namespace MWScript
else
{
MWWorld::Ptr ptr = R()(runtime);
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
{
factionID = "";
}
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
@ -997,11 +997,11 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
std::string factionID = "";
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
return;
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
@ -1009,7 +1009,7 @@ namespace MWScript
if (ptr == player)
return;
std::map<std::string, int>& ranks = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks ();
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
ranks[factionID] = ranks[factionID]+1;
}
};
@ -1024,11 +1024,11 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
std::string factionID = "";
if(MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().empty())
if(ptr.getClass().getNpcStats(ptr).getFactionRanks().empty())
return;
else
{
factionID = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks().begin()->first;
factionID = ptr.getClass().getNpcStats(ptr).getFactionRanks().begin()->first;
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
@ -1036,7 +1036,7 @@ namespace MWScript
if (ptr == player)
return;
std::map<std::string, int>& ranks = MWWorld::Class::get(ptr).getNpcStats(ptr).getFactionRanks ();
std::map<std::string, int>& ranks = ptr.getClass().getNpcStats(ptr).getFactionRanks ();
ranks[factionID] = ranks[factionID]-1;
}
};
@ -1051,10 +1051,10 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value =
MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied();
ptr.getClass().getCreatureStats (ptr).hasDied();
if (value)
MWWorld::Class::get (ptr).getCreatureStats (ptr).clearHasDied();
ptr.getClass().getCreatureStats (ptr).clearHasDied();
runtime.push (value);
}
@ -1070,7 +1070,7 @@ namespace MWScript
MWWorld::Ptr ptr = R()(runtime);
Interpreter::Type_Integer value =
MWWorld::Class::get (ptr).getCreatureStats (ptr).getKnockedDownOneFrame();
ptr.getClass().getCreatureStats (ptr).getKnockedDownOneFrame();
runtime.push (value);
}
@ -1084,7 +1084,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(MWWorld::Class::get(ptr).getNpcStats(ptr).isWerewolf());
runtime.push(ptr.getClass().getNpcStats(ptr).isWerewolf());
}
};

@ -319,7 +319,7 @@ namespace MWScript
}
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
MWWorld::Class::get(ptr).adjustPosition(ptr);
ptr.getClass().adjustPosition(ptr);
}
else
{
@ -366,7 +366,7 @@ namespace MWScript
zRot = zRot/60.;
}
MWBase::Environment::get().getWorld()->rotateObject(ptr,ax,ay,zRot);
MWWorld::Class::get(ptr).adjustPosition(ptr);
ptr.getClass().adjustPosition(ptr);
}
};

@ -12,6 +12,8 @@
#include <OgreImage.h>
#include <boost/filesystem/fstream.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/journal.hpp"
@ -185,7 +187,7 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
else
slot = mCharacterManager.getCurrentCharacter()->updateSlot (slot, profile);
std::ofstream stream (slot->mPath.string().c_str(), std::ios::binary);
boost::filesystem::ofstream stream (slot->mPath, std::ios::binary);
ESM::ESMWriter writer;

@ -16,7 +16,7 @@ namespace MWWorld
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor);
getTarget().getClass().apply (getTarget(), mId, actor);
}
@ -29,7 +29,7 @@ namespace MWWorld
{
MWBase::Environment::get().getWorld()->breakInvisibility(actor);
if (MWWorld::Class::get (getTarget()).apply (getTarget(), mId, actor) && mUsageType!=-1)
MWWorld::Class::get (getTarget()).skillUsageSucceeded (actor, mSkillIndex, mUsageType);
if (getTarget().getClass().apply (getTarget(), mId, actor) && mUsageType!=-1)
getTarget().getClass().skillUsageSucceeded (actor, mSkillIndex, mUsageType);
}
}

@ -20,10 +20,10 @@ namespace MWWorld
getTarget().getContainerStore()->remove(getTarget(), 1, actor);
// apply to actor
std::string id = Class::get (getTarget()).getId (getTarget());
std::string id = getTarget().getClass().getId (getTarget());
if (Class::get (actor).apply (actor, id, actor))
Class::get (actor).skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
if (actor.getClass().apply (actor, id, actor))
actor.getClass().skillUsageSucceeded (actor, ESM::Skill::Alchemy, 1);
}
ActionEat::ActionEat (const MWWorld::Ptr& object) : Action (false, object) {}

@ -40,7 +40,7 @@ namespace MWWorld
}
// slots that this item can be equipped in
std::pair<std::vector<int>, bool> slots_ = MWWorld::Class::get(getTarget()).getEquipmentSlots(getTarget());
std::pair<std::vector<int>, bool> slots_ = getTarget().getClass().getEquipmentSlots(getTarget());
// retrieve ContainerStoreIterator to the item
MWWorld::ContainerStoreIterator it = invStore.begin();

@ -47,7 +47,7 @@ namespace MWWorld
}
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats (player);
// Skill gain from books
if (ref->mBase->mData.mSkillID >= 0 && ref->mBase->mData.mSkillID < ESM::Skill::Length

@ -36,7 +36,7 @@ namespace
MWWorld::Ptr container (&*iter, 0);
MWWorld::Ptr ptr =
MWWorld::Class::get (container).getContainerStore (container).search (id);
container.getClass().getContainerStore (container).search (id);
if (!ptr.isEmpty())
return ptr;

@ -323,7 +323,7 @@ namespace MWWorld
if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return boost::shared_ptr<Action>(new NullAction());
if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf())
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfItem");

@ -325,12 +325,6 @@ namespace MWWorld
static const Class& get (const std::string& key);
///< If there is no class for this \a key, an exception is thrown.
static const Class& get (const Ptr& ptr)
{
return ptr.getClass();
}
///< If there is no class for this pointer, an exception is thrown.
static void registerClass (const std::string& key, boost::shared_ptr<Class> instance);
virtual int getBaseGold(const MWWorld::Ptr& ptr) const;

@ -142,8 +142,8 @@ void MWWorld::ContainerStore::unstack(const Ptr &ptr, const Ptr& container)
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
const MWWorld::Class& cls1 = MWWorld::Class::get(ptr1);
const MWWorld::Class& cls2 = MWWorld::Class::get(ptr2);
const MWWorld::Class& cls1 = ptr1.getClass();
const MWWorld::Class& cls2 = ptr2.getClass();
if (!Misc::StringUtils::ciEqual(ptr1.getCellRef().mRefID, ptr2.getCellRef().mRefID))
return false;
@ -226,14 +226,14 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
item.getCellRef().mPos.pos[1] = 0;
item.getCellRef().mPos.pos[2] = 0;
std::string script = MWWorld::Class::get(item).getScript(item);
std::string script = item.getClass().getScript(item);
if(script != "")
{
CellStore *cell;
MWBase::Environment::get().getWorld()->getLocalScripts().add(script, item);
if(&(MWWorld::Class::get (player).getContainerStore (player)) == this)
if(&(player.getClass().getContainerStore (player)) == this)
{
cell = 0; // Items in player's inventory have cell set to 0, so their scripts will never be removed

@ -129,7 +129,7 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite
std::pair<std::vector<int>, bool> slots_;
slots_ = Class::get (*iterator).getEquipmentSlots (*iterator);
slots_ = iterator->getClass().getEquipmentSlots (*iterator);
if (std::find (slots_.first.begin(), slots_.first.end(), slot)==slots_.first.end())
throw std::runtime_error ("invalid slot");
@ -258,7 +258,7 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor)
}
}
switch(MWWorld::Class::get (test).canBeEquipped (test, actor).first)
switch(test.getClass().canBeEquipped (test, actor).first)
{
case 0:
continue;
@ -325,7 +325,7 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor)
if (*iter==end())
continue;
std::string enchantmentId = MWWorld::Class::get (**iter).getEnchantment (**iter);
std::string enchantmentId = (*iter)->getClass().getEnchantment (**iter);
if (!enchantmentId.empty())
{
@ -441,7 +441,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
if (*iter != end() && (ptr1 == **iter || ptr2 == **iter))
{
bool stackWhenEquipped = MWWorld::Class::get(**iter).getEquipmentSlots(**iter).second;
bool stackWhenEquipped = (*iter)->getClass().getEquipmentSlots(**iter).second;
if (!stackWhenEquipped)
return false;
}
@ -527,7 +527,7 @@ MWWorld::ContainerStoreIterator MWWorld::InventoryStore::unequipSlot(int slot, c
if (actor.getRefData().getHandle() == "player")
{
// Unset OnPCEquip Variable on item's script, if it has a script with that variable declared
const std::string& script = Class::get(*it).getScript(*it);
const std::string& script = it->getClass().getScript(*it);
if (script != "")
(*it).getRefData().getLocals().setVarByInt(script, "onpcequip", 0);
@ -579,7 +579,7 @@ void MWWorld::InventoryStore::visitEffectSources(MWMechanics::EffectSourceVisito
if (*iter==end())
continue;
std::string enchantmentId = MWWorld::Class::get (**iter).getEnchantment (**iter);
std::string enchantmentId = (*iter)->getClass().getEnchantment (**iter);
if (enchantmentId.empty())
continue;

@ -10,6 +10,11 @@
#include "class.hpp"
#include "esmstore.hpp"
MWWorld::LiveCellRefBase::LiveCellRefBase(std::string type, const ESM::CellRef &cref)
: mClass(&Class::get(type)), mRef(cref), mData(mRef)
{
}
void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state)
{
mRef = state.mRef;

@ -36,10 +36,10 @@ namespace
MWWorld::Ptr containerPtr (&*iter, cell);
MWWorld::ContainerStore& container = MWWorld::Class::get(containerPtr).getContainerStore(containerPtr);
MWWorld::ContainerStore& container = containerPtr.getClass().getContainerStore(containerPtr);
for(MWWorld::ContainerStoreIterator it3 = container.begin(); it3 != container.end(); ++it3)
{
std::string script = MWWorld::Class::get(*it3).getScript(*it3);
std::string script = it3->getClass().getScript(*it3);
if(script != "")
{
MWWorld::Ptr item = *it3;

@ -538,7 +538,7 @@ namespace MWWorld
void PhysicsSystem::addObject (const Ptr& ptr, bool placeable)
{
std::string mesh = MWWorld::Class::get(ptr).getModel(ptr);
std::string mesh = ptr.getClass().getModel(ptr);
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
handleToMesh[node->getName()] = mesh;
OEngine::Physic::RigidBody* body = mEngine->createAndAdjustRigidBody(
@ -550,7 +550,7 @@ namespace MWWorld
void PhysicsSystem::addActor (const Ptr& ptr)
{
std::string mesh = MWWorld::Class::get(ptr).getModel(ptr);
std::string mesh = ptr.getClass().getModel(ptr);
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
//TODO:optimize this. Searching the std::map isn't very efficient i think.
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
@ -651,7 +651,7 @@ namespace MWWorld
bool PhysicsSystem::getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max)
{
std::string model = MWWorld::Class::get(ptr).getModel(ptr);
std::string model = ptr.getClass().getModel(ptr);
if (model.empty()) {
return false;
}

@ -75,7 +75,7 @@ namespace MWWorld
void Player::setDrawState (MWMechanics::DrawState_ state)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get(ptr).getNpcStats(ptr).setDrawState (state);
ptr.getClass().getNpcStats(ptr).setDrawState (state);
}
bool Player::getAutoMove() const
@ -94,13 +94,13 @@ namespace MWWorld
if (mAutoMove)
value = 1;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
ptr.getClass().getMovementSettings (ptr).mPosition[1] = value;
}
void Player::setLeftRight (int value)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[0] = value;
ptr.getClass().getMovementSettings (ptr).mPosition[0] = value;
}
void Player::setForwardBackward (int value)
@ -112,13 +112,13 @@ namespace MWWorld
if (mAutoMove)
value = 1;
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[1] = value;
ptr.getClass().getMovementSettings (ptr).mPosition[1] = value;
}
void Player::setUpDown(int value)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get (ptr).getMovementSettings (ptr).mPosition[2] = value;
ptr.getClass().getMovementSettings (ptr).mPosition[2] = value;
}
void Player::setRunState(bool run)
@ -136,23 +136,23 @@ namespace MWWorld
void Player::yaw(float yaw)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[2] += yaw;
ptr.getClass().getMovementSettings(ptr).mRotation[2] += yaw;
}
void Player::pitch(float pitch)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[0] += pitch;
ptr.getClass().getMovementSettings(ptr).mRotation[0] += pitch;
}
void Player::roll(float roll)
{
MWWorld::Ptr ptr = getPlayer();
MWWorld::Class::get(ptr).getMovementSettings(ptr).mRotation[1] += roll;
ptr.getClass().getMovementSettings(ptr).mRotation[1] += roll;
}
MWMechanics::DrawState_ Player::getDrawState()
{
MWWorld::Ptr ptr = getPlayer();
return MWWorld::Class::get(ptr).getNpcStats(ptr).getDrawState();
return ptr.getClass().getNpcStats(ptr).getDrawState();
}
bool Player::wasTeleported() const

@ -5,14 +5,7 @@
#include "containerstore.hpp"
#include "class.hpp"
/* This shouldn't really be here. */
MWWorld::LiveCellRefBase::LiveCellRefBase(std::string type, const ESM::CellRef &cref)
: mClass(&Class::get(type)), mRef(cref), mData(mRef)
{
}
#include "livecellref.hpp"
const std::string& MWWorld::Ptr::getTypeName() const
{
@ -59,4 +52,4 @@ MWWorld::ContainerStore *MWWorld::Ptr::getContainerStore() const
MWWorld::Ptr::operator const void *()
{
return mRef;
}
}

@ -7,12 +7,12 @@
#include <sstream>
#include "cellreflist.hpp"
#include "livecellref.hpp"
namespace MWWorld
{
class ContainerStore;
class CellStore;
class LiveCellRefBase;
/// \brief Pointer to a LiveCellRef

@ -198,7 +198,7 @@ namespace MWWorld
float z = Ogre::Radian(pos.rot[2]).valueDegrees();
world->rotateObject(player, x, y, z);
MWWorld::Class::get(player).adjustPosition(player);
player.getClass().adjustPosition(player);
}
MWBase::MechanicsManager *mechMgr =
@ -399,7 +399,7 @@ namespace MWWorld
float z = Ogre::Radian(position.rot[2]).valueDegrees();
world->rotateObject(world->getPlayerPtr(), x, y, z);
MWWorld::Class::get(world->getPlayerPtr()).adjustPosition(world->getPlayerPtr());
world->getPlayerPtr().getClass().adjustPosition(world->getPlayerPtr());
world->getFader()->fadeIn(0.5f);
return;
}
@ -482,7 +482,7 @@ namespace MWWorld
void Scene::addObjectToScene (const Ptr& ptr)
{
mRendering.addObject(ptr);
MWWorld::Class::get(ptr).insertObject(ptr, *mPhysics);
ptr.getClass().insertObject(ptr, *mPhysics);
MWBase::Environment::get().getWorld()->rotateObject(ptr, 0, 0, 0, true);
MWBase::Environment::get().getWorld()->scaleObject(ptr, ptr.getCellRef().mScale);
}

@ -537,8 +537,8 @@ namespace MWWorld
return ptr;
}
Ptr ptr = Class::get (mPlayer->getPlayer()).
getContainerStore (mPlayer->getPlayer()).search (lowerCaseName);
Ptr ptr = mPlayer->getPlayer().getClass()
.getContainerStore(mPlayer->getPlayer()).search(lowerCaseName);
if (!ptr.isEmpty())
return ptr;
@ -589,10 +589,10 @@ namespace MWWorld
reference.getTypeName()==typeid (ESM::NPC).name() ||
reference.getTypeName()==typeid (ESM::Creature).name())
{
MWWorld::ContainerStore& container = MWWorld::Class::get(reference).getContainerStore(reference);
MWWorld::ContainerStore& container = reference.getClass().getContainerStore(reference);
for(MWWorld::ContainerStoreIterator it = container.begin(); it != container.end(); ++it)
{
std::string script = MWWorld::Class::get(*it).getScript(*it);
std::string script = it->getClass().getScript(*it);
if(script != "")
{
MWWorld::Ptr item = *it;
@ -624,10 +624,10 @@ namespace MWWorld
reference.getTypeName()==typeid (ESM::NPC).name() ||
reference.getTypeName()==typeid (ESM::Creature).name())
{
MWWorld::ContainerStore& container = MWWorld::Class::get(reference).getContainerStore(reference);
MWWorld::ContainerStore& container = reference.getClass().getContainerStore(reference);
for(MWWorld::ContainerStoreIterator it = container.begin(); it != container.end(); ++it)
{
std::string script = MWWorld::Class::get(*it).getScript(*it);
std::string script = it->getClass().getScript(*it);
if(script != "")
{
MWWorld::Ptr item = *it;
@ -976,14 +976,14 @@ namespace MWWorld
removeContainerScripts (ptr);
haveToMove = false;
MWWorld::Ptr newPtr = MWWorld::Class::get(ptr)
MWWorld::Ptr newPtr = ptr.getClass()
.copyToCell(ptr, *newCell);
newPtr.getRefData().setBaseNode(0);
}
else
{
MWWorld::Ptr copy =
MWWorld::Class::get(ptr).copyToCell(ptr, *newCell, pos);
ptr.getClass().copyToCell(ptr, *newCell, pos);
mRendering->updateObjectCell(ptr, copy);
MWBase::Environment::get().getSoundManager()->updatePtr (ptr, copy);
@ -992,7 +992,7 @@ namespace MWWorld
mechMgr->updateCell(ptr, copy);
std::string script =
MWWorld::Class::get(ptr).getScript(ptr);
ptr.getClass().getScript(ptr);
if (!script.empty())
{
mLocalScripts.remove(ptr);
@ -1035,7 +1035,7 @@ namespace MWWorld
void World::scaleObject (const Ptr& ptr, float scale)
{
ptr.getCellRef().mScale = scale;
MWWorld::Class::get(ptr).adjustScale(ptr,scale);
ptr.getClass().adjustScale(ptr,scale);
if(ptr.getRefData().getBaseNode() == 0)
return;
@ -1062,7 +1062,7 @@ namespace MWWorld
objRot[2] = rot.z;
}
if(Class::get(ptr).isActor())
if(ptr.getClass().isActor())
{
/* HACK? Actors shouldn't really be rotating around X (or Y), but
* currently it's done so for rotating the camera, which needs
@ -1580,7 +1580,7 @@ namespace MWWorld
void World::PCDropped (const Ptr& item)
{
std::string script = MWWorld::Class::get(item).getScript(item);
std::string script = item.getClass().getScript(item);
// Set OnPCDrop Variable on item's script, if it has a script with that variable declared
if(script != "")
@ -1648,13 +1648,13 @@ namespace MWWorld
}
MWWorld::Ptr dropped =
MWWorld::Class::get(object).copyToCell(object, *cell, pos);
object.getClass().copyToCell(object, *cell, pos);
if (mWorldScene->isCellActive(*cell)) {
if (dropped.getRefData().isEnabled()) {
mWorldScene->addObjectToScene(dropped);
}
std::string script = MWWorld::Class::get(dropped).getScript(dropped);
std::string script = dropped.getClass().getScript(dropped);
if (!script.empty()) {
mLocalScripts.add(script, dropped);
}
@ -1863,7 +1863,7 @@ namespace MWWorld
if((!physactor->getOnGround()&&physactor->getCollisionMode()) || isUnderwater(currentCell, playerPos))
return 2;
if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) ||
Class::get(player).getNpcStats(player).isWerewolf())
player.getClass().getNpcStats(player).isWerewolf())
return 1;
return 0;
@ -2107,7 +2107,7 @@ namespace MWWorld
void World::setWerewolf(const MWWorld::Ptr& actor, bool werewolf)
{
MWMechanics::NpcStats& npcStats = Class::get(actor).getNpcStats(actor);
MWMechanics::NpcStats& npcStats = actor.getClass().getNpcStats(actor);
// The actor does not have to change state
if (npcStats.isWerewolf() == werewolf)
@ -2119,7 +2119,7 @@ namespace MWWorld
// bones that do not even exist with the werewolf object root.
// Therefore, make sure to unequip everything at once, and only fire the change event
// (which will rebuild the animation parts) afterwards. unequipAll will do this for us.
MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor);
MWWorld::InventoryStore& invStore = actor.getClass().getInventoryStore(actor);
invStore.unequipAll(actor);
if(werewolf)
@ -2158,7 +2158,7 @@ namespace MWWorld
void World::applyWerewolfAcrobatics(const Ptr &actor)
{
const Store<ESM::GameSetting> &gmst = getStore().get<ESM::GameSetting>();
MWMechanics::NpcStats &stats = Class::get(actor).getNpcStats(actor);
MWMechanics::NpcStats &stats = actor.getClass().getNpcStats(actor);
stats.getSkill(ESM::Skill::Acrobatics).setBase(gmst.find("fWerewolfAcrobatics")->getFloat());
}

@ -25,6 +25,9 @@
#include <stdexcept>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include "../files/constrainedfiledatastream.hpp"
using namespace std;
@ -72,7 +75,8 @@ void BSAFile::readHeader()
*/
assert(!isLoaded);
std::ifstream input(filename.c_str(), std::ios_base::binary);
namespace bfs = boost::filesystem;
bfs::ifstream input(bfs::path(filename), std::ios_base::binary);
// Total archive size
size_t fsize = 0;

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

Loading…
Cancel
Save