fix allies module

This commit is contained in:
Enno Rehling 2020-05-03 15:59:37 +02:00
commit 04c3052916
5 changed files with 15 additions and 8 deletions

View File

@ -48,7 +48,9 @@ endif()
find_package(EXPAT REQUIRED)
find_package (ToLua REQUIRED)
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)
elseif (${TOLUA_VERSION_STRING} VERSION_EQUAL "5.3")
find_package ( Lua 5.3 REQUIRED)

11
s/cmake-init Executable file → Normal file
View File

@ -78,17 +78,16 @@ DEST=$(dirname $ROOT)/server
LUA_VERSION="5.2"
LUA_INCLUDE=/usr/include
LUA_DIR=/usr
if [ -d /usr/include/lua5.1 ]; then
LUA_VERSION="5.1"
LUA_INCLUDE=/usr/include/lua5.1
elif [ -d /usr/include/lua5.3 ]; then
export LUA_DIR=/usr
if [ -d /usr/local/include/lua5.3 ]; then
LUA_VERSION="5.3"
LUA_INCLUDE=/usr/include/lua5.3
LUA_INCLUDE=/usr/local/include/lua5.3
elif [ -d /usr/include/lua5.2 ]; then
export LUA_DIR=/usr
LUA_VERSION="5.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
export LUA_DIR=/usr/local
LUA_VERSION="5.1"

View File

@ -10,6 +10,8 @@ package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
lunit = require 'lunit'
require 'eressea'
require 'eressea.path'
lunit = require('lunit')
module = lunit.module
require 'tests'
result = lunit.main()

View File

@ -6,6 +6,10 @@ else
module(tcname, 'seeall')
end
function setup()
eressea.free_game()
end
function test_get_allies()
local f1 = faction.create("human")
local f2 = faction.create("human")

View File

@ -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[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[1] = (short)cap_int(a->data.sa[1], 0, SHRT_MAX);
}