MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SelectPlayer

Method SelectPlayer

engine/Poseidon/Network/NetworkClientActions.cpp:529–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527 }
528 ChangeGameState gs(NGSCreate);
529 SendMsg(&gs, 0, 0, NMFGuaranteed);
530}
531*/
532
533void 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))

Callers

nothing calls this directly

Calls 15

GameValueExtClass · 0.85
BrainMethod · 0.80
GetVehicleInMethod · 0.80
SwitchCameraToMethod · 0.80
SetPlayerManualMethod · 0.80
SwitchPlayerToMethod · 0.80
SetRealPlayerMethod · 0.80
ResetVehicleMethod · 0.80
UIMethod · 0.80
StartCameraScriptMethod · 0.80
RStringClass · 0.50
GameValueClass · 0.50

Tested by

no test coverage detected