mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 18:45:38 +00:00
Set mPluginIndex to -1 for textures defined in this plugin
This commit is contained in:
parent
ed5bedb9db
commit
965bc20bab
5 changed files with 14 additions and 7 deletions
|
@ -73,6 +73,13 @@ namespace CSMWorld
|
|||
bool isDeleted = false;
|
||||
|
||||
loadRecord(record, reader, isDeleted);
|
||||
if constexpr (std::is_same_v<ESXRecordT, LandTexture>)
|
||||
{
|
||||
// This doesn't really matter since the value never gets saved, but it makes the index uniqueness check more
|
||||
// sensible
|
||||
if (!base)
|
||||
record.mPluginIndex = -1;
|
||||
}
|
||||
|
||||
ESM::RefId id = getRecordId(record);
|
||||
int index = this->searchId(id);
|
||||
|
|
|
@ -410,7 +410,7 @@ CSMWorld::LandTextureIdTable::ImportResults CSMWorld::LandTextureIdTable::import
|
|||
int startIndex = index;
|
||||
do
|
||||
{
|
||||
std::string newId = LandTexture::createUniqueRecordId(0, index);
|
||||
std::string newId = LandTexture::createUniqueRecordId(-1, index);
|
||||
const ESM::RefId newRefId = ESM::RefId::stringRefId(newId);
|
||||
int newRow = idCollection()->searchId(newRefId);
|
||||
|
||||
|
|
|
@ -680,13 +680,13 @@ void CSVRender::TerrainTextureMode::createTexture(const std::string& textureFile
|
|||
const size_t maxCounter = std::numeric_limits<uint16_t>::max() - 1;
|
||||
try
|
||||
{
|
||||
newId = CSMWorld::LandTexture::createUniqueRecordId(0, counter);
|
||||
if (ltexTable.getRecord(newId).isDeleted() == 0)
|
||||
newId = CSMWorld::LandTexture::createUniqueRecordId(-1, counter);
|
||||
if (!ltexTable.getRecord(newId).isDeleted())
|
||||
counter = (counter + 1) % maxCounter;
|
||||
}
|
||||
catch (const std::exception&)
|
||||
{
|
||||
newId = CSMWorld::LandTexture::createUniqueRecordId(0, counter);
|
||||
newId = CSMWorld::LandTexture::createUniqueRecordId(-1, counter);
|
||||
freeIndexFound = true;
|
||||
}
|
||||
} while (freeIndexFound == false);
|
||||
|
|
|
@ -167,7 +167,7 @@ void CSVWidget::TextureBrushWindow::setBrushTexture(std::string brushTexture)
|
|||
int pluginInDragged = 0;
|
||||
CSMWorld::LandTexture::parseUniqueRecordId(brushTexture, pluginInDragged, index);
|
||||
const ESM::RefId brushTextureRefId = ESM::RefId::stringRefId(brushTexture);
|
||||
std::string newBrushTextureId = CSMWorld::LandTexture::createUniqueRecordId(0, index);
|
||||
std::string newBrushTextureId = CSMWorld::LandTexture::createUniqueRecordId(-1, index);
|
||||
ESM::RefId newBrushTextureRefId = ESM::RefId::stringRefId(newBrushTextureId);
|
||||
int rowInBase = landtexturesCollection.searchId(brushTextureRefId);
|
||||
int rowInNew = landtexturesCollection.searchId(newBrushTextureRefId);
|
||||
|
@ -184,7 +184,7 @@ void CSVWidget::TextureBrushWindow::setBrushTexture(std::string brushTexture)
|
|||
const int maxCounter = std::numeric_limits<uint16_t>::max() - 1;
|
||||
do
|
||||
{
|
||||
newBrushTextureId = CSMWorld::LandTexture::createUniqueRecordId(0, counter);
|
||||
newBrushTextureId = CSMWorld::LandTexture::createUniqueRecordId(-1, counter);
|
||||
newBrushTextureRefId = ESM::RefId::stringRefId(newBrushTextureId);
|
||||
if (landtexturesCollection.searchId(brushTextureRefId) != -1
|
||||
&& landtexturesCollection.getRecord(brushTextureRefId).isDeleted() == 0
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace CSVWorld
|
|||
|
||||
std::string LandTextureCreator::getId() const
|
||||
{
|
||||
return CSMWorld::LandTexture::createUniqueRecordId(0, mIndexBox->value());
|
||||
return CSMWorld::LandTexture::createUniqueRecordId(-1, mIndexBox->value());
|
||||
}
|
||||
|
||||
void LandTextureCreator::nameChanged(const QString& value)
|
||||
|
|
Loading…
Reference in a new issue