| 527 | } |
| 528 | ChangeGameState gs(NGSCreate); |
| 529 | SendMsg(&gs, 0, 0, NMFGuaranteed); |
| 530 | } |
| 531 | */ |
| 532 | |
| 533 | void NetworkClient::SelectPlayer(int player, Person* person, bool respawn) |
| 534 | { |
| 535 | SelectPlayerMessage msg(player, person->GetNetworkId(), person->Position(), respawn); |
| 536 | SendMsg(&msg, NMFGuaranteed); |
| 537 | |
| 538 | if (person->IsLocal()) |
| 539 | { |
| 540 | AIUnit* unit = person->Brain(); |
| 541 | if (unit) |
| 542 | { |
| 543 | Transport* veh = unit->GetVehicleIn(); |
| 544 | if (veh) |
| 545 | { |
| 546 | if (veh->IsLocal()) |
| 547 | { |
| 548 | UpdateObject(veh, NMFGuaranteed); |
| 549 | } |
| 550 | else |
| 551 | { |
| 552 | RptF("SelectPlayer - local player in remote vehicle"); |
| 553 | } |
| 554 | } |
| 555 | AIGroup* grp = unit->GetGroup(); |
| 556 | if (grp) |
| 557 | { |
| 558 | if (grp->IsLocal()) |
| 559 | { |
| 560 | UpdateObject(grp, NMFGuaranteed); |
| 561 | } |
| 562 | else |
| 563 | { |
| 564 | RptF("SelectPlayer - local player in remote group"); |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 | } |
| 569 | else |
| 570 | { |
| 571 | RptF("SelectPlayer - on remote person"); |
| 572 | } |
| 573 | |
| 574 | if (player == _player) |
| 575 | { |
| 576 | GWorld->SwitchCameraTo(person->Brain()->GetVehicle(), CamInternal); |
| 577 | GWorld->SetPlayerManual(true); |
| 578 | // old player is now in _playerOn |
| 579 | GWorld->SwitchPlayerTo(person); |
| 580 | GWorld->SetRealPlayer(person); |
| 581 | GWorld->UI()->ResetVehicle(person->Brain()->GetVehicle()); |
| 582 | |
| 583 | if (respawn) |
| 584 | { |
| 585 | RString name = "onPlayerResurrect.sqs"; |
| 586 | if (QIFStreamB::FileExist(RString("scripts\\") + name)) |
nothing calls this directly
no test coverage detected