Merge pull request from eressea/develop

release 3.27
This commit is contained in:
Enno Rehling 2021-02-24 19:34:51 +01:00 committed by GitHub
commit 961b936086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
148 changed files with 1401 additions and 19529 deletions

2
.gitignore vendored
View file

@ -1,4 +1,3 @@
tolua/
.vscode/
*.orig
eressea.ini
@ -47,4 +46,3 @@ tests/data/185.dat
/critbit/
*.mo
/.vs
/CMakeSettings.json

12
.gitmodules vendored
View file

@ -1,12 +1,3 @@
[submodule "dlmalloc"]
path = dlmalloc
url = https://github.com/ennorehling/dlmalloc.git
[submodule "iniparser"]
path = iniparser
url = https://github.com/ennorehling/iniparser.git
[submodule "cJSON"]
path = cJSON
url = https://github.com/ennorehling/cJSON.git
[submodule "storage"]
path = storage
url = https://github.com/ennorehling/storage.git
@ -14,3 +5,6 @@
[submodule "clibs"]
path = clibs
url = https://github.com/ennorehling/clibs
[submodule "tolua"]
path = tolua
url = https://github.com/ennorehling/tolua.git

View file

@ -1,5 +1,6 @@
sudo: false
language: c
dist: focal
compiler:
- gcc
- clang
@ -9,17 +10,15 @@ addons:
packages:
- libbsd-dev
- libdb-dev
- liblua5.1-dev
- libtolua-dev
- liblua5.3-dev
- libncurses5-dev
- libsqlite3-dev
- libexpat1-dev
- libiniparser-dev
- libcjson-dev
- valgrind
- cppcheck
- shellcheck
- luarocks
os:
- linux
notifications:
slack:
secure: F89aXLWaE125PaJIlETv12jT4EfH6wLXJmGCPZzrN3OcLn2ahDWqjwuzR7lOEDf2nAISmeMPyDZMhEHXLNHAE5qP6lg9yliYQw5hzGmDK9m1xUq/pPEne/b2Y7K3my1mkRZ6n3asbHgSmBWAfCIk1JN8R5Rv+rmbLuWLc+zofts=

View file

@ -1,3 +1,10 @@
# 3.27
- Schiffe sind kommentarlos nicht nicht gesegelt [2722]
- Meermenschen konnten nicht mehr anschwimmen [2723]
- Magieresistenz repariert [2724]
- Kleine Änderung an Samenwachstum.
- Umstellung auf neue Versionen von externen Libraries.
# 3.26

View file

@ -1,68 +1,68 @@
cmake_minimum_required(VERSION 2.9)
cmake_minimum_required(VERSION 3.13)
if (WIN32)
FILE(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH )
FILE(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH )
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH )
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH )
endif(WIN32)
project (eressea-server C)
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
if (WIN32)
# make subdirectories build to the same output folders (DLLs):
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif (WIN32)
if (MSVC)
find_package (PDCurses)
set (CURSES_FOUND ${PDCURSES_FOUND})
set (CURSES_LIBRARIES ${PDCURSES_LIBRARY})
set (CURSES_INCLUDE_DIR ${PDCURSES_INCLUDE_DIR})
set (CURSES_INCLUDE_DIRS ${PDCURSES_INCLUDE_DIR})
set (HAVE_STRDUP 0)
set (HAVE_STRLCAT 0)
set (HAVE_LIBBSD 0)
set (HAVE_SIGNAL_H 0)
set (HAVE_EXECINFO_H 0)
include (MSVC)
else (MSVC)
find_package (Curses)
include (CheckIncludeFile)
CHECK_INCLUDE_FILE(signal.h HAVE_SIGNAL_H)
CHECK_INCLUDE_FILE(execinfo.h HAVE_EXECINFO_H)
CHECK_INCLUDE_FILE(bsd/string.h HAVE_LIBBSD)
check_include_file(signal.h HAVE_SIGNAL_H)
check_include_file(execinfo.h HAVE_EXECINFO_H)
include (CheckLibraryExists)
check_library_exists(m fmin "" HAVE_LIBM)
check_library_exists(bsd strlcat "" HAVE_LIBBSD)
include (CheckFunctionExists)
CHECK_FUNCTION_EXISTS(strdup HAVE_STRDUP)
check_function_exists(strdup HAVE_STRDUP)
check_function_exists(strlcat HAVE_STRLCAT)
if (HAVE_LIBBSD)
include (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(bsd strlcat "bsd/string.h" HAVE_STRLCAT)
else (HAVE_LIBBSD)
CHECK_FUNCTION_EXISTS(strlcat HAVE_STRLCAT)
set (HAVE_STRLCAT 1)
endif (HAVE_LIBBSD)
endif (MSVC)
find_package (Readline)
if (NOT CURSES_FOUND)
set(CURSES_NEED_WIDE TRUE)
set(CURSES_NEED_NCURSES TRUE)
find_package (Curses)
endif (NOT CURSES_FOUND)
if (ERESSEA_DB STREQUAL "db")
find_package (BerkeleyDB REQUIRED QUIET)
else()
find_package (SQLite3 REQUIRED QUIET)
endif()
#find_package (BerkeleyDB REQUIRED)
find_package (SQLite3 REQUIRED)
find_package (IniParser REQUIRED)
find_package (CJSON REQUIRED)
find_package (EXPAT REQUIRED)
find_package(EXPAT REQUIRED)
find_package (ToLua REQUIRED)
if (TOLUA_FOUND)
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)
else ()
find_package (Lua)
if (NOT LLUA_FOUND)
find_package (Lua51 REQUIRED)
endif()
endif(TOLUA_FOUND)
enable_testing()
add_subdirectory (cJSON)
add_subdirectory (tolua)
add_subdirectory (tools)
add_subdirectory (storage)
add_subdirectory (iniparser)
add_subdirectory (clibs)
add_subdirectory (process)
add_subdirectory (src eressea)

39
CMakeSettings.json Normal file
View file

@ -0,0 +1,39 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake",
"type": "STRING"
},
{
"name": "CMAKE_MODULE_PATH",
"value": "${workspaceRoot}/cmake/Modules",
"type": "STRING"
}
]
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
}
]
}

View file

@ -5,5 +5,5 @@ test:
s/runtests
clean:
@rm -f *.log.*
@rm -rf *.log.* Debug/CMake*
@find . -name "*~" | xargs rm -f

View file

@ -10,7 +10,8 @@ Debian-based Linux system, this is the apt-get command to
install all of them:
sudo apt-get install git cmake gcc make luarocks libxml2-dev \
liblua5.2-dev libtolua-dev libncurses5-dev libsqlite3-dev
liblua5.2-dev libtolua-dev libncurses5-dev libsqlite3-dev \
libcjson-dev libiniparser-dev
# How to check out and build the Eressea server

1
cJSON

@ -1 +0,0 @@
Subproject commit 8df81fb497cc48b089a57fcdc3a9933540ebc7c9

2
clibs

@ -1 +1 @@
Subproject commit 484fbf23e34f6844f1c4e3f685bb6c53cadf5bfe
Subproject commit 8c3ce73e861c952d04a28949b4a80e68c2cce8fd

View file

