mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-31 23:59:03 +01:00
refactor(sonar): declare non-mutating member functions const (cpp:S5817)
Virtual functions are left untouched so overrides keep matching.
This commit is contained in:
@@ -91,7 +91,7 @@ void network::tcp::connection::handle_data(const asio::error_code &err, size_t b
|
||||
read_header();
|
||||
}
|
||||
|
||||
void network::tcp::connection::write_message(const message &msg, std::ostream &stream)
|
||||
void network::tcp::connection::write_message(const message &msg, std::ostream &stream) const
|
||||
{
|
||||
size_t beg = (size_t)stream.tellp();
|
||||
|
||||
@@ -198,7 +198,7 @@ void network::tcp::client::connect()
|
||||
|
||||
}
|
||||
|
||||
void network::tcp::client::handle_accept(const asio::error_code &err)
|
||||
void network::tcp::client::handle_accept(const asio::error_code &err) const
|
||||
{
|
||||
if (!err)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace network::tcp
|
||||
std::string m_header_buffer;
|
||||
std::string m_body_buffer;
|
||||
|
||||
void write_message(const message &msg, std::ostream &stream);
|
||||
void write_message(const message &msg, std::ostream &stream) const;
|
||||
void send_data(std::shared_ptr<std::string> buffer);
|
||||
void read_header();
|
||||
void handle_header(const asio::error_code &err, size_t bytes_transferred);
|
||||
@@ -55,7 +55,7 @@ namespace network::tcp
|
||||
class client : public network::client
|
||||
{
|
||||
private:
|
||||
void handle_accept(const asio::error_code &err);
|
||||
void handle_accept(const asio::error_code &err) const;
|
||||
asio::io_context &io_ctx;
|
||||
std::string host;
|
||||
uint32_t port;
|
||||
|
||||
@@ -17,7 +17,7 @@ network::server_manager::server_manager()
|
||||
backbuffer = std::make_shared<std::fstream>("backbuffer.bin", std::ios::out | std::ios::in | std::ios::trunc | std::ios::binary);
|
||||
}
|
||||
|
||||
command_queue::commands_map network::server_manager::pop_commands()
|
||||
command_queue::commands_map network::server_manager::pop_commands() const
|
||||
{
|
||||
command_queue::commands_map map;
|
||||
|
||||
@@ -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(double render_dt, double dt, double sync, const command_queue::commands_map &commands) const
|
||||
{
|
||||
if (dt == 0.0 && commands.empty())
|
||||
return;
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace network
|
||||
public:
|
||||
server_manager();
|
||||
|
||||
void push_delta(double render_dt, double dt, double sync, const command_queue::commands_map &commands);
|
||||
command_queue::commands_map pop_commands();
|
||||
void push_delta(double render_dt, double dt, double sync, const command_queue::commands_map &commands) const;
|
||||
command_queue::commands_map pop_commands() const;
|
||||
void create_server(const std::string &backend, const std::string &conf);
|
||||
};
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ std::tuple<double, double, command_queue::commands_map> network::client::get_nex
|
||||
}
|
||||
}
|
||||
|
||||
void network::client::send_commands(command_queue::commands_map commands)
|
||||
void network::client::send_commands(command_queue::commands_map commands) const
|
||||
{
|
||||
if (!conn || conn->state == connection::DEAD || commands.empty())
|
||||
return;
|
||||
|
||||
@@ -97,11 +97,11 @@ namespace network
|
||||
public:
|
||||
void update();
|
||||
std::tuple<double, double, command_queue::commands_map> get_next_delta(int counter);
|
||||
void send_commands(command_queue::commands_map commands);
|
||||
int get_frame_counter() {
|
||||
void send_commands(command_queue::commands_map commands) const;
|
||||
int get_frame_counter() const {
|
||||
return static_cast<int>(resume_frame_counter);
|
||||
}
|
||||
int get_awaiting_frames() {
|
||||
int get_awaiting_frames() const {
|
||||
return static_cast<int>(delta_queue.size());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user