MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / Execute

Method Execute

Source/Online/Message/camera_transform_message.cpp:65–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void CameraTransformMessage::Execute(const OnlineMessageRef& ref, void* object, PeerID from) {
66 CameraTransformMessage* t = static_cast<CameraTransformMessage*>(object);
67
68 if (Online::Instance()->online_session->player_states.find(from) != Online::Instance()->online_session->player_states.end()) {
69 int camera_id = Online::Instance()->online_session->player_states[from].camera_id; // TODO this assumes peer_id == player_id
70 Camera* camera = ActiveCameras::Instance()->GetCamera(camera_id);
71 if (camera != nullptr) {
72 camera->SetPos(t->position);
73 camera->SetFlatFacing(t->flat_facing);
74 camera->SetFacing(t->facing);
75 camera->SetUp(t->up);
76 camera->SetXRotation(t->x_rotation);
77 camera->SetYRotation(t->y_rotation);
78 } else {
79 LOGW << "Got camera transform information for camera " << camera_id << " from client " << std::to_string(from) << " without a valid camera!" << std::endl;
80 }
81 } else {
82 LOGW << "Got camera transform information from a client we can no longer find, they might have disconnected!" << std::endl; // TODO should we even warn about this?
83 }
84}
85
86void* CameraTransformMessage::Construct(void* mem) {
87 return new (mem) CameraTransformMessage(vec3(), vec3(), vec3(), vec3(), 0, 0);

Callers

nothing calls this directly

Calls 10

to_stringFunction · 0.85
GetCameraMethod · 0.80
SetFlatFacingMethod · 0.80
SetFacingMethod · 0.80
SetXRotationMethod · 0.80
SetYRotationMethod · 0.80
findMethod · 0.45
endMethod · 0.45
SetPosMethod · 0.45
SetUpMethod · 0.45

Tested by

no test coverage detected