Use HasWater bit flag rather than mWaterInt bool.

c++11
cc9cii 10 years ago
parent b27a879352
commit 1d0b8587a1

@ -62,7 +62,7 @@ namespace CSMWorld
{ ColumnId_StarterSpell, "Starter Spell" },
{ ColumnId_AlwaysSucceeds, "Always Succeeds" },
{ ColumnId_SleepForbidden, "Sleep Forbidden" },
{ ColumnId_Water, "Has Water" },
{ ColumnId_InteriorWater, "Interior Water" },
{ ColumnId_InteriorSky, "Interior Sky" },
{ ColumnId_Model, "Model" },
{ ColumnId_Script, "Script" },
@ -309,7 +309,6 @@ namespace CSMWorld
{ ColumnId_Fog, "Fog" },
{ ColumnId_FogDensity, "Fog Density" },
{ ColumnId_WaterLevel, "Water Level" },
{ ColumnId_InteriorWater, "Interior Water" },
{ ColumnId_MapColor, "Map Color" },
{ ColumnId_UseValue1, "Use value 1" },

@ -57,7 +57,7 @@ namespace CSMWorld
ColumnId_StarterSpell = 42,
ColumnId_AlwaysSucceeds = 43,
ColumnId_SleepForbidden = 44,
ColumnId_Water = 45,
ColumnId_InteriorWater = 45,
ColumnId_InteriorSky = 46,
ColumnId_Model = 47,
ColumnId_Script = 48,
@ -300,8 +300,7 @@ namespace CSMWorld
ColumnId_Fog = 271,
ColumnId_FogDensity = 272,
ColumnId_WaterLevel = 273,
ColumnId_InteriorWater = 274,
ColumnId_MapColor = 275,
ColumnId_MapColor = 274,
// Allocated to a separate value range, so we don't get a collision should we ever need
// to extend the number of use values.

@ -287,7 +287,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mCells.addColumn (new FixedRecordTypeColumn<Cell> (UniversalId::Type_Cell));
mCells.addColumn (new NameColumn<Cell>);
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_SleepForbidden, ESM::Cell::NoSleep));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_Water, ESM::Cell::HasWater));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorWater, ESM::Cell::HasWater));
mCells.addColumn (new FlagColumn<Cell> (Columns::ColumnId_InteriorSky, ESM::Cell::QuasiEx));
mCells.addColumn (new RegionColumn<Cell>);
mCells.addColumn (new RefNumCounterColumn<Cell>);
@ -306,8 +306,6 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
new NestedChildColumn (Columns::ColumnId_Fog, ColumnBase::Display_Integer));
mCells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_FogDensity, ColumnBase::Display_Float));
mCells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_InteriorWater, ColumnBase::Display_Boolean));
mCells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_WaterLevel, ColumnBase::Display_Float));
mCells.getNestableColumn(index)->addColumn(

@ -1064,6 +1064,7 @@ namespace CSMWorld
bool isInterior = (cell.mData.mFlags & ESM::Cell::Interior) != 0;
bool behaveLikeExterior = (cell.mData.mFlags & ESM::Cell::QuasiEx) != 0;
bool interiorWater = (cell.mData.mFlags & ESM::Cell::HasWater) != 0;
switch (subColIndex)
{
@ -1072,16 +1073,15 @@ namespace CSMWorld
case 2: return (isInterior && !behaveLikeExterior) ? cell.mAmbi.mSunlight : QVariant();
case 3: return (isInterior && !behaveLikeExterior) ? cell.mAmbi.mFog : QVariant();
case 4: return (isInterior && !behaveLikeExterior) ? cell.mAmbi.mFogDensity : QVariant();
case 5: return (isInterior && !behaveLikeExterior) ? cell.mWaterInt==true : QVariant();
case 6:
case 5:
{
if (isInterior && !behaveLikeExterior && cell.mWaterInt)
if (isInterior && !behaveLikeExterior && interiorWater)
return cell.mWater;
else
return QVariant();
}
case 7: return isInterior ? QVariant() : cell.mMapColor; // TODO: how to select?
//case 8: return isInterior ? behaveLikeExterior : QVariant();
case 6: return isInterior ? QVariant() : cell.mMapColor; // TODO: how to select?
//case 7: return isInterior ? behaveLikeExterior : QVariant();
default: throw std::runtime_error("Cell subcolumn index out of range");
}
}
@ -1093,6 +1093,7 @@ namespace CSMWorld
bool isInterior = (cell.mData.mFlags & ESM::Cell::Interior) != 0;
bool behaveLikeExterior = (cell.mData.mFlags & ESM::Cell::QuasiEx) != 0;
bool interiorWater = (cell.mData.mFlags & ESM::Cell::HasWater) != 0;
switch (subColIndex)
{
@ -1138,21 +1139,13 @@ namespace CSMWorld
}
case 5:
{
if (isInterior && !behaveLikeExterior)
cell.mWaterInt = value.toBool();
else
return; // return without saving
break;
}
case 6:
{
if (isInterior && !behaveLikeExterior && cell.mWaterInt)
if (isInterior && !behaveLikeExterior && interiorWater)
cell.mWater = value.toFloat();
else
return; // return without saving
break;
}
case 7:
case 6:
{
if (!isInterior)
cell.mMapColor = value.toInt();
@ -1163,7 +1156,7 @@ namespace CSMWorld
#if 0
// redundant since this flag is shown in the main table as "Interior Sky"
// keep here for documenting the logic based on vanilla
case 8:
case 7:
{
if (isInterior)
{
@ -1185,7 +1178,7 @@ namespace CSMWorld
int CellListAdapter::getColumnsCount(const Record<CSMWorld::Cell>& record) const
{
return 8;
return 7;
}
int CellListAdapter::getRowsCount(const Record<CSMWorld::Cell>& record) const

Loading…
Cancel
Save