From cb80254e59862aefc275cd3fe7098d630f9f98d7 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Mon, 21 May 2018 13:16:00 +0200 Subject: [PATCH] Fix infinite Queue --- include/hacks/AutoJoin.hpp | 1 + src/hacks/AutoJoin.cpp | 3 +++ src/hooks/LevelInit.cpp | 1 + src/hooks/LevelShutdown.cpp | 1 + src/tfmm.cpp | 2 ++ 5 files changed, 8 insertions(+) diff --git a/include/hacks/AutoJoin.hpp b/include/hacks/AutoJoin.hpp index 419b724c..0d94d738 100755 --- a/include/hacks/AutoJoin.hpp +++ b/include/hacks/AutoJoin.hpp @@ -15,6 +15,7 @@ namespace autojoin { extern CatVar auto_queue; +extern Timer queuetime; void Update(); void UpdateSearch(); diff --git a/src/hacks/AutoJoin.cpp b/src/hacks/AutoJoin.cpp index f60bbf6a..644dcee4 100644 --- a/src/hacks/AutoJoin.cpp +++ b/src/hacks/AutoJoin.cpp @@ -46,6 +46,7 @@ bool UnassignedClass() } Timer autoqueue_timer{}; +Timer queuetime{}; Timer req_timer{}; /*CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party Bypass", "Bypass Party restrictions");*/ @@ -86,6 +87,8 @@ void UpdateSearch() tfmm::queue_leave(); if (autoqueue_timer.test_and_set(60000)) { + if (!gc->BConnectedToMatchServer(false) && queuetime.test_and_set(10 * 1000 * 60)) + tfmm::queue_leave(); if (gc && !gc->BConnectedToMatchServer(false)) { logging::Info("Starting queue"); diff --git a/src/hooks/LevelInit.cpp b/src/hooks/LevelInit.cpp index 4558c8e6..7de75720 100644 --- a/src/hooks/LevelInit.cpp +++ b/src/hooks/LevelInit.cpp @@ -81,6 +81,7 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) { + hacks::shared::autojoin::queuetime.update(); DelayTimer.update(); #if not LAGBOT_MODE playerlist::Save(); diff --git a/src/hooks/LevelShutdown.cpp b/src/hooks/LevelShutdown.cpp index 525e195b..00b1f797 100644 --- a/src/hooks/LevelShutdown.cpp +++ b/src/hooks/LevelShutdown.cpp @@ -12,6 +12,7 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) { + hacks::shared::autojoin::queuetime.update(); need_name_change = true; #if not LAGBOT_MODE playerlist::Save(); diff --git a/src/tfmm.cpp b/src/tfmm.cpp index d7fed6bd..fd87ef42 100644 --- a/src/tfmm.cpp +++ b/src/tfmm.cpp @@ -6,6 +6,7 @@ */ #include "common.hpp" +#include "AutoJoin.hpp" CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue", []() { tfmm::queue_start(); }); @@ -40,6 +41,7 @@ void queue_start() if (queue == 7) client->LoadSavedCasualCriteria(); client->RequestQueueForMatch((int) queue); + hacks::shared::autojoin::queuetime.update(); } else logging::Info("queue_start: CTFPartyClient == null!");