@ -1,50 +0,0 @@
# -*- cmake -*-
# - Find BerkeleyDB
# Find the BerkeleyDB includes and library
# This module defines
# DB_INCLUDE_DIR, where to find db.h, etc.
# DB_LIBRARIES, the libraries needed to use BerkeleyDB.
# DB_FOUND, If false, do not try to use BerkeleyDB.
# also defined, but not for general use are
# DB_LIBRARY, where to find the BerkeleyDB library.
FIND_PATH(DB_INCLUDE_DIR db.h
/usr/local/include/db4
/usr/local/include
/usr/include/db4
/usr/include
)
SET(DB_NAMES ${DB_NAMES} db)
FIND_LIBRARY(DB_LIBRARY
NAMES ${DB_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_LIBRARIES ${DB_LIBRARY})
SET(DB_FOUND "YES")
ELSE (DB_LIBRARY AND DB_INCLUDE_DIR)
SET(DB_FOUND "NO")
ENDIF (DB_LIBRARY AND DB_INCLUDE_DIR)
IF (DB_FOUND)
IF (NOT DB_FIND_QUIETLY)
MESSAGE(STATUS "Found BerkeleyDB: ${DB_LIBRARIES}")
ENDIF (NOT DB_FIND_QUIETLY)
ELSE (DB_FOUND)
IF (DB_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find BerkeleyDB library")
ENDIF (DB_FIND_REQUIRED)
ENDIF (DB_FOUND)
# Deprecated declarations.
SET (NATIVE_DB_INCLUDE_PATH ${DB_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_DB_LIB_PATH ${DB_LIBRARY} PATH)
MARK_AS_ADVANCED(
DB_LIBRARY
DB_INCLUDE_DIR
)

View file

@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCJSON
-----------
.. versionadded:: 3.20
Find the cJSON libraries, v3
IMPORTED targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
``DaveGamble::CJSON``
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables if found:
``CJSON_INCLUDE_DIRS``
where to find sqlite3.h, etc.
``CJSON_LIBRARIES``
the libraries to link against to use CJSON.
``CJSON_VERSION``
version of the CJSON library found
``CJSON_FOUND``
TRUE if found
#]=======================================================================]
# Look for the necessary header
find_path(CJSON_INCLUDE_DIR cJSON.h PATH_SUFFIXES cjson)
mark_as_advanced(CJSON_INCLUDE_DIR)
# Look for the necessary library
find_library(CJSON_LIBRARY cjson)
mark_as_advanced(CJSON_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CJSON
REQUIRED_VARS CJSON_INCLUDE_DIR CJSON_LIBRARY
VERSION_VAR CJSON_VERSION)
# Create the imported target
if(CJSON_FOUND)
set(CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR})
set(CJSON_LIBRARIES ${CJSON_LIBRARY})
if(NOT TARGET DaveGamble::CJSON)
add_library(DaveGamble::CJSON UNKNOWN IMPORTED)
set_target_properties(DaveGamble::CJSON PROPERTIES
IMPORTED_LOCATION "${CJSON_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CJSON_INCLUDE_DIR}")
endif()
endif()

View file

@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindIniParser
-----------
.. versionadded:: 3.20
Find the IniParser libraries, v3
IMPORTED targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
``Devillard::IniParser``
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables if found:
``IniParser_INCLUDE_DIRS``
where to find sqlite3.h, etc.
``IniParser_LIBRARIES``
the libraries to link against to use IniParser.
``IniParser_VERSION``
version of the IniParser library found
``IniParser_FOUND``
TRUE if found
#]=======================================================================]
# Look for the necessary header
find_path(IniParser_INCLUDE_DIR iniparser.h PATH_SUFFIXES iniparser)
mark_as_advanced(IniParser_INCLUDE_DIR)
# Look for the necessary library
find_library(IniParser_LIBRARY iniparser)
mark_as_advanced(IniParser_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(IniParser
REQUIRED_VARS IniParser_INCLUDE_DIR IniParser_LIBRARY
VERSION_VAR IniParser_VERSION)
# Create the imported target
if(IniParser_FOUND)
set(IniParser_INCLUDE_DIRS ${IniParser_INCLUDE_DIR})
set(IniParser_LIBRARIES ${IniParser_LIBRARY})
if(NOT TARGET Devillard::IniParser)
add_library(Devillard::IniParser UNKNOWN IMPORTED)
set_target_properties(Devillard::IniParser PROPERTIES
IMPORTED_LOCATION "${IniParser_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${IniParser_INCLUDE_DIR}")
endif()
endif()

View file

@ -1,47 +0,0 @@
# - Try to find readline include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Readline)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# READLINE_ROOT_DIR Set this variable to the root installation of
# readline if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# READLINE_FOUND System has readline, include and lib dirs found
# READLINE_INCLUDE_DIR The readline include directories.
# READLINE_LIBRARY The readline library.
find_path(READLINE_ROOT_DIR
NAMES include/readline/readline.h
)
find_path(READLINE_INCLUDE_DIR
NAMES readline/readline.h
HINTS ${READLINE_ROOT_DIR}/include
)
find_library(READLINE_LIBRARY
NAMES readline
HINTS ${READLINE_ROOT_DIR}/lib
)
if(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
set(READLINE_FOUND TRUE)
else(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY )
MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY)
endif(READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND Ncurses_LIBRARY)
mark_as_advanced(
READLINE_ROOT_DIR
READLINE_INCLUDE_DIR
READLINE_LIBRARY
)

View file

@ -1,63 +1,69 @@
# - Try to find the SQLite3 library
# Once done this will define
#
# SQLITE3_FOUND - System has SQLite3
# SQLITE3_INCLUDE_DIR - The SQLite3 include directory
# SQLITE3_LIBRARIES - The libraries needed to use SQLite3
# SQLITE3_DEFINITIONS - Compiler switches required for using SQLite3
# SQLITE3_EXECUTABLE - The SQLite3 command line shell
# SQLITE3_VERSION_STRING - the version of SQLite3 found (since CMake 2.8.8)
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
#[=======================================================================[.rst:
FindSQLite3
-----------
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_SQLITE QUIET sqlite3)
set(SQLITE3_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
.. versionadded:: 3.14
find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h
HINTS
${PC_SQLITE_INCLUDEDIR}
${PC_SQLITE_INCLUDE_DIRS}
)
Find the SQLite libraries, v3
find_library(SQLITE3_LIBRARIES NAMES sqlite3
HINTS
${PC_SQLITE_LIBDIR}
${PC_SQLITE_LIBRARY_DIRS}
)
IMPORTED targets
^^^^^^^^^^^^^^^^
find_program(SQLITE3_EXECUTABLE sqlite3)
This module defines the following :prop_tgt:`IMPORTED` target:
if(PC_SQLITE_VERSION)
set(SQLITE3_VERSION_STRING ${PC_SQLITE_VERSION})
elseif(SQLITE3_INCLUDE_DIR AND EXISTS "${SQLITE3_INCLUDE_DIR}/sqlite3.h")
file(STRINGS "${SQLITE3_INCLUDE_DIR}/sqlite3.h" sqlite3_version_str
REGEX "^#define[\t ]+SQLITE_VERSION[\t ]+\".*\"")
``SQLite::SQLite3``
string(REGEX REPLACE "^#define[\t ]+SQLITE_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
SQLITE3_VERSION_STRING "${sqlite3_version_str}")
unset(sqlite3_version_str)
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables if found:
``SQLite3_INCLUDE_DIRS``
where to find sqlite3.h, etc.
``SQLite3_LIBRARIES``
the libraries to link against to use SQLite3.
``SQLite3_VERSION``
version of the SQLite3 library found
``SQLite3_FOUND``
TRUE if found
#]=======================================================================]
# Look for the necessary header
find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
mark_as_advanced(SQLite3_INCLUDE_DIR)
# Look for the necessary library
find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
mark_as_advanced(SQLite3_LIBRARY)
# Extract version information from the header file
if(SQLite3_INCLUDE_DIR)
file(STRINGS ${SQLite3_INCLUDE_DIR}/sqlite3.h _ver_line
REGEX "^#define SQLITE_VERSION *\"[0-9]+\\.[0-9]+\\.[0-9]+\""
LIMIT_COUNT 1)
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+"
SQLite3_VERSION "${_ver_line}")
unset(_ver_line)
endif()
# handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLite3
REQUIRED_VARS SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIR
VERSION_VAR SQLITE3_VERSION_STRING)
find_package_handle_standard_args(SQLite3
REQUIRED_VARS SQLite3_INCLUDE_DIR SQLite3_LIBRARY
VERSION_VAR SQLite3_VERSION)
# Create the imported target
if(SQLite3_FOUND)
set(SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
set(SQLite3_LIBRARIES ${SQLite3_LIBRARY})
if(NOT TARGET SQLite::SQLite3)
add_library(SQLite::SQLite3 UNKNOWN IMPORTED)
set_target_properties(SQLite::SQLite3 PROPERTIES
IMPORTED_LOCATION "${SQLite3_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}")
endif()
endif()
mark_as_advanced(SQLITE3_INCLUDE_DIR SQLITE3_LIBRARIES SQLITE3_EXECUTABLE)

View file

@ -1,73 +0,0 @@
# - Try to find the ToLua library
# Once done this will define
#
# TOLUA_FOUND - System has ToLua
# TOLUA_INCLUDE_DIR - The ToLua include directory
# TOLUA_LIBRARIES - The libraries needed to use ToLua
# TOLUA_DEFINITIONS - Compiler switches required for using ToLua
# TOLUA_EXECUTABLE - The ToLua command line shell
# TOLUA_VERSION_STRING - the version of ToLua found (since CMake 2.8.8)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# use pkg-config to get the directories and then use these values
# in the find_path() and find_library() calls
find_package(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_TOLUA QUIET ToLua)
set(TOLUA_DEFINITIONS ${PC_TOLUA_CFLAGS_OTHER})
find_path(TOLUA_INCLUDE_DIR NAMES tolua.h
HINTS
${PC_TOLUA_DIR}/include
${PC_TOLUA_INCLUDEDIR}
${PC_TOLUA_INCLUDE_DIRS}
)
find_library(TOLUA_LIBRARY NAMES tolua
HINTS
${PC_TOLUA_DIR}/lib
${PC_TOLUA_LIBDIR}
${PC_TOLUA_LIBRARY_DIRS}
)
find_program(TOLUA_EXECUTABLE tolua
HINTS
${PC_TOLUA_DIR}/bin
${PC_TOLUA_LIBDIR}
${PC_TOLUA_LIBRARY_DIRS}
)
SET( TOLUA_LIBRARIES "${TOLUA_LIBRARY}" CACHE STRING "ToLua Libraries")
if(PC_TOLUA_VERSION)
set(TOLUA_VERSION_STRING ${PC_TOLUA_VERSION})
elseif(TOLUA_INCLUDE_DIR AND EXISTS "${TOLUA_INCLUDE_DIR}/tolua.h")
file(STRINGS "${TOLUA_INCLUDE_DIR}/tolua.h" tolua_version_str
REGEX "^#define[\t ]+TOLUA_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^#define[\t ]+TOLUA_VERSION[\t ]+\"tolua ([^\"]*)\".*" "\\1"
TOLUA_VERSION_STRING "${tolua_version_str}")
unset(tolua_version_str)
else(PC_TOLUA_VERSION)
message(ERROR "TOLUA_VERSION_STRING cannot be determined")
endif(PC_TOLUA_VERSION)
# handle the QUIETLY and REQUIRED arguments and set TOLUA_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ToLua
REQUIRED_VARS TOLUA_LIBRARY TOLUA_INCLUDE_DIR TOLUA_EXECUTABLE
VERSION_VAR TOLUA_VERSION_STRING)
mark_as_advanced(TOLUA_INCLUDE_DIR TOLUA_LIBRARIES TOLUA_EXECUTABLE)

View file

@ -1,19 +0,0 @@
MACRO (MSVC_CRT_SECURE_NO_WARNINGS)
IF (MSVC)
FOREACH (target ${ARGN})
SET_TARGET_PROPERTIES (${target} PROPERTIES
COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS
)
ENDFOREACH (target)
ENDIF (MSVC)
ENDMACRO (MSVC_CRT_SECURE_NO_WARNINGS)
MACRO (MSVC_SET_WARNING_LEVEL level)
IF (MSVC)
IF(CMAKE_C_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W${level}" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W${level}")
ENDIF()
ENDIF(MSVC)
ENDMACRO (MSVC_SET_WARNING_LEVEL)

@ -1 +0,0 @@
Subproject commit f1446c47ca1774ae84bf86a28502e91daf6b421a

File diff suppressed because it is too large Load diff

@ -1 +0,0 @@
Subproject commit 31d42782e2713591da4c1a7db1aca4937137e352

View file

@ -16,7 +16,7 @@
<requirement type="adamantium" quantity="1"/>
<requirement type="log" quantity="1"/>
</construction>
<weapon cut="true" magical="true" skill="melee" offmod="2" defmod="-2" magres="0.30">
<weapon cut="true" magical="true" skill="melee" offmod="2" defmod="-2" magres="0.3">
<damage type="rider" value="3d4+15"/>
<damage type="footman" value="3d4+15"/>
</weapon>
@ -28,7 +28,7 @@
<construction skill="armorer" minskill="10">
<requirement type="adamantium" quantity="3"/>
</construction>
<armor ac="7" penalty="0.1"/>
<armor ac="7" penalty="0.1" magres="0.3"/>
</item>
</resource>

View file

@ -2216,6 +2216,18 @@
<arg name="unit" type="unit"/>
</type>
</message>
<message name="followdetect_ship" section="movement">
<type>
<arg name="follower" type="ship"/>
<arg name="ship" type="ship"/>
</type>
</message>
<message name="followfail_ship" section="movement">
<type>
<arg name="follower" type="ship"/>
<arg name="ship" type="ship"/>
</type>
</message>
<message name="moveblocked" section="errors">
<type>
<arg name="unit" type="unit"/>

View file

@ -436,7 +436,7 @@
<resource name="dragonblood" amount="1" cost="fixed"/><!-- Drachenblut -->
</spell>
<spell name="auratransfer" rank="1" syntax="aura" parameters="ui" ship="true">
<spell name="auratransfer" rank="1" syntax="aura" parameters="ui" noresist="true" ship="true">
<!-- Auratransfer -->
<resource name="aura" amount="1" cost="fixed"/>
</spell>
@ -528,7 +528,7 @@
<resource name="h12" amount="1" cost="fixed"/>
<resource name="h20" amount="1" cost="fixed"/>
</spell>
<spell name="sound_out" rank="5" parameters="ur" los="true">
<spell name="sound_out" rank="5" parameters="ur" noresist="true" los="true">
<resource name="aura" amount="4" cost="fixed"/>
<resource name="money" amount="100" cost="fixed"/>
</spell>

