resolving conflicts, minor update

actorid
greye 12 years ago
commit 7606ebafd6

File diff suppressed because it is too large Load Diff

@ -369,7 +369,7 @@ void OMW::Engine::go()
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (mCellName))
{
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
}

@ -41,7 +41,7 @@ namespace MWClass
ptr.get<ESM::Activator>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -53,7 +53,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->name;
return ref->base->mName;
}
std::string Activator::getScript (const MWWorld::Ptr& ptr) const
@ -61,7 +61,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return ref->base->script;
return ref->base->mScript;
}
void Activator::registerSelf()
@ -76,7 +76,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Activator::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -85,11 +85,11 @@ namespace MWClass
ptr.get<ESM::Activator>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;

@ -44,7 +44,7 @@ namespace MWClass
ptr.get<ESM::Apparatus>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -56,7 +56,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->script;
return ref->base->mScript;
}
int Apparatus::getValue (const MWWorld::Ptr& ptr) const
@ -83,7 +83,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Apparatus::registerSelf()
@ -108,7 +108,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Apparatus::hasToolTip (const MWWorld::Ptr& ptr) const
@ -116,7 +116,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -125,19 +125,19 @@ namespace MWClass
ptr.get<ESM::Apparatus>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sQuality")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -47,7 +47,7 @@ namespace MWClass
ptr.get<ESM::Armor>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -59,7 +59,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
@ -82,7 +82,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.health;
return ref->base->mData.mHealth;
}
std::string Armor::getScript (const MWWorld::Ptr& ptr) const
@ -90,7 +90,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Armor::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -118,7 +118,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
{
slots.push_back (int (sMapping[i][1]));
break;
@ -134,7 +134,7 @@ namespace MWClass
std::string typeGmst;
switch (ref->base->data.type)
switch (ref->base->mData.mType)
{
case ESM::Armor::Helmet: typeGmst = "iHelmWeight"; break;
case ESM::Armor::Cuirass: typeGmst = "iCuirassWeight"; break;
@ -152,14 +152,14 @@ namespace MWClass
if (typeGmst.empty())
return -1;
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->i;
float iWeight = MWBase::Environment::get().getWorld()->getStore().gameSettings.find (typeGmst)->mI;
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->f>=
ref->base->data.weight)
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fLightMaxMod")->mF>=
ref->base->mData.mWeight)
return ESM::Skill::LightArmor;
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->f>=
ref->base->data.weight)
if (iWeight * MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMedMaxMod")->mF>=
ref->base->mData.mWeight)
return ESM::Skill::MediumArmor;
return ESM::Skill::HeavyArmor;
@ -170,7 +170,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Armor::registerSelf()
@ -207,7 +207,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Armor::hasToolTip (const MWWorld::Ptr& ptr) const
@ -215,7 +215,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -224,8 +224,8 @@ namespace MWClass
ptr.get<ESM::Armor>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
@ -235,26 +235,26 @@ namespace MWClass
int armorType = getEquipmentSkill(ptr);
std::string typeText;
if (armorType == ESM::Skill::LightArmor)
typeText = store.gameSettings.search("sLight")->str;
typeText = store.gameSettings.search("sLight")->mStr;
else if (armorType == ESM::Skill::MediumArmor)
typeText = store.gameSettings.search("sMedium")->str;
typeText = store.gameSettings.search("sMedium")->mStr;
else
typeText = store.gameSettings.search("sHeavy")->str;
typeText = store.gameSettings.search("sHeavy")->mStr;
text += "\n" + store.gameSettings.search("sArmorRating")->str + ": " + MWGui::ToolTips::toString(ref->base->data.armor);
text += "\n" + store.gameSettings.search("sArmorRating")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mArmor);
/// \todo store the current armor health somewhere
text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
text += "\n" + store.gameSettings.search("sCondition")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight) + " (" + typeText + ")";
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight) + " (" + typeText + ")";
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -266,7 +266,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const

@ -1,4 +1,3 @@
#include "book.hpp"
#include <components/esm/loadbook.hpp>
@ -44,7 +43,7 @@ namespace MWClass
ptr.get<ESM::Book>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -56,7 +55,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
@ -71,7 +70,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->script;
return ref->base->mScript;
}
int Book::getValue (const MWWorld::Ptr& ptr) const
@ -79,7 +78,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Book::registerSelf()
@ -104,7 +103,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Book::hasToolTip (const MWWorld::Ptr& ptr) const
@ -112,7 +111,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -121,22 +120,22 @@ namespace MWClass
ptr.get<ESM::Book>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -148,7 +147,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Clothing>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Clothing::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -85,7 +85,7 @@ namespace MWClass
std::vector<int> slots;
if (ref->base->data.type==ESM::Clothing::Ring)
if (ref->base->mData.mType==ESM::Clothing::Ring)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_LeftRing));
slots.push_back (int (MWWorld::InventoryStore::Slot_RightRing));
@ -108,7 +108,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
{
slots.push_back (int (sMapping[i][1]));
break;
@ -123,7 +123,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type==ESM::Clothing::Shoes)
if (ref->base->mData.mType==ESM::Clothing::Shoes)
return ESM::Skill::Unarmored;
return -1;
@ -134,7 +134,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Clothing::registerSelf()
@ -149,7 +149,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
if (ref->base->mData.mType == 8)
{
return std::string("Item Ring Up");
}
@ -161,7 +161,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
if (ref->base->data.type == 8)
if (ref->base->mData.mType == 8)
{
return std::string("Item Ring Down");
}
@ -173,7 +173,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Clothing::hasToolTip (const MWWorld::Ptr& ptr) const
@ -181,7 +181,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -190,22 +190,22 @@ namespace MWClass
ptr.get<ESM::Clothing>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
info.text = text;
@ -217,7 +217,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const

@ -76,7 +76,7 @@ namespace MWClass
ptr.get<ESM::Container>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -92,12 +92,12 @@ namespace MWClass
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
bool needKey = ptr.getCellRef().lockLevel>0;
bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false;
std::string keyName;
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{
if (it->getCellRef ().refID == ptr.getCellRef().key)
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);
@ -107,15 +107,15 @@ namespace MWClass
if (needKey && hasKey)
{
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>());
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
}
if (!needKey || hasKey)
{
if(ptr.getCellRef().trap.empty())
if(ptr.getCellRef().mTrap.empty())
{
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr));
return action;
@ -123,10 +123,10 @@ namespace MWClass
else
{
// Trap activation goes here
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
action->setSound(trapActivationSound);
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
return action;
}
}
@ -143,7 +143,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->name;
return ref->base->mName;
}
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
@ -159,7 +159,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->script;
return ref->base->mScript;
}
void Container::registerSelf()
@ -174,7 +174,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -183,19 +183,19 @@ namespace MWClass
ptr.get<ESM::Container>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
if (ref->ref.lockLevel > 0)
text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
if (ref->ref.trap != "")
text += "\n" + store.gameSettings.search("sTrapped")->str;
if (ref->ref.mLockLevel > 0)
text += "\n" + store.gameSettings.search("sLockLevel")->mStr + ": " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
if (ref->ref.mTrap != "")
text += "\n" + store.gameSettings.search("sTrapped")->mStr;
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -208,7 +208,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
return ref->base->weight;
return ref->base->mWeight;
}
float Container::getEncumbrance (const MWWorld::Ptr& ptr) const
@ -221,12 +221,12 @@ namespace MWClass
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
ptr.getCellRef().mLockLevel = lockLevel;
}
void Container::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
}
MWWorld::Ptr

@ -47,19 +47,19 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
// creature stats
data->mCreatureStats.getAttribute(0).set (ref->base->data.strength);
data->mCreatureStats.getAttribute(1).set (ref->base->data.intelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->data.willpower);
data->mCreatureStats.getAttribute(3).set (ref->base->data.agility);
data->mCreatureStats.getAttribute(4).set (ref->base->data.speed);
data->mCreatureStats.getAttribute(5).set (ref->base->data.endurance);
data->mCreatureStats.getAttribute(6).set (ref->base->data.personality);
data->mCreatureStats.getAttribute(7).set (ref->base->data.luck);
data->mCreatureStats.getHealth().set (ref->base->data.health);
data->mCreatureStats.getMagicka().set (ref->base->data.mana);
data->mCreatureStats.getFatigue().set (ref->base->data.fatigue);
data->mCreatureStats.setLevel(ref->base->data.level);
data->mCreatureStats.getAttribute(0).set (ref->base->mData.mStrength);
data->mCreatureStats.getAttribute(1).set (ref->base->mData.mIntelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->mData.mWillpower);
data->mCreatureStats.getAttribute(3).set (ref->base->mData.mAgility);
data->mCreatureStats.getAttribute(4).set (ref->base->mData.mSpeed);
data->mCreatureStats.getAttribute(5).set (ref->base->mData.mEndurance);
data->mCreatureStats.getAttribute(6).set (ref->base->mData.mPersonality);
data->mCreatureStats.getAttribute(7).set (ref->base->mData.mLuck);
data->mCreatureStats.getHealth().set (ref->base->mData.mHealth);
data->mCreatureStats.getMagicka().set (ref->base->mData.mMana);
data->mCreatureStats.getFatigue().set (ref->base->mData.mFatigue);
data->mCreatureStats.setLevel(ref->base->mData.mLevel);
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
data->mCreatureStats.setFight(ref->base->mAiData.mFight);
@ -67,8 +67,8 @@ namespace MWClass
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
// spells
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.list.begin());
iter!=ref->base->mSpells.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
iter!=ref->base->mSpells.mList.end(); ++iter)
data->mCreatureStats.getSpells().add (*iter);
// store
@ -81,7 +81,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->mId;
return ref->base->getId();
}
void Creature::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
@ -105,7 +105,7 @@ namespace MWClass
ptr.get<ESM::Creature>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->name;
return ref->base->mName;
}
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
@ -146,7 +146,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>();
return ref->base->script;
return ref->base->mScript;
}
void Creature::registerSelf()
@ -169,11 +169,11 @@ namespace MWClass
ptr.get<ESM::Creature>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;

@ -46,7 +46,7 @@ namespace MWClass
ptr.get<ESM::Door>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -58,10 +58,10 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
if (ref->ref.teleport && !ref->ref.destCell.empty()) // TODO doors that lead to exteriors
return ref->ref.destCell;
if (ref->ref.mTeleport && !ref->ref.mDestCell.empty()) // TODO doors that lead to exteriors
return ref->ref.mDestCell;
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
@ -70,7 +70,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
const std::string &openSound = ref->base->openSound;
const std::string &openSound = ref->base->mOpenSound;
//const std::string &closeSound = ref->base->closeSound;
const std::string lockedSound = "LockedDoor";
const std::string trapActivationSound = "Disarm Trap Fail";
@ -78,12 +78,12 @@ namespace MWClass
MWWorld::Ptr player = MWBase::Environment::get().getWorld ()->getPlayer().getPlayer();
MWWorld::InventoryStore& invStore = MWWorld::Class::get(player).getInventoryStore(player);
bool needKey = ptr.getCellRef().lockLevel>0;
bool needKey = ptr.getCellRef().mLockLevel>0;
bool hasKey = false;
std::string keyName;
for (MWWorld::ContainerStoreIterator it = invStore.begin(); it != invStore.end(); ++it)
{
if (it->getCellRef ().refID == ptr.getCellRef().key)
if (it->getCellRef ().mRefID == ptr.getCellRef().mKey)
{
hasKey = true;
keyName = MWWorld::Class::get(*it).getName(*it);
@ -93,33 +93,33 @@ namespace MWClass
if (needKey && hasKey)
{
MWBase::Environment::get().getWindowManager ()->messageBox (keyName + " #{sKeyUsed}", std::vector<std::string>());
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
// using a key disarms the trap
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
}
if (!needKey || hasKey)
{
if(!ptr.getCellRef().trap.empty())
if(!ptr.getCellRef().mTrap.empty())
{
// Trap activation
std::cout << "Activated trap: " << ptr.getCellRef().trap << std::endl;
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
action->setSound(trapActivationSound);
ptr.getCellRef().trap = "";
ptr.getCellRef().mTrap = "";
return action;
}
if (ref->ref.teleport)
if (ref->ref.mTeleport)
{
// teleport door
/// \todo remove this if clause once ActionTeleport can also support other actors
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
{
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.mDestCell, ref->ref.mDoorDest));
action->setSound(openSound);
@ -158,12 +158,12 @@ namespace MWClass
if (lockLevel<0)
lockLevel = 0;
ptr.getCellRef().lockLevel = lockLevel;
ptr.getCellRef().mLockLevel = lockLevel;
}
void Door::unlock (const MWWorld::Ptr& ptr) const
{
ptr.getCellRef().lockLevel = 0;
ptr.getCellRef().mLockLevel = 0;
}
std::string Door::getScript (const MWWorld::Ptr& ptr) const
@ -171,7 +171,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return ref->base->script;
return ref->base->mScript;
}
void Door::registerSelf()
@ -186,7 +186,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -195,45 +195,45 @@ namespace MWClass
ptr.get<ESM::Door>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
if (ref->ref.teleport)
if (ref->ref.mTeleport)
{
std::string dest;
if (ref->ref.destCell != "")
if (ref->ref.mDestCell != "")
{
// door leads to an interior, use interior name as tooltip
dest = ref->ref.destCell;
dest = ref->ref.mDestCell;
}
else
{
// door leads to exterior, use cell name (if any), otherwise translated region name
int x,y;
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.doorDest.pos[0], ref->ref.doorDest.pos[1], x, y);
MWBase::Environment::get().getWorld()->positionToIndex (ref->ref.mDoorDest.pos[0], ref->ref.mDoorDest.pos[1], x, y);
const ESM::Cell* cell = store.cells.findExt(x,y);
if (cell->name != "")
dest = cell->name;
if (cell->mName != "")
dest = cell->mName;
else
{
const ESM::Region* region = store.regions.search(cell->region);
dest = region->name;
const ESM::Region* region = store.regions.search(cell->mRegion);
dest = region->mName;
}
}
text += "\n" + store.gameSettings.search("sTo")->str;
text += "\n" + store.gameSettings.search("sTo")->mStr;
text += "\n"+dest;
}
if (ref->ref.lockLevel > 0)
text += "\n" + store.gameSettings.search("sLockLevel")->str + ": " + MWGui::ToolTips::toString(ref->ref.lockLevel);
if (ref->ref.trap != "")
text += "\n" + store.gameSettings.search("sTrapped")->str;
if (ref->ref.mLockLevel > 0)
text += "\n" + store.gameSettings.search("sLockLevel")->mStr + ": " + MWGui::ToolTips::toString(ref->ref.mLockLevel);
if (ref->ref.mTrap != "")
text += "\n" + store.gameSettings.search("sTrapped")->mStr;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;

@ -25,7 +25,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->mId;
return ref->base->getId();
}
void Ingredient::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
@ -52,7 +52,7 @@ namespace MWClass
ptr.get<ESM::Ingredient>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -64,7 +64,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
@ -82,7 +82,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->script;
return ref->base->mScript;
}
int Ingredient::getValue (const MWWorld::Ptr& ptr) const
@ -90,7 +90,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Ingredient::hasToolTip (const MWWorld::Ptr& ptr) const
@ -133,7 +133,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -142,30 +142,30 @@ namespace MWClass
ptr.get<ESM::Ingredient>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
MWGui::Widgets::SpellEffectList list;
for (int i=0; i<4; ++i)
{
if (ref->base->data.effectID[i] < 0)
if (ref->base->mData.mEffectID[i] < 0)
continue;
MWGui::Widgets::SpellEffectParams params;
params.mEffectID = ref->base->data.effectID[i];
params.mAttribute = ref->base->data.attributes[i];
params.mSkill = ref->base->data.skills[i];
params.mEffectID = ref->base->mData.mEffectID[i];
params.mAttribute = ref->base->mData.mAttributes[i];
params.mSkill = ref->base->mData.mSkills[i];
list.push_back(params);
}
info.effects = list;

@ -29,7 +29,7 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
MWRender::Objects& objects = renderingInterface.getObjects();
objects.insertBegin(ptr, ptr.getRefData().isEnabled(), false);
@ -37,11 +37,11 @@ namespace MWClass
if (!model.empty())
objects.insertMesh(ptr, "meshes\\" + model);
const int color = ref->base->data.color;
const int color = ref->base->mData.mColor;
const float r = ((color >> 0) & 0xFF) / 255.0f;
const float g = ((color >> 8) & 0xFF) / 255.0f;
const float b = ((color >> 16) & 0xFF) / 255.0f;
const float radius = float (ref->base->data.radius);
const float radius = float (ref->base->mData.mRadius);
objects.insertLight (ptr, r, g, b, radius);
}
@ -51,13 +51,13 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if(!model.empty()) {
physics.insertObjectPhysics(ptr, "meshes\\" + model);
}
if (!ref->base->sound.empty()) {
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->sound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
if (!ref->base->mSound.empty()) {
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->base->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
}
}
@ -67,7 +67,7 @@ namespace MWClass
ptr.get<ESM::Light>();
assert (ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -79,10 +79,10 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (ref->base->model.empty())
if (ref->base->mModel.empty())
return "";
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
@ -91,7 +91,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
if (!(ref->base->data.flags & ESM::Light::Carry))
if (!(ref->base->mData.mFlags & ESM::Light::Carry))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
@ -106,7 +106,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Light::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -116,7 +116,7 @@ namespace MWClass
std::vector<int> slots;
if (ref->base->data.flags & ESM::Light::Carry)
if (ref->base->mData.mFlags & ESM::Light::Carry)
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedLeft));
return std::make_pair (slots, false);
@ -127,7 +127,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Light::registerSelf()
@ -153,7 +153,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Light::hasToolTip (const MWWorld::Ptr& ptr) const
@ -161,7 +161,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -170,19 +170,19 @@ namespace MWClass
ptr.get<ESM::Light>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Tool>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
@ -75,7 +75,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Lockpick::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -92,7 +92,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Lockpick::registerSelf()
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Lockpick::hasToolTip (const MWWorld::Ptr& ptr) const
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Tool> *ref =
ptr.get<ESM::Tool>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -134,8 +134,8 @@ namespace MWClass
ptr.get<ESM::Tool>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
@ -143,14 +143,14 @@ namespace MWClass
/// \todo store remaining uses somewhere
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sUses")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n" + store.gameSettings.search("sQuality")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -48,7 +48,7 @@ namespace MWClass
ptr.get<ESM::Miscellaneous>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -60,7 +60,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
@ -78,7 +78,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->script;
return ref->base->mScript;
}
int Miscellaneous::getValue (const MWWorld::Ptr& ptr) const
@ -86,7 +86,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Miscellaneous::registerSelf()
@ -101,7 +101,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr)
{
return std::string("Item Gold Up");
}
@ -113,7 +113,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
if (ref->base->name == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
if (ref->base->mName == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr)
{
return std::string("Item Gold Down");
}
@ -125,7 +125,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Miscellaneous::hasToolTip (const MWWorld::Ptr& ptr) const
@ -133,7 +133,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -147,9 +147,9 @@ namespace MWClass
int count = ptr.getRefData().getCount();
bool isGold = (ref->base->name == store.gameSettings.search("sGold")->str);
bool isGold = (ref->base->mName == store.gameSettings.search("sGold")->mStr);
if (isGold && count == 1)
count = ref->base->data.value;
count = ref->base->mData.mValue;
std::string countString;
if (!isGold)
@ -157,26 +157,26 @@ namespace MWClass
else // gold displays its count also if it's 1.
countString = " (" + boost::lexical_cast<std::string>(count) + ")";
info.caption = ref->base->name + countString;
info.icon = ref->base->icon;
info.caption = ref->base->mName + countString;
info.icon = ref->base->mIcon;
if (ref->ref.soul != "")
if (ref->ref.mSoul != "")
{
const ESM::Creature *creature = store.creatures.search(ref->ref.soul);
info.caption += " (" + creature->name + ")";
const ESM::Creature *creature = store.creatures.search(ref->ref.mSoul);
info.caption += " (" + creature->mName + ")";
}
std::string text;
if (!isGold)
{
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
}
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -192,7 +192,7 @@ namespace MWClass
const ESMS::ESMStore &store =
MWBase::Environment::get().getWorld()->getStore();
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.search("sGold")->str) {
if (MWWorld::Class::get(ptr).getName(ptr) == store.gameSettings.search("sGold")->mStr) {
int goldAmount = ptr.getRefData().getCount();
std::string base = "Gold_001";

@ -61,43 +61,43 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
// NPC stats
if (!ref->base->faction.empty())
if (!ref->base->mFaction.empty())
{
std::string faction = ref->base->faction;
std::string faction = ref->base->mFaction;
boost::algorithm::to_lower(faction);
if(ref->base->npdt52.gold != -10)
if(ref->base->mNpdt52.mGold != -10)
{
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt52.rank;
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt52.mRank;
}
else
{
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->npdt12.rank;
data->mNpcStats.getFactionRanks()[faction] = (int)ref->base->mNpdt12.mRank;
}
}
// creature stats
if(ref->base->npdt52.gold != -10)
if(ref->base->mNpdt52.mGold != -10)
{
for (int i=0; i<27; ++i)
data->mNpcStats.getSkill (i).setBase (ref->base->npdt52.skills[i]);
data->mCreatureStats.getAttribute(0).set (ref->base->npdt52.strength);
data->mCreatureStats.getAttribute(1).set (ref->base->npdt52.intelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->npdt52.willpower);
data->mCreatureStats.getAttribute(3).set (ref->base->npdt52.agility);
data->mCreatureStats.getAttribute(4).set (ref->base->npdt52.speed);
data->mCreatureStats.getAttribute(5).set (ref->base->npdt52.endurance);
data->mCreatureStats.getAttribute(6).set (ref->base->npdt52.personality);
data->mCreatureStats.getAttribute(7).set (ref->base->npdt52.luck);
data->mCreatureStats.getHealth().set (ref->base->npdt52.health);
data->mCreatureStats.getMagicka().set (ref->base->npdt52.mana);
data->mCreatureStats.getFatigue().set (ref->base->npdt52.fatigue);
data->mCreatureStats.setLevel(ref->base->npdt52.level);
data->mNpcStats.getSkill (i).setBase (ref->base->mNpdt52.mSkills[i]);
data->mCreatureStats.getAttribute(0).set (ref->base->mNpdt52.mStrength);
data->mCreatureStats.getAttribute(1).set (ref->base->mNpdt52.mIntelligence);
data->mCreatureStats.getAttribute(2).set (ref->base->mNpdt52.mWillpower);
data->mCreatureStats.getAttribute(3).set (ref->base->mNpdt52.mAgility);
data->mCreatureStats.getAttribute(4).set (ref->base->mNpdt52.mSpeed);
data->mCreatureStats.getAttribute(5).set (ref->base->mNpdt52.mEndurance);
data->mCreatureStats.getAttribute(6).set (ref->base->mNpdt52.mPersonality);
data->mCreatureStats.getAttribute(7).set (ref->base->mNpdt52.mLuck);
data->mCreatureStats.getHealth().set (ref->base->mNpdt52.mHealth);
data->mCreatureStats.getMagicka().set (ref->base->mNpdt52.mMana);
data->mCreatureStats.getFatigue().set (ref->base->mNpdt52.mFatigue);
data->mCreatureStats.setLevel(ref->base->mNpdt52.mLevel);
}
else
{
/// \todo do something with npdt12 maybe:p
/// \todo do something with mNpdt12 maybe:p
}
data->mCreatureStats.setHello(ref->base->mAiData.mHello);
@ -106,8 +106,8 @@ namespace MWClass
data->mCreatureStats.setAlarm(ref->base->mAiData.mAlarm);
// spells
for (std::vector<std::string>::const_iterator iter (ref->base->spells.list.begin());
iter!=ref->base->spells.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (ref->base->mSpells.mList.begin());
iter!=ref->base->mSpells.mList.end(); ++iter)
data->mCreatureStats.getSpells().add (*iter);
// store
@ -120,7 +120,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->mId;
return ref->base->getId();
}
void Npc::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
@ -140,7 +140,7 @@ namespace MWClass
ptr.get<ESM::NPC>();
assert(ref->base != NULL);
std::string headID = ref->base->head;
std::string headID = ref->base->mHead;
int end = headID.find_last_of("head_") - 4;
std::string bodyRaceID = headID.substr(0, end);
@ -160,7 +160,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->name;
return ref->base->mName;
}
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
@ -204,7 +204,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref =
ptr.get<ESM::NPC>();
return ref->base->script;
return ref->base->mScript;
}
void Npc::setForceStance (const MWWorld::Ptr& ptr, Stance stance, bool force) const
@ -299,7 +299,7 @@ namespace MWClass
vector.x = - getMovementSettings (ptr).mLeftRight * 127;
vector.y = getMovementSettings (ptr).mForwardBackward * 127;
vector.z = getMovementSettings(ptr).mUpDown * 127;
vector.z = getMovementSettings(ptr).mUpDown * 127;
//if (getStance (ptr, Run, false))
// vector *= 2;
@ -326,11 +326,11 @@ namespace MWClass
ptr.get<ESM::NPC>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name;
info.caption = ref->base->mName;
std::string text;
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
info.text = text;
return info;
@ -375,7 +375,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
const ESM::Class *class_ = MWBase::Environment::get().getWorld()->getStore().classes.find (
ref->base->cls);
ref->base->mClass);
stats.useSkill (skill, *class_, usageType);
}

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Potion>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
@ -76,7 +76,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->script;
return ref->base->mScript;
}
int Potion::getValue (const MWWorld::Ptr& ptr) const
@ -84,7 +84,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Potion::registerSelf()
@ -109,7 +109,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Potion::hasToolTip (const MWWorld::Ptr& ptr) const
@ -117,7 +117,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Potion> *ref =
ptr.get<ESM::Potion>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -126,22 +126,22 @@ namespace MWClass
ptr.get<ESM::Potion>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->effects);
info.effects = MWGui::Widgets::MWEffectList::effectListFromESM(&ref->base->mEffects);
info.isPotion = true;
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -159,7 +159,7 @@ namespace MWClass
MWWorld::Ptr actor = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
boost::shared_ptr<MWWorld::Action> action (
new MWWorld::ActionApply (actor, ref->base->mId));
new MWWorld::ActionApply (actor, ref->base->getId()));
action->setSound ("Drink");

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Probe>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const
@ -74,7 +74,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Probe::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -91,7 +91,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Probe::registerSelf()
@ -116,7 +116,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Probe::hasToolTip (const MWWorld::Ptr& ptr) const
@ -124,7 +124,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Probe> *ref =
ptr.get<ESM::Probe>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -133,8 +133,8 @@ namespace MWClass
ptr.get<ESM::Probe>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
@ -142,14 +142,14 @@ namespace MWClass
/// \todo store remaining uses somewhere
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sUses")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n" + store.gameSettings.search("sQuality")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -43,7 +43,7 @@ namespace MWClass
ptr.get<ESM::Repair>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -55,7 +55,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
@ -73,7 +73,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->script;
return ref->base->mScript;
}
int Repair::getValue (const MWWorld::Ptr& ptr) const
@ -81,7 +81,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Repair::registerSelf()
@ -106,7 +106,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Repair::hasToolTip (const MWWorld::Ptr& ptr) const
@ -114,7 +114,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Repair> *ref =
ptr.get<ESM::Repair>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Repair::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -123,22 +123,22 @@ namespace MWClass
ptr.get<ESM::Repair>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
std::string text;
/// \todo store remaining uses somewhere
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
text += "\n" + store.gameSettings.search("sUses")->str + ": " + MWGui::ToolTips::toString(ref->base->data.uses);
text += "\n" + store.gameSettings.search("sQuality")->str + ": " + MWGui::ToolTips::toString(ref->base->data.quality);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sUses")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mUses);
text += "\n" + store.gameSettings.search("sQuality")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mQuality);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;

