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

reformat: parameters can be made const

This commit is contained in:
jerrrrycho
2026-07-04 07:08:14 +02:00
parent 6fd1d6715b
commit 220689a5e3
121 changed files with 1380 additions and 1352 deletions

View File

@@ -3,7 +3,7 @@
#include "scene/sn_utils.h"
#include "utilities/Logs.h"
network::tcp::connection::connection(asio::io_context &io_ctx, bool client, size_t counter)
network::tcp::connection::connection(asio::io_context &io_ctx, const bool client, const size_t counter)
: network::connection(client, counter),
m_socket(io_ctx)
{
@@ -39,7 +39,7 @@ void network::tcp::connection::read_header()
std::placeholders::_1, std::placeholders::_2));
}
void network::tcp::connection::handle_header(const asio::error_code &err, size_t bytes_transferred)
void network::tcp::connection::handle_header(const asio::error_code &err, const size_t bytes_transferred)
{
if (err) {
disconnect();
@@ -69,7 +69,7 @@ void network::tcp::connection::handle_header(const asio::error_code &err, size_t
std::bind(&connection::handle_data, this, std::placeholders::_1, std::placeholders::_2));
}
void network::tcp::connection::handle_data(const asio::error_code &err, size_t bytes_transferred)
void network::tcp::connection::handle_data(const asio::error_code &err, const size_t bytes_transferred)
{
if (err) {
disconnect();
@@ -133,7 +133,7 @@ void network::tcp::connection::send_message(const message &msg)
// -----------------
network::tcp::server::server(std::shared_ptr<std::istream> buf, asio::io_context &io_ctx, const std::string &host, uint32_t port)
network::tcp::server::server(std::shared_ptr<std::istream> buf, asio::io_context &io_ctx, const std::string &host, const uint32_t port)
: network::server(buf), m_acceptor(io_ctx), m_io_ctx(io_ctx)
{
const auto endpoint = asio::ip::tcp::endpoint(asio::ip::make_address(host), port);
@@ -172,7 +172,7 @@ void network::tcp::server::handle_accept(std::shared_ptr<connection> conn, const
// ------------------
network::tcp::client::client(asio::io_context &io_ctxx, const std::string &hostarg, uint32_t portarg)
network::tcp::client::client(asio::io_context &io_ctxx, const std::string &hostarg, const uint32_t portarg)
: host(hostarg), port(portarg), io_ctx(io_ctxx)
{
}

View File

@@ -27,7 +27,7 @@ command_queue::commands_map network::server_manager::pop_commands()
return map;
}
void network::server_manager::push_delta(double render_dt, double dt, double sync, const command_queue::commands_map &commands)
void network::server_manager::push_delta(const double render_dt, const double dt, const double sync, const command_queue::commands_map &commands)
{
if (dt == 0.0 && commands.empty())
return;

View File

@@ -18,7 +18,7 @@ struct message
type_e type;
message(type_e t) : type(t) {}
message(const type_e t) : type(t) {}
virtual void serialize(std::ostream &stream) const {}
virtual void deserialize(std::istream &stream) {}
};
@@ -49,7 +49,7 @@ struct server_hello : public message
struct request_command : public message
{
request_command(type_e type) : message(type) {}
request_command(const type_e type) : message(type) {}
request_command() : message(REQUEST_COMMAND) {}
command_queue::commands_map commands;

View File

@@ -30,7 +30,7 @@ void network::connection::set_handler(std::function<void (const message &)> hand
message_handler = handler;
}
network::connection::connection(bool client, size_t counter) {
network::connection::connection(const bool client, const size_t counter) {
packet_counter = counter;
is_client = client;
state = AWAITING_HELLO;
@@ -173,7 +173,7 @@ void network::client::update()
}
// client
std::tuple<double, double, command_queue::commands_map> network::client::get_next_delta(int counter)
std::tuple<double, double, command_queue::commands_map> network::client::get_next_delta(const int counter)
{
const auto now = std::chrono::high_resolution_clock::now();
if (counter == 1) {