Fix infinite Queue

This commit is contained in:
BenCat07 2018-05-21 13:16:00 +02:00
parent 7cd308fae2
commit cb80254e59
5 changed files with 8 additions and 0 deletions

View File

@ -15,6 +15,7 @@ namespace autojoin
{ {
extern CatVar auto_queue; extern CatVar auto_queue;
extern Timer queuetime;
void Update(); void Update();
void UpdateSearch(); void UpdateSearch();

View File

@ -46,6 +46,7 @@ bool UnassignedClass()
} }
Timer autoqueue_timer{}; Timer autoqueue_timer{};
Timer queuetime{};
Timer req_timer{}; Timer req_timer{};
/*CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party Bypass", /*CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party Bypass",
"Bypass Party restrictions");*/ "Bypass Party restrictions");*/
@ -86,6 +87,8 @@ void UpdateSearch()
tfmm::queue_leave(); tfmm::queue_leave();
if (autoqueue_timer.test_and_set(60000)) 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)) if (gc && !gc->BConnectedToMatchServer(false))
{ {
logging::Info("Starting queue"); logging::Info("Starting queue");

View File

@ -81,6 +81,7 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
{ {
hacks::shared::autojoin::queuetime.update();
DelayTimer.update(); DelayTimer.update();
#if not LAGBOT_MODE #if not LAGBOT_MODE
playerlist::Save(); playerlist::Save();

View File

@ -12,6 +12,7 @@ namespace hooked_methods
DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_)
{ {
hacks::shared::autojoin::queuetime.update();
need_name_change = true; need_name_change = true;
#if not LAGBOT_MODE #if not LAGBOT_MODE
playerlist::Save(); playerlist::Save();

View File

@ -6,6 +6,7 @@
*/ */
#include "common.hpp" #include "common.hpp"
#include "AutoJoin.hpp"
CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue", CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue",
[]() { tfmm::queue_start(); }); []() { tfmm::queue_start(); });
@ -40,6 +41,7 @@ void queue_start()
if (queue == 7) if (queue == 7)
client->LoadSavedCasualCriteria(); client->LoadSavedCasualCriteria();
client->RequestQueueForMatch((int) queue); client->RequestQueueForMatch((int) queue);
hacks::shared::autojoin::queuetime.update();
} }
else else
logging::Info("queue_start: CTFPartyClient == null!"); logging::Info("queue_start: CTFPartyClient == null!");