Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Changed server version detection to use numbers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
initramfs committed Jan 26, 2014
1 parent e5e98f2 commit cd5fbc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion COM/server/com.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion COM/server/comlink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd5fbc5

Please sign in to comment.