| 912 | } |
| 913 | |
| 914 | int AFCKernelModule::OnSyncContainerPlace( |
| 915 | const AFGUID& self, const uint32_t index, const ArkDataMask mask, uint32_t src_index) |
| 916 | { |
| 917 | // find parent entity |
| 918 | auto pEntity = GetEntity(self); |
| 919 | if (pEntity == nullptr) |
| 920 | { |
| 921 | ARK_LOG_ERROR("sync container failed entity do no exist, self={}", self); |
| 922 | return -1; |
| 923 | } |
| 924 | |
| 925 | auto pContainer = pEntity->FindContainer(index); |
| 926 | if (pEntity == nullptr) |
| 927 | { |
| 928 | ARK_LOG_ERROR("sync container failed container do no exist, self={}, container={}", self, index); |
| 929 | return -1; |
| 930 | } |
| 931 | |
| 932 | auto pContainerEntity = pContainer->Find(src_index); |
| 933 | if (pContainerEntity == nullptr) |
| 934 | { |
| 935 | ARK_LOG_ERROR("sync container failed container entity do no exist, self={}, container={}, entity={}", self, |
| 936 | index, src_index); |
| 937 | return -1; |
| 938 | } |
| 939 | |
| 940 | if (pContainerEntity->IsSent()) |
| 941 | { |
| 942 | AFMsg::pb_container_place pb_data; |
| 943 | pb_data.set_id(self); |
| 944 | pb_data.set_index(index); |
| 945 | pb_data.set_entity_index(src_index); |
| 946 | pb_data.set_entity_id(pContainerEntity->GetID()); |
| 947 | |
| 948 | SendSyncMsg(self, mask, pb_data); |
| 949 | } |
| 950 | else |
| 951 | { |
| 952 | AFMsg::pb_container_create pb_data; |
| 953 | if (!EntityToPBData(pContainerEntity, pb_data.mutable_data())) |
| 954 | { |
| 955 | ARK_LOG_ERROR("sync container failed container entity to pb failed, self={}, container={}, entity={}", self, |
| 956 | index, src_index); |
| 957 | return -1; |
| 958 | } |
| 959 | |
| 960 | pb_data.set_id(self); |
| 961 | pb_data.set_index(index); |
| 962 | pb_data.set_entity_index(src_index); |
| 963 | |
| 964 | SendSyncMsg(self, mask, pb_data); |
| 965 | } |
| 966 | |
| 967 | return 0; |
| 968 | } |
| 969 | |
| 970 | int AFCKernelModule::OnSyncContainerRemove( |
| 971 | const AFGUID& self, const uint32_t index, const ArkDataMask mask, uint32_t src_index) |
nothing calls this directly
no test coverage detected