View file

@ -93,7 +93,7 @@
<spell name="transferauratraum" rank="1" syntax="aura" parameters="ui" ship="true">
<resource name="aura" amount="2" cost="fixed"/>
</spell>
<spell name="auratransfer" rank="1" syntax="aura" parameters="ui" ship="true">
<spell name="auratransfer" rank="1" syntax="aura" parameters="ui" noresist="true" ship="true">
<resource name="aura" amount="1" cost="fixed"/>
</spell>
<spell name="stonegolem" rank="4" variable="true">
@ -192,7 +192,7 @@
<resource name="h7" amount="3" cost="fixed"/>
<resource name="money" amount="50" cost="fixed"/>
</spell>
<spell name="enterastral" rank="7" parameters="u+" variable="true">
<spell name="enterastral" rank="7" parameters="u+" noresist="true" variable="true">
<resource name="aura" amount="2" cost="level"/>
</spell>
<spell name="leaveastral" rank="7" parameters="ru+" variable="true">
@ -214,13 +214,13 @@
<spell name="view_reality" rank="5">
<resource name="aura" amount="40" cost="fixed"/>
</spell>
<spell name="astral_disruption" rank="4" variable="true">
<spell name="astral_disruption" rank="4" noresist="true" variable="true">
<resource name="aura" amount="140" cost="fixed"/>
</spell>
<spell name="seduction" rank="5" parameters="u" los="true">
<resource name="aura" amount="12" cost="fixed"/>
</spell>
<spell name="sound_out" rank="5" parameters="ur" los="true">
<spell name="sound_out" rank="5" parameters="ur" noresist="true" los="true">
<resource name="aura" amount="4" cost="fixed"/>
<resource name="money" amount="100" cost="fixed"/>
</spell>

View file

@ -1161,6 +1161,12 @@ msgid "spyreport_faction"
msgstr "\"$unit($target) gehört der Partei $faction($faction) an.\""
msgid "ship_drift"
msgstr "\"Die $ship($ship) treibt nach $direction($dir).\""
msgid "ship_drift_overload"
msgstr "\"Die $ship($ship) ist überladen und treibt nach $direction($dir).\""
msgid "ship_drift_nocrew"
msgstr "\"Die $ship($ship) hat zu wenig Segler und treibt nach $direction($dir).\""
msgid "error_max_magicians"
@ -2597,6 +2603,12 @@ msgstr "\"$unit($follower) konnte $unit($unit) nicht folgen.\""
msgid "followdetect"
msgstr "\"$unit($follower) ist $unit($unit) gefolgt.\""
msgid "followfail_ship"
msgstr "\"Die $ship($follower) konnte die $ship($ship) nicht einholen.\""
msgid "followdetect_ship"
msgstr "\"Die $ship($ship) wurde von $ship($follower) verfolgt.\""
msgid "unitnotfound_id"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - Einheit $id wurde nicht gefunden.\""

View file

@ -1161,6 +1161,12 @@ msgid "spyreport_faction"
msgstr "\"$unit($target) belongs to $faction($faction).\""
msgid "ship_drift"
msgstr "\"The ship $ship($ship) drifts to the $direction($dir).\""
msgid "ship_drift_overload"
msgstr "\"The ship $ship($ship) is too heavily loaded and drifts to the $direction($dir).\""
msgid "ship_drift_nocrew"
msgstr "\"The ship $ship($ship) needs more sailors and drifts to the $direction($dir).\""
msgid "error_max_magicians"
@ -1812,7 +1818,7 @@ msgid "error243"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - You did not specify a valid race.\""
msgid "error133"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - You must build a caravansary before building roads through deserts.\""
msgstr "\"$unit($unit) in $region($region): '$order($command)' - You must build a caravanserai before building roads through deserts.\""
msgid "changepasswd"
msgstr "\"The password of this faction is '$value'.\""
@ -2591,6 +2597,12 @@ msgstr "\"$unit($mage) makes $unit($target) appear as $race($race,$unit.size($ta
msgid "error248"
msgstr "\"$unit($unit) in $region($region): '$order($command)' - The faction has to be 10 turns old.\""
msgid "followfail_ship"
msgstr "\"$ship($follower) could not catch up to $ship($ship).\""
msgid "followdetect_ship"
msgstr "\"$ship($follower) followed $ship($ship).\""
msgid "followfail"
msgstr "\"$unit($follower) could not follow $unit($unit).\""

View file

@ -1318,7 +1318,7 @@ msgid "peasantblood"
msgstr "peasant blood"
msgid "caravan"
msgstr "caravanserei"
msgstr "caravanserai"
msgctxt "race"
msgid "human"

View file

@ -1,6 +1,5 @@
#!/bin/sh
ROOT=$(git rev-parse --show-toplevel)
eval $(luarocks path)
[ -z "$BUILD" ] && BUILD=Debug
if [ -z "$JOBS" ] ; then
if [ -e /usr/sbin/sysctl ]; then

View file

@ -6,9 +6,6 @@ pkg-config --exists sqlite3 && ERESSEA_DB=sqlite
GETOPT=getopt
GETOPT_LONG=1
if [ -z "$(luarocks show lunitx)" ] ; then
luarocks install lunitx --local
fi
if [ "Darwin" = "$(uname)" ] ; then
if [ -x "/usr/local/opt/gnu-getopt/bin/getopt" ] ; then
GETOPT="/usr/local/opt/gnu-getopt/bin/getopt"
@ -78,22 +75,20 @@ fi
DEST=$(dirname $ROOT)/server
LUA_VERSION="5.2"
LUA_INCLUDE=/usr/include
LUA_DIR=/usr
if [ -d /usr/local/include/lua5.3 ]; then
LUA_VERSION="5.3"
LUA_INCLUDE=/usr/local/include/lua5.3
if [ -d /usr/local/include/lua ]; then
LUA_INCLUDE=/usr/local/include/lua
elif [ -d /usr/include/lua5.4 ]; then
LUA_INCLUDE=/usr/include/lua5.4
elif [ -d /usr/include/lua5.3 ]; then
LUA_INCLUDE=/usr/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"
LUA_DIR=/usr/local
LUA_INCLUDE=/usr/local/include/lua5.1
fi
@ -111,27 +106,6 @@ SET (CMAKE_LIBRARY_PATH "$LIBRARY_PATH" CACHE PATH "")
SET (CMAKE_PREFIX_PATH "$PREFIX_PATH" CACHE PATH "")
HEREDOC
path="$(which tolua)"
if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
echo "tolua is not installed, building from source"
cd $ROOT
if [ ! -d tolua/include ]; then
echo "fetching tolua ${LUA_VERSION} from github..."
git clone https://github.com/ennorehling/tolua-${LUA_VERSION}.git tolua
fi
echo "building tolua..."
cd tolua
make
cd -
cat >> $BUILD/config.cmake <<TOLUA
SET(PC_TOLUA_DIR "$ROOT/tolua" CACHE PATH "tolua root")
TOLUA
else
echo "tolua is $path"
fi
unset path
set -e
cd $BIN_DIR

View file

@ -58,7 +58,6 @@ cat >| eressea.ini <<HEREDOC
dbname = eressea.db
dbswap = :memory:
install = $SOURCE
paths = $SOURCE/lunit:$SOURCE/git/scripts
rules = e$game
HEREDOC
}

View file

@ -1,8 +1,8 @@
#!/bin/bash
set -e
eval $(luarocks path)
ROOT=$(git rev-parse --show-toplevel)
export LUA_PATH="$ROOT/scripts/?.lua;$LUA_PATH"
[ -z $BUILD ] && BUILD=Debug ; export BUILD
UNIT_TESTS=$ROOT/$BUILD/eressea/test_eressea
@ -21,8 +21,8 @@ if [ ! -e $ROOT/$BUILD ]; then
exit
fi
$UNIT_TESTS
cd $ROOT/tests
$UNIT_TESTS
$RUN_TESTS -v1 ../scripts/run-tests.lua
$RUN_TESTS -v1 ../scripts/run-tests-e2.lua
$RUN_TESTS -v1 ../scripts/run-tests-e3.lua

View file

@ -102,7 +102,6 @@ ini_add game id $game
ini_add game start 1
ini_sec lua
ini_add lua install $SOURCE
ini_add lua paths $SOURCE/scripts:$SOURCE/lunit
ini_add lua rules $rules
echo 0 > turn

View file

@ -6,7 +6,7 @@ inifile() {
cd $ROOT
if [ ! -e eressea.ini ]; then
cp conf/eressea.ini .
$BUILD/iniparser/inifile eressea.ini add lua:paths lunit:scripts
$BUILD/tools/inifile eressea.ini add lua:paths lunit:scripts
fi
}
@ -39,5 +39,10 @@ cd ../process
make
cd $ROOT
inifile
luarocks install lunitx --local
eval $(luarocks path)
export LUA_PATH="$ROOT/scripts/?.lua;$LUA_PATH"
echo $LUA_PATH
s/runtests -V
integration_tests

View file

@ -1,5 +1,9 @@
if config.paths ~= nil then
for path in string.gmatch(config.paths, "([^:]+)") do
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
end
local path = '.'
if config.install then
path = config.install
else
path = os.getenv("ERESSEA_ROOT") or path
config.install = path
end
path = path .. "/scripts"
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path

View file

@ -1,8 +1,3 @@
local path = 'scripts'
if config.install then
path = config.install .. '/' .. path
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
require 'eressea.path'
require 'eressea'
require 'eressea.xmlconf'

View file

@ -1,22 +1,15 @@
-- Tests that work in all games. With game config of E2.
-- Tests are under scripts/test/e2 and all files must be in scripts/test/e2/init.lua
lunit = require('lunit')
if _VERSION >= 'Lua 5.2' then
module = lunit.module
end
path = 'scripts'
if config.install then
path = config.install .. '/' .. path
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
config.rules = 'e2'
lunit = require 'lunit'
if _VERSION >= 'Lua 5.2' then
module = lunit.module
end
require 'eressea.path'
require 'eressea'
require 'eressea.xmlconf'
require 'eressea.path'
require 'tests.e2'
rng.inject(0)

View file

@ -1,21 +1,14 @@
-- Tests that work in E3. With game config of E3.
-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua
lunit = require('lunit')
if _VERSION >= 'Lua 5.2' then
module = lunit.module
end
path = 'scripts'
if config.install then
path = config.install .. '/' .. path
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
config.rules = 'e3'
lunit = require 'lunit'
if _VERSION >= 'Lua 5.2' then
module = lunit.module
end
require 'eressea'
require 'eressea.path'
require 'eressea'
require 'eressea.xmlconf'
require 'tests.e3'