@ -35,7 +35,7 @@ namespace MWClass
ptr.get<ESM::Static>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}

@ -45,7 +45,7 @@ namespace MWClass
ptr.get<ESM::Weapon>();
assert(ref->base != NULL);
const std::string &model = ref->base->model;
const std::string &model = ref->base->mModel;
if (!model.empty()) {
return "meshes\\" + model;
}
@ -57,7 +57,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->name;
return ref->base->mName;
}
boost::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
@ -80,7 +80,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.health;
return ref->base->mData.mHealth;
}
std::string Weapon::getScript (const MWWorld::Ptr& ptr) const
@ -88,7 +88,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->script;
return ref->base->mScript;
}
std::pair<std::vector<int>, bool> Weapon::getEquipmentSlots (const MWWorld::Ptr& ptr) const
@ -99,12 +99,12 @@ namespace MWClass
std::vector<int> slots;
bool stack = false;
if (ref->base->data.type==ESM::Weapon::Arrow || ref->base->data.type==ESM::Weapon::Bolt)
if (ref->base->mData.mType==ESM::Weapon::Arrow || ref->base->mData.mType==ESM::Weapon::Bolt)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_Ammunition));
stack = true;
}
else if (ref->base->data.type==ESM::Weapon::MarksmanThrown)
else if (ref->base->mData.mType==ESM::Weapon::MarksmanThrown)
{
slots.push_back (int (MWWorld::InventoryStore::Slot_CarriedRight));
stack = true;
@ -139,7 +139,7 @@ namespace MWClass
};
for (int i=0; i<size; ++i)
if (sMapping[i][0]==ref->base->data.type)
if (sMapping[i][0]==ref->base->mData.mType)
return sMapping[i][1];
return -1;
@ -150,7 +150,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.value;
return ref->base->mData.mValue;
}
void Weapon::registerSelf()
@ -165,7 +165,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
int type = ref->base->mData.mType;
// Ammo
if (type == 12 || type == 13)
{
@ -211,7 +211,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
int type = ref->base->data.type;
int type = ref->base->mData.mType;
// Ammo
if (type == 12 || type == 13)
{
@ -257,7 +257,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->icon;
return ref->base->mIcon;
}
bool Weapon::hasToolTip (const MWWorld::Ptr& ptr) const
@ -265,7 +265,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return (ref->base->name != "");
return (ref->base->mName != "");
}
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::Ptr& ptr) const
@ -274,17 +274,17 @@ namespace MWClass
ptr.get<ESM::Weapon>();
MWGui::ToolTipInfo info;
info.caption = ref->base->name + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->icon;
info.caption = ref->base->mName + MWGui::ToolTips::getCountString(ptr.getRefData().getCount());
info.icon = ref->base->mIcon;
const ESMS::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
std::string text;
// weapon type & damage. arrows / bolts don't have his info.
if (ref->base->data.type < 12)
if (ref->base->mData.mType < 12)
{
text += "\n" + store.gameSettings.search("sType")->str + " ";
text += "\n" + store.gameSettings.search("sType")->mStr + " ";
std::map <int, std::pair <std::string, std::string> > mapping;
mapping[ESM::Weapon::ShortBladeOneHand] = std::make_pair("sSkillShortblade", "sOneHanded");
@ -300,49 +300,49 @@ namespace MWClass
mapping[ESM::Weapon::MarksmanCrossbow] = std::make_pair("sSkillMarksman", "");
mapping[ESM::Weapon::MarksmanThrown] = std::make_pair("sSkillMarksman", "");
std::string type = mapping[ref->base->data.type].first;
std::string oneOrTwoHanded = mapping[ref->base->data.type].second;
std::string type = mapping[ref->base->mData.mType].first;
std::string oneOrTwoHanded = mapping[ref->base->mData.mType].second;
text += store.gameSettings.search(type)->str +
((oneOrTwoHanded != "") ? ", " + store.gameSettings.search(oneOrTwoHanded)->str : "");
text += store.gameSettings.search(type)->mStr +
((oneOrTwoHanded != "") ? ", " + store.gameSettings.search(oneOrTwoHanded)->mStr : "");
// weapon damage
if (ref->base->data.type >= 9)
if (ref->base->mData.mType >= 9)
{
// marksman
text += "\n" + store.gameSettings.search("sAttack")->str + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
text += "\n" + store.gameSettings.search("sAttack")->mStr + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
}
else
{
// Chop
text += "\n" + store.gameSettings.search("sChop")->str + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.chop[1]));
text += "\n" + store.gameSettings.search("sChop")->mStr + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mChop[1]));
// Slash
text += "\n" + store.gameSettings.search("sSlash")->str + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.slash[1]));
text += "\n" + store.gameSettings.search("sSlash")->mStr + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mSlash[1]));
// Thrust
text += "\n" + store.gameSettings.search("sThrust")->str + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->data.thrust[1]));
text += "\n" + store.gameSettings.search("sThrust")->mStr + ": "
+ MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[0]))
+ " - " + MWGui::ToolTips::toString(static_cast<int>(ref->base->mData.mThrust[1]));
}
}
/// \todo store the current weapon health somewhere
if (ref->base->data.type < 11) // thrown weapons and arrows/bolts don't have health, only quantity
text += "\n" + store.gameSettings.search("sCondition")->str + ": " + MWGui::ToolTips::toString(ref->base->data.health);
if (ref->base->mData.mType < 11) // thrown weapons and arrows/bolts don't have health, only quantity
text += "\n" + store.gameSettings.search("sCondition")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mHealth);
text += "\n" + store.gameSettings.search("sWeight")->str + ": " + MWGui::ToolTips::toString(ref->base->data.weight);
text += MWGui::ToolTips::getValueString(ref->base->data.value, store.gameSettings.search("sValue")->str);
text += "\n" + store.gameSettings.search("sWeight")->mStr + ": " + MWGui::ToolTips::toString(ref->base->mData.mWeight);
text += MWGui::ToolTips::getValueString(ref->base->mData.mValue, store.gameSettings.search("sValue")->mStr);
info.enchant = ref->base->enchant;
info.enchant = ref->base->mEnchant;
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ref->ref.owner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->script, "Script");
text += MWGui::ToolTips::getMiscString(ref->ref.mOwner, "Owner");
text += MWGui::ToolTips::getMiscString(ref->base->mScript, "Script");
}
info.text = text;
@ -355,7 +355,7 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Weapon> *ref =
ptr.get<ESM::Weapon>();
return ref->base->enchant;
return ref->base->mEnchant;
}
boost::shared_ptr<MWWorld::Action> Weapon::use (const MWWorld::Ptr& ptr) const

