| 1167 | } |
| 1168 | |
| 1169 | int AFCKernelModule::SendToView(const AFGUID& self, const google::protobuf::Message& msg) |
| 1170 | { |
| 1171 | auto pEntity = GetEntity(self); |
| 1172 | if (nullptr == pEntity) |
| 1173 | { |
| 1174 | return -1; |
| 1175 | } |
| 1176 | |
| 1177 | auto map_id = pEntity->GetMapID(); |
| 1178 | auto inst_id = pEntity->GetMapEntityID(); |
| 1179 | |
| 1180 | AFCDataList map_inst_entity_list; |
| 1181 | m_pMapModule->GetInstEntityList(map_id, inst_id, map_inst_entity_list); |
| 1182 | |
| 1183 | for (size_t i = 0; i < map_inst_entity_list.GetCount(); i++) |
| 1184 | { |
| 1185 | auto pViewEntity = GetEntity(map_inst_entity_list.Int64(i)); |
| 1186 | if (pViewEntity == nullptr) |
| 1187 | { |
| 1188 | continue; |
| 1189 | } |
| 1190 | |
| 1191 | const std::string& strObjClassName = pViewEntity->GetClassName(); |
| 1192 | if (AFEntityMetaPlayer::self_name() == strObjClassName) |
| 1193 | { |
| 1194 | SendToSelf(pViewEntity->GetID(), msg); |
| 1195 | } |
| 1196 | } |
| 1197 | |
| 1198 | return 0; |
| 1199 | } |
| 1200 | |
| 1201 | int AFCKernelModule::SendToSelf(const AFGUID& self, const google::protobuf::Message& msg) |
| 1202 | { |
nothing calls this directly
no test coverage detected