View file

@ -1,19 +1,13 @@
-- Basic test without loading XML Config. Test care about needed settings.
-- Tests are under scripts/test/ and all files must be in scripts/test/init.lua
lunit = require('lunit')
lunit = require 'lunit'
if _VERSION >= 'Lua 5.2' then
module = lunit.module
end
path = 'scripts'
if config.install then
path = config.install .. '/' .. path
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
require 'eressea'
require 'eressea.path'
require 'eressea'
require 'tests'
result = lunit.main()
return result.errors + result.failed

View file

@ -1,3 +1,5 @@
require 'eressea.path'
function nmr_check(maxnmrs)
local nmrs = get_nmrs(1)
if nmrs > maxnmrs then
@ -188,11 +190,6 @@ end
math.randomseed(rng.random())
local path = 'scripts'
if config.install then
path = config.install .. '/' .. path
end
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
require 'eressea'
require 'eressea.xmlconf' -- read xml data

View file

@ -13,6 +13,7 @@ function setup()
eressea.settings.set("NewbieImmunity", "0")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.peasants.growth.factor", "0")
eressea.settings.set("magic.resist.enable", "0")
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("magic.regeneration.enable", "0")
end

View file

@ -9,11 +9,13 @@ end
function setup()
eressea.free_game()
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("rules.grow.formula", "0")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.storms", "0")
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("study.produceexp", "0")
eressea.settings.set("rules.peasants.growth.factor", "0")
eressea.settings.set("magic.resist.enable", "0")
end
function disabled_double_default()
@ -88,7 +90,6 @@ function test_herbalism()
local f = faction.create("human")
local u = unit.create(f, r, 1)
eressea.settings.set("rules.grow.formula", 0) -- plants do not grow
u:add_item("money", u.number * 100)
u:set_skill("herbalism", 5)
r:set_resource("seed", 100)
@ -606,7 +607,7 @@ function test_seacast()
u2.ship = s1
u2:add_spell("stormwinds")
u2:clear_orders()
u2:add_order("Zaubere stufe 2 'Sturmelementar' " .. itoa36(s1.id))
u2:add_order("ZAUBERE STUFE 2 'Sturmelementar' " .. itoa36(s1.id))
u1:clear_orders()
u1:add_order("NACH O O O O")
process_orders()

View file

@ -6,7 +6,6 @@ else
module(tcname, lunit.testcase, package.seeall)
end
local settings
-- use the C implementation in market.c, because the Lua
-- module is wrong (https://bugs.eressea.de/view.php?id=2225)
@ -16,28 +15,14 @@ local function process_markets()
eressea.process.markets()
end
local function set_rule(key, value)
if value==nil then
eressea.settings.set(key, settings[key])
else
settings[key] = settings[key] or eressea.settings.get(key)
eressea.settings.set(key, value)
end
end
function setup()
eressea.game.reset()
settings = {}
set_rule("rules.move.owner_leave", "1")
set_rule("rules.food.flags", "4")
set_rule("rules.ship.drifting", "0")
set_rule("rules.ship.storms", "0")
end
function teardown()
for k,_ in pairs(settings) do
set_rule(k)
end
eressea.settings.set("rules.move.owner_leave", "1")
eressea.settings.set("rules.food.flags", "4")
eressea.settings.set("rules.ship.drifting", "0")
eressea.settings.set("rules.ship.storms", "0")
eressea.settings.set("magic.resist.enable", "0")
end
function test_new_faction_cannot_give_unit()
@ -988,7 +973,7 @@ function test_no_uruk()
end
function test_bug2187()
set_rule("rules.food.flags", "0")
eressea.settings.set("rules.food.flags", "0")
local r = region.create(0,0,"plain")
local f = faction.create("goblin", "2187@eressea.de", "de")
@ -1005,7 +990,7 @@ function test_bug2187()
-- init_reports()
-- write_report(f)
set_rule("rules.food.flags", "4")
eressea.settings.set("rules.food.flags", "4")
end
@ -1027,8 +1012,8 @@ end
function test_demons_using_mallornlance()
-- bug 2392
set_rule("skillchange.demon.up", "0")
set_rule("NewbieImmunity", "0")
eressea.settings.set("skillchange.demon.up", "0")
eressea.settings.set("NewbieImmunity", "0")
local r = region.create(0, 0, "plain")
local f = faction.create('goblin')
local u = unit.create(f, r, 1, 'demon')

View file

@ -15,6 +15,7 @@ function setup()
eressea.settings.set("rules.encounters", "0")
eressea.settings.set("magic.fumble.enable", "0")
eressea.settings.set("magic.regeneration.enable", "0")
eressea.settings.set("magic.resist.enable", "0")
end
function test_create_bogus()

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13)
project (server C)
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CJSON_INCLUDE_DIR})
include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${CLIBS_INCLUDE_DIR})
include_directories (${STORAGE_INCLUDE_DIR})
@ -9,43 +9,44 @@ include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
IF(DEFINED ERESSEA_VERSION)
if(DEFINED ERESSEA_VERSION)
set_source_files_properties(kernel/version.c PROPERTIES
COMPILE_DEFINITIONS ERESSEA_VERSION="${ERESSEA_VERSION}")
ENDIF()
compile_definitions ERESSEA_VERSION="${ERESSEA_VERSION}")
endif()
IF(DEFINED ERESSEA_BUILDNO)
if(DEFINED ERESSEA_BUILDNO)
set_source_files_properties(kernel/version.c PROPERTIES
COMPILE_DEFINITIONS ERESSEA_BUILDNO="${ERESSEA_BUILDNO}")
ENDIF()
endif()
IF (CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvla")
ENDIF()
IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89")
ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES")
if (CMAKE_COMPILER_IS_GNUCC)
add_compile_options(-Wvla)
endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long)
elseif(MSVC)
add_compile_options(/WX /MP)
# set(EXTRA_C_FLAGS /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
ELSE()
MESSAGE(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF()
else()
message(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}")
endif()
IF(CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything")
MESSAGE(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}")
ELSEIF(CMAKE_COMPILER_IS_GCC)
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
if(CMAKE_COMPILER_IS_CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything")
message(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}")
elseif(CMAKE_COMPILER_IS_GCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_GREATER 4.9)
if (GCC_VERSION VERSION_GREATER 4.9)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
ENDIF()
ENDIF(CMAKE_COMPILER_IS_CLANG)
endif()
endif(CMAKE_COMPILER_IS_CLANG)
string(REGEX REPLACE "/W[3|4]" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_subdirectory(util)
add_subdirectory(kernel)
@ -56,25 +57,24 @@ add_subdirectory(triggers)
add_subdirectory(modules)
add_subdirectory(races)
MACRO(ADD_LUA_MODULE MODULE_NAME FILES)
ADD_LIBRARY (${MODULE_NAME} SHARED ${FILES})
SET_TARGET_PROPERTIES(${MODULE_NAME}
macro(ADD_LUA_MODULE MODULE_NAME FILES)
add_library (${MODULE_NAME} SHARED ${FILES})
set_target_properties(${MODULE_NAME}
PROPERTIES
PREFIX ""
)
ENDMACRO(ADD_LUA_MODULE)
endmacro(ADD_LUA_MODULE)
MACRO(TOLUA_BINDING PKGFILE FILES)
ADD_CUSTOM_COMMAND(
macro(TOLUA_BINDING PKGFILE FILES)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c
DEPENDS ${FILES} ${PKGFILE}
COMMAND ${TOLUA_EXECUTABLE}
ARGS -o ${CMAKE_CURRENT_SOURCE_DIR}/${PKGFILE}.c ${PKGFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDMACRO(TOLUA_BINDING)
endmacro(TOLUA_BINDING)
IF(NOT MSVC)
TOLUA_BINDING(log.pkg util/log.h)
TOLUA_BINDING(locale.pkg bind_locale.h)
TOLUA_BINDING(config.pkg bind_config.h)
@ -82,7 +82,6 @@ TOLUA_BINDING(process.pkg bind_process.h)
TOLUA_BINDING(game.pkg bind_eressea.h config.h)
TOLUA_BINDING(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg kenel/config.h)
ENDIF()
set (PARSER_SRC
${DB_SRC}
@ -192,12 +191,18 @@ target_link_libraries(parser
${CRYPTO_LIBRARIES}
)
add_executable(checker ${CHECK_SRC})
target_link_libraries(checker parser)
if (HAVE_LIBBSD)
set (EXTRA_LIBS ${EXTRA_LIBS} bsd)
endif (HAVE_LIBBSD)
if (HAVE_LIBM)
set (EXTRA_LIBS ${EXTRA_LIBS} m)
endif (HAVE_LIBM)
add_library(game ${ERESSEA_SRC})
target_link_libraries(game parser version)
target_link_libraries(game ${EXTRA_LIBS} parser version)
add_executable(eressea ${SERVER_SRC})
if (IWYU_PATH)
@ -209,7 +214,7 @@ target_link_libraries(eressea
${LUA_LIBRARIES}
${STORAGE_LIBRARIES}
${CJSON_LIBRARIES}
${INIPARSER_LIBRARIES}
${IniParser_LIBRARIES}
)
set(TESTS_SRC
@ -268,7 +273,7 @@ target_link_libraries(test_eressea
${CLIBS_LIBRARIES}
${STORAGE_LIBRARIES}
${CJSON_LIBRARIES}
${INIPARSER_LIBRARIES}
${IniParser_LIBRARIES}
)
add_test(server test_eressea)
@ -282,51 +287,54 @@ add_test(server test_eressea)
install(TARGETS eressea DESTINATION "bin")
if (HAVE_EXECINFO_H AND HAVE_SIGNAL_H)
add_definitions(-DHAVE_BACKTRACE)
add_compile_definitions(HAVE_BACKTRACE)
endif ()
if (HAVE_LIBBSD)
add_definitions(-DHAVE_LIBBSD)
add_compile_definitions(HAVE_LIBBSD)
endif (HAVE_LIBBSD)
if (HAVE_STRLCAT)
add_definitions(-DHAVE_BSDSTRING)
add_compile_definitions(HAVE_BSDSTRING)
endif (HAVE_STRLCAT)
if (HAVE_STRDUP)
add_definitions(-DHAVE_STRDUP)
add_compile_definitions(HAVE_STRDUP)
endif(HAVE_STRDUP)
if (HAVE_LIBBSD)
target_link_libraries(parser bsd)
endif (HAVE_LIBBSD)
if (SQLITE3_FOUND)
include_directories (${SQLITE3_INCLUDE_DIR})
target_link_libraries(eressea ${SQLITE3_LIBRARIES})
target_link_libraries(test_eressea ${SQLITE3_LIBRARIES})
add_definitions(-DUSE_SQLITE)
target_include_directories (game PUBLIC ${CJSON_INCLUDE_DIRS})
target_include_directories (game PUBLIC ${IniParser_INCLUDE_DIRS})
if (SQLite3_FOUND)
target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS})
target_link_libraries(eressea ${SQLite3_LIBRARIES})
target_link_libraries(test_eressea ${SQLite3_LIBRARIES})
target_compile_definitions(game PRIVATE USE_SQLITE)
elseif (DB_FOUND)
include_directories (${DB_INCLUDE_DIR})
#include_directories (${DB_INCLUDE_DIR})
target_link_libraries(eressea ${DB_LIBRARIES})
target_link_libraries(test_eressea ${DB_LIBRARIES})
add_definitions(-DUSE_DB)
endif(SQLITE3_FOUND)
target_compile_definitions(game PRIVATE USE_DB)
endif(SQLite3_FOUND)
if (READLINE_FOUND)
include_directories (${READLINE_INCLUDE_DIR})
#include_directories (${READLINE_INCLUDE_DIR})
target_link_libraries(eressea ${READLINE_LIBRARY})
add_definitions(-DUSE_READLINE)
target_compile_definitions(eressea PRIVATE DUSE_READLINE)
endif (READLINE_FOUND)
if (CURSES_FOUND)
include_directories (${CURSES_INCLUDE_DIR})
target_include_directories (eressea PRIVATE ${CURSES_INCLUDE_DIRS})
target_link_libraries(eressea ${CURSES_LIBRARIES})
add_definitions(-DUSE_CURSES)
target_compile_definitions(eressea PRIVATE USE_CURSES)
endif(CURSES_FOUND)
if (EXPAT_FOUND)
include_directories (${EXPAT_INCLUDE_DIRS})
target_include_directories (game PRIVATE ${EXPAT_INCLUDE_DIRS})
target_link_libraries(eressea ${EXPAT_LIBRARIES})
target_link_libraries(test_eressea ${EXPAT_LIBRARIES})
endif (EXPAT_FOUND)

View file

@ -145,7 +145,7 @@ static int read_ext(variant *var, void *owner, gamedata *data)
UNUSED_ARG(var);
READ_INT(data->store, &len);
data->store->api->r_bin(data->store->handle, NULL, (size_t)len);
data->store->api->r_str(data->store->handle, NULL, (size_t)len);
return AT_READ_OK;
}

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "key.h"

View file

@ -11,6 +11,7 @@
#include "util/keyword.h"
#include "util/log.h"
#include "util/stats.h"
#include "automate.h"
#include "laws.h"
@ -216,7 +217,7 @@ void do_autostudy(region *r)
if (money > 0) {
use_pooled(u, get_resourcetype(R_SILVER), GET_DEFAULT, money);
ADDMSG(&u->faction->msgs, msg_message("studycost",
"unit region cost skill", u, u->region, money, skill));
"unit region cost skill", scholars[i].u, r, money, skill));
}
}
}

View file

@ -1,4 +1,5 @@
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#include <platform.h>
#endif
@ -13,52 +14,53 @@
#include "study.h"
#include "spy.h"
#include <spells/buildingcurse.h>
#include <spells/regioncurse.h>
#include <spells/unitcurse.h>
#include "spells/buildingcurse.h"
#include "spells/regioncurse.h"
#include "spells/unitcurse.h"
#include <kernel/ally.h>
#include <kernel/alliance.h>
#include <kernel/build.h>
#include <kernel/building.h>
#include <kernel/curse.h>
#include <kernel/equipment.h>
#include <kernel/faction.h>
#include <kernel/group.h>
#include <kernel/item.h>
#include <kernel/messages.h>
#include <kernel/order.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/ship.h>
#include <kernel/terrain.h>
#include <kernel/unit.h>
#include <kernel/spell.h>
#include "kernel/ally.h"
#include "kernel/alliance.h"
#include "kernel/build.h"
#include "kernel/building.h"
#include "kernel/curse.h"
#include "kernel/equipment.h"
#include "kernel/faction.h"
#include "kernel/group.h"
#include "kernel/item.h"
#include "kernel/messages.h"
#include "kernel/order.h"
#include "kernel/plane.h"
#include "kernel/race.h"
#include "kernel/region.h"
#include "kernel/ship.h"
#include "kernel/terrain.h"
#include "kernel/unit.h"
#include "kernel/spell.h"
#include <reports.h>
#include "reports.h"
/* attributes includes */
#include <attributes/key.h>
#include <attributes/racename.h>
#include <attributes/otherfaction.h>
#include "attributes/key.h"
#include "attributes/racename.h"
#include "attributes/otherfaction.h"
/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <util/base36.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/log.h>
#include <util/macros.h>
#include <util/parser.h>
#include <util/strings.h>
#include <util/rand.h>
#include <util/rng.h>
#include "kernel/attrib.h"
#include "util/base36.h"
#include "util/language.h"
#include "util/lists.h"
#include "util/log.h"
#include "util/macros.h"
#include "util/parser.h"
#include "util/strings.h"
#include "util/stats.h"
#include "util/rand.h"
#include "util/rng.h"
#include <selist.h>
/* libc includes */
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
@ -193,7 +195,7 @@ void battle_message_faction(battle * b, faction * f, struct message *m)
assert(f);
if (f->battles == NULL || f->battles->r != r) {
struct bmsg *bm = (struct bmsg *)calloc(1, sizeof(struct bmsg));
assert_alloc(bm);
assert(bm);
bm->next = f->battles;
f->battles = bm;
bm->r = r;

View file

@ -1,4 +1,8 @@
#include <platform.h>
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "battle.h"

View file

@ -1,7 +1,8 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "bind_config.h"
#include "jsonconf.h"

View file

@ -1,5 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "bind_eressea.h"

View file

@ -188,7 +188,7 @@ static void lua_paint_info(struct window *wnd, const struct state *st)
int size = getmaxx(win) - 2;
int line = 0, maxline = getmaxy(win) - 2;
const char *str = result;
wxborder(win);
box(win, 0, 0);
while (*str && line < maxline) {
const char *end = strchr(str, '\n');

View file

@ -1,7 +1,8 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "bind_storage.h"
#include <kernel/save.h>

View file

@ -1,7 +1,8 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "bindings.h"
#include "bind_tolua.h"

View file

@ -1,7 +1,6 @@
#ifdef _MSV_VER
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "util/order_parser.h"
#include "util/keyword.h"
#include "util/language.h"

View file

@ -2,7 +2,7 @@
** Lua binding: config
*/
#include "tolua.h"
#include <tolua.h>
#ifndef __cplusplus
#include <stdlib.h>
@ -15,8 +15,8 @@
#include <string.h>
/* Exported function */
TOLUA_API int tolua_config_open (lua_State* tolua_S);
LUALIB_API int luaopen_config (lua_State* tolua_S);
int tolua_config_open (lua_State* tolua_S);
int luaopen_config (lua_State* tolua_S);
#undef tolua_reg_types
#define tolua_reg_types tolua_reg_types_config
@ -108,7 +108,7 @@ static int tolua_config_eressea_config_parse00(lua_State* tolua_S)
}
/* Open lib function */
LUALIB_API int luaopen_config (lua_State* tolua_S)
int luaopen_config (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
@ -127,7 +127,7 @@ LUALIB_API int luaopen_config (lua_State* tolua_S)
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_config_open (lua_State* tolua_S)
int tolua_config_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_config);
lua_pushstring(tolua_S, "config");

View file

@ -199,7 +199,7 @@ static int loadline(lua_State * L)
if (!pushline(L, 1))
return -1; /* no input */
for (;;) { /* repeat until gets a complete line */
status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
status = luaL_loadbuffer(L, lua_tostring(L, 1), (size_t)lua_strlen(L, 1), "=stdin");
if (!incomplete(L, status))
break; /* cannot try to add lines? */
if (!pushline(L, 0)) /* no more input? */
@ -227,7 +227,7 @@ static void dotty(lua_State * L)
lua_insert(L, 1);
if (lua_pcall(L, lua_gettop(L) - 1, 0, 0) != 0)
l_message(progname, lua_pushfstring(L,
"error calling " LUA_QL("print") " (%s)", lua_tostring(L, -1)));
"error calling 'print' (%s)", lua_tostring(L, -1)));
}
}
lua_settop(L, 0); /* clear stack */

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include <kernel/version.h>
#include "creport.h"