@ -95,24 +95,24 @@ namespace
int i = 0;
for (; i<static_cast<int> (script->varNames.size()); ++i)
if (script->varNames[i]==name)
for (; i<static_cast<int> (script->mVarNames.size()); ++i)
if (script->mVarNames[i]==name)
break;
if (i>=static_cast<int> (script->varNames.size()))
if (i>=static_cast<int> (script->mVarNames.size()))
return false; // script does not have a variable of this name
const MWScript::Locals& locals = actor.getRefData().getLocals();
if (i<script->data.numShorts)
if (i<script->mData.mNumShorts)
return selectCompare (comp, locals.mShorts[i], value);
else
i -= script->data.numShorts;
i -= script->mData.mNumShorts;
if (i<script->data.numLongs)
if (i<script->mData.mNumLongs)
return selectCompare (comp, locals.mLongs[i], value);
else
i -= script->data.numShorts;
i -= script->mData.mNumShorts;
return selectCompare (comp, locals.mFloats.at (i), value);
}
@ -160,16 +160,16 @@ namespace MWDialogue
{
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter)
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.mSelects.end(); ++iter)
{
ESM::DialInfo::SelectStruct select = *iter;
char type = select.selectRule[1];
char type = select.mSelectRule[1];
if(type == '1')
{
char comp = select.selectRule[4];
std::string name = select.selectRule.substr (5);
std::string function = select.selectRule.substr(2,2);
char comp = select.mSelectRule[4];
std::string name = select.mSelectRule.substr (5);
std::string function = select.mSelectRule.substr(2,2);
int ifunction;
std::istringstream iss(function);
@ -177,19 +177,19 @@ namespace MWDialogue
switch(ifunction)
{
case 39://PC Expelled
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 40://PC Common Disease
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 41://PC Blight Disease
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 43://PC Crime level
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 46://Same faction
@ -205,71 +205,71 @@ namespace MWDialogue
std::string NPCFaction = NPCstats.getFactionRanks().begin()->first;
if(PCstats.getFactionRanks().find(toLower(NPCFaction)) != PCstats.getFactionRanks().end()) sameFaction = 1;
}
if(!selectCompare<int,int>(comp,sameFaction,select.i)) return false;
if(!selectCompare<int,int>(comp,sameFaction,select.mI)) return false;
}
break;
case 48://Detected
if(!selectCompare<int,int>(comp,1,select.i)) return false;
if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break;
case 49://Alarmed
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 50://choice
if(choice)
{
if(!selectCompare<int,int>(comp,mChoice,select.i)) return false;
if(!selectCompare<int,int>(comp,mChoice,select.mI)) return false;
}
break;
case 60://PC Vampire
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 61://Level
if(!selectCompare<int,int>(comp,1,select.i)) return false;
if(!selectCompare<int,int>(comp,1,select.mI)) return false;
break;
case 62://Attacked
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 63://Talked to PC
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 64://PC Health
if(!selectCompare<int,int>(comp,50,select.i)) return false;
if(!selectCompare<int,int>(comp,50,select.mI)) return false;
break;
case 65://Creature target
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 66://Friend hit
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 67://Fight
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 68://Hello????
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 69://Alarm
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 70://Flee
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
case 71://Should Attack
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
break;
default:
@ -287,13 +287,13 @@ namespace MWDialogue
{
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
char type = select.selectRule[1];
char type = select.mSelectRule[1];
if (type!='0')
{
char comp = select.selectRule[4];
std::string name = select.selectRule.substr (5);
std::string function = select.selectRule.substr(1,2);
char comp = select.mSelectRule[4];
std::string name = select.mSelectRule.substr (5);
std::string function = select.mSelectRule.substr(1,2);
switch (type)
{
@ -303,15 +303,15 @@ namespace MWDialogue
case '2': // global
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (!checkGlobal (comp, toLower (name), select.i))
if (!checkGlobal (comp, toLower (name), select.mI))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (!checkGlobal (comp, toLower (name), select.f))
if (!checkGlobal (comp, toLower (name), select.mF))
return false;
}
else
@ -322,16 +322,16 @@ namespace MWDialogue
case '3': // local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (!checkLocal (comp, toLower (name), select.i, actor,
if (!checkLocal (comp, toLower (name), select.mI, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (!checkLocal (comp, toLower (name), select.f, actor,
if (!checkLocal (comp, toLower (name), select.mF, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
@ -342,9 +342,9 @@ namespace MWDialogue
return true;
case '4'://journal
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
if(!selectCompare<int,int>(comp,MWBase::Environment::get().getJournal()->getJournalIndex(toLower(name)),select.i)) return false;
if(!selectCompare<int,int>(comp,MWBase::Environment::get().getJournal()->getJournalIndex(toLower(name)),select.mI)) return false;
}
else
throw std::runtime_error (
@ -360,22 +360,22 @@ namespace MWDialogue
int sum = 0;
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
if (toLower(iter->getCellRef().refID) == toLower(name))
if (toLower(iter->getCellRef().mRefID) == toLower(name))
sum += iter->getRefData().getCount();
if(!selectCompare<int,int>(comp,sum,select.i)) return false;
if(!selectCompare<int,int>(comp,sum,select.mI)) return false;
}
return true;
case '6'://dead
if(!selectCompare<int,int>(comp,0,select.i)) return false;
if(!selectCompare<int,int>(comp,0,select.mI)) return false;
case '7':// not ID
if(select.type==ESM::VT_String ||select.type==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
if(select.mType==ESM::VT_String ||select.mType==ESM::VT_Int)//bug in morrowind here? it's not a short, it's a string
{
int isID = int(toLower(name)==toLower(MWWorld::Class::get (actor).getId (actor)));
if (selectCompare<int,int>(comp,!isID,select.i)) return false;
if (selectCompare<int,int>(comp,!isID,select.mI)) return false;
}
else
throw std::runtime_error (
@ -387,11 +387,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isFaction = int(toLower(npc->base->faction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.i))
int isFaction = int(toLower(npc->base->mFaction) == toLower(name));
if(selectCompare<int,int>(comp,!isFaction,select.mI))
return false;
}
else
@ -404,11 +404,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isClass = int(toLower(npc->base->cls) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.i))
int isClass = int(toLower(npc->base->mClass) == toLower(name));
if(selectCompare<int,int>(comp,!isClass,select.mI))
return false;
}
else
@ -421,11 +421,11 @@ namespace MWDialogue
if (isCreature)
return false;
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
int isRace = int(toLower(npc->base->race) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.i))
int isRace = int(toLower(npc->base->mRace) == toLower(name));
if(selectCompare<int,int>(comp,!isRace,select.mI))
return false;
}
else
@ -435,10 +435,10 @@ namespace MWDialogue
return true;
case 'B'://not Cell
if(select.type==ESM::VT_Int)
if(select.mType==ESM::VT_Int)
{
int isCell = int(toLower(actor.getCell()->cell->name) == toLower(name));
if(selectCompare<int,int>(comp,!isCell,select.i))
int isCell = int(toLower(actor.getCell()->cell->mName) == toLower(name));
if(selectCompare<int,int>(comp,!isCell,select.mI))
return false;
}
else
@ -447,16 +447,16 @@ namespace MWDialogue
return true;
case 'C'://not local
if (select.type==ESM::VT_Short || select.type==ESM::VT_Int ||
select.type==ESM::VT_Long)
if (select.mType==ESM::VT_Short || select.mType==ESM::VT_Int ||
select.mType==ESM::VT_Long)
{
if (checkLocal (comp, toLower (name), select.i, actor,
if (checkLocal (comp, toLower (name), select.mI, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
else if (select.type==ESM::VT_Float)
else if (select.mType==ESM::VT_Float)
{
if (checkLocal (comp, toLower (name), select.f, actor,
if (checkLocal (comp, toLower (name), select.mF, actor,
MWBase::Environment::get().getWorld()->getStore()))
return false;
}
@ -480,12 +480,12 @@ namespace MWDialogue
bool isCreature = (actor.getTypeName() != typeid(ESM::NPC).name());
// actor id
if (!info.actor.empty())
if (toLower (info.actor)!=MWWorld::Class::get (actor).getId (actor))
if (!info.mActor.empty())
if (toLower (info.mActor)!=MWWorld::Class::get (actor).getId (actor))
return false;
//NPC race
if (!info.race.empty())
if (!info.mRace.empty())
{
if (isCreature)
return false;
@ -495,12 +495,12 @@ namespace MWDialogue
if (!cellRef)
return false;
if (toLower (info.race)!=toLower (cellRef->base->race))
if (toLower (info.mRace)!=toLower (cellRef->base->mRace))
return false;
}
//NPC class
if (!info.clas.empty())
if (!info.mClass.empty())
{
if (isCreature)
return false;
@ -510,23 +510,23 @@ namespace MWDialogue
if (!cellRef)
return false;
if (toLower (info.clas)!=toLower (cellRef->base->cls))
if (toLower (info.mClass)!=toLower (cellRef->base->mClass))
return false;
}
//NPC faction
if (!info.npcFaction.empty())
if (!info.mNpcFaction.empty())
{
if (isCreature)
return false;
//MWWorld::Class npcClass = MWWorld::Class::get(actor);
MWMechanics::NpcStats stats = MWWorld::Class::get(actor).getNpcStats(actor);
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.npcFaction));
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.mNpcFaction));
if(it!=stats.getFactionRanks().end())
{
//check rank
if(it->second < (int)info.data.rank) return false;
if(it->second < (int)info.mData.mRank) return false;
}
else
{
@ -536,14 +536,14 @@ namespace MWDialogue
}
// TODO check player faction
if(!info.pcFaction.empty())
if(!info.mPcFaction.empty())
{
MWMechanics::NpcStats stats = MWWorld::Class::get(MWBase::Environment::get().getWorld()->getPlayer().getPlayer()).getNpcStats(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.pcFaction));
std::map<std::string,int>::iterator it = stats.getFactionRanks().find(toLower(info.mPcFaction));
if(it!=stats.getFactionRanks().end())
{
//check rank
if(it->second < (int)info.data.PCrank) return false;
if(it->second < (int)info.mData.mPCrank) return false;
}
else
{
@ -556,24 +556,24 @@ namespace MWDialogue
if (!isCreature)
{
MWWorld::LiveCellRef<ESM::NPC>* npc = actor.get<ESM::NPC>();
if(npc->base->flags&npc->base->Female)
if(npc->base->mFlags & npc->base->Female)
{
if(static_cast<int> (info.data.gender)==0) return false;
if(static_cast<int> (info.mData.mGender)==0) return false;
}
else
{
if(static_cast<int> (info.data.gender)==1) return false;
if(static_cast<int> (info.mData.mGender)==1) return false;
}
}
// check cell
if (!info.cell.empty())
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->name != info.cell)
if (!info.mCell.empty())
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mName != info.mCell)
return false;
// TODO check DATAstruct
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.selects.begin());
iter != info.selects.end(); ++iter)
for (std::vector<ESM::DialInfo::SelectStruct>::const_iterator iter (info.mSelects.begin());
iter != info.mSelects.end(); ++iter)
if (!isMatching (actor, *iter))
return false;
@ -646,7 +646,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{
ESM::Dialogue ndialogue = it->second;
if(ndialogue.type == ESM::Dialogue::Greeting)
if(ndialogue.mType == ESM::Dialogue::Greeting)
{
if (greetingFound) break;
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
@ -654,15 +654,15 @@ namespace MWDialogue
{
if (isMatching (actor, *iter) && functionFilter(mActor,*iter,true))
{
if (!iter->sound.empty())
if (!iter->mSound.empty())
{
// TODO play sound
}
std::string text = iter->response;
std::string text = iter->mResponse;
parseText(text);
win->addText(iter->response);
executeScript(iter->resultScript);
win->addText(iter->mResponse);
executeScript(iter->mResultScript);
greetingFound = true;
mLastTopic = it->first;
mLastDialogue = *iter;
@ -745,7 +745,7 @@ namespace MWDialogue
for(ESMS::RecListCaseT<ESM::Dialogue>::MapType::iterator it = dialogueList.begin(); it!=dialogueList.end();it++)
{
ESM::Dialogue ndialogue = it->second;
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter (it->second.mInfo.begin());
iter!=it->second.mInfo.end(); ++iter)
@ -813,21 +813,21 @@ namespace MWDialogue
if(mDialogueMap.find(keyword) != mDialogueMap.end())
{
ESM::Dialogue ndialogue = mDialogueMap[keyword];
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter)
{
if (isMatching (mActor, *iter) && functionFilter(mActor,*iter,true))
{
std::string text = iter->response;
std::string script = iter->resultScript;
std::string text = iter->mResponse;
std::string script = iter->mResultScript;
parseText(text);
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
win->addTitle(keyword);
win->addText(iter->response);
win->addText(iter->mResponse);
executeScript(script);
@ -858,7 +858,7 @@ namespace MWDialogue
if(mDialogueMap.find(mLastTopic) != mDialogueMap.end())
{
ESM::Dialogue ndialogue = mDialogueMap[mLastTopic];
if(ndialogue.type == ESM::Dialogue::Topic)
if(ndialogue.mType == ESM::Dialogue::Topic)
{
for (std::vector<ESM::DialInfo>::const_iterator iter = ndialogue.mInfo.begin();
iter!=ndialogue.mInfo.end(); ++iter)
@ -869,10 +869,10 @@ namespace MWDialogue
mChoice = -1;
mIsInChoice = false;
MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow();
std::string text = iter->response;
std::string text = iter->mResponse;
parseText(text);
win->addText(text);
executeScript(iter->resultScript);
executeScript(iter->mResultScript);
mLastTopic = mLastTopic;
mLastDialogue = *iter;
break;

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==mInfoId)
return iter->response;
if (iter->getId() == mInfoId)
return iter->mResponse;
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
}
@ -39,9 +39,9 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->data.disposition==index) /// \todo cleanup info structure
if (iter->mData.mDisposition==index) /// \todo cleanup info structure
{
return iter->id;
return iter->getId();
}
throw std::runtime_error ("unknown journal index for topic " + topic);

@ -40,7 +40,7 @@ namespace MWDialogue
quest.addEntry (entry); // we are doing slicing on purpose here
std::vector<std::string> empty;
std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->str;
std::string notification = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sJournalEntry")->mStr;
MWBase::Environment::get().getWindowManager()->messageBox (notification, empty);
}

@ -22,8 +22,8 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->questStatus==ESM::DialInfo::QS_Name)
return iter->response;
if (iter->mQuestStatus==ESM::DialInfo::QS_Name)
return iter->mResponse;
return "";
}
@ -39,13 +39,13 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->data.disposition==index && iter->questStatus!=ESM::DialInfo::QS_Name)
if (iter->mData.mDisposition==index && iter->mQuestStatus!=ESM::DialInfo::QS_Name)
{
mIndex = index;
if (iter->questStatus==ESM::DialInfo::QS_Finished)
if (iter->mQuestStatus==ESM::DialInfo::QS_Finished)
mFinished = true;
else if (iter->questStatus==ESM::DialInfo::QS_Restart)
else if (iter->mQuestStatus==ESM::DialInfo::QS_Restart)
mFinished = false;
return;
@ -67,9 +67,9 @@ namespace MWDialogue
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==entry.mInfoId)
if (iter->getId() == entry.mInfoId)
{
index = iter->data.disposition; /// \todo cleanup info structure
index = iter->mData.mDisposition; /// \todo cleanup info structure
break;
}

@ -112,22 +112,22 @@ namespace MWGui
if (rand() % 2 == 0) /// \todo
{
ESM::Potion newPotion;
newPotion.name = mNameEdit->getCaption();
newPotion.mName = mNameEdit->getCaption();
ESM::EffectList effects;
for (unsigned int i=0; i<4; ++i)
{
if (mEffects.size() >= i+1)
{
ESM::ENAMstruct effect;
effect.effectID = mEffects[i].mEffectID;
effect.area = 0;
effect.range = ESM::RT_Self;
effect.skill = mEffects[i].mSkill;
effect.attribute = mEffects[i].mAttribute;
effect.magnMin = 1; /// \todo
effect.magnMax = 10; /// \todo
effect.duration = 60; /// \todo
effects.list.push_back(effect);
effect.mEffectID = mEffects[i].mEffectID;
effect.mArea = 0;
effect.mRange = ESM::RT_Self;
effect.mSkill = mEffects[i].mSkill;
effect.mAttribute = mEffects[i].mAttribute;
effect.mMagnMin = 1; /// \todo
effect.mMagnMax = 10; /// \todo
effect.mDuration = 60; /// \todo
effects.mList.push_back(effect);
}
}
@ -137,17 +137,17 @@ namespace MWGui
// have 0 weight when using ingredients with 0.1 weight respectively
float weight = 0;
if (mIngredient1->isUserString("ToolTipType"))
weight += mIngredient1->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient1->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient2->isUserString("ToolTipType"))
weight += mIngredient2->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient2->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient3->isUserString("ToolTipType"))
weight += mIngredient3->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
weight += mIngredient3->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
if (mIngredient4->isUserString("ToolTipType"))
weight += mIngredient4->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->data.weight;
newPotion.data.weight = weight / float(numIngreds);
weight += mIngredient4->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>()->base->mData.mWeight;
newPotion.mData.mWeight = weight / float(numIngreds);
newPotion.data.value = 100; /// \todo
newPotion.effects = effects;
newPotion.mData.mValue = 100; /// \todo
newPotion.mEffects = effects;
// pick a random mesh and icon
std::vector<std::string> names;
/// \todo is the mesh/icon dependent on alchemy skill?
@ -158,8 +158,8 @@ namespace MWGui
names.push_back("exclusive");
names.push_back("quality");
int random = rand() % names.size();
newPotion.model = "m\\misc_potion_" + names[random ] + "_01.nif";
newPotion.icon = "m\\tx_potion_" + names[random ] + "_01.dds";
newPotion.mModel = "m\\misc_potion_" + names[random ] + "_01.nif";
newPotion.mIcon = "m\\tx_potion_" + names[random ] + "_01.dds";
// check if a similiar potion record exists already
bool found = false;
@ -170,24 +170,24 @@ namespace MWGui
{
if (found) break;
if (it->second.data.value == newPotion.data.value
&& it->second.data.weight == newPotion.data.weight
&& it->second.name == newPotion.name
&& it->second.effects.list.size() == newPotion.effects.list.size())
if (it->second.mData.mValue == newPotion.mData.mValue
&& it->second.mData.mWeight == newPotion.mData.mWeight
&& it->second.mName == newPotion.mName
&& it->second.mEffects.mList.size() == newPotion.mEffects.mList.size())
{
// check effects
for (unsigned int i=0; i < it->second.effects.list.size(); ++i)
for (unsigned int i=0; i < it->second.mEffects.mList.size(); ++i)
{
const ESM::ENAMstruct& a = it->second.effects.list[i];
const ESM::ENAMstruct& b = newPotion.effects.list[i];
if (a.effectID == b.effectID
&& a.area == b.area
&& a.range == b.range
&& a.skill == b.skill
&& a.attribute == b.attribute
&& a.magnMin == b.magnMin
&& a.magnMax == b.magnMax
&& a.duration == b.duration)
const ESM::ENAMstruct& a = it->second.mEffects.mList[i];
const ESM::ENAMstruct& b = newPotion.mEffects.mList[i];
if (a.mEffectID == b.mEffectID
&& a.mArea == b.mArea
&& a.mRange == b.mRange
&& a.mSkill == b.mSkill
&& a.mAttribute == b.mAttribute
&& a.mMagnMin == b.mMagnMin
&& a.mMagnMax == b.mMagnMax
&& a.mDuration == b.mDuration)
{
found = true;
objectId = it->first;
@ -268,17 +268,17 @@ namespace MWGui
it != store.end(); ++it)
{
MWWorld::LiveCellRef<ESM::Apparatus>* ref = it->get<ESM::Apparatus>();
if (ref->base->data.type == ESM::Apparatus::Albemic
&& (bestAlbemic.isEmpty() || ref->base->data.quality > bestAlbemic.get<ESM::Apparatus>()->base->data.quality))
if (ref->base->mData.mType == ESM::Apparatus::Albemic
&& (bestAlbemic.isEmpty() || ref->base->mData.mQuality > bestAlbemic.get<ESM::Apparatus>()->base->mData.mQuality))
bestAlbemic = *it;
else if (ref->base->data.type == ESM::Apparatus::MortarPestle
&& (bestMortarPestle.isEmpty() || ref->base->data.quality > bestMortarPestle.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::MortarPestle
&& (bestMortarPestle.isEmpty() || ref->base->mData.mQuality > bestMortarPestle.get<ESM::Apparatus>()->base->mData.mQuality))
bestMortarPestle = *it;
else if (ref->base->data.type == ESM::Apparatus::Calcinator
&& (bestCalcinator.isEmpty() || ref->base->data.quality > bestCalcinator.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::Calcinator
&& (bestCalcinator.isEmpty() || ref->base->mData.mQuality > bestCalcinator.get<ESM::Apparatus>()->base->mData.mQuality))
bestCalcinator = *it;
else if (ref->base->data.type == ESM::Apparatus::Retort
&& (bestRetort.isEmpty() || ref->base->data.quality > bestRetort.get<ESM::Apparatus>()->base->data.quality))
else if (ref->base->mData.mType == ESM::Apparatus::Retort
&& (bestRetort.isEmpty() || ref->base->mData.mQuality > bestRetort.get<ESM::Apparatus>()->base->mData.mQuality))
bestRetort = *it;
}
@ -415,12 +415,12 @@ namespace MWGui
MWWorld::LiveCellRef<ESM::Ingredient>* ref = ingredient->getUserData<MWWorld::Ptr>()->get<ESM::Ingredient>();
for (int i=0; i<4; ++i)
{
if (ref->base->data.effectID[i] < 0)
if (ref->base->mData.mEffectID[i] < 0)
continue;
MWGui::Widgets::SpellEffectParams params;
params.mEffectID = ref->base->data.effectID[i];
params.mAttribute = ref->base->data.attributes[i];
params.mSkill = ref->base->data.skills[i];
params.mEffectID = ref->base->mData.mEffectID[i];
params.mAttribute = ref->base->mData.mAttributes[i];
params.mSkill = ref->base->mData.mSkills[i];
effects.push_back(params);
}

@ -118,7 +118,7 @@ void BirthDialog::updateBirths()
for (; it != end; ++it)
{
const ESM::BirthSign &birth = it->second;
mBirthList->addItem(birth.name, it->first);
mBirthList->addItem(birth.mName, it->first);
if (boost::iequals(it->first, mCurrentBirthId))
mBirthList->setIndexSelected(index);
++index;
@ -143,21 +143,21 @@ void BirthDialog::updateSpells()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::BirthSign *birth = store.birthSigns.find(mCurrentBirthId);
std::string texturePath = std::string("textures\\") + birth->texture;
std::string texturePath = std::string("textures\\") + birth->mTexture;
fixTexturePath(texturePath);
mBirthImage->setImageTexture(texturePath);
std::vector<std::string> abilities, powers, spells;
std::vector<std::string>::const_iterator it = birth->powers.list.begin();
std::vector<std::string>::const_iterator end = birth->powers.list.end();
std::vector<std::string>::const_iterator it = birth->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = birth->mPowers.mList.end();
for (; it != end; ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = store.spells.search(spellId);
if (!spell)
continue; // Skip spells which cannot be found
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->data.type);
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
continue; // We only want spell, ability and powers.

@ -60,7 +60,7 @@ void BookWindow::open (MWWorld::Ptr book)
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
BookTextParser parser;
std::vector<std::string> results = parser.split(ref->base->text, mLeftPage->getSize().width, mLeftPage->getSize().height);
std::vector<std::string> results = parser.split(ref->base->mText, mLeftPage->getSize().width, mLeftPage->getSize().height);
int i=0;
for (std::vector<std::string>::iterator it=results.begin();

@ -221,7 +221,7 @@ void CharacterCreation::spawnDialog(const char id)
mPickClassDialog = 0;
mPickClassDialog = new PickClassDialog(*mWM);
mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
mPickClassDialog->setClassId(mPlayerClass.name);
mPickClassDialog->setClassId(mPlayerClass.mName);
mPickClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogDone);
mPickClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onPickClassDialogBack);
mPickClassDialog->setVisible(true);
@ -537,24 +537,24 @@ void CharacterCreation::onCreateClassDialogDone(WindowBase* parWindow)
if (mCreateClassDialog)
{
ESM::Class klass;
klass.name = mCreateClassDialog->getName();
klass.description = mCreateClassDialog->getDescription();
klass.data.specialization = mCreateClassDialog->getSpecializationId();
klass.data.isPlayable = 0x1;
klass.mName = mCreateClassDialog->getName();
klass.mDescription = mCreateClassDialog->getDescription();
klass.mData.mSpecialization = mCreateClassDialog->getSpecializationId();
klass.mData.mIsPlayable = 0x1;
std::vector<int> attributes = mCreateClassDialog->getFavoriteAttributes();
assert(attributes.size() == 2);
klass.data.attribute[0] = attributes[0];
klass.data.attribute[1] = attributes[1];
klass.mData.mAttribute[0] = attributes[0];
klass.mData.mAttribute[1] = attributes[1];
std::vector<ESM::Skill::SkillEnum> majorSkills = mCreateClassDialog->getMajorSkills();
std::vector<ESM::Skill::SkillEnum> minorSkills = mCreateClassDialog->getMinorSkills();
assert(majorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
assert(minorSkills.size() >= sizeof(klass.data.skills)/sizeof(klass.data.skills[0]));
for (size_t i = 0; i < sizeof(klass.data.skills)/sizeof(klass.data.skills[0]); ++i)
assert(majorSkills.size() >= sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]));
assert(minorSkills.size() >= sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]));
for (size_t i = 0; i < sizeof(klass.mData.mSkills)/sizeof(klass.mData.mSkills[0]); ++i)
{
klass.data.skills[i][1] = majorSkills[i];
klass.data.skills[i][0] = minorSkills[i];
klass.mData.mSkills[i][1] = majorSkills[i];
klass.mData.mSkills[i][0] = minorSkills[i];
}
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(klass);
mPlayerClass = klass;

@ -50,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
{
mCurrentClassId = classId;
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->name);
mClassName->setCaption(MWBase::Environment::get().getWorld()->getStore().classes.find(mCurrentClassId)->mName);
}
// widget controls
@ -183,12 +183,12 @@ void PickClassDialog::updateClasses()
for (; it != end; ++it)
{
const ESM::Class &klass = it->second;
bool playable = (klass.data.isPlayable != 0);
bool playable = (klass.mData.mIsPlayable != 0);
if (!playable) // Only display playable classes
continue;
const std::string &id = it->first;
mClassList->addItem(klass.name, id);
mClassList->addItem(klass.mName, id);
if (boost::iequals(id, mCurrentClassId))
mClassList->setIndexSelected(index);
++index;
@ -204,7 +204,7 @@ void PickClassDialog::updateStats()
if (!klass)
return;
ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->data.specialization);
ESM::Class::Specialization specialization = static_cast<ESM::Class::Specialization>(klass->mData.mSpecialization);
static const char *specIds[3] = {
"sSpecializationCombat",
@ -215,17 +215,17 @@ void PickClassDialog::updateStats()
mSpecializationName->setCaption(specName);
ToolTips::createSpecializationToolTip(mSpecializationName, specName, specialization);
mFavoriteAttribute[0]->setAttributeId(klass->data.attribute[0]);
mFavoriteAttribute[1]->setAttributeId(klass->data.attribute[1]);
mFavoriteAttribute[0]->setAttributeId(klass->mData.mAttribute[0]);
mFavoriteAttribute[1]->setAttributeId(klass->mData.mAttribute[1]);
ToolTips::createAttributeToolTip(mFavoriteAttribute[0], mFavoriteAttribute[0]->getAttributeId());
ToolTips::createAttributeToolTip(mFavoriteAttribute[1], mFavoriteAttribute[1]->getAttributeId());
for (int i = 0; i < 5; ++i)
{
mMinorSkill[i]->setSkillNumber(klass->data.skills[i][0]);
mMajorSkill[i]->setSkillNumber(klass->data.skills[i][1]);
ToolTips::createSkillToolTip(mMinorSkill[i], klass->data.skills[i][0]);
ToolTips::createSkillToolTip(mMajorSkill[i], klass->data.skills[i][1]);
mMinorSkill[i]->setSkillNumber(klass->mData.mSkills[i][0]);
mMajorSkill[i]->setSkillNumber(klass->mData.mSkills[i][1]);
ToolTips::createSkillToolTip(mMinorSkill[i], klass->mData.mSkills[i][0]);
ToolTips::createSkillToolTip(mMajorSkill[i], klass->mData.mSkills[i][1]);
}
mClassImage->setImageTexture(std::string("textures\\levelup\\") + mCurrentClassId + ".dds");
@ -664,9 +664,9 @@ SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& pa
getWidget(mSpecialization0, "Specialization0");
getWidget(mSpecialization1, "Specialization1");
getWidget(mSpecialization2, "Specialization2");
std::string combat = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], "");
std::string magic = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Magic], "");
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Stealth], "");
std::string combat = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Combat], "");
std::string magic = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Magic], "");
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Stealth], "");
mSpecialization0->setCaption(combat);
mSpecialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
@ -728,7 +728,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWBase::WindowManager& parWindowMan
getWidget(attribute, std::string("Attribute").append(1, theIndex));
attribute->setWindowManager(&parWindowManager);
attribute->setAttributeId(ESM::Attribute::attributeIds[i]);
attribute->setAttributeId(ESM::Attribute::sAttributeIds[i]);
attribute->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId());
}

@ -407,7 +407,7 @@ namespace MWGui
{
mPtr = object;
if (!mPtr.isEmpty())
setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().refID + ")");
setTitle("#{sConsoleTitle} (" + mPtr.getCellRef().mRefID + ")");
else
setTitle("#{sConsoleTitle}");
MyGUI::InputManager::getInstance().setKeyFocusWidget(command);

@ -110,7 +110,7 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
}
else
{
std::string message = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTake")->str;
std::string message = MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTake")->mStr;
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
dialog->open(MWWorld::Class::get(object).getName(object), message, count);
dialog->eventOkClicked.clear();
@ -130,18 +130,18 @@ void ContainerBase::onSelectedItem(MyGUI::Widget* _sender)
// the player is trying to sell an item, check if the merchant accepts it
// also, don't allow selling gold (let's be better than Morrowind at this, can we?)
if (!MWBase::Environment::get().getWindowManager()->getTradeWindow()->npcAcceptsItem(object)
|| MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
|| MWWorld::Class::get(object).getName(object) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr)
{
// user notification "i don't buy this item"
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog4")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog4")->mStr, std::vector<std::string>());
return;
}
}
bool buying = isTradeWindow(); // buying or selling?
std::string message = buying ? MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage02")->str
: MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage01")->str;
std::string message = buying ? MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage02")->mStr
: MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sQuanityMenuMessage01")->mStr;
if (std::find(mBoughtItems.begin(), mBoughtItems.end(), object) != mBoughtItems.end())
{
@ -275,11 +275,11 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
if (mPtr.getTypeName() == typeid(ESM::Container).name())
{
MWWorld::LiveCellRef<ESM::Container>* ref = mPtr.get<ESM::Container>();
if (ref->base->flags & ESM::Container::Organic)
if (ref->base->mFlags & ESM::Container::Organic)
{
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage2")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage2")->mStr, std::vector<std::string>());
return;
}
}
@ -302,7 +302,7 @@ void ContainerBase::onContainerClicked(MyGUI::Widget* _sender)
object.getRefData().setCount(origCount);
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage3")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sContentsMessage3")->mStr, std::vector<std::string>());
return;
}
else

@ -123,13 +123,13 @@ void DialogueWindow::onSelectTopic(std::string topic)
{
if (!mEnabled) return;
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str)
if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->mStr)
{
/// \todo check if the player is allowed to trade with this actor (e.g. faction rank high enough)?
mWindowManager.pushGuiMode(GM_Barter);
mWindowManager.getTradeWindow()->startTrade(mPtr);
}
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str)
else if (topic == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->mStr)
{
mWindowManager.pushGuiMode(GM_SpellBuying);
mWindowManager.getSpellBuyingWindow()->startSpellBuying(mPtr);
@ -158,10 +158,10 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
bool anyService = mShowTrade||mShowSpells;
if (mShowTrade)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->str);
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarter")->mStr);
if (mShowSpells)
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->str);
mTopicsList->addItem(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSpells")->mStr);
if (anyService)
mTopicsList->addSeparator();
@ -266,7 +266,7 @@ void DialogueWindow::updateOptions()
void DialogueWindow::goodbye()
{
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->str);
mHistory->addDialogText("\n#572D21" + MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGoodbye")->mStr);
mTopicsList->setEnabled(false);
mEnabled = false;
}

@ -350,7 +350,7 @@ void HUD::onResChange(int width, int height)
void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
std::string spellName = spell->name;
std::string spellName = spell->mName;
if (spellName != mSpellName && mSpellVisible)
{
mWeaponSpellTimer = 5.0f;
@ -369,8 +369,8 @@ void HUD::setSelectedSpell(const std::string& spellId, int successChancePercent)
mSpellBox->setUserString("Spell", spellId);
// use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
std::string icon = effect->icon;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
std::string icon = effect->mIcon;
int slashPos = icon.find("\\");
icon.insert(slashPos+1, "b_");
icon = std::string("icons\\") + icon;

@ -284,7 +284,7 @@ namespace MWGui
for (MWWorld::ContainerStoreIterator it = invStore.begin();
it != invStore.end(); ++it)
{
if (toLower(it->getCellRef().refID) == "gold_001")
if (toLower(it->getCellRef().mRefID) == "gold_001")
return it->getRefData().getCount();
}
return 0;

@ -32,7 +32,7 @@ namespace
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
int cmp = a->name.compare(b->name);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
}
}
@ -236,8 +236,8 @@ namespace MWGui
// use the icon of the first effect
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->effects.list.front().effectID);
std::string path = effect->icon;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(spell->mEffects.mList.front().mEffectID);
std::string path = effect->mIcon;
int slashPos = path.find("\\");
path.insert(slashPos+1, "b_");
path = std::string("icons\\") + path;
@ -439,15 +439,15 @@ namespace MWGui
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
if (spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
it = spellList.erase(it);
}
else if (spell->data.type == ESM::Spell::ST_Ability
|| spell->data.type == ESM::Spell::ST_Blight
|| spell->data.type == ESM::Spell::ST_Curse
|| spell->data.type == ESM::Spell::ST_Disease)
else if (spell->mData.mType == ESM::Spell::ST_Ability
|| spell->mData.mType == ESM::Spell::ST_Blight
|| spell->mData.mType == ESM::Spell::ST_Curse
|| spell->mData.mType == ESM::Spell::ST_Disease)
{
it = spellList.erase(it);
}
@ -466,7 +466,7 @@ namespace MWGui
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
int type = enchant->data.type;
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
continue;
@ -490,7 +490,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -507,7 +507,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mMagicList->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);

