DayZ 1.29
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ WriteToContext()

bool InventoryLocation::WriteToContext ( ParamsWriteContext ctx)
inlineprivate

См. определение в файле InventoryLocation.c строка 507

508 {
509 if (GetType() == InventoryLocationType.TEMP)
510 {
511 int type = InventoryLocationType.ATTACHMENT;
512 if (!ctx.Write(type))
513 {
514 Error("InventoryLocation::WriteToContext - cannot write to context! failed to write temp type");
515 return false;
516 }
517 }
518 else if (!ctx.Write(GetType()))
519 {
520 Error("InventoryLocation::WriteToContext - cannot write to context! failed to write type");
521 return false;
522 }
523
524 switch (GetType())
525 {
526 case InventoryLocationType.UNKNOWN:
527 {
528 break;
529 }
530 case InventoryLocationType.GROUND:
531 {
532 if (!ctx.Write(GetItem()))
533 {
534 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=item");
535 return false;
536 }
537
538 vector pos = GetPos();
539 if (!ctx.Write(pos))
540 {
541 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=pos");
542 return false;
543 }
544
545 float dir[4];
546 GetDir(dir);
547 if (!ctx.Write(dir))
548 {
549 Error("InventoryLocation::WriteToContext - cannot write to context! failed GND, arg=dir");
550 return false;
551 }
552
553 break;
554 }
555 case InventoryLocationType.ATTACHMENT:
556 {
557 if (!ctx.Write(GetParent()))
558 {
559 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=parent");
560 return false;
561 }
562 if (!ctx.Write(GetItem()))
563 {
564 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=item");
565 return false;
566 }
567 if (!ctx.Write(GetSlot()))
568 {
569 Error("InventoryLocation::WriteToContext - cannot write to context! failed ATT, arg=slot");
570 return false;
571 }
572 break;
573 }
574 case InventoryLocationType.CARGO:
575 {
576 if (!ctx.Write(GetParent()))
577 {
578 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=parent");
579 return false;
580 }
581 if (!ctx.Write(GetItem()))
582 {
583 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=item");
584 return false;
585 }
586 if (!ctx.Write(GetIdx()))
587 {
588 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=idx");
589 return false;
590 }
591 if (!ctx.Write(GetRow()))
592 {
593 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=row");
594 return false;
595 }
596 if (!ctx.Write(GetCol()))
597 {
598 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=col");
599 return false;
600 }
601 if (!ctx.Write(GetFlip()))
602 {
603 Error("InventoryLocation::WriteToContext - cannot write to context! failed CGO, arg=flp");
604 return false;
605 }
606 break;
607 }
608 case InventoryLocationType.HANDS:
609 {
610 if (!ctx.Write(GetParent()))
611 {
612 Error("InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=parent");
613 return false;
614 }
615 if (!ctx.Write(GetItem()))
616 {
617 Error("InventoryLocation::WriteToContext - cannot write to context! failed HND, arg=item");
618 return false;
619 }
620 break;
621 }
622 case InventoryLocationType.PROXYCARGO:
623 {
624 if (!ctx.Write(GetParent()))
625 {
626 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=parent");
627 return false;
628 }
629 if (!ctx.Write(GetItem()))
630 {
631 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=item");
632 return false;
633 }
634 if (!ctx.Write(GetIdx()))
635 {
636 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=idx");
637 return false;
638 }
639 if (!ctx.Write(GetRow()))
640 {
641 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=row");
642 return false;
643 }
644 if (!ctx.Write(GetCol()))
645 {
646 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=col");
647 return false;
648 }
649 if (!ctx.Write(GetFlip()))
650 {
651 Error("InventoryLocation::WriteToContext - cannot write to context! failed PXY, arg=flp");
652 return false;
653 }
654
655 break;
656 }
657
658 case InventoryLocationType.VEHICLE:
659 {
660 if (!ctx.Write(GetParent()))
661 {
662 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=parent");
663 return false;
664 }
665 if (!ctx.Write(GetItem()))
666 {
667 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=item");
668 return false;
669 }
670 if (!ctx.Write(GetIdx()))
671 {
672 Error("InventoryLocation::WriteToContext - cannot write to context! failed VHC, arg=idx");
673 return false;
674 }
675 break;
676 }
677
678 case InventoryLocationType.TEMP:
679 {
680 if (!ctx.Write(GetParent()))
681 {
682 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=parent");
683 return false;
684 }
685
686 if (!ctx.Write(GetItem()))
687 {
688 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, arg=item");
689 return false;
690 }
691
692 if (!ctx.Write(-1))
693 {
694 Error("InventoryLocation::WriteToContext - cannot write to context! failed TMP, idx=-1");
695 return false;
696 }
697
698 break;
699 }
700 default:
701 {
702 Error("WriteToContext - really unknown location type, this should not happen, type=" + GetType());
703 return false;
704 }
705 }
706 return true;
707 }
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
proto native EntityAI GetParent()
returns parent of current inventory location
proto native vector GetPos()
returns position of item in world if type is Ground
proto native void GetDir(out float dir[4])
returns direction of item in world if type is Ground
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
proto bool Write(void value_out)
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки Error(), GetCol(), GetDir(), GetFlip(), GetIdx(), GetItem(), GetParent(), GetPos(), GetRow(), GetSlot(), GetType() и Serializer::Write().

Используется в InventoryItem::OnRightClick(), OptionalLocationWriteToContext() и InventoryInputUserData::SerializeInventoryCheckForItem().