View file

@ -1,4 +1,5 @@
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#include <platform.h>
#endif

View file

@ -2,7 +2,7 @@
** Lua binding: eressea
*/
#include "tolua.h"
#include <tolua.h>
#ifndef __cplusplus
#include <stdlib.h>
@ -15,8 +15,8 @@
#include <string.h>
/* Exported function */
TOLUA_API int tolua_eressea_open (lua_State* tolua_S);
LUALIB_API int luaopen_eressea (lua_State* tolua_S);
int tolua_eressea_open (lua_State* tolua_S);
int luaopen_eressea (lua_State* tolua_S);
#undef tolua_reg_types
#define tolua_reg_types tolua_reg_types_eressea
@ -190,7 +190,7 @@ static int tolua_eressea_eressea_import00(lua_State* tolua_S)
}
/* Open lib function */
LUALIB_API int luaopen_eressea (lua_State* tolua_S)
int luaopen_eressea (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
@ -209,7 +209,7 @@ LUALIB_API int luaopen_eressea (lua_State* tolua_S)
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_eressea_open (lua_State* tolua_S)
int tolua_eressea_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_eressea);
lua_pushstring(tolua_S, "eressea");

View file

@ -1,5 +1,5 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "exparse.h"
@ -375,7 +375,8 @@ static int ncomponents;
static void start_spells(parseinfo *pi, const XML_Char *el, const XML_Char **attr) {
const char *flag_names[] = {
"far", "variable", "ocean", "ship", "los",
"unittarget", "shiptarget", "buildingtarget", "regiontarget", "globaltarget", NULL };
"unittarget", "shiptarget", "buildingtarget", "regiontarget", "globaltarget",
"noresist", NULL };
if (xml_strequal(el, "resource")) {
spell_component *spc;

View file

@ -15,8 +15,8 @@
#include <string.h>
/* Exported function */
TOLUA_API int tolua_game_open (lua_State* tolua_S);
LUALIB_API int luaopen_game (lua_State* tolua_S);
int tolua_game_open (lua_State* tolua_S);
int luaopen_game (lua_State* tolua_S);
#undef tolua_reg_types
#define tolua_reg_types tolua_reg_types_game
@ -162,7 +162,7 @@ static int tolua_game_eressea_game_import00(lua_State* tolua_S)
}
/* Open lib function */
LUALIB_API int luaopen_game (lua_State* tolua_S)
int luaopen_game (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
@ -183,7 +183,7 @@ LUALIB_API int luaopen_game (lua_State* tolua_S)
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_game_open (lua_State* tolua_S)
int tolua_game_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_game);
lua_pushstring(tolua_S, "game");

