From: Mario Date: Wed, 17 May 2017 21:12:00 +0000 (+1000) Subject: Use an intrusive list to find ladders in bot AI X-Git-Tag: xonotic-v0.8.5~2768^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8c6273b75c486287c18189d71dbd9aa72bcd6f47;p=xonotic%2Fxonotic-data.pk3dir.git Use an intrusive list to find ladders in bot AI --- diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index 5ff2bdcc2..f4a7ffb02 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -49,6 +49,8 @@ void func_ladder_init(entity this) spawnfunc(func_ladder) { + IL_PUSH(g_ladders, this); // TODO: also func_water? bots currently loop through func_ladder only + func_ladder_init(this); } diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index b4503fa14..fc9793154 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -181,12 +181,12 @@ bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float m if(autocvar_bot_debug_tracewalk) debugnodestatus(trace_endpos, DEBUG_NODE_WARNING); - FOREACH_ENTITY_CLASS("func_ladder", true, + IL_EACH(g_ladders, it.classname == "func_ladder", { it.solid = SOLID_BSP; }); traceline( org, move, movemode, e); - FOREACH_ENTITY_CLASS("func_ladder", true, + IL_EACH(g_ladders, it.classname == "func_ladder", { it.solid = SOLID_TRIGGER; }); if ( trace_ent.classname == "door_rotating" || trace_ent.classname == "door") diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index d8747d0b4..08f1d2016 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -470,3 +470,6 @@ STATIC_INIT(g_damagedbycontents) { g_damagedbycontents = IL_NEW(); } IntrusiveList g_railgunhit; STATIC_INIT(g_railgunhit) { g_railgunhit = IL_NEW(); } + +IntrusiveList g_ladders; +STATIC_INIT(g_ladders) { g_ladders = IL_NEW(); }