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 строка 581
582 {
595
596 if (
GetGame().IsDedicatedServer())
597 {
598 return;
599 }
600
601 int udtIdentifier = -1;
603 {
604 return;
605 }
606
610
613 {
614 return;
615 }
616
617 switch (type)
618 {
620 {
623 ClearInventoryReservationEx(dst.
GetItem(), dst);
624 break;
625 }
627 {
629 src = e.GetSrc();
632 break;
633 }
635 {
640
641 ClearInventoryReservationEx(dst.
GetItem(), dst);
642 ClearInventoryReservationEx(temp.
GetItem(), temp);
643 break;
644 }
646 {
647 break;
648 }
650 {
652 break;
653 }
654 }
655
657 if (!ctx.
Read(reason))
658 {
660 }
661
663 }
InventoryValidationReason
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)
proto native CGame GetGame()
Перекрестные ссылки HandEventBase::ClearInventoryReservation(), HandEventBase::GetDst(), GetGame(), InventoryLocation::GetItem(), INPUT_UDT_INVENTORY, OnInventoryFailure(), Serializer::Read() и InventoryLocation::ReadFromContext().