summaryrefslogtreecommitdiffstats
path: root/src/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-12-29 13:11:10 +0100
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:33 +0100
commit968206877c2ee1cf220abdafb39a876c16afb0fa (patch)
tree6c265e41f2f2e2e7eee4465c1dc15fa18aa9f759 /src/GameState.cpp
parentImplemented new event system (diff)
downloadAltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar.gz
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar.bz2
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar.lz
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar.xz
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.tar.zst
AltCraft-968206877c2ee1cf220abdafb39a876c16afb0fa.zip
Diffstat (limited to 'src/GameState.cpp')
-rw-r--r--src/GameState.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index cea92d6..f5eb8d4 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -58,7 +58,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
entity.pitch = packet->Pitch / 256.0;
entity.renderColor = glm::vec3(0,1,0);
world.AddEntity(entity);
- EventAgregator::PushEvent(EventType::EntityChanged, EntityChangedData{ entity.entityId });
+ PUSH_EVENT("EntityChanged", entity.entityId);
break;
}
case SpawnExperienceOrb:
@@ -76,7 +76,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
entity.pitch = packet->Pitch / 256.0;
entity.renderColor = glm::vec3(0,0,1);
world.AddEntity(entity);
- EventAgregator::PushEvent(EventType::EntityChanged, EntityChangedData{ entity.entityId });
+ PUSH_EVENT("EntityChanged", entity.entityId);
break;
}
case SpawnPainting:
@@ -93,7 +93,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
entity.height = 1.8;
entity.width = 0.6;
world.AddEntity(entity);
- EventAgregator::PushEvent(EventType::EntityChanged, EntityChangedData{ entity.entityId });
+ PUSH_EVENT("EntityChanged", entity.entityId);
break;
}
case AnimationCB:
@@ -120,7 +120,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
case ChatMessageCB: {
auto packet = std::static_pointer_cast<PacketChatMessageCB>(ptr);
LOG(INFO) << "Message (" << int(packet->Position) << "): " << packet->JsonData.text;
- EventAgregator::PushEvent(EventType::ChatMessageReceived, ChatMessageReceivedData{ packet->JsonData,packet->Position });
+ PUSH_EVENT("ChatMessageReceived", std::make_tuple(packet->JsonData, packet->Position));
break;
}
case MultiBlockChange: {
@@ -134,7 +134,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
try {
playerInventory.ConfirmTransaction(*packet);
} catch (std::exception &e) {
- EventAgregator::PushEvent(EventType::Disconnect, DisconnectData{ "Transaction failed" });
+ PUSH_EVENT("Disconnected", std::string("Transaction failed"));
}
}
break;
@@ -173,7 +173,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
case DisconnectPlay: {
auto packet = std::static_pointer_cast<PacketDisconnectPlay>(ptr);
LOG(INFO) << "Disconnect reason: " << packet->Reason;
- EventAgregator::PushEvent(EventType::Disconnect, DisconnectData{ packet->Reason });
+ PUSH_EVENT("Disconnected", packet->Reason);
break;
}
case EntityStatus:
@@ -217,7 +217,7 @@ void GameState::UpdatePacket(NetworkClient *nc)
g_ReducedDebugInfo = packet->ReducedDebugInfo;
LOG(INFO) << "Gamemode is " << g_Gamemode << ", Difficulty is " << (int)g_Difficulty
<< ", Level Type is " << g_LevelType;
- EventAgregator::PushEvent(EventType::PlayerConnected, PlayerConnectedData{});
+ PUSH_EVENT("PlayerConnected", 0);
break;
}
case Map:
@@ -295,12 +295,12 @@ void GameState::UpdatePacket(NetworkClient *nc)
player->pos.z = packet->Z;
}
- EventAgregator::PushEvent(EventType::PlayerPosChanged, PlayerPosChangedData{ player->pos });
+ PUSH_EVENT("PlayerPosChanged", player->pos);
LOG(INFO) << "PlayerPos is " << player->pos << "\t\tAngle: " << player->yaw << "," << player->pitch;;
if (!g_IsGameStarted) {
LOG(INFO) << "Game is started";
- EventAgregator::PushEvent(EventType::RemoveLoadingScreen, RemoveLoadingScreenData{});
+ PUSH_EVENT("RemoveLoadingScreen",0);
}
g_IsGameStarted = true;