@ -216,11 +216,11 @@ void RaceDialog::updateRaces()
for (; it != end; ++it)
{
const ESM::Race &race = it->second;
bool playable = race.data.flags & ESM::Race::Playable;
bool playable = race.mData.mFlags & ESM::Race::Playable;
if (!playable) // Only display playable races
continue;
mRaceList->addItem(race.name, it->first);
mRaceList->addItem(race.mName, it->first);
if (boost::iequals(it->first, mCurrentRaceId))
mRaceList->setIndexSelected(index);
++index;
@ -244,10 +244,10 @@ void RaceDialog::updateSkills()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
int count = sizeof(race->data.bonus)/sizeof(race->data.bonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
int count = sizeof(race->mData.mBonus)/sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
for (int i = 0; i < count; ++i)
{
int skillId = race->data.bonus[i].skill;
int skillId = race->mData.mBonus[i].mSkill;
if (skillId < 0 || skillId > ESM::Skill::Length) // Skip unknown skill indexes
continue;
@ -255,7 +255,7 @@ void RaceDialog::updateSkills()
std::string("Skill") + boost::lexical_cast<std::string>(i));
skillWidget->setWindowManager(&mWindowManager);
skillWidget->setSkillNumber(skillId);
skillWidget->setSkillValue(MWSkill::SkillValue(race->data.bonus[i].bonus));
skillWidget->setSkillValue(MWSkill::SkillValue(race->mData.mBonus[i].mBonus));
ToolTips::createSkillToolTip(skillWidget, skillId);
@ -283,8 +283,8 @@ void RaceDialog::updateSpellPowers()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(mCurrentRaceId);
std::vector<std::string>::const_iterator it = race->powers.list.begin();
std::vector<std::string>::const_iterator end = race->powers.list.end();
std::vector<std::string>::const_iterator it = race->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = race->mPowers.mList.end();
for (int i = 0; it != end; ++it)
{
const std::string &spellpower = *it;

@ -70,9 +70,9 @@ ReviewDialog::ReviewDialog(MWBase::WindowManager& parWindowManager)
for (int idx = 0; idx < ESM::Attribute::Length; ++idx)
{
getWidget(attribute, std::string("Attribute") + boost::lexical_cast<std::string>(idx));
mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::attributeIds[idx]), attribute));
mAttributeWidgets.insert(std::make_pair(static_cast<int>(ESM::Attribute::sAttributeIds[idx]), attribute));
attribute->setWindowManager(&mWindowManager);
attribute->setAttributeId(ESM::Attribute::attributeIds[idx]);
attribute->setAttributeId(ESM::Attribute::sAttributeIds[idx]);
attribute->setAttributeValue(MWAttribute::AttributeValue(0, 0));
}
@ -112,14 +112,14 @@ void ReviewDialog::setRace(const std::string &raceId)
if (race)
{
ToolTips::createRaceToolTip(mRaceWidget, race);
mRaceWidget->setCaption(race->name);
mRaceWidget->setCaption(race->mName);
}
}
void ReviewDialog::setClass(const ESM::Class& class_)
{
mKlass = class_;
mClassWidget->setCaption(mKlass.name);
mClassWidget->setCaption(mKlass.mName);
ToolTips::createClassToolTip(mClassWidget, mKlass);
}
@ -129,7 +129,7 @@ void ReviewDialog::setBirthSign(const std::string& signId)
const ESM::BirthSign *sign = MWBase::Environment::get().getWorld()->getStore().birthSigns.search(mBirthSignId);
if (sign)
{
mBirthSignWidget->setCaption(sign->name);
mBirthSignWidget->setCaption(sign->mName);
ToolTips::createBirthsignToolTip(mBirthSignWidget, mBirthSignId);
}
}
@ -193,9 +193,9 @@ void ReviewDialog::configureSkills(const std::vector<int>& major, const std::vec
std::set<int> skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::skillIds.end();
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::sSkillIds.end();
mMiscSkills.clear();
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::skillIds.begin(); it != end; ++it)
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::sSkillIds.begin(); it != end; ++it)
{
int skill = *it;
if (skillSet.find(skill) == skillSet.end())

@ -36,7 +36,7 @@ void ScrollWindow::open (MWWorld::Ptr scroll)
MWWorld::LiveCellRef<ESM::Book> *ref = mScroll.get<ESM::Book>();
BookTextParser parser;
MyGUI::IntSize size = parser.parse(ref->base->text, mTextView, 390);
MyGUI::IntSize size = parser.parse(ref->base->mText, mTextView, 390);
if (size.height > mTextView->getSize().height)
mTextView->setCanvasSize(MyGUI::IntSize(410, size.height));

@ -51,12 +51,27 @@ namespace MWGui
void SpellBuyingWindow::addSpell(const std::string& spellId)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
int price = spell->data.cost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->f;
MyGUI::Button* toAdd = mSpellsView->createWidget<MyGUI::Button>((price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText", 0, mCurrentY, 200, sLineHeight, MyGUI::Align::Default);
int price = spell->mData.mCost*MWBase::Environment::get().getWorld()->getStore().gameSettings.search("fSpellValueMult")->mF;
MyGUI::Button* toAdd =
mSpellsView->createWidget<MyGUI::Button>(
(price>mWindowManager.getInventoryWindow()->getPlayerGold()) ? "SandTextGreyedOut" : "SpellText",
0,
mCurrentY,
200,
sLineHeight,
MyGUI::Align::Default
);
mCurrentY += sLineHeight;
/// \todo price adjustment depending on merchantile skill
toAdd->setUserData(price);
toAdd->setCaption(spell->name+" - "+boost::lexical_cast<std::string>(price)+MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->str);
std::string sgp =
MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sgp")->mStr;
toAdd->setCaption(spell->mName+" - "+boost::lexical_cast<std::string>(price)+ sgp);
toAdd->setSize(toAdd->getTextSize().width,sLineHeight);
toAdd->eventMouseWheel += MyGUI::newDelegate(this, &SpellBuyingWindow::onMouseWheel);
toAdd->setUserString("ToolTipType", "Spell");
@ -89,7 +104,7 @@ namespace MWGui
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
if (spell->data.type!=ESM::Spell::ST_Spell)
if (spell->mData.mType!=ESM::Spell::ST_Spell)
continue; // don't try to sell diseases, curses or powers
if (std::find (playerSpells.begin(), playerSpells.end(), *iter)!=playerSpells.end())
@ -127,7 +142,7 @@ namespace MWGui
void SpellBuyingWindow::updateLabels()
{
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr
+ ": " + boost::lexical_cast<std::string>(mWindowManager.getInventoryWindow()->getPlayerGold()));
mPlayerGold->setCoord(8,
mPlayerGold->getTop(),

@ -29,7 +29,7 @@ namespace
const ESM::Spell* a = MWBase::Environment::get().getWorld()->getStore().spells.find(left);
const ESM::Spell* b = MWBase::Environment::get().getWorld()->getStore().spells.find(right);
int cmp = a->name.compare(b->name);
int cmp = a->mName.compare(b->mName);
return cmp < 0;
}
@ -144,15 +144,15 @@ namespace MWGui
while (it != spellList.end())
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
if (spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mType == ESM::Spell::ST_Power)
{
powers.push_back(*it);
it = spellList.erase(it);
}
else if (spell->data.type == ESM::Spell::ST_Ability
|| spell->data.type == ESM::Spell::ST_Blight
|| spell->data.type == ESM::Spell::ST_Curse
|| spell->data.type == ESM::Spell::ST_Disease)
else if (spell->mData.mType == ESM::Spell::ST_Ability
|| spell->mData.mType == ESM::Spell::ST_Blight
|| spell->mData.mType == ESM::Spell::ST_Curse
|| spell->mData.mType == ESM::Spell::ST_Disease)
{
it = spellList.erase(it);
}
@ -171,7 +171,7 @@ namespace MWGui
{
// only add items with "Cast once" or "Cast on use"
const ESM::Enchantment* enchant = MWBase::Environment::get().getWorld()->getStore().enchants.find(enchantId);
int type = enchant->data.type;
int type = enchant->mData.mType;
if (type != ESM::Enchantment::CastOnce
&& type != ESM::Enchantment::WhenUsed)
continue;
@ -194,7 +194,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -214,7 +214,7 @@ namespace MWGui
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(*it);
MyGUI::Button* t = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
t->setCaption(spell->name);
t->setCaption(spell->mName);
t->setTextAlign(MyGUI::Align::Left);
t->setUserString("ToolTipType", "Spell");
t->setUserString("Spell", *it);
@ -225,7 +225,7 @@ namespace MWGui
// cost / success chance
MyGUI::Button* costChance = mSpellView->createWidget<MyGUI::Button>("SpellText",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
std::string cost = boost::lexical_cast<std::string>(spell->data.cost);
std::string cost = boost::lexical_cast<std::string>(spell->mData.mCost);
std::string chance = boost::lexical_cast<std::string>(int(MWMechanics::getSpellSuccessChance(*it, player)));
costChance->setCaption(cost + "/" + chance);
costChance->setTextAlign(MyGUI::Align::Right);
@ -272,9 +272,9 @@ namespace MWGui
MyGUI::Button* costCharge = mSpellView->createWidget<MyGUI::Button>(equipped ? "SpellText" : "SpellTextUnequipped",
MyGUI::IntCoord(4, mHeight, mWidth-8, spellHeight), MyGUI::Align::Left | MyGUI::Align::Top);
std::string cost = boost::lexical_cast<std::string>(enchant->data.cost);
std::string charge = boost::lexical_cast<std::string>(enchant->data.charge); /// \todo track current charge
if (enchant->data.type == ESM::Enchantment::CastOnce)
std::string cost = boost::lexical_cast<std::string>(enchant->mData.mCost);
std::string charge = boost::lexical_cast<std::string>(enchant->mData.mCharge); /// \todo track current charge
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
{
// this is Morrowind behaviour
cost = "100";
@ -379,8 +379,8 @@ namespace MWGui
{
// delete spell, if allowed
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
if (spell->data.flags & ESM::Spell::F_Always
|| spell->data.type == ESM::Spell::ST_Power)
if (spell->mData.mFlags & ESM::Spell::F_Always
|| spell->mData.mType == ESM::Spell::ST_Power)
{
mWindowManager.messageBox("#{sDeleteSpellError}", std::vector<std::string>());
}
@ -390,7 +390,7 @@ namespace MWGui
mSpellToDelete = spellId;
ConfirmationDialog* dialog = mWindowManager.getConfirmationDialog();
std::string question = mWindowManager.getGameSettingString("sQuestionDeleteSpell", "Delete %s?");
question = boost::str(boost::format(question) % spell->name);
question = boost::str(boost::format(question) % spell->mName);
dialog->open(question);
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SpellWindow::onDeleteSpellAccept);

@ -57,7 +57,7 @@ StatsWindow::StatsWindow (MWBase::WindowManager& parWindowManager)
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
for (int i=0; names[i][0]; ++i)
{
setText (names[i][0], store.gameSettings.find (names[i][1])->str);
setText (names[i][0], store.gameSettings.find (names[i][1])->mStr);
}
getWidget(mSkillView, "SkillView");
@ -222,9 +222,9 @@ void StatsWindow::configureSkills (const std::vector<int>& major, const std::vec
std::set<int> skillSet;
std::copy(major.begin(), major.end(), std::inserter(skillSet, skillSet.begin()));
std::copy(minor.begin(), minor.end(), std::inserter(skillSet, skillSet.begin()));
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::skillIds.end();
boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator end = ESM::Skill::sSkillIds.end();
mMiscSkills.clear();
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::skillIds.begin(); it != end; ++it)
for (boost::array<ESM::Skill::SkillEnum, ESM::Skill::Length>::const_iterator it = ESM::Skill::sSkillIds.begin(); it != end; ++it)
{
int skill = *it;
if (skillSet.find(skill) == skillSet.end())
@ -359,7 +359,7 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
assert(attr);
std::string state = "normal";
@ -375,8 +375,8 @@ void StatsWindow::addSkills(const SkillList &skills, const std::string &titleId,
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipType", "Layout");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ToolTipLayout", "SkillToolTip");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillName", "#{"+skillNameId+"}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillDescription", skill->description);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillDescription", skill->mDescription);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("ImageTexture_SkillImage", icon);
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Caption_SkillProgressText", boost::lexical_cast<std::string>(progressPercent)+"/100");
mSkillWidgets[mSkillWidgets.size()-1-i]->setUserString("Range_SkillProgress", "100");
@ -442,43 +442,43 @@ void StatsWindow::updateSkillArea()
for (FactionList::const_iterator it = mFactions.begin(); it != end; ++it)
{
const ESM::Faction *faction = store.factions.find(it->first);
MyGUI::Widget* w = addItem(faction->name, coord1, coord2);
MyGUI::Widget* w = addItem(faction->mName, coord1, coord2);
std::string text;
text += std::string("#DDC79E") + faction->name;
text += std::string("\n#BF9959") + faction->ranks[it->second];
text += std::string("#DDC79E") + faction->mName;
text += std::string("\n#BF9959") + faction->mRanks[it->second];
if (it->second < 9)
{
// player doesn't have max rank yet
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->ranks[it->second+1];
text += std::string("\n\n#DDC79E#{sNextRank} ") + faction->mRanks[it->second+1];
ESM::RankData rankData = faction->data.rankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute1);
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->data.attribute2);
ESM::RankData rankData = faction->mData.mRankData[it->second+1];
const ESM::Attribute* attr1 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute1);
const ESM::Attribute* attr2 = MWBase::Environment::get().getWorld()->getStore().attributes.search(faction->mData.mAttribute2);
assert(attr1 && attr2);
text += "\n#BF9959#{" + attr1->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute1)
+ ", #{" + attr2->name + "}: " + boost::lexical_cast<std::string>(rankData.attribute2);
text += "\n#BF9959#{" + attr1->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute1)
+ ", #{" + attr2->mName + "}: " + boost::lexical_cast<std::string>(rankData.mAttribute2);
text += "\n\n#DDC79E#{sFavoriteSkills}";
text += "\n#BF9959";
for (int i=0; i<6; ++i)
{
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->data.skillID[i]);
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(faction->mData.mSkillID[i]);
assert(skill);
text += "#{"+ESM::Skill::sSkillNameIds[faction->data.skillID[i]]+"}";
text += "#{"+ESM::Skill::sSkillNameIds[faction->mData.mSkillID[i]]+"}";
if (i<5)
text += ", ";
}
text += "\n";
if (rankData.skill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.skill1);
if (rankData.skill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.skill2);
if (rankData.mSkill1 > 0)
text += "\n#{sNeedOneSkill} " + boost::lexical_cast<std::string>(rankData.mSkill1);
if (rankData.mSkill2 > 0)
text += "\n#{sNeedTwoSkills} " + boost::lexical_cast<std::string>(rankData.mSkill2);
}
w->setUserString("ToolTipType", "Layout");
@ -495,7 +495,7 @@ void StatsWindow::updateSkillArea()
addGroup(mWindowManager.getGameSettingString("sBirthSign", "Sign"), coord1, coord2);
const ESM::BirthSign *sign = store.birthSigns.find(mBirthSignId);
MyGUI::Widget* w = addItem(sign->name, coord1, coord2);
MyGUI::Widget* w = addItem(sign->mName, coord1, coord2);
ToolTips::createBirthsignToolTip(w, mBirthSignId);
}

@ -184,20 +184,20 @@ void ToolTips::onFrame(float frameDuration)
{
ToolTipInfo info;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find(focus->getUserString("Spell"));
info.caption = spell->name;
info.caption = spell->mName;
Widgets::SpellEffectList effects;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
{
Widgets::SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mIsConstant = (spell->data.type == ESM::Spell::ST_Ability);
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
params.mIsConstant = (spell->mData.mType == ESM::Spell::ST_Ability);
params.mNoTarget = false;
effects.push_back(params);
}
@ -373,14 +373,14 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
if (info.enchant != "")
{
enchant = store.enchants.search(info.enchant);
if (enchant->data.type == ESM::Enchantment::CastOnce)
text += "\n" + store.gameSettings.search("sItemCastOnce")->str;
else if (enchant->data.type == ESM::Enchantment::WhenStrikes)
text += "\n" + store.gameSettings.search("sItemCastWhenStrikes")->str;
else if (enchant->data.type == ESM::Enchantment::WhenUsed)
text += "\n" + store.gameSettings.search("sItemCastWhenUsed")->str;
else if (enchant->data.type == ESM::Enchantment::ConstantEffect)
text += "\n" + store.gameSettings.search("sItemCastConstant")->str;
if (enchant->mData.mType == ESM::Enchantment::CastOnce)
text += "\n" + store.gameSettings.search("sItemCastOnce")->mStr;
else if (enchant->mData.mType == ESM::Enchantment::WhenStrikes)
text += "\n" + store.gameSettings.search("sItemCastWhenStrikes")->mStr;
else if (enchant->mData.mType == ESM::Enchantment::WhenUsed)
text += "\n" + store.gameSettings.search("sItemCastWhenUsed")->mStr;
else if (enchant->mData.mType == ESM::Enchantment::ConstantEffect)
text += "\n" + store.gameSettings.search("sItemCastConstant")->mStr;
}
// this the maximum width of the tooltip before it starts word-wrapping
@ -449,24 +449,24 @@ IntSize ToolTips::createToolTip(const MWGui::ToolTipInfo& info)
Widgets::MWEffectListPtr enchantWidget = enchantArea->createWidget<Widgets::MWEffectList>
("MW_StatName", coord, Align::Default, "ToolTipEnchantWidget");
enchantWidget->setWindowManager(mWindowManager);
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->effects));
enchantWidget->setEffectList(Widgets::MWEffectList::effectListFromESM(&enchant->mEffects));
std::vector<MyGUI::WidgetPtr> enchantEffectItems;
int flag = (enchant->data.type == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
int flag = (enchant->mData.mType == ESM::Enchantment::ConstantEffect) ? Widgets::MWEffectList::EF_Constant : 0;
enchantWidget->createEffectWidgets(enchantEffectItems, enchantArea, coord, true, flag);
totalSize.height += coord.top-6;
totalSize.width = std::max(totalSize.width, coord.width);
if (enchant->data.type == ESM::Enchantment::WhenStrikes
|| enchant->data.type == ESM::Enchantment::WhenUsed)
if (enchant->mData.mType == ESM::Enchantment::WhenStrikes
|| enchant->mData.mType == ESM::Enchantment::WhenUsed)
{
/// \todo store the current enchantment charge somewhere
int charge = enchant->data.charge;
int charge = enchant->mData.mCharge;
const int chargeWidth = 204;
TextBox* chargeText = enchantArea->createWidget<TextBox>("SandText", IntCoord(0, 0, 10, 18), Align::Default, "ToolTipEnchantChargeText");
chargeText->setCaption(store.gameSettings.search("sCharges")->str);
chargeText->setCaption(store.gameSettings.search("sCharges")->mStr);
const int chargeTextWidth = chargeText->getTextSize().width + 5;
const int chargeAndTextWidth = chargeWidth + chargeTextWidth;
@ -576,15 +576,15 @@ void ToolTips::createSkillToolTip(MyGUI::Widget* widget, int skillId)
const std::string &skillNameId = ESMS::Skill::sSkillNameIds[skillId];
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().skills.search(skillId);
assert(skill);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->data.attribute);
const ESM::Attribute* attr = MWBase::Environment::get().getWorld()->getStore().attributes.search(skill->mData.mAttribute);
assert(attr);
std::string icon = "icons\\k\\" + ESM::Skill::sIconNames[skillId];
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
widget->setUserString("Caption_SkillNoProgressName", "#{"+skillNameId+"}");
widget->setUserString("Caption_SkillNoProgressDescription", skill->description);
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->name + "}");
widget->setUserString("Caption_SkillNoProgressDescription", skill->mDescription);
widget->setUserString("Caption_SkillNoProgressAttribute", "#{sGoverningAttribute}: #{" + attr->mName + "}");
widget->setUserString("ImageTexture_SkillNoProgressImage", icon);
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
widget->setUserString("ToolTipLayout", "SkillNoProgressToolTip");
@ -595,9 +595,9 @@ void ToolTips::createAttributeToolTip(MyGUI::Widget* widget, int attributeId)
if (attributeId == -1)
return;
std::string icon = ESM::Attribute::attributeIcons[attributeId];
std::string name = ESM::Attribute::gmstAttributeIds[attributeId];
std::string desc = ESM::Attribute::gmstAttributeDescIds[attributeId];
std::string icon = ESM::Attribute::sAttributeIcons[attributeId];
std::string name = ESM::Attribute::sGmstAttributeIds[attributeId];
std::string desc = ESM::Attribute::sGmstAttributeDescIds[attributeId];
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "AttributeToolTip");
@ -615,8 +615,8 @@ void ToolTips::createSpecializationToolTip(MyGUI::Widget* widget, const std::str
for (std::map<int, ESM::Skill>::const_iterator it = skills.begin();
it != skills.end(); ++it)
{
if (it->second.data.specialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.index] + "}";
if (it->second.mData.mSpecialization == specId)
specText += std::string("\n#{") + ESM::Skill::sSkillNameIds[it->second.mIndex] + "}";
}
widget->setUserString("Caption_CenteredCaptionText", specText);
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
@ -629,25 +629,25 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "BirthSignToolTip");
std::string image = sign->texture;
std::string image = sign->mTexture;
image.replace(image.size()-3, 3, "dds");
widget->setUserString("ImageTexture_BirthSignImage", "textures\\" + image);
std::string text;
text += sign->name;
text += "\n#BF9959" + sign->description;
text += sign->mName;
text += "\n#BF9959" + sign->mDescription;
std::vector<std::string> abilities, powers, spells;
std::vector<std::string>::const_iterator it = sign->powers.list.begin();
std::vector<std::string>::const_iterator end = sign->powers.list.end();
std::vector<std::string>::const_iterator it = sign->mPowers.mList.begin();
std::vector<std::string>::const_iterator end = sign->mPowers.mList.end();
for (; it != end; ++it)
{
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
if (!spell)
continue; // Skip spells which cannot be found
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->data.type);
ESM::Spell::SpellType type = static_cast<ESM::Spell::SpellType>(spell->mData.mType);
if (type != ESM::Spell::ST_Spell && type != ESM::Spell::ST_Ability && type != ESM::Spell::ST_Power)
continue; // We only want spell, ability and powers.
@ -677,7 +677,7 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
const std::string &spellId = *it;
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.search(spellId);
text += "\n#BF9959" + spell->name;
text += "\n#BF9959" + spell->mName;
}
}
@ -686,18 +686,18 @@ void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const std::string&
void ToolTips::createRaceToolTip(MyGUI::Widget* widget, const ESM::Race* playerRace)
{
widget->setUserString("Caption_CenteredCaption", playerRace->name);
widget->setUserString("Caption_CenteredCaptionText", playerRace->description);
widget->setUserString("Caption_CenteredCaption", playerRace->mName);
widget->setUserString("Caption_CenteredCaptionText", playerRace->mDescription);
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "TextWithCenteredCaptionToolTip");
}
void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playerClass)
{
if (playerClass.name == "")
if (playerClass.mName == "")
return;
int spec = playerClass.data.specialization;
int spec = playerClass.mData.mSpecialization;
std::string specStr;
if (spec == 0)
specStr = "#{sSpecializationCombat}";
@ -706,8 +706,8 @@ void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playe
else if (spec == 2)
specStr = "#{sSpecializationStealth}";
widget->setUserString("Caption_ClassName", playerClass.name);
widget->setUserString("Caption_ClassDescription", playerClass.description);
widget->setUserString("Caption_ClassName", playerClass.mName);
widget->setUserString("Caption_ClassDescription", playerClass.mDescription);
widget->setUserString("Caption_ClassSpecialisation", "#{sSpecialization}: " + specStr);
widget->setUserString("ToolTipType", "Layout");
widget->setUserString("ToolTipLayout", "ClassToolTip");

@ -110,7 +110,7 @@ namespace MWGui
for (MWWorld::ContainerStoreIterator it = playerStore.begin();
it != playerStore.end(); ++it)
{
if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
if (MWWorld::Class::get(*it).getName(*it) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr)
{
goldFound = true;
gold = *it;
@ -138,7 +138,7 @@ namespace MWGui
{
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog11")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog11")->mStr, std::vector<std::string>());
return;
}
@ -147,7 +147,7 @@ namespace MWGui
{
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog1")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog1")->mStr, std::vector<std::string>());
return;
}
@ -156,21 +156,21 @@ namespace MWGui
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
if (ref->base->mNpdt52.mGold == -10)
merchantgold = ref->base->mNpdt12.mGold;
else
merchantgold = ref->base->npdt52.gold;
merchantgold = ref->base->mNpdt52.mGold;
}
else // ESM::Creature
{
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
merchantgold = ref->base->mData.mGold;
}
if (mCurrentBalance > 0 && merchantgold < mCurrentBalance)
{
// user notification
MWBase::Environment::get().getWindowManager()->
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog2")->str, std::vector<std::string>());
messageBox(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sBarterDialog2")->mStr, std::vector<std::string>());
return;
}
@ -200,17 +200,17 @@ namespace MWGui
void TradeWindow::updateLabels()
{
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sYourGold")->str
mPlayerGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sYourGold")->mStr
+ " " + boost::lexical_cast<std::string>(mWindowManager.getInventoryWindow()->getPlayerGold()));
if (mCurrentBalance > 0)
{
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalSold")->str);
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalSold")->mStr);
mTotalBalance->setCaption(boost::lexical_cast<std::string>(mCurrentBalance));
}
else
{
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalCost")->str);
mTotalBalanceLabel->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sTotalCost")->mStr);
mTotalBalance->setCaption(boost::lexical_cast<std::string>(-mCurrentBalance));
}
@ -218,18 +218,18 @@ namespace MWGui
if (mPtr.getTypeName() == typeid(ESM::NPC).name())
{
MWWorld::LiveCellRef<ESM::NPC>* ref = mPtr.get<ESM::NPC>();
if (ref->base->npdt52.gold == -10)
merchantgold = ref->base->npdt12.gold;
if (ref->base->mNpdt52.mGold == -10)
merchantgold = ref->base->mNpdt12.mGold;
else
merchantgold = ref->base->npdt52.gold;
merchantgold = ref->base->mNpdt52.mGold;
}
else // ESM::Creature
{
MWWorld::LiveCellRef<ESM::Creature>* ref = mPtr.get<ESM::Creature>();
merchantgold = ref->base->data.gold;
merchantgold = ref->base->mData.mGold;
}
mMerchantGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSellerGold")->str
mMerchantGold->setCaption(MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sSellerGold")->mStr
+ " " + boost::lexical_cast<std::string>(merchantgold));
}

