Add item stack size.

develop
Japa 2017-12-17 18:42:03 +05:30
parent 29282a238b
commit c4f9f6edb2
2 changed files with 7 additions and 1 deletions

@ -267,6 +267,7 @@ message Item
optional MatPair type = 5; optional MatPair type = 5;
optional MatPair material = 6; optional MatPair material = 6;
optional ColorDefinition dye = 7; optional ColorDefinition dye = 7;
optional int32 stack_size = 8;
} }
message MapBlock message MapBlock

@ -1313,7 +1313,12 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
{ {
type->set_mat_index(DfItem->isBag()); type->set_mat_index(DfItem->isBag());
} }
auto constructed_item = virtual_cast<df::item_constructed>(DfItem); VIRTUAL_CAST_VAR(actual_item, df::item_actual, DfItem);
if (actual_item)
{
NetItem->set_stack_size(actual_item->stack_size);
}
VIRTUAL_CAST_VAR(constructed_item, df::item_constructed, DfItem);
if (constructed_item) if (constructed_item)
{ {
for (int i = 0; i < constructed_item->improvements.size(); i++) for (int i = 0; i < constructed_item->improvements.size(); i++)