From 82f9af1c4512e928e7ae82f91d3b0cb8a20e3b52 Mon Sep 17 00:00:00 2001 From: maikelvanfaassen Date: Fri, 16 Aug 2024 20:21:28 +0200 Subject: [PATCH 1/2] Added AI subroutine clearExceptTimeouts, call it when auto teleporting --- src/AI.pm | 11 +++++++++++ src/Network/Receive.pm | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/AI.pm b/src/AI.pm index 703d9c2330..1e5dda159e 100644 --- a/src/AI.pm +++ b/src/AI.pm @@ -161,6 +161,17 @@ sub clear { } } +sub clearExceptTimeouts { + undef @ai_seq; + undef @ai_seq_args; + + foreach (keys %ai_v) { + if ($_ !~ /_time$/m) { + delete $ai_v{$_}; + } + } +} + sub suspend { my $i = (defined $_[0] ? $_[0] : 0); $ai_seq_args[$i]{suspended} = time if $i < @ai_seq_args; diff --git a/src/Network/Receive.pm b/src/Network/Receive.pm index 626b7cb462..b613814906 100644 --- a/src/Network/Receive.pm +++ b/src/Network/Receive.pm @@ -7215,7 +7215,7 @@ sub map_change { } if ($ai_v{temp}{clear_aiQueue}) { - AI::clear; + AI::clearExceptTimeouts; AI::SlaveManager::clear(); } From dab18d6baa937ec6246158514f8a98f9e3815d0d Mon Sep 17 00:00:00 2001 From: maikelvanfaassen Date: Sat, 17 Aug 2024 07:39:52 +0200 Subject: [PATCH 2/2] removed undef %ai_v from ai::clear --- src/AI.pm | 12 ------------ src/Network/Receive.pm | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/AI.pm b/src/AI.pm index 1e5dda159e..e344fad09f 100644 --- a/src/AI.pm +++ b/src/AI.pm @@ -134,7 +134,6 @@ sub clear { if ($total == 0) { undef @ai_seq; undef @ai_seq_args; - undef %ai_v; # If 1 arg was given find it in the queue } elsif ($total == 1) { @@ -161,17 +160,6 @@ sub clear { } } -sub clearExceptTimeouts { - undef @ai_seq; - undef @ai_seq_args; - - foreach (keys %ai_v) { - if ($_ !~ /_time$/m) { - delete $ai_v{$_}; - } - } -} - sub suspend { my $i = (defined $_[0] ? $_[0] : 0); $ai_seq_args[$i]{suspended} = time if $i < @ai_seq_args; diff --git a/src/Network/Receive.pm b/src/Network/Receive.pm index b613814906..626b7cb462 100644 --- a/src/Network/Receive.pm +++ b/src/Network/Receive.pm @@ -7215,7 +7215,7 @@ sub map_change { } if ($ai_v{temp}{clear_aiQueue}) { - AI::clearExceptTimeouts; + AI::clear; AI::SlaveManager::clear(); }