mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-29 17:19:20 +02:00
introduce saving house walls and saving all hangables including hangables which transforms
This commit is contained in:
parent
a6e41c5310
commit
8092feb787
@ -99,6 +99,27 @@ bool IOMapSerialize::saveHouseItems()
|
|||||||
}
|
}
|
||||||
stream.clear();
|
stream.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const Direction directions[] = { DIRECTION_EAST, DIRECTION_WEST, DIRECTION_NORTH, DIRECTION_SOUTH };
|
||||||
|
for (Direction direction : directions) {
|
||||||
|
Position position = getNextPosition(direction, tile->getPosition());
|
||||||
|
Tile* nextTile = g_game.map.getTile(position);
|
||||||
|
if (nextTile && nextTile->hasFlag(TILESTATE_BLOCKSOLID) && !nextTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
|
||||||
|
saveTile(stream, nextTile);
|
||||||
|
|
||||||
|
size_t attributesSize;
|
||||||
|
const char* attributes = stream.getStream(attributesSize);
|
||||||
|
if (attributesSize > 0) {
|
||||||
|
query << house->getId() << ',' << db->escapeBlob(attributes, attributesSize);
|
||||||
|
if (!stmt.addRow(query)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
stream.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
nextTile->setFlag(TILESTATE_PROTECTIONZONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,6 +198,9 @@ bool IOMapSerialize::loadItem(PropStream& propStream, Cylinder* parent)
|
|||||||
} else if (iType.isBed() && findItem->getBed()) {
|
} else if (iType.isBed() && findItem->getBed()) {
|
||||||
item = findItem;
|
item = findItem;
|
||||||
break;
|
break;
|
||||||
|
} else if (!iType.moveable && iType.changeUse && findItem->getID() == iType.transformToOnUse) {
|
||||||
|
item = findItem;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +271,7 @@ void IOMapSerialize::saveTile(PropWriteStream& stream, const Tile* tile)
|
|||||||
const ItemType& it = Item::items[item->getID()];
|
const ItemType& it = Item::items[item->getID()];
|
||||||
|
|
||||||
// Note that these are NEGATED, ie. these are the items that will be saved.
|
// Note that these are NEGATED, ie. these are the items that will be saved.
|
||||||
if (!(it.moveable || item->getDoor() || (item->getContainer() && !item->getContainer()->empty()) || it.canWriteText || item->getBed())) {
|
if (!(it.moveable || item->getDoor() || (item->getContainer() && !item->getContainer()->empty()) || it.canWriteText || it.isHangable || item->getBed())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user