Function and setup is still messy due to the switch statement and relation with reading.
It could be cleaner if we used classes to handle each inventory command type, but that comes at a performance cost and will also probably require making a fair amount of changes elsewhere.
The downsides with this system right now:
- It makes it hard to track what is written/read from the serializer
- It makes this file very very large
The new changes at least remove the massive switch block and allow for all inventory commands to respond back to the client if something goes wrong
См. определение в файле DayZPlayerInventory.c строка 559
560 {
573
574 if (
g_Game.IsDedicatedServer())
575 {
576 return;
577 }
578
579 int udtIdentifier = -1;
581 {
582 return;
583 }
584
588
591 {
592 return;
593 }
594
595 switch (type)
596 {
598 {
602 break;
603 }
605 {
607 src = e.GetSrc();
610 break;
611 }
613 {
618
621 break;
622 }
624 {
625 break;
626 }
628 {
630 break;
631 }
632 }
633
635 if (!ctx.
Read(reason))
636 {
638 }
639
641 }
InventoryValidationReason
void ClearInventoryReservationEx(ActionData action_data)
override void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
override InventoryLocation GetDst()
override void ClearInventoryReservation()
Abstracted event, not to be used, only inherited.
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
proto bool Read(void value_in)
Перекрестные ссылки HandEventBase::ClearInventoryReservation(), ClearInventoryReservationEx(), g_Game, HandEventBase::GetDst(), InventoryLocation::GetItem(), INPUT_UDT_INVENTORY, OnInventoryFailure(), Serializer::Read() и InventoryLocation::ReadFromContext().