mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 11:09:19 +02:00
work
This commit is contained in:
@@ -118,6 +118,11 @@ void network::connection::send_message(std::shared_ptr<message> msg)
|
||||
send_data(buf);
|
||||
}
|
||||
|
||||
network::server::server()
|
||||
{
|
||||
recorder.open("recorder.bin", std::ios::trunc | std::ios::out | std::ios::binary);
|
||||
}
|
||||
|
||||
void network::server::push_delta(double dt, double sync, command_queue::commands_map commands)
|
||||
{
|
||||
std::shared_ptr<delta_message> msg = std::make_shared<delta_message>();
|
||||
@@ -125,6 +130,12 @@ void network::server::push_delta(double dt, double sync, command_queue::commands
|
||||
msg->sync = sync;
|
||||
msg->commands = commands;
|
||||
|
||||
sn_utils::ls_uint32(recorder, 0x37305545);
|
||||
sn_utils::ls_uint32(recorder, msg->get_size());
|
||||
sn_utils::ls_uint16(recorder, (uint16_t)msg->type);
|
||||
msg->serialize(recorder);
|
||||
recorder.flush();
|
||||
|
||||
for (auto c : clients)
|
||||
c->send_message(msg);
|
||||
}
|
||||
@@ -159,6 +170,9 @@ std::tuple<double, double, command_queue::commands_map> network::client::get_nex
|
||||
|
||||
void network::client::send_commands(command_queue::commands_map commands)
|
||||
{
|
||||
if (commands.empty())
|
||||
return;
|
||||
|
||||
std::shared_ptr<command_message> msg = std::make_shared<command_message>();
|
||||
msg->commands = commands;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user