mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Load object appearance and pos before addNewObject call, it is required for block-visit calculation.
Added a test for tile block-visit.
This commit is contained in:
@ -322,31 +322,24 @@ bool CGObjectInstance::passableFor(PlayerColor color) const
|
||||
|
||||
void CGObjectInstance::serializeJson(JsonSerializeFormat & handler)
|
||||
{
|
||||
//only save here, loading is handled by map loader
|
||||
if(handler.saving)
|
||||
{
|
||||
handler.serializeString("type", typeName);
|
||||
handler.serializeString("subtype", subTypeName);
|
||||
}
|
||||
|
||||
handler.serializeNumeric("x", pos.x);
|
||||
handler.serializeNumeric("y", pos.y);
|
||||
handler.serializeNumeric("l", pos.z);
|
||||
|
||||
if(handler.saving)
|
||||
{
|
||||
handler.serializeNumeric("x", pos.x);
|
||||
handler.serializeNumeric("y", pos.y);
|
||||
handler.serializeNumeric("l", pos.z);
|
||||
appearance.writeJson(handler.getCurrent()["template"], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
appearance.readJson(handler.getCurrent()["template"], false);
|
||||
}
|
||||
|
||||
{
|
||||
auto options = handler.enterStruct("options");
|
||||
serializeJsonOptions(handler);
|
||||
}
|
||||
|
||||
if(handler.saving && handler.getCurrent()["options"].isNull())
|
||||
if(handler.saving && handler.getCurrent()["options"].Struct().empty())
|
||||
{
|
||||
handler.getCurrent().Struct().erase("options");
|
||||
}
|
||||
|
Reference in New Issue
Block a user