From 713d324eeb6713d62436454619ca2c6614d48dc7 Mon Sep 17 00:00:00 2001 From: Mark Siewert Date: Sun, 20 Jan 2013 19:07:33 +0100 Subject: [PATCH] - Minor code cleanup --- apps/openmw/mwrender/terrain.cpp | 2 +- apps/openmw/mwworld/cellstore.hpp | 5 ++++- apps/openmw/mwworld/esmstore.cpp | 5 ++--- components/esm/esmreader.hpp | 6 +++--- components/esm/loadland.cpp | 2 +- components/esm/loadland.hpp | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwrender/terrain.cpp b/apps/openmw/mwrender/terrain.cpp index eb5b07af4..676139cf5 100644 --- a/apps/openmw/mwrender/terrain.cpp +++ b/apps/openmw/mwrender/terrain.cpp @@ -143,7 +143,7 @@ namespace MWRender std::map indexes; initTerrainTextures(&terrainData, cellX, cellY, x * numTextures, y * numTextures, - numTextures, indexes, land->plugin); + numTextures, indexes, land->mPlugin); if (mTerrainGroup.getTerrain(terrainX, terrainY) == NULL) { diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 2b25faa70..cbaf56458 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -98,7 +98,10 @@ namespace MWWorld /// A list of container references. These references do not track their mRefnumber. /// Otherwise, taking 1 of 20 instances of an object would produce multiple objects /// with the same reference. - // TODO: Check how Morrowind does this! Maybe auto-generate references on drop. + /// Unfortunately, this also means that we need a different STL container. + /// (cells use CellRefList, where refs can be located according to their refnumner, + /// which uses a map; container items do not make use of the refnumber, so we + /// can't use a map with refnumber keys.) template struct ContainerRefList { diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 38fadca9e..1666ad823 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -28,8 +28,8 @@ void ESMStore::load(ESM::ESMReader &esm) ESM::Dialogue *dialogue = 0; // Cache parent esX files by tracking their indices in the global list of - // all files/readers used by the engine. This will greaty help to accelerate - // parsing of reference IDs. + // all files/readers used by the engine. This will greaty accelerate + // refnumber mangling, as required for handling moved references. int index = ~0; const ESM::ESMReader::MasterList &masters = esm.getMasters(); std::vector *allPlugins = esm.getGlobalReaderList(); @@ -122,7 +122,6 @@ void ESMStore::load(ESM::ESMReader &esm) cout << *it << " "; cout << endl; */ - //setUp(); } void ESMStore::setUp() diff --git a/components/esm/esmreader.hpp b/components/esm/esmreader.hpp index df4c1919e..ba7d6c3e0 100644 --- a/components/esm/esmreader.hpp +++ b/components/esm/esmreader.hpp @@ -80,9 +80,9 @@ public: // terrain palette, but ESMReader does not pass a reference to the correct plugin // to the individual load() methods. This hack allows to pass this reference // indirectly to the load() method. - int idx; - void setIndex(const int index) {idx = index; mCtx.index = index;} - const int getIndex() {return idx;} + int mIdx; + void setIndex(const int index) {mIdx = index; mCtx.index = index;} + const int getIndex() {return mIdx;} void setGlobalReaderList(std::vector *list) {mGlobalReaderList = list;} std::vector *getGlobalReaderList() {return mGlobalReaderList;} diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index ecc25501f..89b48c27d 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -81,7 +81,7 @@ Land::~Land() void Land::load(ESMReader &esm) { mEsm = &esm; - plugin = mEsm->getIndex(); + mPlugin = mEsm->getIndex(); // Get the grid location esm.getSubNameIs("INTV"); diff --git a/components/esm/loadland.hpp b/components/esm/loadland.hpp index f72d020ac..c1cce5e7e 100644 --- a/components/esm/loadland.hpp +++ b/components/esm/loadland.hpp @@ -23,7 +23,7 @@ struct Land int mFlags; // Only first four bits seem to be used, don't know what // they mean. int mX, mY; // Map coordinates. - int plugin; // Plugin index, used to reference the correct material palette. + int mPlugin; // Plugin index, used to reference the correct material palette. // File context. This allows the ESM reader to be 'reset' to this // location later when we are ready to load the full data set.