ldtypes.cpp

changeset 13
3955ff2a7d72
parent 11
323390a03294
child 14
6d9d8efae2f8
--- a/ldtypes.cpp	Sat Mar 16 00:35:36 2013 +0200
+++ b/ldtypes.cpp	Sat Mar 16 01:32:47 2013 +0200
@@ -1,5 +1,6 @@
 #include "common.h"
 #include "ldtypes.h"
+#include "io.h"
 
 const char* g_saObjTypeNames[] = {
 	"unidentified",
@@ -64,4 +65,17 @@
 
 LDVertex::LDVertex () {
 	
+}
+
+ulong LDObject::getIndex () {
+	if (!g_CurrentFile)
+		return -1u;
+	
+	// TODO: shouldn't rely on g_CurrentFile
+	for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) {
+		if (g_CurrentFile->objects[i] == this)
+			return i;
+	}
+	
+	return -1u;
 }
\ No newline at end of file

mercurial