forked from github/server
fix allies module
This commit is contained in:
commit
04c3052916
5 changed files with 15 additions and 8 deletions
|
@ -48,7 +48,9 @@ endif()
|
||||||
find_package(EXPAT REQUIRED)
|
find_package(EXPAT REQUIRED)
|
||||||
find_package (ToLua REQUIRED)
|
find_package (ToLua REQUIRED)
|
||||||
if (TOLUA_FOUND)
|
if (TOLUA_FOUND)
|
||||||
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
|
if (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
|
||||||
|
find_package (Lua 5.3 REQUIRED)
|
||||||
|
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.2")
|
||||||
find_package (Lua 5.2 REQUIRED)
|
find_package (Lua 5.2 REQUIRED)
|
||||||
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
|
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
|
||||||
find_package ( Lua 5.3 REQUIRED)
|
find_package ( Lua 5.3 REQUIRED)
|
||||||
|
|
11
s/cmake-init
Executable file → Normal file
11
s/cmake-init
Executable file → Normal file
|
@ -78,17 +78,16 @@ DEST=$(dirname $ROOT)/server
|
||||||
LUA_VERSION="5.2"
|
LUA_VERSION="5.2"
|
||||||
LUA_INCLUDE=/usr/include
|
LUA_INCLUDE=/usr/include
|
||||||
LUA_DIR=/usr
|
LUA_DIR=/usr
|
||||||
if [ -d /usr/include/lua5.1 ]; then
|
if [ -d /usr/local/include/lua5.3 ]; then
|
||||||
LUA_VERSION="5.1"
|
|
||||||
LUA_INCLUDE=/usr/include/lua5.1
|
|
||||||
elif [ -d /usr/include/lua5.3 ]; then
|
|
||||||
export LUA_DIR=/usr
|
|
||||||
LUA_VERSION="5.3"
|
LUA_VERSION="5.3"
|
||||||
LUA_INCLUDE=/usr/include/lua5.3
|
LUA_INCLUDE=/usr/local/include/lua5.3
|
||||||
elif [ -d /usr/include/lua5.2 ]; then
|
elif [ -d /usr/include/lua5.2 ]; then
|
||||||
export LUA_DIR=/usr
|
export LUA_DIR=/usr
|
||||||
LUA_VERSION="5.2"
|
LUA_VERSION="5.2"
|
||||||
LUA_INCLUDE=/usr/include/lua5.2
|
LUA_INCLUDE=/usr/include/lua5.2
|
||||||
|
elif [ -d /usr/include/lua5.1 ]; then
|
||||||
|
LUA_VERSION="5.1"
|
||||||
|
LUA_INCLUDE=/usr/include/lua5.1
|
||||||
elif [ -d /usr/local/include/lua5.1 ]; then
|
elif [ -d /usr/local/include/lua5.1 ]; then
|
||||||
export LUA_DIR=/usr/local
|
export LUA_DIR=/usr/local
|
||||||
LUA_VERSION="5.1"
|
LUA_VERSION="5.1"
|
||||||
|
|
|
@ -10,6 +10,8 @@ package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||||
lunit = require 'lunit'
|
lunit = require 'lunit'
|
||||||
require 'eressea'
|
require 'eressea'
|
||||||
require 'eressea.path'
|
require 'eressea.path'
|
||||||
|
|
||||||
|
lunit = require('lunit')
|
||||||
module = lunit.module
|
module = lunit.module
|
||||||
require 'tests'
|
require 'tests'
|
||||||
result = lunit.main()
|
result = lunit.main()
|
||||||
|
|
|
@ -6,6 +6,10 @@ else
|
||||||
module(tcname, 'seeall')
|
module(tcname, 'seeall')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function setup()
|
||||||
|
eressea.free_game()
|
||||||
|
end
|
||||||
|
|
||||||
function test_get_allies()
|
function test_get_allies()
|
||||||
local f1 = faction.create("human")
|
local f1 = faction.create("human")
|
||||||
local f2 = faction.create("human")
|
local f2 = faction.create("human")
|
||||||
|
|
|
@ -684,7 +684,7 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
|
||||||
a->data.sa[0] = (short)cap_int(rtrees(r, 0), 0, SHRT_MAX);
|
a->data.sa[0] = (short)cap_int(rtrees(r, 0), 0, SHRT_MAX);
|
||||||
a->data.sa[1] = (short)cap_int(rtrees(r, 1), 0, SHRT_MAX);
|
a->data.sa[1] = (short)cap_int(rtrees(r, 1), 0, SHRT_MAX);
|
||||||
}
|
}
|
||||||
else if (a->data.sa[0] < 0 || a->data.sa[1] << 0) {
|
else if (a->data.sa[0] < 0 || a->data.sa[1] < 0) {
|
||||||
a->data.sa[0] = (short)cap_int(a->data.sa[0], 0, SHRT_MAX);
|
a->data.sa[0] = (short)cap_int(a->data.sa[0], 0, SHRT_MAX);
|
||||||
a->data.sa[1] = (short)cap_int(a->data.sa[1], 0, SHRT_MAX);
|
a->data.sa[1] = (short)cap_int(a->data.sa[1], 0, SHRT_MAX);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue