Send building items and items kept in buildings separately.

develop
Japa Illo 2017-03-30 16:23:14 +05:30
parent 7c626ba3c2
commit 06225dd896
1 changed files with 12 additions and 4 deletions

@ -1170,14 +1170,22 @@ void CopyBuildings(df::map_block * DfBlock, RemoteFortressReader::MapBlock * Net
continue; continue;
auto out_bld = NetBlock->add_buildings(); auto out_bld = NetBlock->add_buildings();
CopyBuilding(i, out_bld); CopyBuilding(i, out_bld);
df::building_actual* actualBuilding = strict_virtual_cast<df::building_actual>(bld); df::building_actual* actualBuilding = virtual_cast<df::building_actual>(bld);
if (actualBuilding) if (actualBuilding)
{ {
for (int i = 0; i < actualBuilding->contained_items.size(); i++) for (int i = 0; i < actualBuilding->contained_items.size(); i++)
{ {
auto buildingItem = out_bld->add_items(); if (actualBuilding->contained_items[i]->use_mode == 0)
buildingItem->set_mode(actualBuilding->contained_items[i]->use_mode); {
CopyItem(buildingItem->mutable_item(), actualBuilding->contained_items[i]->item); if (isItemChanged(actualBuilding->contained_items[i]->item->id))
CopyItem(NetBlock->add_items(), actualBuilding->contained_items[i]->item);
}
else
{
auto buildingItem = out_bld->add_items();
buildingItem->set_mode(actualBuilding->contained_items[i]->use_mode);
CopyItem(buildingItem->mutable_item(), actualBuilding->contained_items[i]->item);
}
} }
} }
} }