fix: do not clean non-cmd buttons on IN_SCORE hook.

fix: reset search nodes when receiving team info message.
fix: clear bot args on every call to bot client command.
add: drone build scenario.
This commit is contained in:
dmitry 2020-07-08 13:03:27 +03:00
commit f51d3bf13b
5 changed files with 56 additions and 4 deletions

44
.drone.jsonnet Normal file
View file

@ -0,0 +1,44 @@
local mesonBuild (buildName, cxx, ld, mesonOptions) = {
kind: "pipeline",
type: "exec",
name: buildName,
steps: [
{
environment: {
CXX: cxx,
CXX_LD: ld
},
name: "setup",
commands: [
"meson setup build " + mesonOptions,
]
},
{
name: "build",
commands: [
"ninja -C build",
]
},
{
name: "upload",
commands: [
"upload-binary " + buildName
]
}
]
};
[
mesonBuild("linux-release-gcc", "gcc", "", ""),
mesonBuild("linux-release-clang", "clang", "lld", ""),
mesonBuild("linux-release-intel", "/opt/intel/bin/icc", "", ""),
mesonBuild("linux-debug-gcc", "gcc", "", "--buildtype=debug"),
mesonBuild("macos-release-clang", "", "", "--cross-file=/opt/meson/cross/darwin.ini"),
mesonBuild("macos-debug-clang", "", "", "--cross-file=/opt/meson/cross/darwin.ini --buildtype=debug"),
mesonBuild("win32-release-msvc", "", "", "--cross-file=/opt/meson/cross/msvc.ini -Db_vscrt=mt"),
mesonBuild("win32-debug-msvc", "", "", "--cross-file=/opt/meson/cross/msvc.ini --buildtype=debug -Db_vscrt=mtd"),
mesonBuild("win32-release-mingw", "", "", "--cross-file=/opt/meson/cross/mingw.ini"),
]

View file

@ -436,6 +436,8 @@ void Game::prepareBotArgs (edict_t *ent, String str) {
// supply directly the whole string as if you were typing it in the bot's "console". It
// is supposed to work exactly like the pfnClientCommand (server-sided client command).
m_botArgs.clear (); // always clear args
if (str.empty ()) {
return;
}

View file

@ -409,10 +409,9 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
table->pfnCmdStart = [] (const edict_t *player, usercmd_t *cmd, unsigned int random_seed) {
auto ent = const_cast <edict_t *> (player);
// if we're handle pings for bots and clients, clear IN_SCORE button so SV_ShouldUpdatePing engine function return false
// and SV_EmitPings will not overwrite our results
// if we're handle pings for bots and clients, clear IN_SCORE button so SV_ShouldUpdatePing engine function return false, and SV_EmitPings will not overwrite our results
if (game.is (GameFlags::HasFakePings) && cv_show_latency.int_ () == 2) {
if ((cmd->buttons & IN_SCORE) || (ent->v.oldbuttons & IN_SCORE)) {
if (cmd->buttons & IN_SCORE) {
cmd->buttons &= ~IN_SCORE;
// send our version of pings

View file

@ -329,6 +329,13 @@ void MessageDispatcher::netMsgTeamInfo () {
// update player team
client.team2 = m_teamInfoCache[m_args[team].chars_]; // update real team
client.team = game.is (GameFlags::FreeForAll) ? m_args[index].long_ : client.team2;
auto bot = bots[client.ent];
// clear the routes so we're have no error in pathfinding in case team info update (respawn/change team)
if (bot) {
bot->clearSearchNodes ();
}
}
void MessageDispatcher::netMsgBarTime () {

View file

@ -596,7 +596,7 @@ void BotSupport::calculatePings () {
}
int part = static_cast <int> (average.first * 0.2f);
int botPing = bot->m_basePing + rg.int_ (average.first - part, average.first + part) + rg.int_ (bot->m_difficulty / 2, bot->m_difficulty);
int botPing = bot->index () / 2 + bot->m_basePing + rg.int_ (average.first - part, average.first + part) + rg.int_ (bot->m_difficulty / 2, bot->m_difficulty);
int botLoss = rg.int_ (average.second / 2, average.second);
client.ping = getPingBitmask (client.ent, botLoss, botPing);