From cd5fbc5da65a0c04c91519fe8a4451c6a5c6280a Mon Sep 17 00:00:00 2001 From: Amit Agnani Date: Sun, 26 Jan 2014 17:45:13 +0800 Subject: [PATCH] Changed server version detection to use numbers Changed the server version detection to use numbers rather than strings. This allows for numerical comparisons to determine if a particular function is supported. The general convention for version numbering would just be the official JC2-MP server version without the dot separators (e.g. Server version `0.1.2` becomes `12.0`). The server version is represented as a floating-point number to account for the possibility of additional releases within the same version branch (e.g `0.1.2a`) should that ever happen. Server version `-1.0` represents server version is not yet known. This can happen if a modified server is loaded or if a new server is loaded with a older GUI. All functions are assumed to be compatible if the server version is unknown. --- COM/server/com.lua | 2 +- COM/server/comlink.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/COM/server/com.lua b/COM/server/com.lua index cac4fe8..ceee878 100644 --- a/COM/server/com.lua +++ b/COM/server/com.lua @@ -39,7 +39,7 @@ ProcessDO = true -- Setup -- ActiveLinks = {} -ServVer = "UNKNOWN" +ServVer = -1.0 io.stderr:setvbuf("no") -- Disable output buffering io.stdout:setvbuf("no") -- Disable output buffering diff --git a/COM/server/comlink.lua b/COM/server/comlink.lua index 815c48d..970ce89 100644 --- a/COM/server/comlink.lua +++ b/COM/server/comlink.lua @@ -143,7 +143,7 @@ function SERVER_COM:StartHandshake() if string.starts(response, "VALIDATE ") then local resp = string.split(response, " ") local GUI_VER = resp[2] - ServVer = resp[3] + ServVer = tonumber(resp[3]) self.UseHash = toboolean(resp[4]) if (tonumber(GUI_VER) < MIN_GUI_VER) then