mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 00:49:19 +02:00
work
This commit is contained in:
0
network/backend/file.cpp
Normal file
0
network/backend/file.cpp
Normal file
22
network/backend/file.h
Normal file
22
network/backend/file.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "network/network.h"
|
||||
|
||||
namespace network::file
|
||||
{
|
||||
class server : public network::server
|
||||
{
|
||||
private:
|
||||
std::fstream stream;
|
||||
|
||||
public:
|
||||
server();
|
||||
};
|
||||
|
||||
class client : public network::client
|
||||
{
|
||||
private:
|
||||
std::fstream stream;
|
||||
|
||||
public:
|
||||
client();
|
||||
};
|
||||
}
|
||||
@@ -113,11 +113,6 @@ command_queue::commands_map network::connection::pop_commands()
|
||||
|
||||
// server
|
||||
|
||||
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, const command_queue::commands_map &commands)
|
||||
{
|
||||
if (dt == 0.0 && commands.empty())
|
||||
@@ -128,12 +123,6 @@ void network::server::push_delta(double dt, double sync, const command_queue::co
|
||||
msg.sync = sync;
|
||||
msg.commands = commands;
|
||||
|
||||
sn_utils::ls_uint32(recorder, 0x37305545);
|
||||
sn_utils::ls_uint32(recorder, 0);
|
||||
sn_utils::ls_uint16(recorder, (uint16_t)msg.type);
|
||||
msg.serialize(recorder);
|
||||
recorder.flush();
|
||||
|
||||
for (auto c : clients)
|
||||
if (c->state == connection::ACTIVE)
|
||||
c->send_message(msg);
|
||||
|
||||
@@ -54,12 +54,10 @@ namespace network
|
||||
void handle_message(connection &conn, const message &msg);
|
||||
|
||||
std::vector<std::shared_ptr<connection>> clients;
|
||||
std::fstream recorder;
|
||||
|
||||
command_queue::commands_map client_commands_queue;
|
||||
|
||||
public:
|
||||
server();
|
||||
void push_delta(double dt, double sync, const command_queue::commands_map &commands);
|
||||
command_queue::commands_map pop_commands();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user