From 23b93679bb081756f34d835f7463077d3fd8fd98 Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Sun, 4 Dec 2005 01:50:24 +0000 Subject: [PATCH] Fixed a bug in TargetControllerAttr. Added IsController function. --- NIF_Blocks.h | 2 ++ nif_attrs.h | 6 +++++- niflib.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NIF_Blocks.h b/NIF_Blocks.h index 29abf7ad..07e58129 100644 --- a/NIF_Blocks.h +++ b/NIF_Blocks.h @@ -84,6 +84,7 @@ public: vector<attr_ref> GetAttrs(); int GetBlockNum() { return _block_num; } bool IsControllable() { return false; } + bool IsController() { return false; } string asString(); //Links @@ -195,6 +196,7 @@ class AController : public ABlock { public: AController(); void Init() {} + bool IsController() { return true; } ~AController() {} }; diff --git a/nif_attrs.h b/nif_attrs.h index 78711b62..71bb0abf 100644 --- a/nif_attrs.h +++ b/nif_attrs.h @@ -1268,7 +1268,7 @@ public: ReadUInt(in); } void WriteAttr( ofstream& out, unsigned int version ) { - WriteUInt( _owner->GetParent()->GetBlockNum(), out ); + WriteUInt( FindTarget()->GetBlockNum(), out ); } blk_ref FindTarget() const { //Find first ancestor that is controllable @@ -1301,6 +1301,8 @@ public: return out.str(); } blk_ref asLink() const { return FindTarget(); } + void Set(blk_ref&) { throw runtime_error("The attribute you tried to set is calculated automatically. You cannot change it directly."); } + }; class SkeletonRootAttr : public AAttr { @@ -1355,6 +1357,8 @@ public: return out.str(); } blk_ref asLink() const { return FindRoot(); } + void Set(blk_ref&) { throw runtime_error("The attribute you tried to set is calculated automatically. You cannot change it directly."); } + private: int original_root; }; diff --git a/niflib.h b/niflib.h index 2e24e6c3..d4c6941a 100644 --- a/niflib.h +++ b/niflib.h @@ -455,6 +455,7 @@ public: virtual string asString() = 0; virtual string GetBlockType() = 0; virtual bool IsControllable() = 0; + virtual bool IsController() = 0; //Attribute Functions virtual attr_ref GetAttr(string attr_name) = 0; -- GitLab