Skip to content

Commit efe3c6d

Browse files
committed
balance: allow to update qlx_balance* cvars between games
Before this commit, if new game starts with different values of qlx_balanceUrl/Api/UseLocal, those values are ignored
1 parent 991d0bc commit efe3c6d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

balance.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ def __init__(self):
6767
self.set_cvar_once("qlx_balanceMinimumSuggestionDiff", "25")
6868
self.set_cvar_once("qlx_balanceApi", "elo")
6969

70+
self.cache_cvars()
71+
72+
def cache_cvars(self):
73+
# Store some cvar values that are used in non-game threads
7074
self.use_local = self.get_cvar("qlx_balanceUseLocal", bool)
7175
self.api_url = "http://{}/{}/".format(self.get_cvar("qlx_balanceUrl"), self.get_cvar("qlx_balanceApi"))
7276

@@ -105,6 +109,8 @@ def handle_player_disconnect(self, player, reason):
105109
self.clean_player_data(player)
106110

107111
def handle_new_game(self):
112+
self.cache_cvars()
113+
108114
# reset ratings cache on start
109115
if self.game.state == "warmup":
110116
with self.ratings_lock:

0 commit comments

Comments
 (0)