diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..c67e9d3c4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,27 @@ +[submodule "lunit"] + path = lunit + url = git@github.com:eressea/lunit.git +[submodule "crypto"] + path = crypto + url = git@github.com:eressea/crypto.git +[submodule "cmake"] + path = cmake + url = git@github.com:eressea/cmake.git +[submodule "eressea"] + path = eressea + url = git@github.com:eressea/core.git +[submodule "quicklist"] + path = quicklist + url = git@github.com:badgerman/quicklist.git +[submodule "critbit"] + path = critbit + url = git@github.com:badgerman/critbit.git +[submodule "dlmalloc"] + path = dlmalloc + url = git@github.com:badgerman/dlmalloc.git +[submodule "cutest"] + path = cutest + url = git@github.com:badgerman/cutest.git +[submodule "iniparser"] + path = iniparser + url = git@github.com:badgerman/iniparser.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d2ce9b0c9..49a9a58ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 2.6) -project (server C) +project (e4-server C) enable_testing() -add_subdirectory (../dependencies "${CMAKE_CURRENT_BINARY_DIR}/dependencies") -add_subdirectory (../core/src "${CMAKE_CURRENT_BINARY_DIR}/core") - -add_subdirectory(src server) +add_subdirectory (crypto) +add_subdirectory (quicklist) +add_subdirectory (iniparser) +add_subdirectory (cutest) +add_subdirectory (critbit) +add_subdirectory (eressea/src eressea) +add_subdirectory (src server) diff --git a/Makefile b/Makefile deleted file mode 100644 index a44c760cf..000000000 --- a/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -all: tests - -tests: bin/server - @bin/server -l/dev/null --tests - -bin: - @mkdir bin - -bin/server: bin/Makefile - cd bin ; make - -bin/Makefile: CMakeLists.txt | bin - cd bin ; cmake .. - -clean: - rm -rf bin diff --git a/cmake b/cmake new file mode 160000 index 000000000..8cbbeef52 --- /dev/null +++ b/cmake @@ -0,0 +1 @@ +Subproject commit 8cbbeef52b5807bdec52369322cbc9f21d5ed621 diff --git a/critbit b/critbit new file mode 160000 index 000000000..ab655aa61 --- /dev/null +++ b/critbit @@ -0,0 +1 @@ +Subproject commit ab655aa6167f8d7cfc323a4af803470857156041 diff --git a/crypto b/crypto new file mode 160000 index 000000000..c19c4011e --- /dev/null +++ b/crypto @@ -0,0 +1 @@ +Subproject commit c19c4011ebf1c391a50d0afe89849135f39b6086 diff --git a/cutest b/cutest new file mode 160000 index 000000000..b5910573d --- /dev/null +++ b/cutest @@ -0,0 +1 @@ +Subproject commit b5910573d0b7da7f46c3efbaeb85cb2eaf269980 diff --git a/dlmalloc b/dlmalloc new file mode 160000 index 000000000..4292cd5e8 --- /dev/null +++ b/dlmalloc @@ -0,0 +1 @@ +Subproject commit 4292cd5e81395d09a7457ab93659ea3b7784e958 diff --git a/eressea b/eressea new file mode 160000 index 000000000..457c111da --- /dev/null +++ b/eressea @@ -0,0 +1 @@ +Subproject commit 457c111da2ffda54ac1ff3e7758f5ba0ccc5bc26 diff --git a/example.sln b/example.sln deleted file mode 100644 index 182de7c62..000000000 --- a/example.sln +++ /dev/null @@ -1,47 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "..\shared\src\kernel.vcxproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "..\shared\src\gamecode.vcxproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "..\shared\src\util.vcxproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-bindings", "..\shared\src\lua-bindings.vcxproj", "{75501170-51C2-E641-BA8B-EDC008184192}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "external", "..\external\external.vcxproj", "{F9AE4586-8F65-486B-9666-744839E40A54}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amalgamation-example", "src\example.vcxproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.ActiveCfg = Release|Win32 - {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.Build.0 = Release|Win32 - {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Debug|Win32.ActiveCfg = Debug|Win32 - {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.ActiveCfg = Release|Win32 - {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.Build.0 = Release|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.ActiveCfg = Release|Win32 - {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.Build.0 = Release|Win32 - {75501170-51C2-E641-BA8B-EDC008184192}.Debug|Win32.ActiveCfg = Debug|Win32 - {75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.ActiveCfg = Release|Win32 - {75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.Build.0 = Release|Win32 - {F9AE4586-8F65-486B-9666-744839E40A54}.Debug|Win32.ActiveCfg = Debug|Win32 - {F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.ActiveCfg = Release|Win32 - {F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.Build.0 = Release|Win32 - {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.ActiveCfg = Debug|Win32 - {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.Build.0 = Debug|Win32 - {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Release|Win32.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(SubversionScc) = preSolution - Svn-Managed = True - Manager = AnkhSVN - Subversion Support for Visual Studio - EndGlobalSection -EndGlobal diff --git a/game/eressea.ini b/game/eressea.ini index e26b01e36..e1b51607c 100644 --- a/game/eressea.ini +++ b/game/eressea.ini @@ -10,7 +10,7 @@ locales = de,en [config] game = arda -source_dir = ../.. +source_dir = .. maxnmrs = 10 [editor] diff --git a/game/setup.lua b/game/setup.lua index 2a7d2b274..31fc9173a 100644 --- a/game/setup.lua +++ b/game/setup.lua @@ -1,9 +1,9 @@ local srcpath = config.source_dir -local respath = srcpath .. '/server/res' +local respath = srcpath .. '/res' local paths = { - 'server/scripts/?.lua', - 'core/scripts/?.lua', - 'dependencies/lunit/?.lua' + 'scripts/?.lua', + 'eressea/scripts/?.lua', + 'lunit/?.lua' } for idx, path in pairs(paths) do diff --git a/iniparser b/iniparser new file mode 160000 index 000000000..f412ae545 --- /dev/null +++ b/iniparser @@ -0,0 +1 @@ +Subproject commit f412ae545c1465e4128075790dfda79f3c3de604 diff --git a/lunit b/lunit new file mode 160000 index 000000000..155c96594 --- /dev/null +++ b/lunit @@ -0,0 +1 @@ +Subproject commit 155c96594435413b4f704eb17558ea0b70631bad diff --git a/quicklist b/quicklist new file mode 160000 index 000000000..9426da896 --- /dev/null +++ b/quicklist @@ -0,0 +1 @@ +Subproject commit 9426da89690972fea3d594c7843a8f172c75c7ca diff --git a/res/catalog-arda.xml b/res/catalog-arda.xml index b94eb340f..77e0f1210 100644 --- a/res/catalog-arda.xml +++ b/res/catalog-arda.xml @@ -6,5 +6,5 @@ + rewritePrefix="../eressea/res/" /> diff --git a/scripts/arda/modules.lua b/scripts/arda/modules.lua index 39f5b268d..74a8f9e3a 100644 --- a/scripts/arda/modules.lua +++ b/scripts/arda/modules.lua @@ -3,8 +3,10 @@ require "arda.rules" local srcpath = config.source_dir tests = { - srcpath .. '/core/scripts/tests/spells.lua', - srcpath .. '/core/scripts/tests/common.lua', - srcpath .. '/core/scripts/tests/bson.lua', - srcpath .. '/server/scripts/tests/rules.lua', +-- srcpath .. '/eressea/scripts/tests/bson.lua', + srcpath .. '/eressea/scripts/tests/spells.lua', + srcpath .. '/eressea/scripts/tests/common.lua', + srcpath .. '/eressea/scripts/tests/orders.lua', + srcpath .. '/eressea/scripts/tests/bindings.lua', + srcpath .. '/scripts/tests/rules.lua', } diff --git a/scripts/tests/rules.lua b/scripts/tests/rules.lua index 522b5c747..97a3966fb 100644 --- a/scripts/tests/rules.lua +++ b/scripts/tests/rules.lua @@ -3,10 +3,10 @@ require "lunit" module("tests.rules", package.seeall, lunit.testcase) function setup() - free_game() - settings.set("nmr.removenewbie", "0") - settings.set("nmr.timeout", "0") - settings.set("NewbieImmunity", "0") + eressea.free_game() + eressea.settings.set("nmr.removenewbie", "0") + eressea.settings.set("nmr.timeout", "0") + eressea.settings.set("NewbieImmunity", "0") end function test_landing1() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dd168ebb6..5655da466 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,11 +3,11 @@ project (server C) find_package (Lua51 REQUIRED) find_package (LibXml2 REQUIRED) -find_package (Sqlite3 REQUIRED) +find_package (SQLite3 REQUIRED) find_package (ToLua REQUIRED) find_package (Curses REQUIRED) -include_directories (${CORE_INCLUDE_DIR}) +include_directories (${ERESSEA_INCLUDE_DIR}) include_directories (${CRITBIT_INCLUDE_DIR}) include_directories (${CRYPTO_INCLUDE_DIR}) include_directories (${QUICKLIST_INCLUDE_DIR}) @@ -18,18 +18,9 @@ include_directories (${BSON_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR}) add_executable(server main.c) - -target_link_libraries(server eressea) -target_link_libraries(server ${QUICKLIST_LIBRARIES}) -target_link_libraries(server ${CRITBIT_LIBRARIES}) -target_link_libraries(server ${BSON_LIBRARIES}) -target_link_libraries(server ${CRYPTO_LIBRARIES}) -target_link_libraries(server ${INIPARSER_LIBRARIES}) -target_link_libraries(server ${CUTEST_LIBRARIES}) -target_link_libraries(server ${CURSES_LIBRARIES}) -target_link_libraries(server ${LUA_LIBRARIES}) -target_link_libraries(server ${TOLUA_LIBRARIES}) -target_link_libraries(server ${LIBXML2_LIBRARIES}) -target_link_libraries(server ${SQLITE3_LIBRARIES}) - -add_test (server server --tests) +target_link_libraries(server + ${ERESSEA_LIBRARY} + ${BINDINGS_LIBRARY} + ${TOLUA_LIBRARIES} + ${SQLITE3_LIBRARIES} +) diff --git a/src/example.vcproj b/src/example.vcproj deleted file mode 100644 index 1e776ab66..000000000 --- a/src/example.vcproj +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/example.vcxproj b/src/example.vcxproj deleted file mode 100644 index cb379c5ca..000000000 --- a/src/example.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - example - {4A17DAEE-2261-4E2C-96F6-BA4132A09551} - build - Win32Proj - - - - Application - Unicode - true - - - Application - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(ProjectDir)$(Configuration)\ - $(ProjectDir)$(Configuration)\ - true - $(ProjectDir)$(Configuration)\ - $(ProjectDir)$(Configuration)\ - false - - - - /MP %(AdditionalOptions) - Disabled - ../../shared/src;../../external;../../external/lua/src;../../external/tolua/include;../../external/pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories) - LIBXML_STATIC;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - stdafx.h - Level4 - EditAndContinue - true - - - libxml2.lib;pdcurses.lib;lua.lib;tolua.lib;ws2_32.lib;%(AdditionalDependencies) - true - Console - MachineX86 - ..\..\external\$(Configuration)\;%(AdditionalLibraryDirectories) - - - - - ../../shared/src;../../external;../../external/lua/src;../../external/tolua/include;../../external/pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories) - LIBXML_STATIC;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - Use - Level3 - ProgramDatabase - true - - - libxml2.lib;pdcurses.lib;lua.lib;tolua.lib;ws2_32.lib;%(AdditionalDependencies) - true - Console - true - true - MachineX86 - ..\..\external\$(Configuration)\;%(AdditionalLibraryDirectories) - - - - - true - true - - - - - - - - Create - stdafx.h - Create - - - src/util;%(AdditionalIncludeDirectories) - - - - - - - - - - - - \ No newline at end of file diff --git a/src/example.vcxproj.filters b/src/example.vcxproj.filters deleted file mode 100644 index de2d8b949..000000000 --- a/src/example.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {28903f02-8887-4f37-9579-228fe73a2dcd} - - - - - Source Files - - - Unity Build - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - - - - \ No newline at end of file diff --git a/src/main.c b/src/main.c index eb1f7f6f9..99b041047 100644 --- a/src/main.c +++ b/src/main.c @@ -24,18 +24,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #include +#include #include +#include + #include #include #include -#include - -static const char *luafile = "setup.lua"; +static const char *luafile = 0; static const char *entry_point = NULL; static const char *inifile = "eressea.ini"; -static const char *logfile="eressea.log"; +static const char *logfile= "eressea.log"; static int memdebug = 0; static void parse_config(const char *filename) @@ -43,6 +44,7 @@ static void parse_config(const char *filename) dictionary *d = iniparser_new(filename); if (d) { load_inifile(d); + log_debug("reading from configuration file %s\n", filename); memdebug = iniparser_getint(d, "eressea:memcheck", memdebug); entry_point = iniparser_getstring(d, "eressea:run", entry_point); @@ -50,6 +52,8 @@ static void parse_config(const char *filename) /* only one value in the [editor] section */ force_color = iniparser_getint(d, "editor:color", force_color); + } else { + log_error("could not open configuration file %s\n", filename); } global.inifile = d; } @@ -64,14 +68,13 @@ static int usage(const char *prog, const char *arg) "-q : be quite (same as -v 0)\n" "-v : verbosity level\n" "-C : run in interactive mode\n" - "--color : force curses to use colors even when not detected\n" - "--tests : run test suite\n" "--help : help\n", prog); + "--color : force curses to use colors even when not detected\n", prog); return -1; } static int parse_args(int argc, char **argv, int *exitcode) { - int i, run_tests = 0; + int i; for (i = 1; i != argc; ++i) { if (argv[i][0] != '-') { @@ -87,8 +90,6 @@ static int parse_args(int argc, char **argv, int *exitcode) force_color = 1; } else if (strcmp(argv[i] + 2, "help") == 0) { return usage(argv[0], NULL); - } else if (strcmp(argv[i] + 2, "tests") == 0) { - run_tests = 1; } else { return usage(argv[0], argv[i]); } @@ -140,10 +141,6 @@ static int parse_args(int argc, char **argv, int *exitcode) log_stderr = LOG_CPERROR|LOG_CPWARNING|LOG_CPDEBUG|LOG_CPINFO; break; } - if (run_tests) { - *exitcode = RunAllTests(); - return 1; - } return 0; } @@ -158,7 +155,9 @@ void locale_init(void) int main(int argc, char **argv) { int err, result = 0; + lua_State * L; + log_open(logfile); parse_config(inifile); err = parse_args(argc, argv, &result); @@ -166,22 +165,19 @@ int main(int argc, char **argv) return result; } - log_open(logfile); locale_init(); - err = eressea_init(); - if (err) { - log_error("initialization failed with code %d\n", err); - return err; - } + L = lua_init(); + game_init(); - err = eressea_run(luafile, entry_point); + err = eressea_run(L, luafile, entry_point); if (err) { log_error("server execution failed with code %d\n", err); return err; } - eressea_done(); + game_done(); + lua_done(L); log_close(); return 0; }