cvars: allow to set very long descriptions

cvars: added full descriptions to yb+restricted_weapons (closes #659)
crlib: update submodule
fix: send server messages should split as string and not stringref to keep null-terminated chunks
This commit is contained in:
jeefo 2025-02-15 13:51:45 +03:00
commit b8fb2e8845
No known key found for this signature in database
GPG key ID: D696786B81B667C8
9 changed files with 77 additions and 58 deletions

View file

@ -468,7 +468,7 @@ void Game::sendServerMessage (StringRef message) {
// split up the string into chunks if needed (maybe check if it's multibyte?)
if (message.length () > kMaxSendLength) {
auto chunks = message.split (kMaxSendLength);
auto chunks = message.split <String> (kMaxSendLength);
// send in chunks
for (size_t i = 0; i < chunks.length (); ++i) {
@ -733,6 +733,15 @@ void Game::checkCvarsBounds () {
}
}
void Game::setCvarDescription (const ConVar &cv, StringRef info) {
for (auto &var : m_cvars) {
if (var.name == cv.name ()) {
var.info = info;
break;
}
}
}
void Game::registerCvars (bool gameVars) {
// this function pushes all added global variables to engine registration
@ -911,6 +920,9 @@ bool Game::postload () {
// register bot cvars
registerCvars ();
// set custom cvar descriptions after registering them
util.setCustomCvarDescriptions ();
// handle prefixes
static StringArray prefixes = { product.cmdPri, product.cmdSec };