@ -233,19 +233,19 @@ void MWSpell::createEffectWidgets(std::vector<MyGUI::WidgetPtr> &effects, MyGUI:
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
MWSpellEffectPtr effect = nullptr;
std::vector<ESM::ENAMstruct>::const_iterator end = spell->effects.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->effects.list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = spell->mEffects.mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = spell->mEffects.mList.begin(); it != end; ++it)
{
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
effect->setWindowManager(mWindowManager);
SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
params.mIsConstant = (flags & MWEffectList::EF_Constant);
params.mNoTarget = (flags & MWEffectList::EF_NoTarget);
effect->setSpellEffect(params);
@ -262,7 +262,7 @@ void MWSpell::updateWidgets()
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Spell *spell = store.spells.search(mId);
if (spell)
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->name);
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption(spell->mName);
else
static_cast<MyGUI::TextBox*>(mSpellNameWidget)->setCaption("");
}
@ -351,17 +351,17 @@ MWEffectList::~MWEffectList()
SpellEffectList MWEffectList::effectListFromESM(const ESM::EffectList* effects)
{
SpellEffectList result;
std::vector<ESM::ENAMstruct>::const_iterator end = effects->list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects->list.begin(); it != end; ++it)
std::vector<ESM::ENAMstruct>::const_iterator end = effects->mList.end();
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects->mList.begin(); it != end; ++it)
{
SpellEffectParams params;
params.mEffectID = it->effectID;
params.mSkill = it->skill;
params.mAttribute = it->attribute;
params.mDuration = it->duration;
params.mMagnMin = it->magnMin;
params.mMagnMax = it->magnMax;
params.mRange = it->range;
params.mEffectID = it->mEffectID;
params.mSkill = it->mSkill;
params.mAttribute = it->mAttribute;
params.mDuration = it->mDuration;
params.mMagnMin = it->mMagnMin;
params.mMagnMax = it->mMagnMax;
params.mRange = it->mRange;
result.push_back(params);
}
return result;
@ -457,7 +457,7 @@ void MWSpellEffect::updateWidgets()
}
if (mImageWidget)
{
std::string path = std::string("icons\\") + magicEffect->icon;
std::string path = std::string("icons\\") + magicEffect->mIcon;
fixTexturePath(path);
mImageWidget->setImageTexture(path);
}

@ -161,12 +161,12 @@ WindowManager::WindowManager(
// Setup player stats
for (int i = 0; i < ESM::Attribute::Length; ++i)
{
mPlayerAttributes.insert(std::make_pair(ESM::Attribute::attributeIds[i], MWMechanics::Stat<int>()));
mPlayerAttributes.insert(std::make_pair(ESM::Attribute::sAttributeIds[i], MWMechanics::Stat<int>()));
}
for (int i = 0; i < ESM::Skill::Length; ++i)
{
mPlayerSkillValues.insert(std::make_pair(ESM::Skill::skillIds[i], MWMechanics::Stat<float>()));
mPlayerSkillValues.insert(std::make_pair(ESM::Skill::sSkillIds[i], MWMechanics::Stat<float>()));
}
unsetSelectedSpell();
@ -446,7 +446,7 @@ void WindowManager::setValue (const std::string& id, int value)
void WindowManager::setPlayerClass (const ESM::Class &class_)
{
mPlayerClass = class_;
mStatsWindow->setValue("class", mPlayerClass.name);
mStatsWindow->setValue("class", mPlayerClass.mName);
}
void WindowManager::configureSkills (const SkillList& major, const SkillList& minor)
@ -501,8 +501,8 @@ int WindowManager::readPressedButton ()
const std::string &WindowManager::getGameSettingString(const std::string &id, const std::string &default_)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(id);
if (setting && setting->type == ESM::VT_String)
return setting->str;
if (setting && setting->mType == ESM::VT_String)
return setting->mStr;
return default_;
}
@ -543,16 +543,16 @@ void WindowManager::onFrame (float frameDuration)
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
{
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
{
std::string name;
if (cell->cell->name != "")
name = cell->cell->name;
if (cell->cell->mName != "")
name = cell->cell->mName;
else
{
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->region);
const ESM::Region* region = MWBase::Environment::get().getWorld()->getStore().regions.search(cell->cell->mRegion);
if (region)
name = region->name;
name = region->mName;
else
name = getGameSettingString("sDefaultCellname", "Wilderness");
}
@ -562,15 +562,15 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
mMap->setCellPrefix("Cell");
mHud->setCellPrefix("Cell");
mMap->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY );
mHud->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY );
mMap->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
mHud->setActiveCell( cell->cell->mData.mX, cell->cell->mData.mY );
}
else
{
mMap->setCellName( cell->cell->name );
mHud->setCellName( cell->cell->name );
mMap->setCellPrefix( cell->cell->name );
mHud->setCellPrefix( cell->cell->name );
mMap->setCellName( cell->cell->mName );
mHud->setCellName( cell->cell->mName );
mMap->setCellPrefix( cell->cell->mName );
mHud->setCellPrefix( cell->cell->mName );
}
}
@ -654,8 +654,8 @@ void WindowManager::setDragDrop(bool dragDrop)
void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _result)
{
const ESM::GameSetting *setting = MWBase::Environment::get().getWorld()->getStore().gameSettings.search(_tag);
if (setting && setting->type == ESM::VT_String)
_result = setting->str;
if (setting && setting->mType == ESM::VT_String)
_result = setting->mStr;
else
_result = _tag;
}
@ -745,7 +745,7 @@ void WindowManager::setSelectedSpell(const std::string& spellId, int successChan
{
mHud->setSelectedSpell(spellId, successChancePercent);
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
mSpellWindow->setTitle(spell->name);
mSpellWindow->setTitle(spell->mName);
}
void WindowManager::setSelectedEnchantItem(const MWWorld::Ptr& item, int chargePercent)

@ -65,12 +65,12 @@ namespace MWMechanics
const MWWorld::TimeStamp& start = iter->second.first;
float magnitude = iter->second.second;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration)
if (iter->mDuration)
{
int duration = iter->duration;
int duration = iter->mDuration;
if (effects.second)
duration *= magnitude;
@ -87,22 +87,22 @@ namespace MWMechanics
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
iter->effectID);
iter->mEffectID);
if (iter->duration==0)
if (iter->mDuration==0)
{
param.mMagnitude =
static_cast<int> (magnitude / (0.1 * magicEffect->data.baseCost));
static_cast<int> (magnitude / (0.1 * magicEffect->mData.mBaseCost));
}
else
{
param.mMagnitude =
static_cast<int> (0.05*magnitude / (0.1 * magicEffect->data.baseCost));
static_cast<int> (0.05*magnitude / (0.1 * magicEffect->mData.mBaseCost));
}
}
else
param.mMagnitude = static_cast<int> (
(iter->magnMax-iter->magnMin)*magnitude + iter->magnMin);
(iter->mMagnMax-iter->mMagnMin)*magnitude + iter->mMagnMin);
mEffects.add (*iter, param);
}
@ -115,32 +115,32 @@ namespace MWMechanics
{
if (const ESM::Spell *spell =
MWBase::Environment::get().getWorld()->getStore().spells.search (id))
return std::make_pair (spell->effects, false);
return std::make_pair (spell->mEffects, false);
if (const ESM::Potion *potion =
MWBase::Environment::get().getWorld()->getStore().potions.search (id))
return std::make_pair (potion->effects, false);
return std::make_pair (potion->mEffects, false);
if (const ESM::Ingredient *ingredient =
MWBase::Environment::get().getWorld()->getStore().ingreds.search (id))
{
const ESM::MagicEffect *magicEffect =
MWBase::Environment::get().getWorld()->getStore().magicEffects.find (
ingredient->data.effectID[0]);
ingredient->mData.mEffectID[0]);
ESM::ENAMstruct effect;
effect.effectID = ingredient->data.effectID[0];
effect.skill = ingredient->data.skills[0];
effect.attribute = ingredient->data.attributes[0];
effect.range = 0;
effect.area = 0;
effect.duration = magicEffect->data.flags & ESM::MagicEffect::NoDuration ? 0 : 1;
effect.magnMin = 1;
effect.magnMax = 1;
effect.mEffectID = ingredient->mData.mEffectID[0];
effect.mSkill = ingredient->mData.mSkills[0];
effect.mAttribute = ingredient->mData.mAttributes[0];
effect.mRange = 0;
effect.mArea = 0;
effect.mDuration = magicEffect->mData.mFlags & ESM::MagicEffect::NoDuration ? 0 : 1;
effect.mMagnMin = 1;
effect.mMagnMax = 1;
std::pair<ESM::EffectList, bool> result;
result.first.list.push_back (effect);
result.first.mList.push_back (effect);
result.second = true;
return result;
@ -159,10 +159,10 @@ namespace MWMechanics
bool found = false;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration)
if (iter->mDuration)
{
found = true;
break;
@ -238,11 +238,11 @@ namespace MWMechanics
int duration = 0;
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.list.begin());
iter!=effects.first.list.end(); ++iter)
for (std::vector<ESM::ENAMstruct>::const_iterator iter (effects.first.mList.begin());
iter!=effects.first.mList.end(); ++iter)
{
if (iter->duration>duration)
duration = iter->duration;
if (iter->mDuration > duration)
duration = iter->mDuration;
}
if (effects.second)

