From 4fe94f6a4f5f12c22db33c31b87dd618d2802abc Mon Sep 17 00:00:00 2001
From: Shon Ferguson <shonferg@users.sourceforge.net>
Date: Sat, 27 May 2006 21:19:02 +0000
Subject: [PATCH] Fixed a few errors in niflib.cpp by adding a GetName function
 to NiObjectNET.

---
 niflib.cpp          | 6 +++---
 obj/NiObjectNET.cpp | 9 +++++++++
 obj/NiObjectNET.h   | 3 +++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/niflib.cpp b/niflib.cpp
index 402947e4..a7016834 100644
--- a/niflib.cpp
+++ b/niflib.cpp
@@ -729,7 +729,7 @@ void MapParentNodeNames( map<string,NiAVObjectRef> & name_map, NiAVObjectRef par
 	//}
 
 	//Add the par node to the map, and then call this function for each of its children
-	name_map[par->name] = par;
+	name_map[par->GetName()] = par;
 
 	//TODO: Implement functions to get and set children
 	list<NiAVObjectRef> links;// = par->GetAttr("Children")->asLinkList();;
@@ -761,7 +761,7 @@ void ReassignTreeCrossRefs( map<string,NiAVObjectRef> & name_map, NiAVObjectRef
 //existing nodes by changing their data or attatched properties
 void MergeSceneGraph( map<string,NiAVObjectRef> & name_map, const NiAVObjectRef & root, NiAVObjectRef par ) {
 	//Check if this block's name exists in the block map
-	string name = par->name;
+	string name = par->GetName();
 
 	if ( name_map.find(name) != name_map.end() ) {
 		//This block already exists in the original file, so continue on to its children
@@ -809,7 +809,7 @@ void MergeSceneGraph( map<string,NiAVObjectRef> & name_map, const NiAVObjectRef
 		//par_par->GetAttr("Children")->RemoveLinks( par );
 
 		//Get the block to attatch to
-		NiObjectRef attatch = DynamicCast<NiObject>(name_map[par_par->name]);
+		NiObjectRef attatch = DynamicCast<NiObject>(name_map[par_par->GetName()]);
 
 		//TODO:  Implement children
 		////Add this block as new child
diff --git a/obj/NiObjectNET.cpp b/obj/NiObjectNET.cpp
index d5e20ad4..44f8e36a 100644
--- a/obj/NiObjectNET.cpp
+++ b/obj/NiObjectNET.cpp
@@ -27,3 +27,12 @@ string NiObjectNET::asString( bool verbose ) const {
 void NiObjectNET::FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version ) {
 	NI_OBJECT_N_E_T_FIXLINKS
 }
+
+string NiObjectNET::GetName() {
+	return name;
+}
+
+void NiObjectNET::SetName( string & new_name ) {
+	name = new_name;
+}
+
diff --git a/obj/NiObjectNET.h b/obj/NiObjectNET.h
index fa214213..2c5da457 100644
--- a/obj/NiObjectNET.h
+++ b/obj/NiObjectNET.h
@@ -24,6 +24,9 @@ public:
 	virtual void Write( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version ) const;
 	virtual string asString( bool verbose = false ) const;
 	virtual void FixLinks( const vector<NiObjectRef> & objects, list<uint> link_stack, unsigned int version );
+	
+	string GetName();
+	void SetName( string & new_name );
 	//TODO: pointer to extra data type... find out what that is.  AExtraData right now.  Need functions to add/remove.
 	//TODO: pointer to first NiTimeController type.  Need functions to add/remove.
 private:
-- 
GitLab