fix: make ammo pickups actually to work

fix: buy: bots never buy enough ammo for secondary weapons
fix: yb_pickup_best disabling all pickups instead of weapons only
add: yb_pickup_ammo_and_kits, that allows to enable ammos medkits and kevlars
refactor: switched to crlib strings where possible
refactor: fix some compiler warnings at high levels
refactor: move constants to separate header (thx @spodlesniy)
This commit is contained in:
jeefo 2023-06-20 15:18:35 +03:00
commit 214b56f37b
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
23 changed files with 734 additions and 625 deletions

View file

@ -106,8 +106,12 @@ void BotConfig::loadMainConfig (bool isFirstLoad) {
}
// bind the correct menu key for bot menu...
if (!game.isDedicated () && !strings.isEmpty (cv_bind_menu_key.str ())) {
game.serverCommand ("bind \"%s\" \"yb menu\"", cv_bind_menu_key.str ());
if (!game.isDedicated ()) {
auto val = cv_bind_menu_key.str ();
if (!val.empty ()) {
game.serverCommand ("bind \"%s\" \"yb menu\"", val);
}
}
// disable logger if requested
@ -500,7 +504,7 @@ void BotConfig::loadLanguageConfig () {
}
file.close ();
}
else if (cr::strcmp (cv_language.str (), "en") != 0) {
else if (cv_language.str () != "en") {
logger.error ("Couldn't load language configuration");
}
}
@ -834,7 +838,7 @@ bool BotConfig::openConfig (StringRef fileName, StringRef errorIfNotExists, MemF
auto configDir = strings.joinPath (folders.addons, folders.bot, folders.config);
if (languageDependant) {
if (fileName.startsWith ("lang") && cr::strcmp (cv_language.str (), "en") == 0) {
if (fileName.startsWith ("lang") && cv_language.str () == "en") {
return false;
}
auto langConfig = strings.joinPath (configDir, folders.lang, strings.format ("%s_%s.%s", cv_language.str (), fileName, kConfigExtension));