@ -5,7 +5,7 @@
#include <stdexcept>
#include <components/esm/defs.hpp>
#include <components/esm/effectlist.hpp>
namespace MWMechanics
{
@ -13,19 +13,19 @@ namespace MWMechanics
EffectKey::EffectKey (const ESM::ENAMstruct& effect)
{
mId = effect.effectID;
mId = effect.mEffectID;
mArg = -1;
if (effect.skill!=-1)
mArg = effect.skill;
if (effect.mSkill!=-1)
mArg = effect.mSkill;
if (effect.attribute!=-1)
if (effect.mAttribute!=-1)
{
if (mArg!=-1)
throw std::runtime_error (
"magic effect can't have both a skill and an attribute argument");
mArg = effect.attribute;
mArg = effect.mAttribute;
}
}
@ -70,17 +70,17 @@ namespace MWMechanics
void MagicEffects::add (const ESM::EffectList& list)
{
for (std::vector<ESM::ENAMstruct>::const_iterator iter (list.list.begin()); iter!=list.list.end();
for (std::vector<ESM::ENAMstruct>::const_iterator iter (list.mList.begin()); iter!=list.mList.end();
++iter)
{
EffectParam param;
if (iter->magnMin>=iter->magnMax)
param.mMagnitude = iter->magnMin;
if (iter->mMagnMin>=iter->mMagnMax)
param.mMagnitude = iter->mMagnMin;
else
param.mMagnitude = static_cast<int> (
(iter->magnMax-iter->magnMin+1)*
(static_cast<float> (std::rand()) / RAND_MAX) + iter->magnMin);
(iter->mMagnMax-iter->mMagnMin+1)*
(static_cast<float> (std::rand()) / RAND_MAX) + iter->mMagnMin);
add (*iter, param);
}

@ -22,21 +22,21 @@ namespace MWMechanics
const ESM::NPC *player = ptr.get<ESM::NPC>()->base;
// reset
creatureStats.setLevel(player->npdt52.level);
creatureStats.setLevel(player->mNpdt52.mLevel);
creatureStats.getSpells().clear();
creatureStats.setMagicEffects(MagicEffects());
for (int i=0; i<27; ++i)
npcStats.getSkill (i).setBase (player->npdt52.skills[i]);
npcStats.getSkill (i).setBase (player->mNpdt52.mSkills[i]);
creatureStats.getAttribute(0).setBase (player->npdt52.strength);
creatureStats.getAttribute(1).setBase (player->npdt52.intelligence);
creatureStats.getAttribute(2).setBase (player->npdt52.willpower);
creatureStats.getAttribute(3).setBase (player->npdt52.agility);
creatureStats.getAttribute(4).setBase (player->npdt52.speed);
creatureStats.getAttribute(5).setBase (player->npdt52.endurance);
creatureStats.getAttribute(6).setBase (player->npdt52.personality);
creatureStats.getAttribute(7).setBase (player->npdt52.luck);
creatureStats.getAttribute(0).setBase (player->mNpdt52.mStrength);
creatureStats.getAttribute(1).setBase (player->mNpdt52.mIntelligence);
creatureStats.getAttribute(2).setBase (player->mNpdt52.mWillpower);
creatureStats.getAttribute(3).setBase (player->mNpdt52.mAgility);
creatureStats.getAttribute(4).setBase (player->mNpdt52.mSpeed);
creatureStats.getAttribute(5).setBase (player->mNpdt52.mEndurance);
creatureStats.getAttribute(6).setBase (player->mNpdt52.mPersonality);
creatureStats.getAttribute(7).setBase (player->mNpdt52.mLuck);
// race
if (mRaceSelected)
@ -52,18 +52,18 @@ namespace MWMechanics
const ESM::Race::MaleFemale *attribute = 0;
switch (i)
{
case 0: attribute = &race->data.strength; break;
case 1: attribute = &race->data.intelligence; break;
case 2: attribute = &race->data.willpower; break;
case 3: attribute = &race->data.agility; break;
case 4: attribute = &race->data.speed; break;
case 5: attribute = &race->data.endurance; break;
case 6: attribute = &race->data.personality; break;
case 7: attribute = &race->data.luck; break;
case 0: attribute = &race->mData.mStrength; break;
case 1: attribute = &race->mData.mIntelligence; break;
case 2: attribute = &race->mData.mWillpower; break;
case 3: attribute = &race->mData.mAgility; break;
case 4: attribute = &race->mData.mSpeed; break;
case 5: attribute = &race->mData.mEndurance; break;
case 6: attribute = &race->mData.mPersonality; break;
case 7: attribute = &race->mData.mLuck; break;
}
creatureStats.getAttribute(i).setBase (
static_cast<int> (male ? attribute->male : attribute->female));
static_cast<int> (male ? attribute->mMale : attribute->mFemale));
}
for (int i=0; i<27; ++i)
@ -71,17 +71,17 @@ namespace MWMechanics
int bonus = 0;
for (int i2=0; i2<7; ++i2)
if (race->data.bonus[i2].skill==i)
if (race->mData.mBonus[i2].mSkill==i)
{
bonus = race->data.bonus[i2].bonus;
bonus = race->mData.mBonus[i2].mBonus;
break;
}
npcStats.getSkill (i).setBase (5 + bonus);
}
for (std::vector<std::string>::const_iterator iter (race->powers.list.begin());
iter!=race->powers.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (race->mPowers.mList.begin());
iter!=race->mPowers.mList.end(); ++iter)
{
creatureStats.getSpells().add (*iter);
}
@ -94,8 +94,8 @@ namespace MWMechanics
MWBase::Environment::get().getWorld()->getStore().birthSigns.find (
MWBase::Environment::get().getWorld()->getPlayer().getBirthsign());
for (std::vector<std::string>::const_iterator iter (sign->powers.list.begin());
iter!=sign->powers.list.end(); ++iter)
for (std::vector<std::string>::const_iterator iter (sign->mPowers.mList.begin());
iter!=sign->mPowers.mList.end(); ++iter)
{
creatureStats.getSpells().add (*iter);
}
@ -108,7 +108,7 @@ namespace MWMechanics
for (int i=0; i<2; ++i)
{
int attribute = class_.data.attribute[i];
int attribute = class_.mData.mAttribute[i];
if (attribute>=0 && attribute<8)
{
creatureStats.getAttribute(attribute).setBase (
@ -122,7 +122,7 @@ namespace MWMechanics
for (int i2=0; i2<5; ++i2)
{
int index = class_.data.skills[i2][i];
int index = class_.mData.mSkills[i2][i];
if (index>=0 && index<27)
{
@ -137,7 +137,7 @@ namespace MWMechanics
for (ContainerType::const_iterator iter (skills.begin()); iter!=skills.end(); ++iter)
{
if (iter->second.data.specialization==class_.data.specialization)
if (iter->second.mData.mSpecialization==class_.mData.mSpecialization)
{
int index = iter->first;
@ -262,9 +262,9 @@ namespace MWMechanics
MWBase::Environment::get().getWindowManager()->setValue ("name", MWBase::Environment::get().getWorld()->getPlayer().getName());
MWBase::Environment::get().getWindowManager()->setValue ("race",
MWBase::Environment::get().getWorld()->getStore().races.find (MWBase::Environment::get().getWorld()->getPlayer().
getRace())->name);
getRace())->mName);
MWBase::Environment::get().getWindowManager()->setValue ("class",
MWBase::Environment::get().getWorld()->getPlayer().getClass().name);
MWBase::Environment::get().getWorld()->getPlayer().getClass().mName);
mUpdatePlayer = false;
MWBase::WindowManager::SkillList majorSkills (5);
@ -272,8 +272,8 @@ namespace MWMechanics
for (int i=0; i<5; ++i)
{
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][0];
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().data.skills[i][1];
minorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][0];
majorSkills[i] = MWBase::Environment::get().getWorld()->getPlayer().getClass().mData.mSkills[i][1];
}
MWBase::Environment::get().getWindowManager()->configureSkills (majorSkills, minorSkills);

@ -81,29 +81,29 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
if (usageType>0)
{
skillFactor = skill->data.useValue[usageType];
skillFactor = skill->mData.mUseValue[usageType];
if (skillFactor<=0)
throw std::runtime_error ("invalid skill gain factor");
}
float typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->f;
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMiscSkillBonus")->mF;
for (int i=0; i<5; ++i)
if (class_.data.skills[i][0]==skillIndex)
if (class_.mData.mSkills[i][0]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->f;
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMinorSkillBonus")->mF;
break;
}
for (int i=0; i<5; ++i)
if (class_.data.skills[i][1]==skillIndex)
if (class_.mData.mSkills[i][1]==skillIndex)
{
typeFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->f;
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fMajorSkillBonus")->mF;
break;
}
@ -113,10 +113,10 @@ float MWMechanics::NpcStats::getSkillGain (int skillIndex, const ESM::Class& cla
float specialisationFactor = 1;
if (skill->data.specialization==class_.data.specialization)
if (skill->mData.mSpecialization==class_.mData.mSpecialization)
{
specialisationFactor =
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->f;
MWBase::Environment::get().getWorld()->getStore().gameSettings.find ("fSpecialSkillBonus")->mF;
if (specialisationFactor<=0)
throw std::runtime_error ("invalid skill specialisation factor");

@ -14,7 +14,7 @@ namespace MWMechanics
{
void Spells::addSpell (const ESM::Spell *spell, MagicEffects& effects) const
{
effects.add (spell->effects);
effects.add (spell->mEffects);
}
Spells::TIterator Spells::begin() const
@ -52,8 +52,8 @@ namespace MWMechanics
{
const ESM::Spell *spell = MWBase::Environment::get().getWorld()->getStore().spells.find (*iter);
if (spell->data.type==ESM::Spell::ST_Ability || spell->data.type==ESM::Spell::ST_Blight ||
spell->data.type==ESM::Spell::ST_Disease || spell->data.type==ESM::Spell::ST_Curse)
if (spell->mData.mType==ESM::Spell::ST_Ability || spell->mData.mType==ESM::Spell::ST_Blight ||
spell->mData.mType==ESM::Spell::ST_Disease || spell->mData.mType==ESM::Spell::ST_Curse)
addSpell (spell, effects);
}

@ -35,14 +35,14 @@ namespace MWMechanics
// determine the spell's school
// this is always the school where the player's respective skill is the least advanced
// out of all the magic effects' schools
const std::vector<ESM::ENAMstruct>& effects = spell->effects.list;
const std::vector<ESM::ENAMstruct>& effects = spell->mEffects.mList;
int school = -1;
int skillLevel = -1;
for (std::vector<ESM::ENAMstruct>::const_iterator it = effects.begin();
it != effects.end(); ++it)
{
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->effectID);
int _school = effect->data.school;
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().magicEffects.find(it->mEffectID);
int _school = effect->mData.mSchool;
int _skillLevel = stats.getSkill (spellSchoolToSkill(_school)).getModified();
if (school == -1)
@ -73,8 +73,8 @@ namespace MWMechanics
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().spells.find(spellId);
if (spell->data.flags & ESM::Spell::F_Always // spells with this flag always succeed (usually birthsign spells)
|| spell->data.type == ESM::Spell::ST_Power) // powers always succeed, but can be cast only once per day
if (spell->mData.mFlags & ESM::Spell::F_Always // spells with this flag always succeed (usually birthsign spells)
|| spell->mData.mType == ESM::Spell::ST_Power) // powers always succeed, but can be cast only once per day
return 100.0;
NpcStats& stats = MWWorld::Class::get(actor).getNpcStats(actor);
@ -89,7 +89,7 @@ namespace MWMechanics
int luck = creatureStats.getAttribute(ESM::Attribute::Luck).getModified();
int currentFatigue = creatureStats.getFatigue().getCurrent();
int maxFatigue = creatureStats.getFatigue().getModified();
int spellCost = spell->data.cost;
int spellCost = spell->mData.mCost;
// There we go, all needed variables are there, lets go
float chance = (float(skillLevel * 2) + float(willpower)/5.0 + float(luck)/ 10.0 - spellCost - soundMagnitude) * (float(currentFatigue + maxFatigue * 1.5)) / float(maxFatigue * 2.0);

@ -45,10 +45,10 @@ void Actors::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
Ogre::SceneNode* insert = cellnode->createChildSceneNode();
const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]);
insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale);
insert->setScale(ptr.getCellRef().mScale, ptr.getCellRef().mScale, ptr.getCellRef().mScale);
// Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot;
f = ptr.getCellRef().mPos.rot;
// Rotate around X axis
Quaternion xr(Radian(-f[0]), Vector3::UNIT_X);

@ -22,9 +22,9 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr): Animation()
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
assert (ref->base != NULL);
if(!ref->base->model.empty())
if(!ref->base->mModel.empty())
{
std::string mesh = "meshes\\" + ref->base->model;
std::string mesh = "meshes\\" + ref->base->mModel;
mEntityList = NifOgre::NIFLoader::createEntities(mInsert, &mTextKeys, mesh);
for(size_t i = 0;i < mEntityList.mEntities.size();i++)

@ -71,18 +71,18 @@ ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
ManualObject *result = mSceneMgr->createManualObject();
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
it != pathgrid->edges.end();
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->mEdges.begin();
it != pathgrid->mEdges.end();
++it)
{
const ESM::Pathgrid::Edge &edge = *it;
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1];
Vector3 direction = (Vector3(p2.x, p2.y, p2.z) - Vector3(p1.x, p1.y, p1.z));
const ESM::Pathgrid::Point &p1 = pathgrid->mPoints[edge.mV0], &p2 = pathgrid->mPoints[edge.mV1];
Vector3 direction = (Vector3(p2.mX, p2.mY, p2.mZ) - Vector3(p1.mX, p1.mY, p1.mZ));
Vector3 lineDisplacement = direction.crossProduct(Vector3::UNIT_Z).normalisedCopy();
lineDisplacement = lineDisplacement * POINT_MESH_BASE +
Vector3(0, 0, 10); // move lines up a little, so they will be less covered by meshes/landscape
result->position(Vector3(p1.x, p1.y, p1.z) + lineDisplacement);
result->position(Vector3(p2.x, p2.y, p2.z) + lineDisplacement);
result->position(Vector3(p1.mX, p1.mY, p1.mZ) + lineDisplacement);
result->position(Vector3(p2.mX, p2.mY, p2.mZ) + lineDisplacement);
}
result->end();
@ -98,11 +98,11 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
bool first = true;
uint32 startIndex = 0;
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->points.begin();
it != pathgrid->points.end();
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->mPoints.begin();
it != pathgrid->mPoints.end();
it++, startIndex += 6)
{
Vector3 pointPos(it->x, it->y, it->z);
Vector3 pointPos(it->mX, it->mY, it->mZ);
if (!first)
{
@ -229,8 +229,8 @@ void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
Vector3 cellPathGridPos(0, 0, 0);
if (store->cell->isExterior())
{
cellPathGridPos.x = store->cell->data.gridX * ESM::Land::REAL_SIZE;
cellPathGridPos.y = store->cell->data.gridY * ESM::Land::REAL_SIZE;
cellPathGridPos.x = store->cell->mData.mX * ESM::Land::REAL_SIZE;
cellPathGridPos.y = store->cell->mData.mY * ESM::Land::REAL_SIZE;
}
SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
cellPathGrid->attachObject(createPathgridLines(pathgrid));
@ -238,7 +238,7 @@ void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
if (store->cell->isExterior())
{
mExteriorPathgridNodes[std::make_pair(store->cell->data.gridX, store->cell->data.gridY)] = cellPathGrid;
mExteriorPathgridNodes[std::make_pair(store->cell->mData.mX, store->cell->mData.mY)] = cellPathGrid;
}
else
{
@ -252,7 +252,7 @@ void Debugging::disableCellPathgrid(MWWorld::Ptr::CellStore *store)
if (store->cell->isExterior())
{
ExteriorPathgridNodes::iterator it =
mExteriorPathgridNodes.find(std::make_pair(store->cell->data.gridX, store->cell->data.gridY));
mExteriorPathgridNodes.find(std::make_pair(store->cell->mData.mX, store->cell->mData.mY));
if (it != mExteriorPathgridNodes.end())
{
destroyCellPathgridNode(it->second);

@ -108,10 +108,10 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell)
mCameraRotNode->setOrientation(Quaternion::IDENTITY);
std::string name = "Cell_"+coordStr(cell->cell->data.gridX, cell->cell->data.gridY);
std::string name = "Cell_"+coordStr(cell->cell->mData.mX, cell->cell->mData.mY);
int x = cell->cell->data.gridX;
int y = cell->cell->data.gridY;
int x = cell->cell->mData.mX;
int y = cell->cell->mData.mY;
mCameraPosNode->setPosition(Vector3(0,0,0));
@ -163,7 +163,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
const int segsX = std::ceil( length.x / sSize );
const int segsY = std::ceil( length.y / sSize );
mInteriorName = cell->cell->name;
mInteriorName = cell->cell->mName;
for (int x=0; x<segsX; ++x)
{
@ -173,7 +173,7 @@ void LocalMap::requestMap(MWWorld::Ptr::CellStore* cell,
Vector2 newcenter = start + 4096;
render(newcenter.x - center.x, newcenter.y - center.y, z.y, z.x, sSize, sSize,
cell->cell->name + "_" + coordStr(x,y));
cell->cell->mName + "_" + coordStr(x,y));
}
}
}

@ -63,18 +63,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
}
const ESMS::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Race *race = store.races.find(ref->base->race);
const ESM::Race *race = store.races.find(ref->base->mRace);
std::string hairID = ref->base->hair;
std::string headID = ref->base->head;
headModel = "meshes\\" + store.bodyParts.find(headID)->model;
hairModel = "meshes\\" + store.bodyParts.find(hairID)->model;
npcName = ref->base->name;
std::string hairID = ref->base->mHair;
std::string headID = ref->base->mHead;
headModel = "meshes\\" + store.bodyParts.find(headID)->mModel;
hairModel = "meshes\\" + store.bodyParts.find(hairID)->mModel;
npcName = ref->base->mName;
isFemale = !!(ref->base->flags&ESM::NPC::Female);
isBeast = !!(race->data.flags&ESM::Race::Beast);
isFemale = !!(ref->base->mFlags&ESM::NPC::Female);
isBeast = !!(race->mData.mFlags&ESM::Race::Beast);
bodyRaceID = "b_n_"+ref->base->race;
bodyRaceID = "b_n_"+ref->base->mRace;
std::transform(bodyRaceID.begin(), bodyRaceID.end(), bodyRaceID.begin(), ::tolower);
/*std::cout << "Race: " << ref->base->race ;
@ -129,10 +129,12 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
}
}
if(isFemale)
mInsert->scale(race->data.height.female, race->data.height.female, race->data.height.female);
else
mInsert->scale(race->data.height.male, race->data.height.male, race->data.height.male);
float scale = race->mData.mHeight.mMale;
if (isFemale) {
scale = race->mData.mHeight.mFemale;
}
mInsert->scale(scale, scale, scale);
updateParts();
}
@ -175,7 +177,7 @@ void NpcAnimation::updateParts()
MWWorld::Ptr ptr = *robe;
const ESM::Clothing *clothes = (ptr.get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Robe, 5, parts);
reserveIndividualPart(ESM::PRT_Groin, MWWorld::InventoryStore::Slot_Robe, 5);
reserveIndividualPart(ESM::PRT_Skirt, MWWorld::InventoryStore::Slot_Robe, 5);
@ -195,7 +197,7 @@ void NpcAnimation::updateParts()
MWWorld::Ptr ptr = *skirtiter;
const ESM::Clothing *clothes = (ptr.get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Skirt, 4, parts);
reserveIndividualPart(ESM::PRT_Groin, MWWorld::InventoryStore::Slot_Skirt, 4);
reserveIndividualPart(ESM::PRT_RLeg, MWWorld::InventoryStore::Slot_Skirt, 4);
@ -206,32 +208,32 @@ void NpcAnimation::updateParts()
{
removeIndividualPart(ESM::PRT_Hair);
const ESM::Armor *armor = (helmet->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Helmet, 3, parts);
}
if(cuirass != mInv.end())
{
const ESM::Armor *armor = (cuirass->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Cuirass, 3, parts);
}
if(greaves != mInv.end())
{
const ESM::Armor *armor = (greaves->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Greaves, 3, parts);
}
if(leftpauldron != mInv.end())
{
const ESM::Armor *armor = (leftpauldron->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftPauldron, 3, parts);
}
if(rightpauldron != mInv.end())
{
const ESM::Armor *armor = (rightpauldron->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightPauldron, 3, parts);
}
if(boots != mInv.end())
@ -239,13 +241,13 @@ void NpcAnimation::updateParts()
if(boots->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (boots->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Boots, 2, parts);
}
else if(boots->getTypeName() == typeid(ESM::Armor).name())
{
const ESM::Armor *armor = (boots->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Boots, 3, parts);
}
}
@ -254,13 +256,13 @@ void NpcAnimation::updateParts()
if(leftglove->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (leftglove->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftGauntlet, 2, parts);
}
else
{
const ESM::Armor *armor = (leftglove->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_LeftGauntlet, 3, parts);
}
}
@ -269,13 +271,13 @@ void NpcAnimation::updateParts()
if(rightglove->getTypeName() == typeid(ESM::Clothing).name())
{
const ESM::Clothing *clothes = (rightglove->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightGauntlet, 2, parts);
}
else
{
const ESM::Armor *armor = (rightglove->get<ESM::Armor>())->base;
std::vector<ESM::PartReference> parts = armor->parts.parts;
std::vector<ESM::PartReference> parts = armor->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_RightGauntlet, 3, parts);
}
@ -284,13 +286,13 @@ void NpcAnimation::updateParts()
if(shirt != mInv.end())
{
const ESM::Clothing *clothes = (shirt->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Shirt, 2, parts);
}
if(pants != mInv.end())
{
const ESM::Clothing *clothes = (pants->get<ESM::Clothing>())->base;
std::vector<ESM::PartReference> parts = clothes->parts.parts;
std::vector<ESM::PartReference> parts = clothes->mParts.mParts;
addPartGroup(MWWorld::InventoryStore::Slot_Pants, 2, parts);
}
}
@ -348,7 +350,7 @@ void NpcAnimation::updateParts()
} while(1);
if(part)
addOrReplaceIndividualPart(PartTypeList[i].type, -1,1, "meshes\\"+part->model);
addOrReplaceIndividualPart(PartTypeList[i].type, -1,1, "meshes\\"+part->mModel);
}
}
}
@ -575,14 +577,14 @@ void NpcAnimation::addPartGroup(int group, int priority, std::vector<ESM::PartRe
const ESM::BodyPart *bodypart = 0;
if(isFemale)
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.female);
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.mFemale);
if(!bodypart)
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.male);
bodypart = MWBase::Environment::get().getWorld()->getStore().bodyParts.search(part.mMale);
if(bodypart)
addOrReplaceIndividualPart(part.part, group, priority,"meshes\\" + bodypart->model);
addOrReplaceIndividualPart(part.mPart, group, priority,"meshes\\" + bodypart->mModel);
else
reserveIndividualPart(part.part, group, priority);
reserveIndividualPart(part.mPart, group, priority);
}
}

@ -64,11 +64,11 @@ void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_)
const float *f = ptr.getRefData().getPosition().pos;
insert->setPosition(f[0], f[1], f[2]);
insert->setScale(ptr.getCellRef().scale, ptr.getCellRef().scale, ptr.getCellRef().scale);
insert->setScale(ptr.getCellRef().mScale, ptr.getCellRef().mScale, ptr.getCellRef().mScale);
// Convert MW rotation to a quaternion:
f = ptr.getCellRef().pos.rot;
f = ptr.getCellRef().mPos.rot;
// Rotate around X axis
Ogre::Quaternion xr(Ogre::Radian(-f[0]), Ogre::Vector3::UNIT_X);
@ -219,18 +219,18 @@ void Objects::insertLight (const MWWorld::Ptr& ptr, float r, float g, float b, f
info.radius = radius;
info.colour = Ogre::ColourValue(r, g, b);
if (ref->base->data.flags & ESM::Light::Negative)
if (ref->base->mData.mFlags & ESM::Light::Negative)
info.colour *= -1;
info.interior = (ptr.getCell()->cell->data.flags & ESM::Cell::Interior);
info.interior = (ptr.getCell()->cell->mData.mFlags & ESM::Cell::Interior);
if (ref->base->data.flags & ESM::Light::Flicker)
if (ref->base->mData.mFlags & ESM::Light::Flicker)
info.type = LT_Flicker;
else if (ref->base->data.flags & ESM::Light::FlickerSlow)
else if (ref->base->mData.mFlags & ESM::Light::FlickerSlow)
info.type = LT_FlickerSlow;
else if (ref->base->data.flags & ESM::Light::Pulse)
else if (ref->base->mData.mFlags & ESM::Light::Pulse)
info.type = LT_Pulse;
else if (ref->base->data.flags & ESM::Light::PulseSlow)
else if (ref->base->mData.mFlags & ESM::Light::PulseSlow)
info.type = LT_PulseSlow;
else
info.type = LT_Normal;

@ -366,9 +366,9 @@ void RenderingManager::update (float duration)
}
void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
if(store->cell->data.flags & store->cell->HasWater
|| ((!(store->cell->data.flags & ESM::Cell::Interior))
&& !MWBase::Environment::get().getWorld()->getStore().lands.search(store->cell->data.gridX,store->cell->data.gridY) )) // always use water, if the cell does not have land.
if(store->cell->mData.mFlags & store->cell->HasWater
|| ((!(store->cell->mData.mFlags & ESM::Cell::Interior))
&& !MWBase::Environment::get().getWorld()->getStore().lands.search(store->cell->mData.mX,store->cell->mData.mY) )) // always use water, if the cell does not have land.
{
if(mWater == 0)
mWater = new MWRender::Water(mRendering.getCamera(), this, store->cell);
@ -459,9 +459,9 @@ bool RenderingManager::toggleRenderMode(int mode)
void RenderingManager::configureFog(MWWorld::Ptr::CellStore &mCell)
{
Ogre::ColourValue color;
color.setAsABGR (mCell.cell->ambi.fog);
color.setAsABGR (mCell.cell->mAmbi.mFog);
configureFog(mCell.cell->ambi.fogDensity, color);
configureFog(mCell.cell->mAmbi.mFogDensity, color);
if (mWater)
mWater->setViewportBackground (Ogre::ColourValue(0.8f, 0.9f, 1.0f));
@ -511,7 +511,7 @@ void RenderingManager::setAmbientMode()
void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
{
mAmbientColor.setAsABGR (mCell.cell->ambi.ambient);
mAmbientColor.setAsABGR (mCell.cell->mAmbi.mAmbient);
setAmbientMode();
// Create a "sun" that shines light downwards. It doesn't look
@ -521,7 +521,7 @@ void RenderingManager::configureAmbient(MWWorld::Ptr::CellStore &mCell)
mSun = mRendering.getScene()->createLight();
}
Ogre::ColourValue colour;
colour.setAsABGR (mCell.cell->ambi.sunlight);
colour.setAsABGR (mCell.cell->mAmbi.mSunlight);
mSun->setDiffuseColour (colour);
mSun->setType(Ogre::Light::LT_DIRECTIONAL);
mSun->setDirection(0,-1,0);
@ -605,7 +605,7 @@ void RenderingManager::setGlare(bool glare)
void RenderingManager::requestMap(MWWorld::Ptr::CellStore* cell)
{
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
mLocalMap->requestMap(cell);
else
mLocalMap->requestMap(cell, mObjects.getDimensions(cell));

@ -99,7 +99,7 @@ namespace MWRender
if (land == NULL) // no land data means we're not going to create any terrain.
return;
if (!land->dataLoaded)
if (!land->mDataLoaded)
{
land->loadData();
}
@ -134,7 +134,7 @@ namespace MWRender
const size_t xOffset = x * (mLandSize-1);
memcpy(&terrainData.inputFloat[terrainCopyY*mLandSize],
&land->landData->heights[yOffset + xOffset],
&land->mLandData->mHeights[yOffset + xOffset],
mLandSize*sizeof(float));
}
@ -159,7 +159,7 @@ namespace MWRender
terrain->setRenderQueueGroup(RQG_Main);
// disable or enable global colour map (depends on available vertex colours)
if ( land->landData->usingColours )
if ( land->mLandData->mUsingColours )
{
TexturePtr vertex = getVertexColours(land,
cellX, cellY,
@ -254,7 +254,7 @@ namespace MWRender
}
else
{
texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1)->texture;
texture = MWBase::Environment::get().getWorld()->getStore().landTexts.search(ltexIndex-1)->mTexture;
//TODO this is needed due to MWs messed up texture handling
texture = texture.substr(0, texture.rfind(".")) + ".dds";
}
@ -413,13 +413,13 @@ namespace MWRender
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cellX, cellY);
if ( land != NULL )
{
if (!land->dataLoaded)
if (!land->mDataLoaded)
{
land->loadData();
}
return land->landData
->textures[y * ESM::Land::LAND_TEXTURE_SIZE + x];
return land->mLandData
->mTextures[y * ESM::Land::LAND_TEXTURE_SIZE + x];
}
else
{
@ -463,7 +463,7 @@ namespace MWRender
if ( land != NULL )
{
const char* const colours = land->landData->colours;
const char* const colours = land->mLandData->mColours;
for ( int y = 0; y < size; y++ )
{
for ( int x = 0; x < size; x++ )

@ -38,7 +38,7 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mMaterial = MaterialManager::getSingleton().getByName("Water");
mTop = cell->water;
mTop = cell->mWater;
mIsUnderwater = false;
@ -55,9 +55,9 @@ Water::Water (Ogre::Camera *camera, RenderingManager* rend, const ESM::Cell* cel
mReflectionCamera = mSceneManager->createCamera("ReflectionCamera");
if(!(cell->data.flags & cell->Interior))
if(!(cell->mData.mFlags & cell->Interior))
{
mWaterNode->setPosition(getSceneNodeCoordinates(cell->data.gridX, cell->data.gridY));
mWaterNode->setPosition(getSceneNodeCoordinates(cell->mData.mX, cell->mData.mY));
}
mWaterNode->attachObject(mWater);
@ -156,12 +156,12 @@ Water::~Water()
void Water::changeCell(const ESM::Cell* cell)
{
mTop = cell->water;
mTop = cell->mWater;
setHeight(mTop);
if(!(cell->data.flags & cell->Interior))
mWaterNode->setPosition(getSceneNodeCoordinates(cell->data.gridX, cell->data.gridY));
if(!(cell->mData.mFlags & cell->Interior))
mWaterNode->setPosition(getSceneNodeCoordinates(cell->mData.mX, cell->mData.mY));
}
void Water::setHeight(const float height)

@ -45,7 +45,7 @@ namespace MWScript
if (const ESM::Cell *exterior = MWBase::Environment::get().getWorld()->getExterior (cell))
{
MWBase::Environment::get().getWorld()->indexToPosition (exterior->data.gridX, exterior->data.gridY,
MWBase::Environment::get().getWorld()->indexToPosition (exterior->mData.mX, exterior->mData.mY,
pos.pos[0], pos.pos[1], true);
MWBase::Environment::get().getWorld()->changeToExteriorCell (pos);
}
@ -87,7 +87,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
bool interior =
MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->data.flags &
MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mData.mFlags &
ESM::Cell::Interior;
runtime.push (interior ? 1 : 0);
@ -105,14 +105,14 @@ namespace MWScript
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell;
std::string current = cell->name;
std::string current = cell->mName;
if (!(cell->data.flags & ESM::Cell::Interior) && current.empty())
if (!(cell->mData.mFlags & ESM::Cell::Interior) && current.empty())
{
const ESM::Region *region =
MWBase::Environment::get().getWorld()->getStore().regions.find (cell->region);
MWBase::Environment::get().getWorld()->getStore().regions.find (cell->mRegion);
current = region->name;
current = region->mName;
}
bool match = current.length()>=name.length() &&
@ -143,7 +143,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel = level;
@ -161,7 +161,7 @@ namespace MWScript
MWWorld::Ptr::CellStore *cell = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell();
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
throw std::runtime_error("Can't set water level in exterior cell");
cell->mWaterLevel +=level;

@ -78,7 +78,7 @@ namespace MWScript
Interpreter::Type_Integer sum = 0;
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end(); ++iter)
if (toLower(iter->getCellRef().refID) == toLower(item))
if (toLower(iter->getCellRef().mRefID) == toLower(item))
sum += iter->getRefData().getCount();
runtime.push (sum);
@ -108,7 +108,7 @@ namespace MWScript
for (MWWorld::ContainerStoreIterator iter (store.begin()); iter!=store.end() && count;
++iter)
{
if (toLower(iter->getCellRef().refID) == toLower(item))
if (toLower(iter->getCellRef().mRefID) == toLower(item))
{
if (iter->getRefData().getCount()<=count)
{

@ -21,7 +21,7 @@ namespace MWScript
for (ESMS::RecListT<ESM::StartScript>::MapType::const_iterator iter
(store.startScripts.list.begin());
iter != store.startScripts.list.end(); ++iter)
addScript (iter->second.script);
addScript (iter->second.mScript);
}
void GlobalScripts::addScript (const std::string& name)

@ -17,11 +17,11 @@ namespace MWScript
void configure (const ESM::Script& script)
{
mShorts.clear();
mShorts.resize (script.data.numShorts, 0);
mShorts.resize (script.mData.mNumShorts, 0);
mLongs.clear();
mLongs.resize (script.data.numLongs, 0);
mLongs.resize (script.mData.mNumLongs, 0);
mFloats.clear();
mFloats.resize (script.data.numFloats, 0);
mFloats.resize (script.mData.mNumFloats, 0);
}
};
}

@ -38,7 +38,7 @@ namespace MWScript
try
{
std::istringstream input (script->scriptText);
std::istringstream input (script->mScriptText);
Compiler::Scanner scanner (mErrorHandler, input, mCompilerContext.getExtensions());
@ -62,7 +62,7 @@ namespace MWScript
{
std::cerr
<< "compiling failed: " << name << std::endl
<< script->scriptText
<< script->mScriptText
<< std::endl << std::endl;
}
@ -180,19 +180,19 @@ namespace MWScript
case 's':
offset = 0;
size = script->data.numShorts;
size = script->mData.mNumShorts;
break;
case 'l':
offset = script->data.numShorts;
size = script->data.numLongs;
offset = script->mData.mNumShorts;
size = script->mData.mNumLongs;
break;
case 'f':
offset = script->data.numShorts+script->data.numLongs;
size = script->data.numFloats;
offset = script->mData.mNumShorts+script->mData.mNumLongs;
size = script->mData.mNumFloats;
default:
@ -200,7 +200,7 @@ namespace MWScript
}
for (int i=0; i<size; ++i)
if (script->varNames.at (i+offset)==variable)
if (script->mVarNames.at (i+offset)==variable)
return i;
throw std::runtime_error ("unable to access local variable " + variable + " of " + scriptId);

@ -280,7 +280,7 @@ namespace MWScript
assert (ref);
const ESM::Class& class_ =
*MWBase::Environment::get().getWorld()->getStore().classes.find (ref->base->cls);
*MWBase::Environment::get().getWorld()->getStore().classes.find (ref->base->mClass);
float level = 0;
float progress = std::modf (stats.getSkill (mIndex).getBase(), &level);

@ -44,7 +44,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(ptr.getCellRef().scale);
runtime.push(ptr.getCellRef().mScale);
}
};
@ -126,15 +126,15 @@ namespace MWScript
if (axis=="x")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[0]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[0]).valueDegrees());
}
else if (axis=="y")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[1]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[1]).valueDegrees());
}
else if (axis=="z")
{
runtime.push(Ogre::Radian(ptr.getCellRef().pos.rot[2]).valueDegrees());
runtime.push(Ogre::Radian(ptr.getCellRef().mPos.rot[2]).valueDegrees());
}
else
throw std::runtime_error ("invalid ration axis: " + axis);

@ -120,22 +120,22 @@ namespace MWSound
if(snd == NULL)
throw std::runtime_error(std::string("Failed to lookup sound ")+soundId);
volume *= pow(10.0, (snd->data.volume/255.0*3348.0 - 3348.0) / 2000.0);
volume *= pow(10.0, (snd->mData.mVolume/255.0*3348.0 - 3348.0) / 2000.0);
if(snd->data.minRange == 0 && snd->data.maxRange == 0)
if(snd->mData.mMinRange == 0 && snd->mData.mMaxRange == 0)
{
min = 100.0f;
max = 2000.0f;
}
else
{
min = snd->data.minRange * 20.0f;
max = snd->data.maxRange * 50.0f;
min = snd->mData.mMinRange * 20.0f;
max = snd->mData.mMaxRange * 50.0f;
min = std::max(min, 1.0f);
max = std::max(min, max);
}
return "Sound/"+snd->sound;
return "Sound/"+snd->mSound;
}
@ -426,13 +426,13 @@ namespace MWSound
//If the region has changed
timePassed += duration;
if((current->cell->data.flags & current->cell->Interior) || timePassed < 10)
if((current->cell->mData.mFlags & current->cell->Interior) || timePassed < 10)
return;
timePassed = 0;
if(regionName != current->cell->region)
if(regionName != current->cell->mRegion)
{
regionName = current->cell->region;
regionName = current->cell->mRegion;
total = 0;
}
@ -443,10 +443,10 @@ namespace MWSound
std::vector<ESM::Region::SoundRef>::const_iterator soundIter;
if(total == 0)
{
soundIter = regn->soundList.begin();
while(soundIter != regn->soundList.end())
soundIter = regn->mSoundList.begin();
while(soundIter != regn->mSoundList.end())
{
total += (int)soundIter->chance;
total += (int)soundIter->mChance;
soundIter++;
}
if(total == 0)
@ -456,11 +456,11 @@ namespace MWSound
int r = (int)(rand()/((double)RAND_MAX+1) * total);
int pos = 0;
soundIter = regn->soundList.begin();
while(soundIter != regn->soundList.end())
soundIter = regn->mSoundList.begin();
while(soundIter != regn->mSoundList.end())
{
const std::string go = soundIter->sound.toString();
int chance = (int) soundIter->chance;
const std::string go = soundIter->mSound.toString();
int chance = (int) soundIter->mChance;
//std::cout << "Sound: " << go.name <<" Chance:" << chance << "\n";
soundIter++;
if(r - pos < chance)
@ -492,7 +492,7 @@ namespace MWSound
const ESM::Cell *cell = player.getCell()->cell;
Environment env = Env_Normal;
if((cell->data.flags&cell->HasWater) && mListenerPos.z < cell->water)
if((cell->mData.mFlags&cell->HasWater) && mListenerPos.z < cell->mWater)
env = Env_Underwater;
mOutput->updateListener(

@ -16,7 +16,7 @@ namespace MWWorld
{
LiveCellRef<ESM::Book> *ref = getTarget().get<ESM::Book>();
if (ref->base->data.isScroll)
if (ref->base->mData.mIsScroll)
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Scroll);
MWBase::Environment::get().getWindowManager()->getScrollWindow()->open(getTarget());

@ -10,13 +10,13 @@
MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
{
if (cell->data.flags & ESM::Cell::Interior)
if (cell->mData.mFlags & ESM::Cell::Interior)
{
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (cell->name);
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (cell->mName);
if (result==mInteriors.end())
{
result = mInteriors.insert (std::make_pair (cell->name, Ptr::CellStore (cell))).first;
result = mInteriors.insert (std::make_pair (cell->mName, Ptr::CellStore (cell))).first;
}
return &result->second;
@ -24,12 +24,12 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
else
{
std::map<std::pair<int, int>, Ptr::CellStore>::iterator result =
mExteriors.find (std::make_pair (cell->data.gridX, cell->data.gridY));
mExteriors.find (std::make_pair (cell->mData.mX, cell->mData.mY));
if (result==mExteriors.end())
{
result = mExteriors.insert (std::make_pair (
std::make_pair (cell->data.gridX, cell->data.gridY), Ptr::CellStore (cell))).first;
std::make_pair (cell->mData.mX, cell->mData.mY), Ptr::CellStore (cell))).first;
}
@ -46,7 +46,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
for (CellRefList<ESM::Creature>::List::iterator iter (
@ -56,7 +56,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
for (CellRefList<ESM::NPC>::List::iterator iter (
@ -66,7 +66,7 @@ void MWWorld::Cells::fillContainers (Ptr::CellStore& cellStore)
Ptr container (&*iter, &cellStore);
Class::get (container).getContainerStore (container).fill (
iter->base->inventory, mStore);
iter->base->mInventory, mStore);
}
}
@ -105,11 +105,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getExterior (int x, int y)
// Cell isn't predefined. Make one on the fly.
ESM::Cell record;
record.data.flags = 0;
record.data.gridX = x;
record.data.gridY = y;
record.water = 0;
record.mapColor = 0;
record.mData.mFlags = 0;
record.mData.mX = x;
record.mData.mY = y;
record.mWater = 0;
record.mMapColor = 0;
cell = MWBase::Environment::get().getWorld()->createRecord (record);
}

@ -13,7 +13,7 @@ namespace MWWorld
{
CellStore::CellStore (const ESM::Cell *cell_) : cell (cell_), mState (State_Unloaded)
{
mWaterLevel = cell->water;
mWaterLevel = cell->mWater;
}
void CellStore::load (const ESMS::ESMStore &store, ESM::ESMReader &esm)
@ -45,7 +45,7 @@ namespace MWWorld
{
assert (cell);
if (cell->context.filename.empty())
if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position.
@ -58,7 +58,7 @@ namespace MWWorld
{
std::string lowerCase;
std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase),
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
(int(*)(int)) std::tolower);
mIds.push_back (lowerCase);
@ -71,7 +71,7 @@ namespace MWWorld
{
assert (cell);
if (cell->context.filename.empty())
if (cell->mContext.filename.empty())
return; // this is a dynamically generated cell -> skipping.
// Reopen the ESM reader and seek to the right position.
@ -84,12 +84,12 @@ namespace MWWorld
{
std::string lowerCase;
std::transform (ref.refID.begin(), ref.refID.end(), std::back_inserter (lowerCase),
std::transform (ref.mRefID.begin(), ref.mRefID.end(), std::back_inserter (lowerCase),
(int(*)(int)) std::tolower);
int rec = store.find(ref.refID);
int rec = store.find(ref.mRefID);
ref.refID = lowerCase;
ref.mRefID = lowerCase;
/* We can optimize this further by storing the pointer to the
record itself in store.all, so that we don't need to look it
@ -119,9 +119,9 @@ namespace MWWorld
case ESM::REC_STAT: statics.find(ref, store.statics); break;
case ESM::REC_WEAP: weapons.find(ref, store.weapons); break;
case 0: std::cout << "Cell reference " + ref.refID + " not found!\n"; break;
case 0: std::cout << "Cell reference " + ref.mRefID + " not found!\n"; break;
default:
std::cout << "WARNING: Ignoring reference '" << ref.refID << "' of unhandled type\n";
std::cout << "WARNING: Ignoring reference '" << ref.mRefID << "' of unhandled type\n";
}
}
}

@ -58,9 +58,9 @@ namespace MWWorld
template <typename Y>
void find(ESM::CellRef &ref, const Y& recList)
{
const X* obj = recList.find(ref.refID);
const X* obj = recList.find(ref.mRefID);
if(obj == NULL)
throw std::runtime_error("Error resolving cell reference " + ref.refID);
throw std::runtime_error("Error resolving cell reference " + ref.mRefID);
list.push_back(LiveRef(ref, obj));
}
@ -69,7 +69,7 @@ namespace MWWorld
{
for (typename std::list<LiveRef>::iterator iter (list.begin()); iter!=list.end(); ++iter)
{
if (iter->mData.getCount() > 0 && iter->ref.refID == name)
if (iter->mData.getCount() > 0 && iter->ref.mRefID == name)
return &*iter;
}
@ -156,9 +156,9 @@ namespace MWWorld
}
bool operator==(const CellStore &cell) {
return this->cell->name == cell.cell->name &&
this->cell->data.gridX == cell.cell->data.gridX &&
this->cell->data.gridY == cell.cell->data.gridY;
return this->cell->mName == cell.cell->mName &&
this->cell->mData.mX == cell.cell->mData.mX &&
this->cell->mData.mY == cell.cell->mData.mY;
}
bool operator!=(const CellStore &cell) {

@ -29,7 +29,7 @@ namespace
++iter)
{
if (iter->mData.getCount()>0)
sum += iter->mData.getCount()*iter->base->data.weight;
sum += iter->mData.getCount()*iter->base->mData.mWeight;
}
return sum;
@ -59,12 +59,12 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
/// \todo add current weapon/armor health, remaining lockpick/repair uses, current enchantment charge here as soon as they are implemented
if ( ptr1.mCellRef->refID == ptr2.mCellRef->refID
if ( ptr1.mCellRef->mRefID == ptr2.mCellRef->mRefID
&& MWWorld::Class::get(ptr1).getScript(ptr1) == "" // item with a script never stacks
&& MWWorld::Class::get(ptr1).getEnchantment(ptr1) == "" // item with enchantment never stacks (we could revisit this later, but for now it makes selecting items in the spell window much easier)
&& ptr1.mCellRef->owner == ptr2.mCellRef->owner
&& ptr1.mCellRef->soul == ptr2.mCellRef->soul
&& ptr1.mCellRef->charge == ptr2.mCellRef->charge)
&& ptr1.mCellRef->mOwner == ptr2.mCellRef->mOwner
&& ptr1.mCellRef->mSoul == ptr2.mCellRef->mSoul
&& ptr1.mCellRef->mCharge == ptr2.mCellRef->mCharge)
return true;
return false;
@ -76,24 +76,24 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
// gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001
// this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->str)
if (MWWorld::Class::get(ptr).getName(ptr) == MWBase::Environment::get().getWorld()->getStore().gameSettings.search("sGold")->mStr)
{
MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
ptr.get<ESM::Miscellaneous>();
if (compare_string_ci(gold->ref.refID, "gold_001")
|| compare_string_ci(gold->ref.refID, "gold_005")
|| compare_string_ci(gold->ref.refID, "gold_010")
|| compare_string_ci(gold->ref.refID, "gold_025")
|| compare_string_ci(gold->ref.refID, "gold_100"))
if (compare_string_ci(gold->ref.mRefID, "gold_001")
|| compare_string_ci(gold->ref.mRefID, "gold_005")
|| compare_string_ci(gold->ref.mRefID, "gold_010")
|| compare_string_ci(gold->ref.mRefID, "gold_025")
|| compare_string_ci(gold->ref.mRefID, "gold_100"))
{
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), "Gold_001");
int count = (ptr.getRefData().getCount() == 1) ? gold->base->data.value : ptr.getRefData().getCount();
int count = (ptr.getRefData().getCount() == 1) ? gold->base->mData.mValue : ptr.getRefData().getCount();
ref.getPtr().getRefData().setCount(count);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
{
if (compare_string_ci((*iter).get<ESM::Miscellaneous>()->ref.refID, "gold_001"))
if (compare_string_ci((*iter).get<ESM::Miscellaneous>()->ref.mRefID, "gold_001"))
{
(*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
flagAsModified();
@ -117,7 +117,6 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr)
return iter;
}
}
// if we got here, this means no stacking
return addImpl(ptr);
}
@ -148,10 +147,10 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImpl (const Ptr& ptr
void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS::ESMStore& store)
{
for (std::vector<ESM::ContItem>::const_iterator iter (items.list.begin()); iter!=items.list.end();
for (std::vector<ESM::ContItem>::const_iterator iter (items.mList.begin()); iter!=items.mList.end();
++iter)
{
ManualRef ref (store, iter->item.toString());
ManualRef ref (store, iter->mItem.toString());
if (ref.getPtr().getTypeName()==typeid (ESM::ItemLevList).name())
{
@ -159,7 +158,7 @@ void MWWorld::ContainerStore::fill (const ESM::InventoryList& items, const ESMS:
continue;
}
ref.getPtr().getRefData().setCount (std::abs(iter->count)); /// \todo implement item restocking (indicated by negative count)
ref.getPtr().getRefData().setCount (std::abs(iter->mCount)); /// \todo implement item restocking (indicated by negative count)
add (ref.getPtr());
}

@ -35,27 +35,27 @@ namespace MWWorld
char type = ' ';
Data value;
switch (iter->second.type)
switch (iter->second.mType)
{
case ESM::VT_Short:
type = 's';
value.mShort = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
case ESM::VT_Int:
type = 'l';
value.mLong = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
case ESM::VT_Float:
type = 'f';
value.mFloat = *reinterpret_cast<const Interpreter::Type_Float *> (
&iter->second.value);
&iter->second.mValue);
break;
default:

@ -233,8 +233,8 @@ const MWMechanics::MagicEffects& MWWorld::InventoryStore::getMagicEffects()
const ESM::Enchantment& enchantment =
*MWBase::Environment::get().getWorld()->getStore().enchants.find (enchantmentId);
if (enchantment.data.type==ESM::Enchantment::ConstantEffect)
mMagicEffects.add (enchantment.effects);
if (enchantment.mData.mType==ESM::Enchantment::ConstantEffect)
mMagicEffects.add (enchantment.mEffects);
}
}

@ -15,9 +15,9 @@ namespace
cellRefList.list.begin());
iter!=cellRefList.list.end(); ++iter)
{
if (!iter->base->script.empty() && iter->mData.getCount())
if (!iter->base->mScript.empty() && iter->mData.getCount())
{
localScripts.add (iter->base->script, MWWorld::Ptr (&*iter, cell));
localScripts.add (iter->base->mScript, MWWorld::Ptr (&*iter, cell));
}
}
}

@ -82,16 +82,16 @@ namespace MWWorld
// initialise
ESM::CellRef& cellRef = mPtr.getCellRef();
cellRef.refID = name;
cellRef.refnum = -1;
cellRef.scale = 1;
cellRef.factIndex = 0;
cellRef.charge = 0;
cellRef.intv = 0;
cellRef.nam9 = 0;
cellRef.teleport = false;
cellRef.lockLevel = 0;
cellRef.unam = 0;
cellRef.mRefID = name;
cellRef.mRefnum = -1;
cellRef.mScale = 1;
cellRef.mFactIndex = 0;
cellRef.mCharge = 0;
cellRef.mIntv = 0;
cellRef.mNam9 = 0;
cellRef.mTeleport = false;
cellRef.mLockLevel = 0;
cellRef.mUnam = 0;
}
const Ptr& getPtr() const

@ -378,7 +378,7 @@ namespace MWWorld
return false;
}
btVector3 btMin, btMax;
float scale = ptr.getCellRef().scale;
float scale = ptr.getCellRef().mScale;
mEngine->getObjectAABB(model, scale, btMin, btMax);
min.x = btMin.x();

@ -18,16 +18,16 @@ namespace MWWorld
mAutoMove (false), mForwardBackward (0)
{
mPlayer.base = player;
mPlayer.ref.refID = "player";
mName = player->name;
mMale = !(player->flags & ESM::NPC::Female);
mRace = player->race;
mPlayer.ref.mRefID = "player";
mName = player->mName;
mMale = !(player->mFlags & ESM::NPC::Female);
mRace = player->mRace;
float* playerPos = mPlayer.mData.getPosition().pos;
playerPos[0] = playerPos[1] = playerPos[2] = 0;
/// \todo Do not make a copy of classes defined in esm/p records.
mClass = new ESM::Class (*world.getStore().classes.find (player->cls));
mClass = new ESM::Class (*world.getStore().classes.find (player->mClass));
}
Player::~Player()

@ -29,7 +29,7 @@ namespace MWWorld
}
RefData::RefData (const ESM::CellRef& cellRef)
: mBaseNode(0), mHasLocals (false), mEnabled (true), mCount (1), mPosition (cellRef.pos),
: mBaseNode(0), mHasLocals (false), mEnabled (true), mCount (1), mPosition (cellRef.mPos),
mCustomData (0)
{}

@ -88,11 +88,11 @@ namespace MWWorld
mPhysics->removeObject (node->getName());
}
if (!((*iter)->cell->data.flags & ESM::Cell::Interior))
if (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior))
{
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->data.gridX,(*iter)->cell->data.gridY);
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search((*iter)->cell->mData.mX,(*iter)->cell->mData.mY);
if (land)
mPhysics->removeHeightField( (*iter)->cell->data.gridX, (*iter)->cell->data.gridY );
mPhysics->removeHeightField( (*iter)->cell->mData.mX, (*iter)->cell->mData.mY );
}
}
@ -126,12 +126,12 @@ namespace MWWorld
float verts = ESM::Land::LAND_SIZE;
float worldsize = ESM::Land::REAL_SIZE;
if (!(cell->cell->data.flags & ESM::Cell::Interior))
if (!(cell->cell->mData.mFlags & ESM::Cell::Interior))
{
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->data.gridX,cell->cell->data.gridY);
ESM::Land* land = MWBase::Environment::get().getWorld()->getStore().lands.search(cell->cell->mData.mX,cell->cell->mData.mY);
if (land)
mPhysics->addHeightField (land->landData->heights,
cell->cell->data.gridX, cell->cell->data.gridY,
mPhysics->addHeightField (land->mLandData->mHeights,
cell->cell->mData.mX, cell->cell->mData.mY,
0, ( worldsize/(verts-1) ), verts);
}
@ -149,8 +149,8 @@ namespace MWWorld
const ESM::Position& pos,
bool adjustPlayerPos)
{
bool hasWater = cell->cell->data.flags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->water);
bool hasWater = cell->cell->mData.mFlags & cell->cell->HasWater;
mPhysics->setCurrentWater(hasWater, cell->cell->mWater);
MWBase::World *world = MWBase::Environment::get().getWorld();
world->getPlayer().setCell(cell);
@ -188,10 +188,10 @@ namespace MWWorld
int numUnload = 0;
while (active!=mActiveCells.end())
{
if (!((*active)->cell->data.flags & ESM::Cell::Interior))
if (!((*active)->cell->mData.mFlags & ESM::Cell::Interior))
{
if (std::abs (X-(*active)->cell->data.gridX)<=1 &&
std::abs (Y-(*active)->cell->data.gridY)<=1)
if (std::abs (X-(*active)->cell->mData.mX)<=1 &&
std::abs (Y-(*active)->cell->mData.mY)<=1)
{
// keep cells within the new 3x3 grid
++active;
@ -206,10 +206,10 @@ namespace MWWorld
active = mActiveCells.begin();
while (active!=mActiveCells.end())
{
if (!((*active)->cell->data.flags & ESM::Cell::Interior))
if (!((*active)->cell->mData.mFlags & ESM::Cell::Interior))
{
if (std::abs (X-(*active)->cell->data.gridX)<=1 &&
std::abs (Y-(*active)->cell->data.gridY)<=1)
if (std::abs (X-(*active)->cell->mData.mX)<=1 &&
std::abs (Y-(*active)->cell->mData.mY)<=1)
{
// keep cells within the new 3x3 grid
++active;
@ -231,10 +231,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (x==(*iter)->cell->data.gridX &&
y==(*iter)->cell->data.gridY)
if (x==(*iter)->cell->mData.mX &&
y==(*iter)->cell->mData.mY)
break;
++iter;
@ -253,10 +253,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (x==(*iter)->cell->data.gridX &&
y==(*iter)->cell->data.gridY)
if (x==(*iter)->cell->mData.mX &&
y==(*iter)->cell->mData.mY)
break;
++iter;
@ -277,10 +277,10 @@ namespace MWWorld
while (iter!=mActiveCells.end())
{
assert (!((*iter)->cell->data.flags & ESM::Cell::Interior));
assert (!((*iter)->cell->mData.mFlags & ESM::Cell::Interior));
if (X==(*iter)->cell->data.gridX &&
Y==(*iter)->cell->data.gridY)
if (X==(*iter)->cell->mData.mX &&
Y==(*iter)->cell->mData.mY)
break;
++iter;

@ -493,7 +493,7 @@ void WeatherManager::update(float duration)
if (exterior)
{
std::string regionstr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->region;
std::string regionstr = MWBase::Environment::get().getWorld()->getPlayer().getPlayer().getCell()->cell->mRegion;
boost::algorithm::to_lower(regionstr);
if (mWeatherUpdateTime <= 0 || regionstr != mCurrentRegion)
@ -512,16 +512,16 @@ void WeatherManager::update(float duration)
if (region != 0)
{
float clear = region->data.clear/255.f;
float cloudy = region->data.cloudy/255.f;
float foggy = region->data.foggy/255.f;
float overcast = region->data.overcast/255.f;
float rain = region->data.rain/255.f;
float thunder = region->data.thunder/255.f;
float ash = region->data.ash/255.f;
float blight = region->data.blight/255.f;
//float snow = region->data.a/255.f;
//float blizzard = region->data.b/255.f;
float clear = region->mData.mClear/255.f;
float cloudy = region->mData.mCloudy/255.f;
float foggy = region->mData.mFoggy/255.f;
float overcast = region->mData.mOvercast/255.f;
float rain = region->mData.mRain/255.f;
float thunder = region->mData.mThunder/255.f;
float ash = region->mData.mAsh/255.f;
float blight = region->mData.mBlight/255.f;
//float snow = region->mData.a/255.f;
//float blizzard = region->mData.b/255.f;
// re-scale to 100 percent
const float total = clear+cloudy+foggy+overcast+rain+thunder+ash+blight;//+snow+blizzard;

@ -231,7 +231,7 @@ namespace MWWorld
for (ESMS::RecListT<ESM::Region>::MapType::const_iterator iter (mStore.regions.list.begin());
iter!=mStore.regions.list.end(); ++iter)
{
if (ESMS::RecListT<ESM::Region>::toLower (iter->second.name)==cellName2)
if (ESMS::RecListT<ESM::Region>::toLower (iter->second.mName)==cellName2)
{
if (const ESM::Cell *cell = mStore.cells.searchExtByRegion (iter->first))
return cell;
@ -514,7 +514,7 @@ namespace MWWorld
std::pair<std::string, float> result = mPhysics->getFacedHandle (*this);
if (result.first.empty() ||
result.second>getStore().gameSettings.find ("iMaxActivateDist")->i)
result.second>getStore().gameSettings.find ("iMaxActivateDist")->mI)
return "";
return result.first;
@ -554,10 +554,10 @@ namespace MWWorld
if (*currCell != newCell) {
if (isPlayer) {
if (!newCell.isExterior()) {
changeToInteriorCell(newCell.cell->name, pos);
changeToInteriorCell(newCell.cell->mName, pos);
} else {
int cellX = newCell.cell->data.gridX;
int cellY = newCell.cell->data.gridY;
int cellX = newCell.cell->mData.mX;
int cellY = newCell.cell->mData.mY;
mWorldScene->changeCell(cellX, cellY, pos, false);
}
} else {
@ -621,7 +621,7 @@ namespace MWWorld
{
MWWorld::Class::get(ptr).adjustScale(ptr,scale);
ptr.getCellRef().scale = scale;
ptr.getCellRef().mScale = scale;
//scale = scale/ptr.getRefData().getBaseNode()->getScale().x;
ptr.getRefData().getBaseNode()->setScale(scale,scale,scale);
mPhysics->scaleObject( ptr.getRefData().getHandle(), scale );
@ -746,7 +746,7 @@ namespace MWWorld
stream << "$dynamic" << mNextDynamicRecord++;
ESM::Potion record2 (record);
record2.mId = stream.str();
record2.getId() = stream.str();
const ESM::Potion *created =
&mStore.potions.list.insert (std::make_pair (stream.str(), record2)).first->second;
@ -772,23 +772,23 @@ namespace MWWorld
const ESM::Cell *World::createRecord (const ESM::Cell& record)
{
if (record.data.flags & ESM::Cell::Interior)
if (record.mData.mFlags & ESM::Cell::Interior)
{
if (mStore.cells.searchInt (record.name))
if (mStore.cells.searchInt (record.mName))
throw std::runtime_error ("failed creating interior cell");
ESM::Cell *cell = new ESM::Cell (record);
mStore.cells.intCells.insert (std::make_pair (record.name, cell));
mStore.cells.intCells.insert (std::make_pair (record.mName, cell));
return cell;
}
else
{
if (mStore.cells.searchExt (record.data.gridX, record.data.gridY))
if (mStore.cells.searchExt (record.mData.mX, record.mData.mY))
throw std::runtime_error ("failed creating exterior cell");
ESM::Cell *cell = new ESM::Cell (record);
mStore.cells.extCells.insert (
std::make_pair (std::make_pair (record.data.gridX, record.data.gridY), cell));
std::make_pair (std::make_pair (record.mData.mX, record.mData.mY), cell));
return cell;
}
}
@ -983,7 +983,7 @@ namespace MWWorld
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
if (currentCell)
{
if (!(currentCell->cell->data.flags & ESM::Cell::Interior))
if (!(currentCell->cell->mData.mFlags & ESM::Cell::Interior))
return true;
else
return false;
@ -996,7 +996,7 @@ namespace MWWorld
Ptr::CellStore *currentCell = mWorldScene->getCurrentCell();
if (currentCell)
{
if (!(currentCell->cell->data.flags & ESM::Cell::QuasiEx))
if (!(currentCell->cell->mData.mFlags & ESM::Cell::QuasiEx))
return false;
else
return true;
@ -1041,28 +1041,28 @@ namespace MWWorld
{
MWWorld::LiveCellRef<ESM::Door>& ref = *it;
if (ref.ref.teleport)
if (ref.ref.mTeleport)
{
World::DoorMarker newMarker;
std::string dest;
if (ref.ref.destCell != "")
if (ref.ref.mDestCell != "")
{
// door leads to an interior, use interior name
dest = ref.ref.destCell;
dest = ref.ref.mDestCell;
}
else
{
// door leads to exterior, use cell name (if any), otherwise translated region name
int x,y;
positionToIndex (ref.ref.doorDest.pos[0], ref.ref.doorDest.pos[1], x, y);
positionToIndex (ref.ref.mDoorDest.pos[0], ref.ref.mDoorDest.pos[1], x, y);
const ESM::Cell* cell = mStore.cells.findExt(x,y);
if (cell->name != "")
dest = cell->name;
if (cell->mName != "")
dest = cell->mName;
else
{
const ESM::Region* region = mStore.regions.search(cell->region);
dest = region->name;
const ESM::Region* region = mStore.regions.search(cell->mRegion);
dest = region->mName;
}
}
@ -1212,10 +1212,10 @@ namespace MWWorld
bool
World::isUnderwater(const ESM::Cell &cell, const Ogre::Vector3 &pos)
{
if (!(cell.data.flags & ESM::Cell::HasWater)) {
if (!(cell.mData.mFlags & ESM::Cell::HasWater)) {
return false;
}
return pos.z < cell.water;
return pos.z < cell.mWater;
}
void World::renderPlayer()

@ -39,11 +39,11 @@ add_component_dir (esm_store
)
add_component_dir (esm
attr defs esm_reader loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell
attr defs esm_reader esm_writer loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell
loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst
loadinfo loadingr loadland loadlevlist loadligh loadlocks loadltex loadmgef loadmisc loadnpcc
loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat
loadweap records aipackage
loadweap records aipackage effectlist spelllist
)
add_component_dir (misc

@ -1,5 +1,8 @@
#include "aipackage.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM
{
void AIPackageList::load(ESMReader &esm)
@ -34,4 +37,8 @@ namespace ESM
}
}
}
void AIPackageList::save(ESMWriter &esm)
{
}
}

@ -1,12 +1,16 @@
#ifndef OPENMW_ESM_AIPACKAGE_H
#define OPENMW_ESM_AIPACKAGE_H
#include "esm_reader.hpp"
#include <vector>
#include <string>
#include "esm_common.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
#pragma pack(push)
#pragma pack(1)
@ -88,6 +92,7 @@ namespace ESM
/// it needs to use retSubName() if needed. But, hey, there
/// is only one field left (XSCL) and only two records uses AI
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
}

@ -2,7 +2,7 @@
using namespace ESM;
const Attribute::AttributeID Attribute::attributeIds[Attribute::Length] = {
const Attribute::AttributeID Attribute::sAttributeIds[Attribute::Length] = {
Attribute::Strength,
Attribute::Intelligence,
Attribute::Willpower,
@ -13,7 +13,7 @@ const Attribute::AttributeID Attribute::attributeIds[Attribute::Length] = {
Attribute::Luck
};
const std::string Attribute::gmstAttributeIds[Attribute::Length] = {
const std::string Attribute::sGmstAttributeIds[Attribute::Length] = {
"sAttributeStrength",
"sAttributeIntelligence",
"sAttributeWillpower",
@ -24,7 +24,7 @@ const std::string Attribute::gmstAttributeIds[Attribute::Length] = {
"sAttributeLuck"
};
const std::string Attribute::gmstAttributeDescIds[Attribute::Length] = {
const std::string Attribute::sGmstAttributeDescIds[Attribute::Length] = {
"sStrDesc",
"sIntDesc",
"sWilDesc",
@ -35,7 +35,7 @@ const std::string Attribute::gmstAttributeDescIds[Attribute::Length] = {
"sLucDesc"
};
const std::string Attribute::attributeIcons[Attribute::Length] = {
const std::string Attribute::sAttributeIcons[Attribute::Length] = {
"icons\\k\\attribute_strength.dds",
"icons\\k\\attribute_int.dds",
"icons\\k\\attribute_wilpower.dds",

@ -24,18 +24,18 @@ struct Attribute
Length
};
AttributeID id;
std::string name, description;
AttributeID mId;
std::string mName, mDescription;
static const AttributeID attributeIds[Length];
static const std::string gmstAttributeIds[Length];
static const std::string gmstAttributeDescIds[Length];
static const std::string attributeIcons[Length];
static const AttributeID sAttributeIds[Length];
static const std::string sGmstAttributeIds[Length];
static const std::string sGmstAttributeDescIds[Length];
static const std::string sAttributeIcons[Length];
Attribute(AttributeID id, const std::string &name, const std::string &description)
: id(id)
, name(name)
, description(description)
: mId(id)
, mName(name)
, mDescription(description)
{
}
};

@ -1,7 +1,7 @@
#ifndef _ESM_DEFS_H
#define _ESM_DEFS_H
#include "esm_reader.hpp"
#include <libs/platform/stdint.h>
namespace ESM
{
@ -35,23 +35,6 @@ enum RangeType
RT_Target = 2
};
/** A list of references to spells and spell effects. This is shared
between the records BSGN, NPC and RACE.
*/
struct SpellList
{
std::vector<std::string> list;
void load(ESMReader &esm)
{
while (esm.isNextSub("NPCS"))
list.push_back(esm.getHString());
}
};
/** Defines a spell effect. Shared between SPEL (Spells), ALCH
(Potions) and ENCH (Item enchantments) records
*/
#pragma pack(push)
#pragma pack(1)
@ -61,38 +44,7 @@ struct Position
float pos[3];
float rot[3];
};
struct ENAMstruct
{
// Magical effect, hard-coded ID
short effectID;
// Which skills/attributes are affected (for restore/drain spells
// etc.)
signed char skill, attribute; // -1 if N/A
// Other spell parameters
int range; // 0 - self, 1 - touch, 2 - target (RangeType enum)
int area, duration, magnMin, magnMax;
// Struct size should be 24 bytes
};
#pragma pack(pop)
struct EffectList
{
std::vector<ENAMstruct> list;
void load(ESMReader &esm)
{
ENAMstruct s;
while (esm.isNextSub("ENAM"))
{
esm.getHT(s, 24);
list.push_back(s);
}
}
};
}
#endif

