fixed bug where the correct port wasnt being set per game type

This commit is contained in:
Seth Samuel 2024-12-03 22:38:03 +13:00
parent 1bf8b589a3
commit bc9381627c
4 changed files with 8 additions and 1 deletions

View file

@ -72,7 +72,14 @@ def csvWriteOut(firstRun,carData,csvFile):
def runningThread(): def runningThread():
global stopThread global stopThread
gameType= tkGametype.get()
#check everything is connected #check everything is connected
if gameType==GameType.BEAMNG.value:
portToConnect=BEAMNG_UDP_PORT
elif gameType==GameType.FORZA.value:
portToConnect=FORZA_UDP_PORT
try: try:
sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.bind((UDP_IP,portToConnect)) sock.bind((UDP_IP,portToConnect))
@ -91,7 +98,7 @@ def runningThread():
if csvOut == True: if csvOut == True:
csvFile = open(loggingLocationText.get(),"a") csvFile = open(loggingLocationText.get(),"a")
gameType= tkGametype.get()
while not stopThread: while not stopThread:
data, addr = sock.recvfrom(1024) data, addr = sock.recvfrom(1024)