View file

@ -530,9 +530,11 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
}
if (u2->number == 0) {
set_racename(&u2->attribs, get_racename(u->attribs));
u_setrace(u2, u_race(u));
u2->irace = u->irace;
const race* rc = u_race(u);
u_setrace(u2, rc);
if (rc == get_race(RC_DAEMON)) {
u2->irace = u->irace;
}
if (fval(u, UFL_HERO)) {
fset(u2, UFL_HERO);
}

View file

@ -1,7 +1,8 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <curses.h>
#include "gmtool.h"
@ -29,7 +30,6 @@
#include "util/path.h"
#include "util/rand.h"
#include "util/rng.h"
#include "util/unicode.h"
#include "gmtool_structs.h"
#include "console.h"
@ -58,42 +58,6 @@ state *current_state = NULL;
static WINDOW *hstatus;
#ifdef STDIO_CP
int gm_codepage = STDIO_CP;
#else
int gm_codepage = -1;
#endif
static void unicode_remove_diacritics(const char *rp, char *wp) {
while (*rp) {
if (gm_codepage >= 0 && *rp & 0x80) {
size_t sz = 0;
unsigned char ch;
switch (gm_codepage) {
case 1252:
unicode_utf8_to_cp1252(&ch, rp, &sz);
break;
case 437:
unicode_utf8_to_cp437(&ch, rp, &sz);
break;
default:
unicode_utf8_to_ascii(&ch, rp, &sz);
break;
}
rp += sz;
*wp++ = (char)ch;
}
else {
*wp++ = *rp++;
}
}
*wp = 0;
}
static void simplify(const char *rp, char *wp) {
unicode_remove_diacritics(rp, wp);
}
int umvwprintw(WINDOW *win, int y, int x, const char *format, ...) {
char buffer[128];
va_list args;
@ -103,15 +67,12 @@ int umvwprintw(WINDOW *win, int y, int x, const char *format, ...) {
vsnprintf(buffer, sizeof(buffer) - 1, format, args);
va_end(args);
simplify(buffer, buffer);
return mvwaddstr(win, y, x, buffer);
}
int umvwaddnstr(WINDOW *w, int y, int x, const char * str, int len) {
char buffer[128];
simplify(str, buffer);
return mvwaddnstr(w, y, x, buffer, len);
(void)len;
return mvwaddstr(w, y, x, str);
}
static void init_curses(void)
@ -123,13 +84,11 @@ static void init_curses(void)
short bcol = COLOR_BLACK;
short hcol = COLOR_MAGENTA;
start_color();
#ifdef __PDCURSES__
/* looks crap on putty with TERM=linux */
if (can_change_color()) {
init_color(COLOR_YELLOW, 1000, 1000, 0);
init_color(COLOR_CYAN, 0, 1000, 1000);
}
#endif
for (fg = 0; fg != 8; ++fg) {
for (bg = 0; bg != 2; ++bg) {
init_pair((short)(fg + 8 * bg), (short)fg, (short)(bg ? hcol : bcol));
@ -401,15 +360,6 @@ static bool handle_info_region(window * wnd, state * st, int c)
return false;
}
int wxborder(WINDOW *win)
{
#ifdef __PDCURSES__
return wborder(win, 0, 0, 0, 0, 0, 0, 0, 0);
#else
return wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
#endif
}
static void paint_info_region(window * wnd, const state * st)
{
WINDOW *win = wnd->handle;
@ -419,7 +369,6 @@ static void paint_info_region(window * wnd, const state * st)
UNUSED_ARG(st);
werase(win);
wxborder(win);
if (mr && mr->r) {
int line = 0;
const region *r = mr->r;
@ -434,9 +383,9 @@ static void paint_info_region(window * wnd, const state * st)
if (r->land) {
int iron = region_getresource_level(r, get_resourcetype(R_IRON));
int stone = region_getresource_level(r, get_resourcetype(R_STONE));
mvwprintw(win, line++, 1, "$:%6d P:%5d", rmoney(r), rpeasants(r));
mvwprintw(win, line++, 1, "S:%6d I:%5d", stone, iron);
mvwprintw(win, line++, 1, "H:%6d %s:%5d", rhorses(r),
mvwprintw(win, line++, 1, "$:%8d P:%8d", rmoney(r), rpeasants(r));
mvwprintw(win, line++, 1, "S:%8d I:%8d", stone, iron);
mvwprintw(win, line++, 1, "H:%8d %s:%8d", rhorses(r),
(r->flags & RF_MALLORN) ? "M" : "T",
r->land->trees[1] + r->land->trees[2]);
}
@ -478,6 +427,7 @@ static void paint_info_region(window * wnd, const state * st)
}
}
}
box(win, 0, 0);
}
static void(*paint_info) (struct window * wnd, const struct state * st);
@ -757,7 +707,7 @@ static faction *select_faction(state * st)
}
selected = do_selection(ilist, "Select Faction", NULL, NULL);
st->wnd_info->update |= 1;
st->wnd_map->update |= 1;
st->wnd_map->update |= 3;
st->wnd_status->update |= 1;
if (selected == NULL)
@ -782,7 +732,7 @@ static const terrain_type *select_terrain(state * st,
}
selected = do_selection(ilist, "Terrain", NULL, NULL);
st->wnd_info->update |= 1;
st->wnd_map->update |= 1;
st->wnd_map->update |= 3;
st->wnd_status->update |= 1;
if (selected == NULL)
@ -797,8 +747,7 @@ static coordinate *region2coord(const region * r, coordinate * c)
c->pl = rplane(r);
return c;
}
#ifdef __PDCURSES__
#ifdef PDCURSES
#define FAST_UP CTL_UP
#define FAST_DOWN CTL_DOWN
#define FAST_LEFT CTL_LEFT
@ -1298,7 +1247,7 @@ static void handlekey(state * st, int c)
st->modified = 1;
st->wnd_info->update |= 1;
st->wnd_status->update |= 1;
st->wnd_map->update |= 1;
st->wnd_map->update |= 3;
break;
case 'I':
statusline(st->wnd_status->handle, "info-");
@ -1351,7 +1300,7 @@ static void handlekey(state * st, int c)
clear();
st->wnd_info->update |= 1;
st->wnd_status->update |= 1;
st->wnd_map->update |= 1;
st->wnd_map->update |= 3;
}
break;
case 12: /* Ctrl-L */
@ -1546,15 +1495,17 @@ static void update_view(view * vi)
state *state_open(void)
{
state *st = (state *)calloc(1, sizeof(state));
st->display.pl = get_homeplane();
st->cursor.pl = get_homeplane();
st->cursor.x = 0;
st->cursor.y = 0;
st->selected = calloc(1, sizeof(struct selection));
st->modified = 0;
st->info_flags = 0xFFFFFFFF;
st->prev = current_state;
current_state = st;
if (st) {
st->display.pl = get_homeplane();
st->cursor.pl = get_homeplane();
st->cursor.x = 0;
st->cursor.y = 0;
st->selected = calloc(1, sizeof(struct selection));
st->modified = 0;
st->info_flags = 0xFFFFFFFF;
st->prev = current_state;
current_state = st;
}
return st;
}
@ -1571,7 +1522,7 @@ void run_mapper(void)
WINDOW *hwininfo;
WINDOW *hwinmap;
int width, height, x, y;
int split = 20;
int split = 30;
state *st;
point tl;

View file

