diff --git a/nif/nif_file.cpp b/nif/nif_file.cpp index fd7a38b3b..a18496550 100644 --- a/nif/nif_file.cpp +++ b/nif/nif_file.cpp @@ -50,8 +50,13 @@ void NIFFile::parse() cout << i << ": " << rec.toString() << endl; + NifRecord *r = NULL; + if(rec == "NiNode") cout << " got a node!\n"; + if(r) r->read(this); + else cout << "No record was created\n"; + break; } } diff --git a/nif/nif_file.h b/nif/nif_file.h index f276acd64..093131246 100644 --- a/nif/nif_file.h +++ b/nif/nif_file.h @@ -33,6 +33,8 @@ #include #include +#include "record.h" + using namespace Mangle::Stream; class NIFFile @@ -52,7 +54,6 @@ class NIFFile std::string filename; /// Record list - typedef void NifRecord; std::vector records; /// Used for error handling diff --git a/nif/record.h b/nif/record.h new file mode 100644 index 000000000..52fbd030c --- /dev/null +++ b/nif/record.h @@ -0,0 +1,42 @@ +/* + OpenMW - The completely unofficial reimplementation of Morrowind + Copyright (C) 2008-2010 Nicolay Korslund + Email: < korslund@gmail.com > + WWW: http://openmw.sourceforge.net/ + + This file (record.h) is part of the OpenMW package. + + OpenMW is distributed as free software: you can redistribute it + and/or modify it under the terms of the GNU General Public License + version 3, as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + version 3 along with this program. If not, see + http://www.gnu.org/licenses/ . + + */ + +#ifndef _NIF_RECORD_H_ +#define _NIF_RECORD_H_ + +class NIFFile; + +class NifRecord +{ + public: + virtual void read(NIFFile *nif) = 0; + + /* + Use these later if you want custom allocation of all NIF objects + + static void* operator new(size_t size); + static void operator delete(void *p); + */ +}; + +#endif diff --git a/nif/tests/Makefile b/nif/tests/Makefile index 196ce26e2..ea6e21959 100644 --- a/nif/tests/Makefile +++ b/nif/tests/Makefile @@ -2,7 +2,7 @@ GCC=g++ all: niftool -niftool: niftool.cpp ../nif_file.h +niftool: niftool.cpp ../nif_file.h ../nif_file.cpp ../record.h $(GCC) $< ../nif_file.cpp ../../tools/stringops.cpp -o $@ clean: