Skip to content
Snippets Groups Projects
Commit 23b93679 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Fixed a bug in TargetControllerAttr.

Added IsController function.
parent 57908221
No related branches found
No related tags found
No related merge requests found
...@@ -84,6 +84,7 @@ public: ...@@ -84,6 +84,7 @@ public:
vector<attr_ref> GetAttrs(); vector<attr_ref> GetAttrs();
int GetBlockNum() { return _block_num; } int GetBlockNum() { return _block_num; }
bool IsControllable() { return false; } bool IsControllable() { return false; }
bool IsController() { return false; }
string asString(); string asString();
//Links //Links
...@@ -195,6 +196,7 @@ class AController : public ABlock { ...@@ -195,6 +196,7 @@ class AController : public ABlock {
public: public:
AController(); AController();
void Init() {} void Init() {}
bool IsController() { return true; }
~AController() {} ~AController() {}
}; };
......
...@@ -1268,7 +1268,7 @@ public: ...@@ -1268,7 +1268,7 @@ public:
ReadUInt(in); ReadUInt(in);
} }
void WriteAttr( ofstream& out, unsigned int version ) { void WriteAttr( ofstream& out, unsigned int version ) {
WriteUInt( _owner->GetParent()->GetBlockNum(), out ); WriteUInt( FindTarget()->GetBlockNum(), out );
} }
blk_ref FindTarget() const { blk_ref FindTarget() const {
//Find first ancestor that is controllable //Find first ancestor that is controllable
...@@ -1301,6 +1301,8 @@ public: ...@@ -1301,6 +1301,8 @@ public:
return out.str(); return out.str();
} }
blk_ref asLink() const { return FindTarget(); } 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 { class SkeletonRootAttr : public AAttr {
...@@ -1355,6 +1357,8 @@ public: ...@@ -1355,6 +1357,8 @@ public:
return out.str(); return out.str();
} }
blk_ref asLink() const { return FindRoot(); } 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: private:
int original_root; int original_root;
}; };
......
...@@ -455,6 +455,7 @@ public: ...@@ -455,6 +455,7 @@ public:
virtual string asString() = 0; virtual string asString() = 0;
virtual string GetBlockType() = 0; virtual string GetBlockType() = 0;
virtual bool IsControllable() = 0; virtual bool IsControllable() = 0;
virtual bool IsController() = 0;
//Attribute Functions //Attribute Functions
virtual attr_ref GetAttr(string attr_name) = 0; virtual attr_ref GetAttr(string attr_name) = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment