| 675 | } |
| 676 | } |
| 677 | break; |
| 678 | } |
| 679 | } |
| 680 | } |
| 681 | |
| 682 | // send mission description and roles |
| 683 | for (int i = 0; i < _players.Size(); i++) |
| 684 | { |
| 685 | NetworkPlayerInfo& info = _players[i]; |
| 686 | if (info.state < NGSCreate) |
| 687 | { |
| 688 | continue; |
| 689 | } |
| 690 | SendMissionInfo(info.dpid); |
| 691 | info.state = NGSPrepareSide; |
| 692 | SetPlayerState(info.dpid, NGSPrepareSide); |
| 693 | info.missionFileValid = false; |
| 694 | } |
| 695 | } |
| 696 | |
| 697 | void NetworkServer::ChangeOwner(NetworkId& id, int from, int to) |
| 698 | { |
| 699 | if (from == to) |
| 700 | { |
| 701 | return; |
| 702 | } |
| 703 | if (id.IsNull()) |
| 704 | { |
| 705 | return; |
| 706 | } |
| 707 | |
| 708 | NetworkObjectInfo* oInfo = GetObjectInfo(id); |
| 709 | if (!oInfo) |
| 710 | { |
| 711 | RptF("Server: Object info %d:%d not found.", id.creator, id.id); |
| 712 | return; |
| 713 | } |
| 714 | oInfo->owner = to; |
| 715 | LOG_DEBUG(Network, "ChangeOwner: object {}:{} from={} to={}", id.creator, id.id, from, to); |
| 716 | |
| 717 | NetworkPlayerInfo* pInfo = GetPlayerInfo(to); |
| 718 | if (pInfo) |
| 719 | { |
| 720 | for (int cls = NMCUpdateFirst; cls < NMCUpdateN; cls++) |
| 721 | { |
| 722 | UpdateObject(pInfo, oInfo, (NetworkMessageClass)cls, NMFGuaranteed); |
| 723 | } |
| 724 | // pInfo->DeleteObjectInfo(id); |
| 725 | } |
| 726 | oInfo->DeletePlayerObjectInfo(from); |
| 727 | |
| 728 | // PlayerObjectInfo for object creates automatically |
| 729 | |
| 730 | ChangeOwnerMessage msg(id, to); |
| 731 | SendMsg(from, &msg, NMFGuaranteed); |
| 732 | SendMsg(to, &msg, NMFGuaranteed); |
| 733 | } |
| 734 |
nothing calls this directly
no test coverage detected