Use CellRef's global variable to disable owner (Fixes #1677)

deque
scrawl 11 years ago
parent 038a811f16
commit 2b57c7fa67

@ -249,6 +249,7 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
std::cout << " Refnum: " << ref.mRefNum.mIndex << std::endl;
std::cout << " ID: '" << ref.mRefID << "'\n";
std::cout << " Owner: '" << ref.mOwner << "'\n";
std::cout << " Global: '" << ref.mGlobalVariable << "'" << std::endl;
std::cout << " Enchantment charge: '" << ref.mEnchantmentCharge << "'\n";
std::cout << " Uses/health: '" << ref.mCharge << "'\n";
std::cout << " Gold value: '" << ref.mGoldValue << "'\n";

@ -99,6 +99,7 @@ namespace MWClass
{
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}
info.text = text;

@ -129,6 +129,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}
info.text = text;

@ -249,6 +249,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -141,6 +141,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -195,6 +195,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -237,6 +237,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -254,6 +254,7 @@ namespace MWClass
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
}
info.text = text;

@ -149,6 +149,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -189,6 +189,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -143,6 +143,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -184,6 +184,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -153,6 +153,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -142,6 +142,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -146,6 +146,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -353,6 +353,7 @@ namespace MWClass
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getOwner(), "Owner");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getFaction(), "Faction");
text += MWGui::ToolTips::getMiscString(ptr.getCellRef().getGlobalVariable(), "Global");
text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script");
}

@ -38,6 +38,13 @@ namespace
isFactionOwned = true;
}
const std::string& globalVariable = item.getCellRef().getGlobalVariable();
if (!globalVariable.empty() && MWBase::Environment::get().getWorld()->getGlobalInt(Misc::StringUtils::lowerCase(globalVariable)) == 1)
{
isOwned = false;
isFactionOwned = false;
}
if (!item.getCellRef().getOwner().empty())
victim = MWBase::Environment::get().getWorld()->searchPtr(item.getCellRef().getOwner(), true);

@ -88,6 +88,11 @@ namespace MWWorld
return mCellRef.mOwner;
}
std::string CellRef::getGlobalVariable() const
{
return mCellRef.mGlobalVariable;
}
void CellRef::setOwner(const std::string &owner)
{
if (owner != mCellRef.mOwner)

@ -61,6 +61,11 @@ namespace MWWorld
std::string getOwner() const;
void setOwner(const std::string& owner);
// Name of a global variable. If the global variable is set to '1', using the object is temporarily allowed
// even if it has an Owner field.
// Used by bed rent scripts to allow the player to use the bed for the duration of the rent.
std::string getGlobalVariable() const;
// ID of creature trapped in this soul gem
std::string getSoul() const;
void setSoul(const std::string& soul);

@ -27,7 +27,7 @@ void ESM::CellRef::load (ESMReader& esm, bool wideRefNum)
esm.getHNOT (mScale, "XSCL");
mOwner = esm.getHNOString ("ANAM");
mGlob = esm.getHNOString ("BNAM");
mGlobalVariable = esm.getHNOString ("BNAM");
mSoul = esm.getHNOString ("XSOL");
mFaction = esm.getHNOString ("CNAM");
@ -90,7 +90,7 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory) cons
}
esm.writeHNOCString("ANAM", mOwner);
esm.writeHNOCString("BNAM", mGlob);
esm.writeHNOCString("BNAM", mGlobalVariable);
esm.writeHNOCString("XSOL", mSoul);
esm.writeHNOCString("CNAM", mFaction);
@ -144,7 +144,7 @@ void ESM::CellRef::blank()
mRefID.clear();
mScale = 1;
mOwner.clear();
mGlob.clear();
mGlobalVariable.clear();
mSoul.clear();
mFaction.clear();
mFactIndex = -1;

@ -35,12 +35,13 @@ namespace ESM
float mScale; // Scale applied to mesh
// The NPC that owns this object (and will get angry if you steal
// it)
// The NPC that owns this object (and will get angry if you steal it)
std::string mOwner;
// I have no idea, looks like a link to a global variable?
std::string mGlob;
// Name of a global variable. If the global variable is set to '1', using the object is temporarily allowed
// even if it has an Owner field.
// Used by bed rent scripts to allow the player to use the bed for the duration of the rent.
std::string mGlobalVariable;
// ID of creature trapped in this soul gem
std::string mSoul;

Loading…
Cancel
Save