From 9d3f0b2ed55fcef733d3afdc01703c15dbdb719d Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jan 2015 01:53:20 +0100 Subject: [PATCH] Remove some unused code, include cleanup --- apps/esmtool/record.cpp | 2 + apps/openmw/mwscript/globalscripts.cpp | 1 + apps/openmw/mwworld/esmloader.cpp | 2 +- apps/openmw/mwworld/esmstore.cpp | 2 + apps/openmw/mwworld/localscripts.cpp | 2 + apps/openmw/mwworld/recordcmp.hpp | 2 + apps/openmw/mwworld/store.cpp | 7 +++ apps/openmw/mwworld/store.hpp | 5 +- components/CMakeLists.txt | 2 +- components/esm/esmcommon.hpp | 12 ---- components/esm/esmwriter.cpp | 2 + components/esm/esmwriter.hpp | 7 ++- components/esm/loadnpcc.hpp | 82 -------------------------- components/esm/records.hpp | 1 - 14 files changed, 27 insertions(+), 102 deletions(-) delete mode 100644 components/esm/loadnpcc.hpp diff --git a/apps/esmtool/record.cpp b/apps/esmtool/record.cpp index 2f07a5f08..7e2124a2f 100644 --- a/apps/esmtool/record.cpp +++ b/apps/esmtool/record.cpp @@ -2,6 +2,8 @@ #include "labels.hpp" #include +#include + #include void printAIPackage(ESM::AIPackage p) diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index 6c4bb3be5..92fd51d87 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -2,6 +2,7 @@ #include "globalscripts.hpp" #include +#include #include #include diff --git a/apps/openmw/mwworld/esmloader.cpp b/apps/openmw/mwworld/esmloader.cpp index 1b8880d37..13a786d00 100644 --- a/apps/openmw/mwworld/esmloader.cpp +++ b/apps/openmw/mwworld/esmloader.cpp @@ -1,7 +1,7 @@ #include "esmloader.hpp" #include "esmstore.hpp" -#include "components/to_utf8/to_utf8.hpp" +#include namespace MWWorld { diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 12e02f938..36c198f01 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -7,6 +7,8 @@ #include +#include + namespace MWWorld { diff --git a/apps/openmw/mwworld/localscripts.cpp b/apps/openmw/mwworld/localscripts.cpp index d74aab694..5be66ccea 100644 --- a/apps/openmw/mwworld/localscripts.cpp +++ b/apps/openmw/mwworld/localscripts.cpp @@ -1,5 +1,7 @@ #include "localscripts.hpp" +#include + #include "esmstore.hpp" #include "cellstore.hpp" diff --git a/apps/openmw/mwworld/recordcmp.hpp b/apps/openmw/mwworld/recordcmp.hpp index 7de4f5565..500f86b1e 100644 --- a/apps/openmw/mwworld/recordcmp.hpp +++ b/apps/openmw/mwworld/recordcmp.hpp @@ -5,6 +5,8 @@ #include +#include + namespace MWWorld { struct RecordCmp diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index 7d58013e7..cdcc00b4d 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -1,6 +1,8 @@ #include "store.hpp" #include "esmstore.hpp" +#include + namespace MWWorld { void Store::handleMovedCellRefs(ESM::ESMReader& esm, ESM::Cell* cell) @@ -117,4 +119,9 @@ void Store::load(ESM::ESMReader &esm, const std::string &id) } } +void Store::load(ESM::ESMReader &esm, const std::string &id) +{ + load(esm, id, esm.getIndex()); +} + } diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index adca81adc..929ff62a2 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -436,9 +437,7 @@ namespace MWWorld ltexl[lt.mIndex] = lt; } - void load(ESM::ESMReader &esm, const std::string &id) { - load(esm, id, esm.getIndex()); - } + void load(ESM::ESMReader &esm, const std::string &id); iterator begin(size_t plugin) const { assert(plugin < mStatic.size()); diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 2126c5ca5..814dde6a2 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -58,7 +58,7 @@ add_component_dir (to_utf8 add_component_dir (esm attr defs esmcommon esmreader esmwriter loadacti loadalch loadappa loadarmo loadbody loadbook loadbsgn loadcell loadclas loadclot loadcont loadcrea loaddial loaddoor loadench loadfact loadglob loadgmst - loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpcc + loadinfo loadingr loadland loadlevlist loadligh loadlock loadprob loadrepa loadltex loadmgef loadmisc loadnpc loadpgrd loadrace loadregn loadscpt loadskil loadsndg loadsoun loadspel loadsscr loadstat loadweap records aipackage effectlist spelllist variant variantimp loadtes3 cellref filter savedgame journalentry queststate locals globalscript player objectstate cellid cellstate globalmap inventorystate containerstate npcstate creaturestate dialoguestate statstate diff --git a/components/esm/esmcommon.hpp b/components/esm/esmcommon.hpp index 80706793a..54b18aeaf 100644 --- a/components/esm/esmcommon.hpp +++ b/components/esm/esmcommon.hpp @@ -53,18 +53,6 @@ typedef NAME_T<32> NAME32; typedef NAME_T<64> NAME64; typedef NAME_T<256> NAME256; -#pragma pack(push) -#pragma pack(1) -// Data that is only present in save game files -struct SaveData -{ - float pos[6]; // Player position and rotation - NAME64 cell; // Cell name - float unk2; // Unknown value - possibly game time? - NAME32 player; // Player name -}; -#pragma pack(pop) - /* This struct defines a file 'context' which can be saved and later restored by an ESMReader instance. It will save the position within a file, and when restored will let you read from that position as diff --git a/components/esm/esmwriter.cpp b/components/esm/esmwriter.cpp index 544f8bbed..14951608d 100644 --- a/components/esm/esmwriter.cpp +++ b/components/esm/esmwriter.cpp @@ -4,6 +4,8 @@ #include #include +#include + namespace ESM { ESMWriter::ESMWriter() diff --git a/components/esm/esmwriter.hpp b/components/esm/esmwriter.hpp index e57c6e45d..30cec58b4 100644 --- a/components/esm/esmwriter.hpp +++ b/components/esm/esmwriter.hpp @@ -4,11 +4,14 @@ #include #include -#include - #include "esmcommon.hpp" #include "loadtes3.hpp" +namespace ToUTF8 +{ + class Utf8Encoder; +} + namespace ESM { class ESMWriter diff --git a/components/esm/loadnpcc.hpp b/components/esm/loadnpcc.hpp deleted file mode 100644 index 6b3cd533f..000000000 --- a/components/esm/loadnpcc.hpp +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef OPENMW_ESM_NPCC_H -#define OPENMW_ESM_NPCC_H - -#include - -// TODO: create implementation files to remove this -#include "esmreader.hpp" - -namespace ESM { - -class ESMReader; -class ESMWriter; - -/* - * NPC change information (found in savegame files only). We can't - * read these yet. - * - * Some general observations about savegames: - * - * SCPT records do not define new scripts, but assign values to the - * variables of existing ones. - * - * VFXM, SPLM - no clue - * - * FMAP - MAPH and MAPD, global map image. - * - * JOUR - the entire journal in html - * - * QUES - seems to contain all the quests in the game, not just the - * ones you have done or begun. - * - * REGN - lists all regions in the game, even unvisited ones. - * notable differences to Regions in ESM files: mMapColor may be missing, and includes an unknown WNAM subrecord. - * - * - * The DIAL/INFO blocks contain changes to characters' dialog status. - * - * Dammit there's a lot of stuff in there! Should really have - * suspected as much. The strategy further is to completely ignore - * save files for the time being. - * - * Several records have a "change" variant, like NPCC, CNTC - * (contents), and CREC (creature.) These seem to alter specific - * instances of creatures, npcs, etc. I have not identified most of - * their subrecords yet. - * - * Several NPCC records have names that begin with "chargen ", I don't - * know if it means something special yet. - * - * The CNTC blocks seem to be instances of leveled lists. When a - * container is supposed to contain this leveled list of this type, - * but is referenced elsewhere in the file by an INDX, the CNTC with - * the corresponding leveled list identifier and INDX will determine - * the container contents instead. - * - * Some classes of objects seem to be altered, and these include an - * INDX, which is probably an index used by specific references other - * places within the save file. I guess this means 'use this class for - * these objects, not the general class.' All the indices I have - * encountered so far are zero, but they have been for different - * classes (different containers, really) so possibly we start from - * zero for each class. This looks like a mess, but is probably still - * easier than to duplicate everything. I think WRITING this format - * will be harder than reading it. - */ - -struct LoadNPCC -{ - static unsigned int sRecordId; - - std::string mId; - - void load(ESMReader &esm) - { - esm.skipRecord(); - } - void save(ESMWriter &esm) const - { - } -}; -} -#endif diff --git a/components/esm/records.hpp b/components/esm/records.hpp index c01c89d57..5c183b6f6 100644 --- a/components/esm/records.hpp +++ b/components/esm/records.hpp @@ -32,7 +32,6 @@ #include "loadmgef.hpp" #include "loadmisc.hpp" #include "loadnpc.hpp" -#include "loadnpcc.hpp" #include "loadpgrd.hpp" #include "loadrace.hpp" #include "loadregn.hpp"