Skip to content

Commit

Permalink
stead.atleast added
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Kosyh committed Jan 26, 2014
1 parent 77254ca commit e74345c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
4 changes: 2 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
* -lua and -luac parameters;
* in windows do not close -debug console until press return;
* game.gui.hidetitle;
* stead.api_atleast();
* stead.api_atleast() and stead.atleast();
* stead.tonum, stead.tostr, stead.type, stead.ipairs, stead.pairs, stead.opairs;
* potential bug with non ascii save path and non UTF-8 game codepage;
* bug with language changing;
* bug with anigif rotate and scale;
* bug with anigif and cursor;
* typo in Please, wait message;

-- Peter Kosyh <p.kosyh@gmail.com> Mon, 25 Jan 2014 21:38:00 +0400
-- Peter Kosyh <p.kosyh@gmail.com> Sun, 26 Jan 2014 13:12:00 +0400

1.9.1

Expand Down
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
instead (2.0.0) unstable; urgency=low
* 2.0.0 release;

-- Peter Kosyh <p.kosyh@gmail.com> Mon, 25 Jan 2014 21:38:00 +0400
-- Peter Kosyh <p.kosyh@gmail.com> Sun, 26 Jan 2014 13:12:00 +0400

instead (1.9.1) unstable; urgency=low
* 1.9.1 release;
Expand Down
64 changes: 40 additions & 24 deletions stead/stead.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
stead = {
version = "2.0.0",
api_version = "1.1.6", -- last version before 1.2.0
api_atleast = function(...)
local k
local v
for k, v in ipairs {...} do
if stead.type(k) ~= 'number' then
return false
end
if not stead.api_version_table[k] or v > stead.api_version_table[k] then
return false
end
if v < stead.api_version_table[k] then
return true
end
end
return true
end;
table = table,
delim = ',',
busy = instead_busy,
Expand Down Expand Up @@ -73,6 +57,40 @@ stead = {
end
}

stead.api_atleast = function(...)
local k
local v
for k, v in stead.ipairs {...} do
if stead.type(k) ~= 'number' then
return false
end
if not stead.api_version_table[k] or v > stead.api_version_table[k] then
return false
end
if v < stead.api_version_table[k] then
return true
end
end
return true
end;

stead.atleast = function(...)
local k
local v
for k, v in stead.ipairs {...} do
if stead.type(k) ~= 'number' then
return false
end
if not stead.version_table[k] or v > stead.version_table[k] then
return false
end
if v < stead.version_table[k] then
return true
end
end
return true
end;

stead.last_act = function(s)
local r = game.__last_act

Expand Down Expand Up @@ -3134,33 +3152,31 @@ function stead_version(v)
return
end
local n
local ver = {}

stead.version_table = {}
stead.api_version_table = {}

for n in stead.string.gfind(stead.version, "[0-9]+") do
stead.table.insert(stead.version_table, stead.tonum(n))
end

for n in stead.string.gfind(v, "[0-9]+") do
stead.table.insert(ver, stead.tonum(n))
stead.table.insert(stead.api_version_table, stead.tonum(n))
end

stead.api_version_table = stead.version_table

if not stead.api_atleast(stead.unpack(ver)) then
if not stead.atleast(stead.unpack(stead.api_version_table)) then
error ([[The game requires instead engine of version ]] ..v.. [[ or higher.
http://instead.sourceforge.net]], 2)
end

stead.api_version = v
stead.api_version_table = ver

if v >= "1.2.0" then
if stead.api_atleast(1, 2, 0) then
require ("walk")
require ("vars")
require ("object")
end
if v >= "1.6.3" then
if stead.api_atleast(1, 6, 3) then
require ("dlg")
end
end
Expand Down

0 comments on commit e74345c

Please sign in to comment.