summaryrefslogtreecommitdiffstats
path: root/src/GameState.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-09-15 17:46:56 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:31 +0100
commitdcd030c6ed41e080846d1d50cf82e1055ae48edd (patch)
tree791bf81717a40273fcd6f72b06d3eb24c0c94b1a /src/GameState.cpp
parent2017-09-03 (diff)
downloadAltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar.gz
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar.bz2
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar.lz
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar.xz
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.tar.zst
AltCraft-dcd030c6ed41e080846d1d50cf82e1055ae48edd.zip
Diffstat (limited to '')
-rw-r--r--src/GameState.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/GameState.cpp b/src/GameState.cpp
index b9f9b28..46b236c 100644
--- a/src/GameState.cpp
+++ b/src/GameState.cpp
@@ -144,10 +144,20 @@ void GameState::UpdatePacket()
break;
case CloseWindowCB:
break;
- case OpenWindow:
+ case OpenWindow: {
+ auto packet = std::static_pointer_cast<PacketOpenWindow>(ptr);
+
+ LOG(INFO) << "Open new window " << packet->WindowTitle << ": " << packet->WindowId;
break;
- case WindowItems:
+ }
+ case WindowItems: {
+ auto packet = std::static_pointer_cast<PacketWindowItems>(ptr);
+ if (packet->WindowId == 0) {
+ playerInventory.WindowId = 0;
+ playerInventory.slots = packet->SlotData;
+ }
break;
+ }
case WindowProperty:
break;
case SetSlot:
@@ -392,6 +402,10 @@ void GameState::UpdatePacket()
}
ptr = nc->ReceivePacket();
}
+ while (!playerInventory.pendingTransactions.empty()) {
+ nc->SendPacket(std::make_shared<PacketClickWindow>(playerInventory.pendingTransactions.front()));
+ playerInventory.pendingTransactions.pop();
+ }
}
void GameState::HandleMovement(GameState::Direction direction, float deltaTime) {
@@ -419,7 +433,7 @@ void GameState::HandleMovement(GameState::Direction direction, float deltaTime)
break;
case JUMP:
if (g_OnGround) {
- vel.y += 5;
+ vel.y += 10;
g_OnGround = false;
}
break;