mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-29 03:33:48 +00:00
editor: forgot to create tile repeat data when setting flag, causing a crash
This commit is contained in:
parent
812c958661
commit
09f3cc4096
1 changed files with 10 additions and 3 deletions
|
@ -212,11 +212,16 @@ void TileStorage::setEffect(const TileEffectStorage& effstore, int idx, const si
|
||||||
|
|
||||||
void TileStorage::changeFlags(unsigned flagsToSet, unsigned flagsToUnset, const size_t* indices, size_t n)
|
void TileStorage::changeFlags(unsigned flagsToSet, unsigned flagsToUnset, const size_t* indices, size_t n)
|
||||||
{
|
{
|
||||||
|
assert(!(flagsToSet & flagsToUnset)); // don't set and unset flag at the same time
|
||||||
|
const unsigned unsetMask = ~flagsToUnset;
|
||||||
|
const unsigned setRep = flagsToSet & TILEFLAG_REPEAT;
|
||||||
for(size_t i = 0; i < n; ++i)
|
for(size_t i = 0; i < n; ++i)
|
||||||
{
|
{
|
||||||
unsigned& f = tiles[indices[i]].flags;
|
TileData& t = tiles[indices[i]];
|
||||||
unsigned tmp = f & ~flagsToUnset;
|
unsigned tmp = t.flags & unsetMask;
|
||||||
f = tmp | flagsToSet;
|
t.flags = tmp | flagsToSet;
|
||||||
|
if(setRep && !t.rep) // setting the flag does not create the attached data, do that if necessary
|
||||||
|
t.setRepeatOn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,6 +720,7 @@ void TileData::setRepeatOff()
|
||||||
|
|
||||||
void TileData::refreshRepeat()
|
void TileData::refreshRepeat()
|
||||||
{
|
{
|
||||||
|
assert(!(flags & TILEFLAG_REPEAT) || rep);
|
||||||
if(rep)
|
if(rep)
|
||||||
{
|
{
|
||||||
rep->refresh(*this);
|
rep->refresh(*this);
|
||||||
|
@ -729,6 +735,7 @@ bool TileData::hasStandardTexcoords() const
|
||||||
|
|
||||||
const TexCoordBox& TileData::getTexcoords() const
|
const TexCoordBox& TileData::getTexcoords() const
|
||||||
{
|
{
|
||||||
|
assert(!(flags & TILEFLAG_REPEAT) || rep);
|
||||||
return !(flags & TILEFLAG_REPEAT)
|
return !(flags & TILEFLAG_REPEAT)
|
||||||
? et->tc
|
? et->tc
|
||||||
: rep->grid.getTexCoords();
|
: rep->grid.getTexCoords();
|
||||||
|
|
Loading…
Reference in a new issue