forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'scrawl/ltex'
This commit is contained in:
commit
ff5582e318
15 changed files with 64 additions and 14 deletions
|
@ -257,6 +257,8 @@ void Launcher::MainDialog::changePage(QListWidgetItem *current, QListWidgetItem
|
|||
|
||||
bool Launcher::MainDialog::setupLauncherSettings()
|
||||
{
|
||||
mLauncherSettings.clear();
|
||||
|
||||
mLauncherSettings.setMultiValueEnabled(true);
|
||||
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
|
@ -289,6 +291,8 @@ bool Launcher::MainDialog::setupLauncherSettings()
|
|||
|
||||
bool Launcher::MainDialog::setupGameSettings()
|
||||
{
|
||||
mGameSettings.clear();
|
||||
|
||||
QString userPath = QString::fromUtf8(mCfgMgr.getUserConfigPath().string().c_str());
|
||||
QString globalPath = QString::fromUtf8(mCfgMgr.getGlobalPath().string().c_str());
|
||||
|
||||
|
@ -384,6 +388,9 @@ bool Launcher::MainDialog::setupGraphicsSettings()
|
|||
// remain consistent, and possibly be merged into a shared component. At the very least
|
||||
// the filenames should be in the CfgMgr component.
|
||||
|
||||
// Ensure to clear previous settings in case we had already loaded settings.
|
||||
mEngineSettings.clear();
|
||||
|
||||
// Create the settings manager and load default settings file
|
||||
const std::string localDefault = (mCfgMgr.getLocalPath() / "settings-default.cfg").string();
|
||||
const std::string globalDefault = (mCfgMgr.getGlobalPath() / "settings-default.cfg").string();
|
||||
|
|
|
@ -37,9 +37,7 @@ namespace CSVRender
|
|||
return ltex;
|
||||
}
|
||||
|
||||
std::stringstream error;
|
||||
error << "Can't find LandTexture " << index << " from plugin " << plugin;
|
||||
throw std::runtime_error(error.str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TerrainStorage::getBounds(float &minX, float &maxX, float &minY, float &maxY)
|
||||
|
|
|
@ -926,7 +926,7 @@ namespace MWMechanics
|
|||
PtrActorMap::iterator iter = mActors.begin();
|
||||
while(iter != mActors.end())
|
||||
{
|
||||
if(iter->first.getCell()==cellStore && iter->first != ignore)
|
||||
if((iter->first.isInCell() && iter->first.getCell()==cellStore) && iter->first != ignore)
|
||||
{
|
||||
delete iter->second;
|
||||
mActors.erase(iter++);
|
||||
|
|
|
@ -185,7 +185,7 @@ void RippleSimulation::removeCell(const MWWorld::CellStore *store)
|
|||
{
|
||||
for (std::vector<Emitter>::iterator it = mEmitters.begin(); it != mEmitters.end();)
|
||||
{
|
||||
if (it->mPtr.getCell() == store && it->mPtr != MWMechanics::getPlayer())
|
||||
if ((it->mPtr.isInCell() && it->mPtr.getCell() == store) && it->mPtr != MWMechanics::getPlayer())
|
||||
{
|
||||
it = mEmitters.erase(it);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ namespace MWRender
|
|||
{
|
||||
const MWWorld::ESMStore &esmStore =
|
||||
MWBase::Environment::get().getWorld()->getStore();
|
||||
return esmStore.get<ESM::LandTexture>().find(index, plugin);
|
||||
return esmStore.get<ESM::LandTexture>().search(index, plugin);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,12 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener)
|
|||
|
||||
ESM::Dialogue *dialogue = 0;
|
||||
|
||||
// Land texture loading needs to use a separate internal store for each plugin.
|
||||
// We set the number of plugins here to avoid continual resizes during loading,
|
||||
// and so we can properly verify if valid plugin indices are being passed to the
|
||||
// LandTexture Store retrieval methods.
|
||||
mLandTextures.resize(esm.getGlobalReaderList()->size());
|
||||
|
||||
/// \todo Move this to somewhere else. ESMReader?
|
||||
// Cache parent esX files by tracking their indices in the global list of
|
||||
// all files/readers used by the engine. This will greaty accelerate
|
||||
|
|
|
@ -351,8 +351,9 @@ namespace MWWorld
|
|||
assert(plugin < mStatic.size());
|
||||
const LandTextureList <exl = mStatic[plugin];
|
||||
|
||||
assert(index < ltexl.size());
|
||||
return <exl.at(index);
|
||||
if (index >= ltexl.size())
|
||||
return NULL;
|
||||
return <exl[index];
|
||||
}
|
||||
const ESM::LandTexture *Store<ESM::LandTexture>::find(size_t index, size_t plugin) const
|
||||
{
|
||||
|
@ -380,10 +381,8 @@ namespace MWWorld
|
|||
|
||||
lt.load(esm, isDeleted);
|
||||
|
||||
// Make sure we have room for the structure
|
||||
if (plugin >= mStatic.size()) {
|
||||
mStatic.resize(plugin+1);
|
||||
}
|
||||
assert(plugin < mStatic.size());
|
||||
|
||||
LandTextureList <exl = mStatic[plugin];
|
||||
if(lt.mIndex + 1 > (int)ltexl.size())
|
||||
ltexl.resize(lt.mIndex+1);
|
||||
|
@ -407,6 +406,11 @@ namespace MWWorld
|
|||
assert(plugin < mStatic.size());
|
||||
return mStatic[plugin].end();
|
||||
}
|
||||
void Store<ESM::LandTexture>::resize(size_t num)
|
||||
{
|
||||
if (mStatic.size() < num)
|
||||
mStatic.resize(num);
|
||||
}
|
||||
|
||||
// Land
|
||||
//=========================================================================
|
||||
|
|
|
@ -210,6 +210,9 @@ namespace MWWorld
|
|||
const ESM::LandTexture *search(size_t index, size_t plugin) const;
|
||||
const ESM::LandTexture *find(size_t index, size_t plugin) const;
|
||||
|
||||
/// Resize the internal store to hold at least \a num plugins.
|
||||
void resize(size_t num);
|
||||
|
||||
size_t getSize() const;
|
||||
size_t getSize(size_t plugin) const;
|
||||
|
||||
|
|
|
@ -2281,7 +2281,7 @@ namespace MWWorld
|
|||
{
|
||||
if (!targetActor.getRefData().isEnabled() || !actor.getRefData().isEnabled())
|
||||
return false; // cannot get LOS unless both NPC's are enabled
|
||||
if (!targetActor.getRefData().getBaseNode() || !targetActor.getRefData().getBaseNode())
|
||||
if (!targetActor.getRefData().getBaseNode() || !actor.getRefData().getBaseNode())
|
||||
return false; // not in active cell
|
||||
|
||||
return mPhysics->getLineOfSight(actor, targetActor);
|
||||
|
|
|
@ -454,3 +454,11 @@ QStringList Config::GameSettings::getContentList() const
|
|||
return Config::LauncherSettings::reverse(values(sContentKey));
|
||||
}
|
||||
|
||||
void Config::GameSettings::clear()
|
||||
{
|
||||
mSettings.clear();
|
||||
mUserSettings.clear();
|
||||
mDataDirs.clear();
|
||||
mDataLocal.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ namespace Config
|
|||
void setContentList(const QStringList& fileNames);
|
||||
QStringList getContentList() const;
|
||||
|
||||
void clear();
|
||||
|
||||
private:
|
||||
Files::ConfigurationManager &mCfgMgr;
|
||||
|
||||
|
|
|
@ -101,6 +101,11 @@ namespace Config
|
|||
return true;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
mSettings.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
Map mSettings;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "storage.hpp"
|
||||
|
||||
#include <set>
|
||||
#include <iostream>
|
||||
|
||||
#include <osg/Image>
|
||||
#include <osg/Plane>
|
||||
|
@ -299,11 +300,17 @@ namespace ESMTerrain
|
|||
|
||||
std::string Storage::getTextureName(UniqueTextureId id)
|
||||
{
|
||||
static const std::string defaultTexture = "textures\\_land_default.dds";
|
||||
if (id.first == 0)
|
||||
return "textures\\_land_default.dds"; // Not sure if the default texture really is hardcoded?
|
||||
return defaultTexture; // Not sure if the default texture really is hardcoded?
|
||||
|
||||
// NB: All vtex ids are +1 compared to the ltex ids
|
||||
const ESM::LandTexture* ltex = getLandTexture(id.first-1, id.second);
|
||||
if (!ltex)
|
||||
{
|
||||
std::cerr << "Unable to find land texture index " << id.first-1 << " in plugin " << id.second << ", using default texture instead" << std::endl;
|
||||
return defaultTexture;
|
||||
}
|
||||
|
||||
// this is needed due to MWs messed up texture handling
|
||||
std::string texture = Misc::ResourceHelpers::correctTexturePath(ltex->mTexture, mVFS);
|
||||
|
|
|
@ -353,6 +353,13 @@ private:
|
|||
int mLine;
|
||||
};
|
||||
|
||||
void Manager::clear()
|
||||
{
|
||||
mDefaultSettings.clear();
|
||||
mUserSettings.clear();
|
||||
mChangedSettings.clear();
|
||||
}
|
||||
|
||||
void Manager::loadDefault(const std::string &file)
|
||||
{
|
||||
SettingsFileParser parser;
|
||||
|
|
|
@ -23,6 +23,9 @@ namespace Settings
|
|||
static CategorySettingVector mChangedSettings;
|
||||
///< tracks all the settings that were changed since the last apply() call
|
||||
|
||||
void clear();
|
||||
///< clears all settings and default settings
|
||||
|
||||
void loadDefault (const std::string& file);
|
||||
///< load file as the default settings (can be overridden by user settings)
|
||||
|
||||
|
|
Loading…
Reference in a new issue