16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00
This commit is contained in:
milek7
2019-01-13 14:19:21 +01:00
parent 3db9efd3f7
commit cb106fb135
17 changed files with 82 additions and 66 deletions

View File

@@ -38,6 +38,9 @@ void::network::command_message::serialize(std::ostream &stream)
sn_utils::ls_float64(stream, data.param1);
sn_utils::ls_float64(stream, data.param2);
sn_utils::ls_float64(stream, data.time_delta);
sn_utils::s_bool(stream, data.freefly);
sn_utils::s_vec3(stream, data.location);
}
}
}
@@ -58,6 +61,9 @@ void network::command_message::deserialize(std::istream &stream)
data.param2 = sn_utils::ld_float64(stream);
data.time_delta = sn_utils::ld_float64(stream);
data.freefly = sn_utils::d_bool(stream);
data.location = sn_utils::d_vec3(stream);
sequence.emplace_back(data);
}
@@ -72,7 +78,7 @@ size_t network::command_message::get_size()
for (auto const &kv : commands) {
cmd_size += 8;
for (command_data const &data : kv.second) {
cmd_size += 8 + 3 * 8;
cmd_size += 8 + 3 * 8 + 2 + 4 * 3;
}
}

View File

@@ -35,8 +35,10 @@ void network::connection::message_received(std::shared_ptr<message> &msg)
else if (msg->type == message::CONNECT_ACCEPT)
{
auto cmd = std::dynamic_pointer_cast<accept_message>(msg);
WriteLog("accept received", logtype::net);
//Global.random_engine.seed(cmd->seed);
Global.random_seed = cmd->seed;
Global.random_engine.seed(Global.random_seed);
}
else if (msg->type == message::CLIENT_COMMAND)
{