summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/misc/splashes_client.txt (renamed from data/misc/splashes.txt)4
-rw-r--r--data/misc/splashes_server.txt46
-rw-r--r--game/client/bother.cc1
-rw-r--r--game/client/game.cc1
-rw-r--r--game/client/main.cc2
-rw-r--r--game/client/play_menu.cc3
-rw-r--r--game/server/game.cc5
-rw-r--r--game/server/status.cc1
-rw-r--r--game/shared/splash.cc46
-rw-r--r--game/shared/splash.hh3
10 files changed, 93 insertions, 19 deletions
diff --git a/data/misc/splashes.txt b/data/misc/splashes_client.txt
index cb5801d..581c47f 100644
--- a/data/misc/splashes.txt
+++ b/data/misc/splashes_client.txt
@@ -1,5 +1,6 @@
((void *)(0))
[deleted]
+[REDACTED]
#define FALSE 1
#define NULL ((void *)(0))
#define NULL ((void *)(1))
@@ -26,7 +27,7 @@ Format your hard drive today!
From Urals with Love
Happiness only real when shared
Hell is empty and all the devils are here.
-I am confiscating that MOTD
+I am confiscating that splash
I am inside your walls
It's all connected!
It's downward from here
@@ -46,7 +47,6 @@ Send dudes, we need more men!
Sometimes I dream about cheese
Stay hydrated. This is a threat.
STOP POSTING ABOUT AMONG US
-Stop reading this and join
Trust me, I'm a doctor.
What is a MOTD?
YES NO YES NO YES NO YES NO YES NO YES NO
diff --git a/data/misc/splashes_server.txt b/data/misc/splashes_server.txt
new file mode 100644
index 0000000..fab2330
--- /dev/null
+++ b/data/misc/splashes_server.txt
@@ -0,0 +1,46 @@
+((void *)(0))
+[deleted]
+[REDACTED]
+#define FALSE 1
+#define NULL ((void *)(-1))
+#define NULL ((void *)(0))
+#define NULL ((void *)(1))
+#define TRUE 0
+A Voxelius Server
+All your base are belong to us
+Also try CaveCube!
+Also try OpenBuilder!
+Cache my chunks if you can
+Chicken and sphere challenge
+Connection limit: YES
+Don't eat yellow snow!
+ENetPacket tastes like purple
+Error 418: I'm a teapot
+Experiencing technical gremlins
+Fahrenheit 451 Server Room
+From Urals with Love
+globals::sanity underflow
+Good code was never an option
+I am confiscating that MOTD
+I am inside your walls
+Insert more server RAM here
+It's all connected!
+It's not a bug - it's lore
+ITS ALL CONNECTED
+Maximum sass capacity reached
+My stepdads play in here
+No cookies, only sessions
+protocol.entity_id_desync
+Rebooting the matrix...
+REEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
+Segmentation fault (core dumped)
+Server hamsters need coffee
+Stay hydrated. This is a threat.
+STOP POSTING ABOUT AMONG US
+Stop reading this and join
+this_is_fine_20220224.png
+Uptime: 30 years... maybe
+VoxelStorage overflow detected
+vserver.exe has stopped thinking
+We ran out of stack traces
+You wouldn't download a server
diff --git a/game/client/bother.cc b/game/client/bother.cc
index e808485..8ca247a 100644
--- a/game/client/bother.cc
+++ b/game/client/bother.cc
@@ -75,6 +75,7 @@ void bother::update_late(void)
if(auto peer = enet_host_connect(bother_host, &address, 1, 0)) {
peer->data = reinterpret_cast<void *>(static_cast<std::uintptr_t>(item.identity));
bother_set.insert(item.identity);
+ enet_host_flush(bother_host);
}
bother_queue.pop_front();
diff --git a/game/client/game.cc b/game/client/game.cc
index e0e02d1..f7a6349 100644
--- a/game/client/game.cc
+++ b/game/client/game.cc
@@ -205,7 +205,6 @@ void client_game::init(void)
settings::add_keybind(4, hide_hud_toggle, settings_location::KEYBOARD_MISC, "game.key.toggle_hide_hud");
globals::client_host = enet_host_create(nullptr, 1, 1, 0, 0);
- globals::client_host->checksum = &enet_crc32;
if(!globals::client_host) {
spdlog::critical("game: unable to setup an ENet host");
diff --git a/game/client/main.cc b/game/client/main.cc
index 6fabaa3..277b278 100644
--- a/game/client/main.cc
+++ b/game/client/main.cc
@@ -266,7 +266,7 @@ int main(int argc, char **argv)
alcMakeContextCurrent(globals::sound_ctx);
- splash::init();
+ splash::init_client();
window_title::update();
diff --git a/game/client/play_menu.cc b/game/client/play_menu.cc
index 4c1d2cd..1c89252 100644
--- a/game/client/play_menu.cc
+++ b/game/client/play_menu.cc
@@ -195,7 +195,7 @@ static void on_bother_response(const BotherResponseEvent &event)
item->num_players = event.num_players;
item->max_players = event.max_players;
item->motd = event.motd;
- item->status = item_status::FAILURE;
+ item->status = item_status::REACHED;
}
break;
@@ -480,7 +480,6 @@ void play_menu::update_late(void)
{
for(auto item : servers_deque) {
if(item->status == item_status::UNKNOWN) {
- spdlog::info("bothering {}", item->name);
bother::ping(item->identity, item->hostname.c_str(), item->port);
item->status = item_status::PINGING;
continue;
diff --git a/game/server/game.cc b/game/server/game.cc
index 9d690f2..cc5baf8 100644
--- a/game/server/game.cc
+++ b/game/server/game.cc
@@ -48,7 +48,7 @@ void server_game::init(void)
whitelist::init();
- splash::init();
+ splash::init_server();
status::init();
@@ -72,8 +72,7 @@ void server_game::init_late(void)
address.port = listen_port.get_value();
globals::server_host = enet_host_create(&address, sessions::max_players.get_value() + status_peers.get_value(), 1, 0, 0);
- globals::server_host->checksum = &enet_crc32;
-
+
if(!globals::server_host) {
spdlog::critical("game: unable to setup an ENet host");
std::terminate();
diff --git a/game/server/status.cc b/game/server/status.cc
index 0b8660b..e44a4f4 100644
--- a/game/server/status.cc
+++ b/game/server/status.cc
@@ -11,7 +11,6 @@
static void on_status_request_packet(const protocol::StatusRequest &packet)
{
- spdlog::info("STATUS REQUEST");
protocol::StatusResponse response;
response.version = protocol::VERSION;
response.max_players = sessions::max_players.get_value();
diff --git a/game/shared/splash.cc b/game/shared/splash.cc
index ec7b3c8..068c5c6 100644
--- a/game/shared/splash.cc
+++ b/game/shared/splash.cc
@@ -1,14 +1,29 @@
#include "shared/pch.hh"
#include "shared/splash.hh"
-constexpr static const char *SPLASHES_FILENAME = "misc/splashes.txt";
+constexpr static const char *SPLASHES_FILENAME_CLIENT = "misc/splashes_client.txt";
+constexpr static const char *SPLASHES_FILENAME_SERVER = "misc/splashes_server.txt";
+constexpr static std::size_t SPLASH_SERVER_MAX_LENGTH = 32;
static std::mt19937_64 splash_random;
static std::vector<std::string> splash_lines;
-void splash::init(void)
+static std::string sanitize_line(const std::string &line)
{
- if(auto file = PHYSFS_openRead(SPLASHES_FILENAME)) {
+ std::string result;
+
+ for(auto chr : line) {
+ if((chr == '\r') || (chr == '\n'))
+ continue;
+ result.push_back(chr);
+ }
+
+ return result;
+}
+
+static void splash_init_filename(const char *filename)
+{
+ if(auto file = PHYSFS_openRead(filename)) {
auto source = std::string(PHYSFS_fileLength(file), char(0x00));
PHYSFS_readBytes(file, source.data(), source.size());
PHYSFS_close(file);
@@ -16,14 +31,29 @@ void splash::init(void)
std::string line;
std::istringstream stream(source);
- while(std::getline(stream, line)) {
- splash_lines.push_back(line);
- }
-
+ while(std::getline(stream, line))
+ splash_lines.push_back(sanitize_line(line));
splash_random.seed(std::random_device()());
}
else {
- splash_lines.push_back(fmt::format("{}: {}", SPLASHES_FILENAME, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())));
+ splash_lines.push_back(fmt::format("{}: {}", filename, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())));
+ splash_random.seed(std::random_device()());
+ }
+}
+
+void splash::init_client(void)
+{
+ splash_init_filename(SPLASHES_FILENAME_CLIENT);
+}
+
+void splash::init_server(void)
+{
+ splash_init_filename(SPLASHES_FILENAME_SERVER);
+
+ // Server browser GUI should be able to display
+ // these splash messages without text clipping over
+ for(int i = 0; i < splash_lines.size(); i++) {
+ splash_lines[i] = splash_lines[i].substr(0, SPLASH_SERVER_MAX_LENGTH);
}
}
diff --git a/game/shared/splash.hh b/game/shared/splash.hh
index 2a370f9..9510d35 100644
--- a/game/shared/splash.hh
+++ b/game/shared/splash.hh
@@ -4,7 +4,8 @@
namespace splash
{
-void init(void);
+void init_client(void);
+void init_server(void);
const char* get(void);
} // namespace splash