@ -0,0 +1,24 @@
#include "effectlist.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM {
void EffectList::load(ESMReader &esm)
{
ENAMstruct s;
while (esm.isNextSub("ENAM")) {
esm.getHT(s, 24);
mList.push_back(s);
}
}
void EffectList::save(ESMWriter &esm)
{
for (std::vector<ENAMstruct>::iterator it = mList.begin(); it != mList.end(); ++it) {
esm.writeHNT<ENAMstruct>("ENAM", *it, 24);
}
}
} // end namespace

@ -0,0 +1,43 @@
#ifndef OPENMW_ESM_EFFECTLIST_H
#define OPENMW_ESM_EFFECTLIST_H
#include <vector>
namespace ESM
{
class ESMReader;
class ESMWriter;
#pragma pack(push)
#pragma pack(1)
/** Defines a spell effect. Shared between SPEL (Spells), ALCH
(Potions) and ENCH (Item enchantments) records
*/
struct ENAMstruct
{
// Magical effect, hard-coded ID
short mEffectID;
// Which skills/attributes are affected (for restore/drain spells
// etc.)
signed char mSkill, mAttribute; // -1 if N/A
// Other spell parameters
int mRange; // 0 - self, 1 - touch, 2 - target (RangeType enum)
int mArea, mDuration, mMagnMin, mMagnMax;
};
#pragma pack(pop)
struct EffectList
{
std::vector<ENAMstruct> mList;
void load(ESMReader &esm);
void save(ESMWriter &esm);
};
}
#endif

