fix: bots at difficulty 0 unable to do anything useful

fix: lang configs unable to parse last translated line (fixes #340)
fix: last enemy isn't  cleared instantly with dead entity anymore
fix: bot weakness in pistol rounds
analyzer: improved optimization of useless nodes
linkage: make inability to call gamedll player( non-fatal
linkage: fixed bot boot  on WON engines pre 2000 builds (support for beta 6.5 restored)
cvars: added suupport to revert all cvars to defaults via 'yb cvars defaults'
cvars: added cv_preferred_personality  to select bot default personality
refactor: use single function to send hud messages over the bot code
bot: added random original podbot welcome message to preserve origins of this bot
conf: shuffle bot names and chatter items on conflig load
conf: simplified a bit chatter.cfg syntax (old syntax  still works
build: added support for building with CMake (thanks @Velaron)
refactor: rall the memory hooks moved into their one cpp file
This commit is contained in:
jeefo 2024-01-19 00:03:45 +03:00
commit bf91ef2831
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
35 changed files with 1256 additions and 734 deletions

View file

@ -144,6 +144,7 @@ void BotConfig::loadNamesConfig () {
}
file.close ();
}
m_botNames.shuffle ();
}
void BotConfig::loadWeaponsConfig () {
@ -345,6 +346,7 @@ void BotConfig::loadChatterConfig () {
if (event.str == items.first ()) {
// this does common work of parsing comma-separated chatter line
auto sentences = items[1].split (",");
sentences.shuffle ();
for (auto &sound : sentences) {
sound.trim ().trim ("\"");
@ -480,6 +482,10 @@ void BotConfig::loadLanguageConfig () {
String temp;
Twin <String, String> lang;
auto pushTranslatedMsg = [&] () {
m_language[hashLangString (lang.first.trim ().chars ())] = lang.second.trim ();
};
// clear all the translations before new load
m_language.clear ();
@ -494,7 +500,7 @@ void BotConfig::loadLanguageConfig () {
}
if (!lang.second.empty () && !lang.first.empty ()) {
m_language[hashLangString (lang.first.trim ().chars ())] = lang.second.trim ();
pushTranslatedMsg ();
}
}
else if (line.startsWith ("[TRANSLATED]") && !temp.empty ()) {
@ -503,6 +509,12 @@ void BotConfig::loadLanguageConfig () {
else {
temp += line;
}
// make sure last string is translated
if (file.eof () && !lang.first.empty ()) {
lang.second = line.trim ();
pushTranslatedMsg ();
}
}
file.close ();
}