16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

renderer changes, time and environment window

This commit is contained in:
milek7
2019-03-09 14:18:10 +01:00
parent 748e7b1dda
commit 3693c1660e
30 changed files with 299 additions and 93 deletions

View File

@@ -16,11 +16,13 @@ void network::client_hello::deserialize(std::istream &stream)
void network::server_hello::serialize(std::ostream &stream) const
{
sn_utils::ls_uint32(stream, seed);
sn_utils::ls_int64(stream, timestamp);
}
void network::server_hello::deserialize(std::istream &stream)
{
seed = sn_utils::ld_uint32(stream);
timestamp = sn_utils::ld_int64(stream);
}
void ::network::request_command::serialize(std::ostream &stream) const

View File

@@ -39,6 +39,7 @@ struct server_hello : public message
server_hello() : message(SERVER_HELLO) {}
uint32_t seed;
int64_t timestamp;
virtual void serialize(std::ostream &stream) const override;
virtual void deserialize(std::istream &stream) override;

View File

@@ -122,6 +122,7 @@ void network::server::handle_message(std::shared_ptr<connection> conn, const mes
server_hello reply;
reply.seed = Global.random_seed;
reply.timestamp = Global.starting_timestamp;
conn->state = connection::CATCHING_UP;
conn->backbuffer = backbuffer;
conn->backbuffer_pos = 0;
@@ -229,6 +230,7 @@ void network::client::handle_message(std::shared_ptr<connection> conn, const mes
if (!Global.ready_to_load) {
Global.random_seed = cmd.seed;
Global.random_engine.seed(Global.random_seed);
Global.starting_timestamp = cmd.timestamp;
Global.ready_to_load = true;
} else if (Global.random_seed != cmd.seed) {
ErrorLog("net: seed mismatch", logtype::net);