From eec4d75635ff051964091fa88fa2ad9ec6c41c61 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 11 Dec 2021 10:44:10 +0800 Subject: [PATCH] remove some debug/spam --- ttd.go | 12 ++++++------ version.go | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ttd.go b/ttd.go index 14c8750..0ea1b14 100644 --- a/ttd.go +++ b/ttd.go @@ -526,6 +526,7 @@ func (s *ServerTTD) Poll(stop chan struct{}) { } sp.Read(buffer[:p.PLength]) r := regexp.MustCompile("#:(?P[0-9]+)\\((?P[a-zA-Z]+)\\) Company Name: '(?P.+)'.*Money: (?P[0-9]+).*Loan: (?P[0-9]*).*Value: (?P[0-9]+).* \\(T:(?P[0-9]+), R:(?P[0-9]+), P:(?P[0-9]+), S:(?P[0-9]+)\\).*$") + r2 := regexp.MustCompile("Client #(?P[0-9]+).*name: '(?P.+)'.*company: (?P[0-9]+)( )+IP: .*$") if r.MatchString(sp.Output) { coID := uint8(0) for _, co := range srv.Status.Companies { @@ -564,17 +565,16 @@ func (s *ServerTTD) Poll(stop chan struct{}) { stats.Plane, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Plane}")) stats.Ship, _ = strconv.Atoi(r.ReplaceAllString(sp.Output, "${Ship}")) } - } - r = regexp.MustCompile("Client #(?P[0-9]+).*name: '(?P.+)'.*company: (?P[0-9]+)( )+IP: .*$") - if r.MatchString(sp.Output) { + } else if r2.MatchString(sp.Output) { for _, c := range srv.Status.Clients { - if c.Name == r.ReplaceAllString(sp.Output, "${ClientName}") { - c.ClientExtlID, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${ClientID}"), 10, 64) + if c.Name == r2.ReplaceAllString(sp.Output, "${ClientName}") { + c.ClientExtlID, _ = strconv.ParseInt(r2.ReplaceAllString(sp.Output, "${ClientID}"), 10, 64) break } } + } else { + logInfoDebug("Server.Poll() : AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output) } - logInfoDebug("Server.Poll() : AdminPacketServerRCon :\n- ColorID: %d\n- Output: %s", sp.ColorID, sp.Output) case AdminPacketServerRConEnd: sp := PacketServerRConEnd{ diff --git a/version.go b/version.go index be93055..a985a0a 100644 --- a/version.go +++ b/version.go @@ -1,6 +1,6 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "1520326" -var buildstamp = "2021-12-11_02:35:54" -var commits = "253" -var version = "1520326-b253 - 2021-12-11_02:35:54" +var githash = "0bfa446" +var buildstamp = "2021-12-11_02:44:00" +var commits = "254" +var version = "0bfa446-b254 - 2021-12-11_02:44:00"