@ -0,0 +1,125 @@
#ifndef _ESM_COMMON_H
#define _ESM_COMMON_H
#include <libs/platform/stdint.h>
#include <libs/platform/string.h>
namespace ESM
{
enum Version
{
VER_12 = 0x3f99999a,
VER_13 = 0x3fa66666
};
enum FileType
{
FT_ESP = 0, // Plugin
FT_ESM = 1, // Master
FT_ESS = 32 // Savegame
};
// Used to mark special files. The original ESM files are given
// special treatment in a few places, most noticably in loading and
// filtering out "dirtly" GMST entries correctly.
enum SpecialFile
{
SF_Other,
SF_Morrowind,
SF_Tribunal,
SF_Bloodmoon
};
/* A structure used for holding fixed-length strings. In the case of
LEN=4, it can be more efficient to match the string as a 32 bit
number, therefore the struct is implemented as a union with an int.
*/
template <int LEN>
union NAME_T
{
char name[LEN];
int32_t val;
bool operator==(const char *str) const
{
for(int i=0; i<LEN; i++)
if(name[i] != str[i]) return false;
else if(name[i] == 0) return true;
return str[LEN] == 0;
}
bool operator!=(const char *str) const { return !((*this)==str); }
bool operator==(const std::string &str) const
{
return (*this) == str.c_str();
}
bool operator!=(const std::string &str) const { return !((*this)==str); }
bool operator==(int v) const { return v == val; }
bool operator!=(int v) const { return v != val; }
std::string toString() const { return std::string(name, strnlen(name, LEN)); }
};
typedef NAME_T<4> NAME;
typedef NAME_T<32> NAME32;
typedef NAME_T<64> NAME64;
typedef NAME_T<256> NAME256;
#pragma pack(push)
#pragma pack(1)
/// File header data for all ES files
struct HEDRstruct
{
/* File format version. This is actually a float, the supported
versions are 1.2 and 1.3. These correspond to:
1.2 = 0x3f99999a and 1.3 = 0x3fa66666
*/
int version;
int type; // 0=esp, 1=esm, 32=ess
NAME32 author; // Author's name
NAME256 desc; // File description
int records; // Number of records? Not used.
};
// Defines another files (esm or esp) that this file depends upon.
struct MasterData
{
std::string name;
uint64_t size;
};
// Data that is only present in save game files
struct SaveData
{
float pos[6]; // Player position and rotation
NAME64 cell; // Cell name
float unk2; // Unknown value - possibly game time?
NAME32 player; // Player name
};
#pragma pack(pop)
/* This struct defines a file 'context' which can be saved and later
restored by an ESMReader instance. It will save the position within
a file, and when restored will let you read from that position as
if you never left it.
*/
struct ESM_Context
{
std::string filename;
uint32_t leftRec, leftSub;
size_t leftFile;
NAME recName, subName;
HEDRstruct header;
// True if subName has been read but not used.
bool subCached;
// File position. Only used for stored contexts, not regularly
// updated within the reader itself.
size_t filePos;
};
}
#endif

@ -12,124 +12,10 @@
#include <components/misc/stringops.hpp>
#include <components/to_utf8/to_utf8.hpp>
#include "esm_common.hpp"
namespace ESM {
enum Version
{
VER_12 = 0x3f99999a,
VER_13 = 0x3fa66666
};
enum FileType
{
FT_ESP = 0, // Plugin
FT_ESM = 1, // Master
FT_ESS = 32 // Savegame
};
// Used to mark special files. The original ESM files are given
// special treatment in a few places, most noticably in loading and
// filtering out "dirtly" GMST entries correctly.
enum SpecialFile
{
SF_Other,
SF_Morrowind,
SF_Tribunal,
SF_Bloodmoon
};
/* A structure used for holding fixed-length strings. In the case of
LEN=4, it can be more efficient to match the string as a 32 bit
number, therefore the struct is implemented as a union with an int.
*/
template <int LEN>
union NAME_T
{
char name[LEN];
int32_t val;
bool operator==(const char *str) const
{
for(int i=0; i<LEN; i++)
if(name[i] != str[i]) return false;
else if(name[i] == 0) return true;
return str[LEN] == 0;
}
bool operator!=(const char *str) const { return !((*this)==str); }
bool operator==(const std::string &str) const
{
return (*this) == str.c_str();
}
bool operator!=(const std::string &str) const { return !((*this)==str); }
bool operator==(int v) const { return v == val; }
bool operator!=(int v) const { return v != val; }
std::string toString() const { return std::string(name, strnlen(name, LEN)); }
};
typedef NAME_T<4> NAME;
typedef NAME_T<32> NAME32;
typedef NAME_T<64> NAME64;
typedef NAME_T<256> NAME256;
#pragma pack(push)
#pragma pack(1)
/// File header data for all ES files
struct HEDRstruct
{
/* File format version. This is actually a float, the supported
versions are 1.2 and 1.3. These correspond to:
1.2 = 0x3f99999a and 1.3 = 0x3fa66666
*/
int version;
int type; // 0=esp, 1=esm, 32=ess
NAME32 author; // Author's name
NAME256 desc; // File description
int records; // Number of records? Not used.
};
// Defines another files (esm or esp) that this file depends upon.
struct MasterData
{
std::string name;
uint64_t size;
};
// Data that is only present in save game files
struct SaveData
{
float pos[6]; // Player position and rotation
NAME64 cell; // Cell name
float unk2; // Unknown value - possibly game time?
NAME32 player; // Player name
};
#pragma pack(pop)
/* This struct defines a file 'context' which can be saved and later
restored by an ESMReader instance. It will save the position within
a file, and when restored will let you read from that position as
if you never left it.
*/
struct ESM_Context
{
std::string filename;
uint32_t leftRec, leftSub;
size_t leftFile;
NAME recName, subName;
HEDRstruct header;
// True if subName has been read but not used.
bool subCached;
// File position. Only used for stored contexts, not regularly
// updated within the reader itself.
size_t filePos;
};
class ESMReader
{
public:
@ -150,7 +36,8 @@ public:
int getVer() const { return mCtx.header.version; }
float getFVer() { if(mCtx.header.version == VER_12) return 1.2; else return 1.3; }
int getSpecial() const { return mSpf; }
int getSpecial() { return mSpf; }
int getType() { return mCtx.header.type; }
const std::string getAuthor() { return mCtx.header.author.toString(); }
const std::string getDesc() { return mCtx.header.desc.toString(); }
const SaveData &getSaveData() const { return mSaveData; }

@ -0,0 +1,212 @@
#include "esm_writer.hpp"
#include <fstream>
#include <cstring>
bool count = true;
namespace ESM
{
int ESMWriter::getVersion()
{
return m_header.version;
}
void ESMWriter::setVersion(int ver)
{
m_header.version = ver;
}
int ESMWriter::getType()
{
return m_header.type;
}
void ESMWriter::setType(int type)
{
m_header.type = type;
}
void ESMWriter::setAuthor(const std::string& auth)
{
strncpy((char*)&m_header.author, auth.c_str(), 32);
}
void ESMWriter::setDescription(const std::string& desc)
{
strncpy((char*)&m_header.desc, desc.c_str(), 256);
}
void ESMWriter::addMaster(const std::string& name, uint64_t size)
{
MasterData d;
d.name = name;
d.size = size;
m_masters.push_back(d);
}
void ESMWriter::save(const std::string& file)
{
std::ofstream fs(file.c_str(), std::ios_base::out | std::ios_base::trunc);
save(fs);
}
void ESMWriter::save(std::ostream& file)
{
m_recordCount = 0;
m_stream = &file;
startRecord("TES3", 0);
m_header.records = 0;
writeHNT("HEDR", m_header, 300);
m_headerPos = m_stream->tellp() - (std::streampos)4;
for (std::list<MasterData>::iterator it = m_masters.begin(); it != m_masters.end(); ++it)
{
writeHNString("MAST", it->name);
writeHNT("DATA", it->size);
}
endRecord("TES3");
}
void ESMWriter::close()
{
std::cout << "Writing amount of saved records (" << m_recordCount - 1 << ")" << std::endl;
m_stream->seekp(m_headerPos);
writeT<int>(m_recordCount-1);
m_stream->seekp(0, std::ios::end);
m_stream->flush();
if (!m_records.empty())
throw "Unclosed record remaining";
}
void ESMWriter::startRecord(const std::string& name, uint32_t flags)
{
m_recordCount++;
writeName(name);
RecordData rec;
rec.name = name;
rec.position = m_stream->tellp();
rec.size = 0;
writeT<int>(0); // Size goes here
writeT<int>(0); // Unused header?
writeT(flags);
m_records.push_back(rec);
assert(m_records.back().size == 0);
}
void ESMWriter::startSubRecord(const std::string& name)
{
writeName(name);
RecordData rec;
rec.name = name;
rec.position = m_stream->tellp();
rec.size = 0;
writeT<int>(0); // Size goes here
m_records.push_back(rec);
assert(m_records.back().size == 0);
}
void ESMWriter::endRecord(const std::string& name)
{
RecordData rec = m_records.back();
assert(rec.name == name);
m_records.pop_back();
m_stream->seekp(rec.position);
count = false;
write((char*)&rec.size, sizeof(int));
count = true;
m_stream->seekp(0, std::ios::end);
}
void ESMWriter::writeHNString(const std::string& name, const std::string& data)
{
startSubRecord(name);
writeHString(data);
endRecord(name);
}
void ESMWriter::writeHNString(const std::string& name, const std::string& data, int size)
{
assert(data.size() <= size);
startSubRecord(name);
writeHString(data);
if (data.size() < size)
{
for (int i = data.size(); i < size; ++i)
write("\0",1);
}
endRecord(name);
}
void ESMWriter::writeHString(const std::string& data)
{
if (data.size() == 0)
write("\0", 1);
else
{
char *ptr = ToUTF8::getBuffer(data.size()+1);
strncpy(ptr, &data[0], data.size());
ptr[data.size()] = '\0';
// Convert to UTF8 and return
std::string ascii = ToUTF8::getASCII(m_encoding);
write(ascii.c_str(), ascii.size());
}
}
void ESMWriter::writeHCString(const std::string& data)
{
writeHString(data);
if (data.size() > 0 && data[data.size()-1] != '\0')
write("\0", 1);
}
void ESMWriter::writeName(const std::string& name)
{
assert((name.size() == 4 && name[3] != '\0'));
write(name.c_str(), name.size());
}
void ESMWriter::write(const char* data, int size)
{
if (count && !m_records.empty())
{
for (std::list<RecordData>::iterator it = m_records.begin(); it != m_records.end(); ++it)
it->size += size;
}
m_stream->write(data, size);
}
void ESMWriter::setEncoding(const std::string& encoding)
{
if (encoding == "win1250")
{
m_encoding = ToUTF8::WINDOWS_1250;
}
else if (encoding == "win1251")
{
m_encoding = ToUTF8::WINDOWS_1251;
}
else
{
// Default Latin encoding
m_encoding = ToUTF8::WINDOWS_1252;
}
}
}

@ -0,0 +1,105 @@
#ifndef _ESM_WRITER_H
#define _ESM_WRITER_H
#include <iostream>
#include <list>
#include <assert.h>
#include "esm_common.hpp"
#include "../to_utf8/to_utf8.hpp"
namespace ESM {
class ESMWriter
{
struct RecordData
{
std::string name;
std::streampos position;
int size;
};
public:
int getVersion();
void setVersion(int ver);
int getType();
void setType(int type);
void setEncoding(const std::string& encoding); // Write strings as UTF-8?
void setAuthor(const std::string& author);
void setDescription(const std::string& desc);
void addMaster(const std::string& name, uint64_t size);
void save(const std::string& file);
void save(std::ostream& file);
void close();
void writeHNString(const std::string& name, const std::string& data);
void writeHNString(const std::string& name, const std::string& data, int size);
void writeHNCString(const std::string& name, const std::string& data)
{
startSubRecord(name);
writeHCString(data);
endRecord(name);
}
void writeHNOString(const std::string& name, const std::string& data)
{
if (!data.empty())
writeHNString(name, data);
}
void writeHNOCString(const std::string& name, const std::string& data)
{
if (!data.empty())
writeHNCString(name, data);
}
template<typename T>
void writeHNT(const std::string& name, const T& data)
{
startSubRecord(name);
writeT(data);
endRecord(name);
}
template<typename T>
void writeHNT(const std::string& name, const T& data, int size)
{
startSubRecord(name);
writeT(data, size);
endRecord(name);
}
template<typename T>
void writeT(const T& data)
{
write((char*)&data, sizeof(T));
}
template<typename T>
void writeT(const T& data, int size)
{
write((char*)&data, size);
}
void startRecord(const std::string& name, uint32_t flags);
void startSubRecord(const std::string& name);
void endRecord(const std::string& name);
void writeHString(const std::string& data);
void writeHCString(const std::string& data);
void writeName(const std::string& data);
void write(const char* data, int size);
private:
std::list<MasterData> m_masters;
std::list<RecordData> m_records;
std::ostream* m_stream;
std::streampos m_headerPos;
ToUTF8::FromType m_encoding;
int m_recordCount;
HEDRstruct m_header;
SaveData m_saveData;
};
}
#endif

@ -1,11 +1,20 @@
#include "loadacti.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM
{
void Activator::load(ESMReader &esm)
{
model = esm.getHNString("MODL");
name = esm.getHNString("FNAM");
script = esm.getHNOString("SCRI");
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
mScript = esm.getHNOString("SCRI");
}
void Activator::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
esm.writeHNOCString("SCRI", mScript);
}
}

@ -1,16 +1,20 @@
#ifndef _ESM_ACTI_H
#define _ESM_ACTI_H
#include "esm_reader.hpp"
#include "record.hpp"
namespace ESM
{
struct Activator
struct Activator : public Record
{
std::string name, script, model;
std::string mName, mScript, mModel;
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ACTI; }
};
}
#endif

@ -1,16 +1,26 @@
#include "loadalch.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM
{
void Potion::load(ESMReader &esm, const std::string& id)
void Potion::load(ESMReader &esm)
{
mId = id;
model = esm.getHNString("MODL");
icon = esm.getHNOString("TEXT"); // not ITEX here for some reason
script = esm.getHNOString("SCRI");
name = esm.getHNOString("FNAM");
esm.getHNT(data, "ALDT", 12);
effects.load(esm);
mModel = esm.getHNString("MODL");
mIcon = esm.getHNOString("TEXT"); // not ITEX here for some reason
mScript = esm.getHNOString("SCRI");
mName = esm.getHNOString("FNAM");
esm.getHNT(mData, "ALDT", 12);
mEffects.load(esm);
}
void Potion::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNOCString("TEXT", mIcon);
esm.writeHNOCString("SCRI", mScript);
esm.writeHNOCString("FNAM", mName);
esm.writeHNT("ALDT", mData, 12);
mEffects.save(esm);
}
}

@ -1,32 +1,34 @@
#ifndef _ESM_ALCH_H
#define _ESM_ALCH_H
#include "esm_reader.hpp"
#include "defs.hpp"
#include <string>
#include "record.hpp"
#include "effectlist.hpp"
namespace ESM
{
/*
* Alchemy item (potions)
*/
struct Potion
struct Potion : public Record
{
struct ALDTstruct
{
float weight;
int value;
int autoCalc;
float mWeight;
int mValue;
int mAutoCalc;
};
ALDTstruct data;
std::string name, model, icon, script;
EffectList effects;
ALDTstruct mData;
std::string mId;
std::string mName, mModel, mIcon, mScript;
EffectList mEffects;
void load(ESMReader &esm, const std::string& id);
void load(ESMReader &esm);
void save(ESMWriter &esm);
int getName() { return REC_ALCH; }
};
}
#endif

@ -1,13 +1,24 @@
#include "loadappa.hpp"
#include "esm_reader.hpp"
#include "esm_writer.hpp"
namespace ESM
{
void Apparatus::load(ESMReader &esm)
{
model = esm.getHNString("MODL");
name = esm.getHNString("FNAM");
esm.getHNT(data, "AADT", 16);
script = esm.getHNOString("SCRI");
icon = esm.getHNString("ITEX");
mModel = esm.getHNString("MODL");
mName = esm.getHNString("FNAM");
esm.getHNT(mData, "AADT", 16);
mScript = esm.getHNOString("SCRI");
mIcon = esm.getHNString("ITEX");
}
void Apparatus::save(ESMWriter &esm)
{
esm.writeHNCString("MODL", mModel);
esm.writeHNCString("FNAM", mName);
esm.writeHNT("AADT", mData, 16);
esm.writeHNOCString("SCRI", mScript);
esm.writeHNCString("ITEX", mIcon);
}
}

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

Loading…
Cancel
Save