@ -23,7 +23,6 @@ extern "C" {
void run_mapper(void);
extern int force_color;
extern int gm_codepage;
struct state *state_open(void);
void state_close(struct state *);

View file

@ -80,8 +80,6 @@ extern "C" {
#define TWIDTH 2 /* width of tile */
#define THEIGHT 1 /* height of tile */
int wxborder(WINDOW *win);
#ifdef __cplusplus
}
#endif

View file

@ -1,5 +1,6 @@
#include "platform.h"
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "json.h"
#include <util/base36.h>
@ -9,7 +10,8 @@
#include <kernel/faction.h>
#include <kernel/terrain.h>
#include <stream.h>
#include "cJSON.h"
#include <cJSON.h>
#include <string.h>
#include <stdlib.h>

View file

@ -12,6 +12,7 @@
#include <cJSON.h>
#include <CuTest.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@ -38,15 +39,14 @@ static void test_export_no_regions(CuTest * tc) {
char buf[1024];
stream out = { 0 };
int err;
size_t len;
test_setup();
mstream_init(&out);
CuAssertIntEquals(tc, 0, mstream_init(&out));
err = json_export(&out, EXPORT_REGIONS);
CuAssertIntEquals(tc, 0, err);
out.api->write(out.handle, "", 1);
out.api->rewind(out.handle);
len = out.api->read(out.handle, buf, sizeof(buf));
buf[len] = '\0';
CuAssertIntEquals(tc, EOF, out.api->read(out.handle, buf, sizeof(buf)));
CuAssertStrEquals(tc, "{}", strip(buf));
mstream_done(&out);
test_teardown();
@ -58,16 +58,15 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
int err;
region *r;
cJSON *json, *attr, *result, *regs;
size_t sz;
r = test_create_region(0, 0, terrain);
mstream_init(&out);
CuAssertIntEquals(tc, 0, mstream_init(&out));
err = json_export(&out, EXPORT_REGIONS);
CuAssertIntEquals(tc, 0, err);
out.api->write(out.handle, "", 1);
out.api->rewind(out.handle);
sz = out.api->read(out.handle, buf, sizeof(buf));
buf[sz] = '\0';
CuAssertIntEquals(tc, EOF, out.api->read(out.handle, buf, sizeof(buf)));
mstream_done(&out);
json = cJSON_Parse(buf);
@ -122,15 +121,14 @@ static void test_export_no_factions(CuTest * tc) {
char buf[1024];
stream out = { 0 };
int err;
size_t len;
test_setup();
mstream_init(&out);
CuAssertIntEquals(tc, 0, mstream_init(&out));
err = json_export(&out, EXPORT_FACTIONS);
CuAssertIntEquals(tc, 0, err);
out.api->write(out.handle, "", 1);
out.api->rewind(out.handle);
len = out.api->read(out.handle, buf, sizeof(buf));
buf[len] = 0;
CuAssertIntEquals(tc, EOF, out.api->read(out.handle, buf, sizeof(buf)));
CuAssertStrEquals(tc, "{}", strip(buf));
mstream_done(&out);
test_teardown();

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "jsonconf.h"
/* kernel includes */
@ -47,22 +49,37 @@
#include <stdlib.h>
#include <string.h>
static int json_flags(cJSON *json, const char *flags[]) {
cJSON *entry;
int result = 0;
assert(json->type == cJSON_Array);
for (entry = json->child; entry; entry = entry->next) {
if (entry->type == cJSON_String) {
int i;
for (i = 0; flags[i]; ++i) {
if (strcmp(flags[i], entry->valuestring) == 0) {
result |= (1 << i);
break;
}
}
static void json_map(void* object, void (*mapfun)(void* child, void* udata), void* udata)
{
cJSON *child, *json = (cJSON*)object;
for (child = json->child; child; child = child->next) {
mapfun(child, udata);
}
}
struct flags {
const char** names;
int result;
};
static void cb_flags(void* json, void *udata) {
struct flags *flags = (struct flags *)udata;
cJSON* entry = (cJSON*)json;
int i;
for (i = 0; flags->names[i]; ++i) {
if (strcmp(flags->names[i], entry->valuestring) == 0) {
flags->result |= (1 << i);
break;
}
}
return result;
}
static int json_flags(cJSON *json, const char *flags[]) {
struct flags ctx = { flags, 0 };
assert(json->type == cJSON_Array);
json_map(json, cb_flags, &ctx);
return ctx.result;
}
static void json_requirements(cJSON *json, requirement **matp) {

View file

@ -1,5 +1,7 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "kernel/types.h"

View file

@ -1,4 +1,6 @@
#include "platform.h"
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "config.h"
#include "ally.h"

View file

@ -94,33 +94,18 @@ void a_writechars(const variant * var, const void *owner, struct storage *store)
int a_readstring(variant * var, void *owner, struct gamedata *data)
{
char buf[DISPLAYSIZE];
char * result = 0;
int e;
size_t len = 0;
do {
e = READ_STR(data->store, buf, sizeof(buf));
if (result) {
char *tmp = realloc(result, len + DISPLAYSIZE - 1);
if (!tmp) {
free(result);
abort();
}
result = tmp;
strcpy(result + len, buf);
len += DISPLAYSIZE - 1;
}
else {
result = str_strdup(buf);
}
} while (e == ENOMEM);
var->v = result;
READ_STR(data->store, buf, sizeof(buf));
var->v = str_strdup(buf);
return AT_READ_OK;
}
void a_writestring(const variant * var, const void *owner, struct storage *store)
{
const char* str = (const char*)var->v;
assert(var && var->v);
WRITE_STR(store, (const char *)var->v);
assert(strlen(str) < DISPLAYSIZE);
WRITE_STR(store, str);
}
void a_finalizestring(variant * var)

View file

@ -1,7 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "config.h"
/* kernel includes */

View file

@ -1,5 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include <util/log.h>

View file

@ -1,5 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "faction.h"
#include "calendar.h"

View file

@ -1,5 +1,8 @@
#include <platform.h>
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/ally.h>
#include <kernel/alliance.h>
#include <kernel/calendar.h>

View file

@ -1,5 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "gamedata.h"
#include <util/log.h>

View file

@ -48,8 +48,9 @@
#define SHIP_NUMBER_VERSION 370 /* ships have a number */
#define FIX_SHAPESHIFT_VERSION 371 /* shapeshifting demons */
#define FIX_SEAROADS_VERSION 372 /* removing roads in ocean regions */
#define FIX_SHAPESHIFT_SPELL_VERSION 373 /* shapeshift spell, bug 2719 */
#define RELEASE_VERSION FIX_SEAROADS_VERSION /* current datafile */
#define RELEASE_VERSION FIX_SHAPESHIFT_SPELL_VERSION /* current datafile */
#define MIN_VERSION UIDHASH_VERSION /* minimal datafile we support */
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "item.h"

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "messages.h"
/* kernel includes */

View file

@ -1,7 +1,6 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "order.h"

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "race.h"

View file

@ -1,4 +1,8 @@
#include <platform.h>
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "faction.h"
#include "unit.h"
#include "race.h"

View file

@ -26,7 +26,6 @@
#include <spells/regioncurse.h>
/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <kernel/gamedata.h>
#include <util/strings.h>
@ -698,7 +697,7 @@ void r_setdemand(region * r, const luxury_type * ltype, int value)
d = *dp;
if (!d) {
d = *dp = malloc(sizeof(struct demand));
assert_alloc(d);
assert(d);
d->next = NULL;
d->type = ltype;
}
@ -763,7 +762,7 @@ int rsettrees(const region * r, int ageclass, int value)
region *region_create(int uid)
{
region *r = (region *)calloc(1, sizeof(region));
assert_alloc(r);
assert(r);
r->uid = uid;
rhash_uid(r);
return r;

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include <kernel/version.h>
#include "save.h"
@ -35,11 +37,11 @@
#include <attributes/attributes.h>
#include <attributes/key.h>
#include <attributes/racename.h>
#include <triggers/changerace.h>
#include <triggers/timeout.h>
#include <triggers/shock.h>
/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <util/base36.h>
#include <kernel/event.h>
@ -81,7 +83,7 @@
#define MAXPERSISTENT 128
/* exported symbols symbols */
int firstx = 0, firsty = 0;
int g_writegame = 1;
static void read_alliances(gamedata *data)
{
@ -444,10 +446,12 @@ unit *read_unit(gamedata *data)
u_setrace(u, rc);
READ_TOK(data->store, rname, sizeof(rname));
if (rname[0])
if (rname[0]) {
u->irace = rc_find(rname);
else
}
else {
u->irace = NULL;
}
READ_INT(data->store, &bn);
READ_INT(data->store, &sn);
@ -524,14 +528,39 @@ unit *read_unit(gamedata *data)
u->hp = u->number;
}
read_attribs(data, &u->attribs, u);
if (rc_demon && data->version < FIX_SHAPESHIFT_VERSION) {
if (rc_demon) {
if (u_race(u) == rc_demon) {
const char *zRace = get_racename(u->attribs);
if (zRace) {
const struct race *rc = rc_find(zRace);
if (rc) {
set_racename(&u->attribs, NULL);
u->irace = rc;
if (data->version < FIX_SHAPESHIFT_VERSION) {
const char* zRace = get_racename(u->attribs);
if (zRace) {
const struct race* rc = rc_find(zRace);
if (rc) {
set_racename(&u->attribs, NULL);
u->irace = rc;
}
}
}
}
else {
if (data->version < FIX_SHAPESHIFT_SPELL_VERSION) {
if (u->irace) {
/* Einheit ist rassengetarnt, aber hat sie einen changerace timer? */
trigger** trigs = get_triggers(u->attribs, "timer");
if (trigs) {
trigger* t = *trigs;
while (t != NULL) {
if (t->type == &tt_changerace) {
break;
}
t = t->next;
}
if (t == NULL) {
u->irace = NULL;
}
}
else {
u->irace = NULL;
}
}
}
}
@ -1719,6 +1748,9 @@ int writegame(const char *filename)
stream strm;
FILE *F;
if (g_writegame == 0) {
return -1;
}
create_directories();
path_join(datapath(), filename, path, sizeof(path));
/* make sure we don't overwrite an existing file (hard links) */

View file

@ -23,7 +23,7 @@ extern "C" {
* dass hier ein Fehler (fehlende ") vorliegt */
/* TODO: is this *really* still in use? */
extern int enc_gamedata;
extern int g_writegame;
int readgame(const char *filename);
int writegame(const char *filename);

View file

@ -1,4 +1,8 @@
#include <platform.h>
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/config.h>
#include <kernel/race.h>
#include <attributes/key.h>

View file

@ -1,3 +1,8 @@
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/ally.h>
#include <kernel/config.h>
#include <kernel/curse.h>

View file

@ -1,5 +1,5 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "version.h"
@ -8,7 +8,7 @@
#ifndef ERESSEA_VERSION
/* the version number, if it was not passed to make with -D */
#define ERESSEA_VERSION "3.26.0"
#define ERESSEA_VERSION "3.27.0"
#endif
const char *eressea_version(void) {

View file

@ -1,5 +1,5 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "laws.h"
@ -598,15 +598,27 @@ static int cap_int(int i, int imin, int imax) {
return imin;
}
static bool
increased_growth(const region* r, const struct race *rc_elf) {
const unit* u;
for (u = r->units; u; u = u->next) {
if (u_race(u) != rc_elf) {
return false;
}
}
return true;
}
static void
growing_trees(region * r, const season_t current_season, const season_t last_weeks_season)
growing_trees(region * r, const season_t current_season, const season_t last_weeks_season, int rules)
{
int grownup_trees, i, seeds, sprout;
attrib *a;
double seedchance = config_get_flt("rules.treeseeds.chance", 0.01F) * RESOURCE_QUANTITY;
if (current_season == SEASON_SUMMER || current_season == SEASON_AUTUMN) {
int mp, elves = count_race(r, get_race(RC_ELF));
const struct race* rc_elf = get_race(RC_ELF);
int mp, elves = count_race(r, rc_elf);
direction_t d;
a = a_find(r->attribs, &at_germs);
@ -644,6 +656,12 @@ growing_trees(region * r, const season_t current_season, const season_t last_wee
++seeds;
}
if (seeds > 0) {
if (rules > 2) {
if (increased_growth(r, rc_elf)) {
/* in empty regions, plant twice the seeds */
seeds += seeds;
}
}
seeds += rtrees(r, 0);
rsettrees(r, 0, seeds);
}
@ -803,7 +821,7 @@ void nmr_warnings(void)
void demographics(void)
{
region *r;
int plant_rules = config_get_int("rules.grow.formula", 2);
int plant_rules = config_get_int("rules.grow.formula", 3);
int horse_rules = config_get_int("rules.horses.growth", 1);
int peasant_rules = config_get_int("rules.peasants.growth", 1);
const struct building_type *bt_harbour = bt_find("harbour");
@ -850,13 +868,13 @@ void demographics(void)
if (horse_rules > 0) {
horses(r);
}
if (plant_rules == 2) { /* E2 */
growing_trees(r, current_season, last_weeks_season);
growing_herbs(r, current_season, last_weeks_season);
}
else if (plant_rules==1) { /* E3 */
if (plant_rules==1) { /* E3 */
growing_trees_e3(r, current_season, last_weeks_season);
}
else if (plant_rules) { /* E2 */
growing_trees(r, current_season, last_weeks_season, plant_rules);
growing_herbs(r, current_season, last_weeks_season);
}
}
update_resources(r);
@ -1250,8 +1268,8 @@ void do_enter(struct region *r, bool is_final_attempt)
}
}
int newbies[MAXNEWPLAYERS];
int dropouts[2];
int *age = NULL;
bool nmr_death(const faction * f, int turn, int timeout)
{
@ -1303,15 +1321,13 @@ static void remove_idle_players(void)
i = turn + 1;
if (i < 4) i = 4;
free(age);
age = calloc(i, sizeof(int));
if (!age) abort();
for (fp = &factions; *fp;) {
faction *f = *fp;
if (!is_monsters(f)) {
if (RemoveNMRNewbie() && !fval(f, FFL_NOIDLEOUT)) {
if (f->age >= 0 && f->age <= turn)
++age[f->age];
if (f->age >= 0 && f->age < MAXNEWPLAYERS) {
++newbies[f->age];
}
if (f->age == 2 || f->age == 3) {
if (f->lastorders == turn - 2) {
++dropouts[f->age - 2];

View file

@ -18,8 +18,9 @@ extern "C" {
extern struct attrib_type at_germs;
#define MAXNEWPLAYERS 4
extern int newbies[MAXNEWPLAYERS];
extern int dropouts[2];
extern int *age;
void demographics(void);
void immigration(void);

View file

@ -101,7 +101,7 @@ list_selection *do_selection(list_selection * sel, const char *title,
wclrtoeol(wn);
}
wclrtobot(wn);
wxborder(wn);
box(wn, 0, 0);
mvwprintw(wn, 0, 2, "[ %s ]", title);
update = false;
}

View file

@ -15,8 +15,8 @@
#include <string.h>
/* Exported function */
TOLUA_API int tolua_locale_open (lua_State* tolua_S);
LUALIB_API int luaopen_locale (lua_State* tolua_S);
int tolua_locale_open (lua_State* tolua_S);
int luaopen_locale (lua_State* tolua_S);
#undef tolua_reg_types
#define tolua_reg_types tolua_reg_types_locale
@ -142,7 +142,7 @@ static int tolua_locale_eressea_locale_direction00(lua_State* tolua_S)
}
/* Open lib function */
LUALIB_API int luaopen_locale (lua_State* tolua_S)
int luaopen_locale (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
@ -162,7 +162,7 @@ LUALIB_API int luaopen_locale (lua_State* tolua_S)
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_locale_open (lua_State* tolua_S)
int tolua_locale_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_locale);
lua_pushstring(tolua_S, "locale");

View file

@ -15,8 +15,8 @@
#include <string.h>
/* Exported function */
TOLUA_API int tolua_log_open (lua_State* tolua_S);
LUALIB_API int luaopen_log (lua_State* tolua_S);
int tolua_log_open (lua_State* tolua_S);
int luaopen_log (lua_State* tolua_S);
#undef tolua_reg_types
#define tolua_reg_types tolua_reg_types_log
@ -132,7 +132,7 @@ static int tolua_log_eressea_log_info00(lua_State* tolua_S)
}
/* Open lib function */
LUALIB_API int luaopen_log (lua_State* tolua_S)
int luaopen_log (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
@ -152,7 +152,7 @@ LUALIB_API int luaopen_log (lua_State* tolua_S)
return 1;
}
/* Open tolua function */
TOLUA_API int tolua_log_open (lua_State* tolua_S)
int tolua_log_open (lua_State* tolua_S)
{
lua_pushcfunction(tolua_S, luaopen_log);
lua_pushstring(tolua_S, "log");

View file

@ -1,5 +1,5 @@
#ifdef _MSC_VER
#include <platform.h>
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "magic.h"
@ -1664,7 +1664,7 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
case SPP_UNIT:
u = spobj->data.u;
if ((sp->sptyp & TESTRESISTANCE)
if (((sp->sptyp & NORESISTANCE) == 0)
&& target_resists_magic(caster, u, TYP_UNIT, 0)) {
/* Fehlermeldung */
spobj->data.i = u->no;
@ -1681,7 +1681,7 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
case SPP_BUILDING:
b = spobj->data.b;
if ((sp->sptyp & TESTRESISTANCE)
if (((sp->sptyp & NORESISTANCE) == 0)
&& target_resists_magic(caster, b, TYP_BUILDING, 0)) { /* Fehlermeldung */
spobj->data.i = b->no;
spobj->flag = TARGET_RESISTS;
@ -1696,7 +1696,7 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
case SPP_SHIP:
sh = spobj->data.sh;
if ((sp->sptyp & TESTRESISTANCE)
if (((sp->sptyp & NORESISTANCE) == 0)
&& target_resists_magic(caster, sh, TYP_SHIP, 0)) { /* Fehlermeldung */
spobj->data.i = sh->no;
spobj->flag = TARGET_RESISTS;
@ -1713,7 +1713,7 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
nicht target_r ueberprueft. */
tr = spobj->data.r;
if ((sp->sptyp & TESTRESISTANCE)
if (((sp->sptyp & NORESISTANCE) == 0)
&& target_resists_magic(caster, tr, TYP_REGION, 0)) { /* Fehlermeldung */
spobj->flag = TARGET_RESISTS;
++*resist;
@ -1752,7 +1752,7 @@ verify_targets(castorder * co, int *invalid, int *resist, int *success)
sa->param[0] = spobj;
co->par = sa;
if ((sp->sptyp & TESTRESISTANCE)) {
if (((sp->sptyp & NORESISTANCE) == 0)) {
if (target_resists_magic(caster, target_r, TYP_REGION, 0)) {
/* Fehlermeldung */
ADDMSG(&caster->faction->msgs, msg_message("spellregionresists",

View file

@ -134,14 +134,14 @@ extern "C" {
#define BUILDINGSPELL (1<<7) /* ZAUBER .. <Gebaeude-Nr> [<Gebaeude-Nr> ..] */
#define REGIONSPELL (1<<8) /* wirkt auf struct region */
#define GLOBALTARGET (1<<9) /* Ziel kann ausserhalb der region sein */
#define NORESISTANCE (1<<10) /* Zielobjekte nicht auf Magieresistenz pruefen. */
#define PRECOMBATSPELL (1<<10) /* PRAEKAMPFZAUBER .. */
#define COMBATSPELL (1<<11) /* KAMPFZAUBER .. */
#define POSTCOMBATSPELL (1<<12) /* POSTKAMPFZAUBER .. */
#define PRECOMBATSPELL (1<<11) /* PRAEKAMPFZAUBER .. */
#define COMBATSPELL (1<<12) /* KAMPFZAUBER .. */
#define POSTCOMBATSPELL (1<<13) /* POSTKAMPFZAUBER .. */
#define ISCOMBATSPELL (PRECOMBATSPELL|COMBATSPELL|POSTCOMBATSPELL)
#define TESTRESISTANCE (1<<13) /* Zielobjekte auf Magieresistenz pruefen. not used in XML? */
#define NOTFAMILIARCAST (1<<14) /* not used by XML? */
#define ANYTARGET (UNITSPELL|REGIONSPELL|BUILDINGSPELL|SHIPSPELL) /* wirkt auf alle objekttypen (unit, ship, building, region) */

View file

@ -1,14 +1,18 @@
#ifdef _MSC_VER
#include <platform.h>
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/calendar.h>
#include <kernel/config.h>
#include <kernel/messages.h>
#include <kernel/version.h>
#include <kernel/save.h>
#include <util/language.h>
#include <util/log.h>
#include <util/stats.h>
#include <util/path.h>
#include <util/password.h>
@ -60,7 +64,6 @@ static void load_inifile(void)
#ifdef USE_CURSES
/* only one value in the [editor] section */
force_color = config_get_int("editor.color", force_color);
gm_codepage = config_get_int("editor.codepage", gm_codepage);
#endif
}
@ -141,9 +144,9 @@ static int get_arg(int argc, char **argv, size_t len, int index, const char **re
return index;
}
static int verbosity_to_flags(int verbosity) {
static int verbosity_to_flags(int value) {
int flags = 0;
switch (verbosity) {
switch (value) {
case 0:
flags = 0;
break;
@ -166,7 +169,7 @@ static int verbosity_to_flags(int verbosity) {
static int parse_args(int argc, char **argv)
{
int i;
int log_stderr, log_flags = 3;
int log_flags = 3;
for (i = 1; i != argc; ++i) {
char *argi = argv[i];
@ -196,6 +199,9 @@ static int parse_args(int argc, char **argv)
else {
const char *arg;
switch (argi[1]) {
case 'D':
g_writegame = 0;
break;
case 'c':
i = get_arg(argc, argv, 2, i, &arg, 0);
config_set("config.path", arg);
@ -241,9 +247,9 @@ static int parse_args(int argc, char **argv)
log_open(logfile, log_flags);
/* also log to stderr: */
log_stderr = verbosity_to_flags(verbosity);
if (log_stderr) {
log_to_file(log_stderr | LOG_FLUSH | LOG_BRIEF, stderr);
log_flags = verbosity_to_flags(verbosity);
if (log_flags) {
log_to_file(log_flags | LOG_FLUSH | LOG_BRIEF, stderr);
}
return 0;
}

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "autoseed.h"
@ -131,6 +133,11 @@ newfaction *read_newfactions(const char *filename)
}
nf->password = str_strdup(password);
nf->race = rc_find(race);
if (nf->race == NULL) {
log_error("new faction has unknown race '%s'.\n", race);
free(nf);
continue;
}
if (alliances != NULL) {
struct alliance *al = findalliance(alliance);
if (al == NULL) {
@ -143,24 +150,6 @@ newfaction *read_newfactions(const char *filename)
else {
nf->allies = NULL;
}
if (nf->race == NULL) {
/* if the script didn't supply the race as a token, then it gives us a
* race in the default locale (which means that itis a UTF8 string) */
nf->race = findrace(race, default_locale);
if (nf->race == NULL) {
char buffer[32];
size_t outbytes = sizeof(buffer) - 1;
size_t inbytes = strlen(race);
unicode_latin1_to_utf8(buffer, &outbytes, race, &inbytes);
buffer[outbytes] = 0;
nf->race = findrace(buffer, default_locale);
if (nf->race == NULL) {
log_error("new faction has unknown race '%s'.\n", race);
free(nf);
continue;
}
}
}
nf->lang = get_locale(lang);
assert(nf->race && nf->email && nf->lang);
nfi = &newfactions;

View file

@ -1,4 +1,6 @@
#include <platform.h>
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h>
#include "score.h"

View file

@ -1,7 +1,3 @@
#ifdef _MSC_VER
#include <platform.h>
#endif
#include "monsters.h"
#include "economy.h"
@ -34,21 +30,22 @@
#include "kernel/unit.h"
/* util includes */
#include <util/base36.h>
#include "util/base36.h"
#include "util/keyword.h"
#include "util/language.h"
#include <util/log.h>
#include <util/rand.h>
#include <util/rng.h>
#include <util/strings.h>
#include "util/log.h"
#include "util/stats.h"
#include "util/rand.h"
#include "util/rng.h"
#include "util/strings.h"
/* attributes includes */
#include <attributes/hate.h>
#include <attributes/otherfaction.h>
#include <attributes/stealth.h>
#include <attributes/targetregion.h>
#include "attributes/hate.h"
#include "attributes/otherfaction.h"
#include "attributes/stealth.h"
#include "attributes/targetregion.h"
#include <spells/regioncurse.h>
#include "spells/regioncurse.h"
#include <selist.h>

Some files were not shown because too many files have changed in this diff Show more