From 6f90e071f4ce46c82ceda87ae9a882f009e29143 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 22 Jul 2013 20:50:04 +0200 Subject: [PATCH] added filter record (will not be used in OpenMW prior to 1.1) --- components/CMakeLists.txt | 2 +- components/esm/filter.cpp | 20 ++++++++++++++++++++ components/esm/filter.hpp | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 components/esm/filter.cpp create mode 100644 components/esm/filter.hpp diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index e1e5fbe9b..f28b5ec09 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -39,7 +39,7 @@ add_component_dir (esm loadclas loadclot loadcont loadcrea loadcrec loaddial loaddoor loadench loadfact loadglob loadgmst loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat - loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref + loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter ) add_component_dir (misc diff --git a/components/esm/filter.cpp b/components/esm/filter.cpp new file mode 100644 index 000000000..205332f6b --- /dev/null +++ b/components/esm/filter.cpp @@ -0,0 +1,20 @@ + +#include "filter.hpp" + +#include "esmreader.hpp" +#include "esmwriter.hpp" + +void ESM::Filter::load (ESMReader& esm) +{ + mFilter = esm.getHNString ("FILT"); +} + +void ESM::Filter::save (ESMWriter& esm) +{ + esm.writeHNCString ("FILT", mFilter); +} + +void ESM::Filter::blank() +{ + mFilter.clear(); +} diff --git a/components/esm/filter.hpp b/components/esm/filter.hpp new file mode 100644 index 000000000..2dde92fb0 --- /dev/null +++ b/components/esm/filter.hpp @@ -0,0 +1,25 @@ +#ifndef COMPONENTS_ESM_FILTER_H +#define COMPONENTS_ESM_FILTER_H + +#include + +namespace ESM +{ + class ESMReader; + class ESMWriter; + + struct Filter + { + std::string mId; + + std::string mFilter; + + void load (ESMReader& esm); + void save (ESMWriter& esm); + + void blank(); + ///< Set record to default state (does not touch the ID). + }; +} + +#endif