From 62d881dbb2c7cc4195d41f8fb69a70c03be57ca3 Mon Sep 17 00:00:00 2001
From: Amorilia <amorilia@users.sourceforge.net>
Date: Thu, 19 Aug 2010 22:42:52 +0100
Subject: [PATCH] Store block number in NiObject when reading a nif file.

---
 include/obj/NiObject.h | 4 ++++
 src/niflib.cpp         | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/include/obj/NiObject.h b/include/obj/NiObject.h
index 09bccad5..f18fd59d 100644
--- a/include/obj/NiObject.h
+++ b/include/obj/NiObject.h
@@ -88,6 +88,10 @@ public:
 	NIFLIB_HIDDEN virtual void FixLinks( const map<unsigned int,NiObjectRef> & objects, list<unsigned int> & link_stack, const NifInfo & info );
 	/*! NIFLIB_HIDDEN function.  For internal use only. */
 	NIFLIB_HIDDEN virtual list<NiObjectRef> GetRefs() const;
+
+	/*! Block number in the nif file. Only set when you read
+            blocks from the file. */
+	int internal_block_number;
 };
 
 //--BEGIN FILE FOOT CUSTOM CODE--//
diff --git a/src/niflib.cpp b/src/niflib.cpp
index 08732582..ed6393ad 100644
--- a/src/niflib.cpp
+++ b/src/niflib.cpp
@@ -318,6 +318,9 @@ vector<NiObjectRef> ReadNifList( istream & in, NifInfo * info ) {
 		//Add object to list
 		obj_list.push_back(new_obj);
 
+		//Store block number
+		new_obj->internal_block_number = index;
+
 		// Ending position of block in stream
 		std::streampos endobjpos = in.tellg();
 
-- 
GitLab