selected_item bugfix
parent
36232e1e20
commit
32deb322db
|
@ -32,8 +32,8 @@ pkt_desc pkt_entity_view_desc[] = {
|
||||||
|
|
||||||
{ PKT_KEEP_IF(entity_view, has_items, true, 3) },
|
{ PKT_KEEP_IF(entity_view, has_items, true, 3) },
|
||||||
{ PKT_UINT(entity_view, has_items) },
|
{ PKT_UINT(entity_view, has_items) },
|
||||||
{ PKT_ARRAY(entity_view, items) },
|
|
||||||
{ PKT_UINT(entity_view, selected_item) },
|
{ PKT_UINT(entity_view, selected_item) },
|
||||||
|
{ PKT_ARRAY(entity_view, items) },
|
||||||
|
|
||||||
{ PKT_END },
|
{ PKT_END },
|
||||||
};
|
};
|
||||||
|
@ -51,14 +51,6 @@ entity_view entity_view_unpack_struct(void *data, size_t len) {
|
||||||
|
|
||||||
entity_view view = {0};
|
entity_view view = {0};
|
||||||
pkt_unpack_struct(&uc, pkt_entity_view_desc, PKT_STRUCT_PTR(&view));
|
pkt_unpack_struct(&uc, pkt_entity_view_desc, PKT_STRUCT_PTR(&view));
|
||||||
#if 0
|
|
||||||
if (view.kind == EKIND_CHUNK) {
|
|
||||||
for (int i=0;i<256;i++){
|
|
||||||
zpl_printf("%d, ", view.blocks[i]);
|
|
||||||
}
|
|
||||||
zpl_exit(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,6 @@ entity_view world_build_entity_view(int64_t e) {
|
||||||
ItemDrop const* dr = ecs_get(world_ecs(), e, ItemDrop);
|
ItemDrop const* dr = ecs_get(world_ecs(), e, ItemDrop);
|
||||||
view.asset = item_get_asset(dr->kind);
|
view.asset = item_get_asset(dr->kind);
|
||||||
view.quantity = dr->quantity;
|
view.quantity = dr->quantity;
|
||||||
|
|
||||||
const Input *in = ecs_get(world_ecs(), e, Input);
|
|
||||||
if (in)
|
|
||||||
view.selected_item = in->selected_item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Inventory *inv = 0;
|
Inventory *inv = 0;
|
||||||
|
@ -70,6 +66,9 @@ entity_view world_build_entity_view(int64_t e) {
|
||||||
view.items[i] = inv->items[i];
|
view.items[i] = inv->items[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Input *in = ecs_get(world_ecs(), e, Input);
|
||||||
|
if (in)
|
||||||
|
view.selected_item = in->selected_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunk *chpos = 0;
|
Chunk *chpos = 0;
|
||||||
|
|
Loading…
Reference in New Issue