summaryrefslogtreecommitdiffstats
path: root/src/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-01-27 06:10:33 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2019-01-27 06:10:33 +0100
commite2479261c56c8d1a64b51ad4f084ad3c18505359 (patch)
tree5256688eaec174cebdcf873f5247ece28ec45b9c /src/GameState.cpp
parentAdded slow GameState sync (diff)
downloadAltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar.gz
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar.bz2
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar.lz
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar.xz
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.tar.zst
AltCraft-e2479261c56c8d1a64b51ad4f084ad3c18505359.zip
Diffstat (limited to 'src/GameState.cpp')
-rw-r--r--src/GameState.cpp17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index df227b3..ace2488 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -10,8 +10,6 @@ void GameState::Update(float deltaTime) {
if (!gameStatus.isGameStarted)
return;
- std::lock_guard<std::mutex> guard(accessMutex);
-
std::chrono::steady_clock clock;
static auto timeOfPreviousSendedPacket(clock.now());
auto delta = clock.now() - timeOfPreviousSendedPacket;
@@ -69,7 +67,6 @@ void GameState::Update(float deltaTime) {
}
void GameState::UpdatePacket(std::shared_ptr<Packet> ptr) {
- std::lock_guard<std::mutex> guard(accessMutex);
switch ((PacketNamePlayCB)ptr->GetPacketId()) {
case SpawnObject: {
auto packet = std::static_pointer_cast<PacketSpawnObject>(ptr);
@@ -490,8 +487,6 @@ void GameState::HandleMovement(GameState::MoveType direction, float deltaTime) {
if (!gameStatus.isGameStarted)
return;
- std::lock_guard<std::mutex> guard(accessMutex);
-
const double playerSpeed = 43;
float velocity = playerSpeed * deltaTime;
@@ -548,8 +543,6 @@ void GameState::HandleRotation(double yaw, double pitch) {
if (!gameStatus.isGameStarted)
return;
- std::lock_guard<std::mutex> guard(accessMutex);
-
double playerYaw = Entity::DecodeYaw(player->yaw);
double playerPitch = Entity::DecodePitch(player->pitch);
playerYaw += yaw;
@@ -563,8 +556,6 @@ void GameState::HandleRotation(double yaw, double pitch) {
}
glm::mat4 GameState::GetViewMatrix() {
- std::lock_guard<std::mutex> guard(accessMutex);
-
double playerYaw = Entity::DecodeYaw(player->yaw);
double playerPitch = Entity::DecodePitch(player->pitch);
glm::vec3 front, right, worldUp, up;
@@ -589,8 +580,6 @@ void GameState::StartDigging() {
if (!selectionStatus.isBlockSelected)
return;
- std::lock_guard<std::mutex> guard(accessMutex);
-
auto packetStart = std::make_shared<PacketPlayerDigging>(0, selectionStatus.selectedBlock, 1);
auto packet = std::static_pointer_cast<Packet>(packetStart);
PUSH_EVENT("SendPacket", packet);
@@ -599,8 +588,6 @@ void GameState::StartDigging() {
}
void GameState::FinishDigging() {
- std::lock_guard<std::mutex> guard(accessMutex);
-
auto packetFinish = std::make_shared<PacketPlayerDigging>(2, selectionStatus.selectedBlock, 1);
auto packet = std::static_pointer_cast<Packet>(packetFinish);
PUSH_EVENT("SendPacket", packet);
@@ -612,8 +599,6 @@ void GameState::FinishDigging() {
// send_packet(packet_type=start_digging_packet)
// remove_delayed_action(finish_digging)
void GameState::CancelDigging() {
- std::lock_guard<std::mutex> guard(accessMutex);
-
auto packetCancel = std::make_shared<PacketPlayerDigging>(1, selectionStatus.selectedBlock, 1);
auto packet = std::static_pointer_cast<Packet>(packetCancel);
PUSH_EVENT("SendPacket", packet);
@@ -652,8 +637,6 @@ void GameState::PlaceBlock() {
if (!selectionStatus.isBlockSelected)
return;
- std::lock_guard<std::mutex> guard(accessMutex);
-
BlockFacing face = detectHitFace(selectionStatus.raycastHit, selectionStatus.selectedBlock);
auto packetPlace = std::make_shared<PacketPlayerBlockPlacement>(
selectionStatus.selectedBlock, (unsigned char)face, 0, 0, 0, 0);