misc: cosmetic changes

This commit is contained in:
ds 2020-09-10 13:54:00 +03:00
commit c65272e65b
6 changed files with 8 additions and 6 deletions

View file

@ -47,6 +47,8 @@ public:
const StringRef dtime { __DATE__ " " __TIME__ }; const StringRef dtime { __DATE__ " " __TIME__ };
const StringRef date { __DATE__ }; const StringRef date { __DATE__ };
const StringRef version { MODULE_BOT_VERSION }; const StringRef version { MODULE_BOT_VERSION };
const StringRef cmdPri { "yb" };
const StringRef cmdSec { "yapb" };
}; };
// expose product info // expose product info

View file

@ -58,7 +58,7 @@ void BotConfig::loadMainConfig () {
MemFile file; MemFile file;
// this is does the same as exec of engine, but not overwriting values of cvars spcified in cv_ignore_cvars_on_changelevel // this is does the same as exec of engine, but not overwriting values of cvars spcified in cv_ignore_cvars_on_changelevel
if (util.openConfig ("yapb.cfg", "YaPB main config file is not found.", &file, false)) { if (util.openConfig (strings.format ("%s.cfg", product.folder), "Bot main config file is not found.", &file, false)) {
while (file.getLine (line)) { while (file.getLine (line)) {
line.trim (); line.trim ();

View file

@ -1549,7 +1549,7 @@ bool BotControl::executeCommands () {
const auto &prefix = m_args[0]; const auto &prefix = m_args[0];
// no handling if not for us // no handling if not for us
if (prefix != "yb" && prefix != "yapb") { if (prefix != product.cmdPri && prefix != product.cmdSec) {
return false; return false;
} }
Client &client = util.getClient (game.indexOfPlayer (m_ent)); Client &client = util.getClient (game.indexOfPlayer (m_ent));

View file

@ -747,7 +747,7 @@ bool Game::postload () {
game.registerCvars (); game.registerCvars ();
// handle prefixes // handle prefixes
static StringArray prefixes = { "yb", "yapb" }; static StringArray prefixes = { product.cmdPri, product.cmdSec };
// register all our handlers // register all our handlers
for (const auto &prefix : prefixes) { for (const auto &prefix : prefixes) {

View file

@ -1832,11 +1832,11 @@ bool BotGraph::saveGraphData () {
author = m_editor->v.netname.chars (); author = m_editor->v.netname.chars ();
} }
else { else {
author = "YAPB"; author = product.name;
} }
// mark as official // mark as official
if (author.startsWith ("YAPB")) { if (author.startsWith (product.name)) {
options |= StorageOption::Official; options |= StorageOption::Official;
} }

View file

@ -198,7 +198,7 @@ BotCreateResult BotManager::create (StringRef name, int difficulty, int personal
resultName = botName->name; resultName = botName->name;
} }
else { else {
resultName.assignf ("yapb_%d.%d", rg.int_ (100, 10000), rg.int_ (100, 10000)); // just pick ugly random name resultName.assignf ("%s_%d.%d", product.folder, rg.int_ (100, 10000), rg.int_ (100, 10000)); // just pick ugly random name
} }
} }
else { else {