Skip to content

Commit

Permalink
implement state change to playing
Browse files Browse the repository at this point in the history
  • Loading branch information
lionkor committed Jan 25, 2024
1 parent 0eec0fd commit 4dad60b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ServerNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ bmp::Packet ServerNetwork::udp_read(ip::udp::endpoint& out_ep) {
bmp::Header header {};
auto offset = header.deserialize_from(s_buffer);
packet.raw_data.resize(header.size);
std::copy(s_buffer.begin() + offset, s_buffer.begin() + offset + header.size, packet.raw_data.begin());
std::copy(s_buffer.begin() + long(offset), s_buffer.begin() + long(offset) + header.size, packet.raw_data.begin());
return packet;
}

Expand All @@ -267,6 +267,14 @@ void ServerNetwork::handle_session_setup(const bmp::Packet& packet) {
case bmp::Purpose::PlayersVehiclesInfo: {
spdlog::debug("Players and vehicles info: {} bytes ({} bytes on arrival)", packet.get_readable_data().size(), packet.raw_data.size());
// TODO: Send to game
bmp::Packet ready {
.purpose = bmp::Purpose::SessionReady,
};
tcp_write(ready);
break;
}
case bmp::Purpose::StateChangePlaying: {
spdlog::debug("Playing!");
break;
}
default:
Expand Down

0 comments on commit 4dad60b

Please sign in to comment.