fix: android builds unable to load anything due to #498

fix: simd sse4.2 is now required for _mm_dp_ps, due to strange behavior on some cpus (ref #506)
refactor: cosmetic changes all over the code
linkage: do not flush linkent export table on changelevel
manager: do not allow to create bots while analyzing map
conifg: notify user about probably outdated configs, not just error in config file
This commit is contained in:
jeefo 2024-01-26 19:52:00 +03:00
commit d234a3f156
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
15 changed files with 91 additions and 55 deletions

View file

@ -576,12 +576,15 @@ void BotConfig::loadDifficultyConfig () {
// currently, mindelay, maxdelay, headprob, seenthruprob, heardthruprob, recoil, aim_error {x,y,z}
constexpr uint32_t kMaxDifficultyValues = 9;
// has errors ?
int errorCount = 0;
// helper for parsing each level
auto parseLevel = [&] (int32_t level, StringRef data) {
auto values = data.split <String> (",");
if (values.length () != kMaxDifficultyValues) {
logger.error ("Bad value for difficulty level #%d.", level);
++errorCount;
return;
}
auto diff = &m_difficulty[level];
@ -629,6 +632,11 @@ void BotConfig::loadDifficultyConfig () {
parseLevel (Difficulty::Expert, items[1]);
}
}
// if some errors occurred, notify user
if (errorCount > 0) {
logger.error ("Config file: difficulty.%s has a bad syntax. Probably out of date.", kConfigExtension);
}
}
}
@ -656,6 +664,9 @@ void BotConfig::loadCustomConfig () {
};
setDefaults ();
// has errors ?
int errorCount = 0;
// custom initialization
if (openConfig ("custom", "Custom config file not found. Loading defaults.", &file)) {
m_custom.clear ();
@ -672,8 +683,8 @@ void BotConfig::loadCustomConfig () {
auto values = line.split ("=");
if (values.length () != 2) {
logger.error ("Bad configuration for custom.%s", kConfigExtension);
return;
++errorCount;
continue;
}
auto kv = Twin <String, String> (values[0].trim (), values[1].trim ());
@ -681,6 +692,11 @@ void BotConfig::loadCustomConfig () {
m_custom[kv.first] = kv.second;
}
}
// if some errors occurred, notify user
if (errorCount > 0) {
logger.error ("Config file: custom.%s has a bad syntax. Probably out of date.", kConfigExtension);
}
}
}