blob: 6b6471981aca235d47ca90ba866702fc90bd6cca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include "server/pch.hh"
#include "server/status.hh"
#include "core/config.hh"
#include "shared/protocol.hh"
#include "shared/splash.hh"
#include "server/globals.hh"
#include "server/sessions.hh"
static void on_status_request_packet(const protocol::StatusRequest& packet)
{
protocol::StatusResponse response;
response.version = protocol::VERSION;
response.max_players = sessions::max_players.get_value();
response.num_players = sessions::num_players;
response.motd = splash::get();
protocol::send(packet.peer, protocol::encode(response));
}
void status::init(void)
{
globals::dispatcher.sink<protocol::StatusRequest>().connect<&on_status_request_packet>();
}
|