making server compile with new github repository layout

todo: fix scripts and config files
This commit is contained in:
Enno Rehling 2012-06-04 21:45:25 -07:00
parent 21ba523503
commit 4e7a758a75
15 changed files with 164 additions and 155 deletions

4
.gitignore vendored
View File

@ -1,5 +1,5 @@
bin/ build-*/
*~
*.ncb *.ncb
*.suo *.suo
*.ncb *.ncb

View File

@ -1,59 +1,12 @@
cmake_minimum_required(VERSION 2.4) cmake_minimum_required(VERSION 2.6)
project(eressea C) project (e3-server C)
## CMake configuration ## enable_testing()
# You can pass these to cmake with -DNEED_OPTION=1
#
# if your system does not have libsqlite3-dev installed:
# set(NEED_SQLITE 1)
if (${CMAKE_C_COMPILER} MATCHES ".*tcc") add_subdirectory (crypto)
set(CMAKE_C_FLAGS "-Wall -g") add_subdirectory (quicklist)
add_definitions(-DTINYCC) add_subdirectory (iniparser)
endif(${CMAKE_C_COMPILER} MATCHES ".*tcc") add_subdirectory (cutest)
add_subdirectory (critbit)
if (${CMAKE_C_COMPILER} MATCHES ".*gcc") add_subdirectory (eressea/src eressea)
set(CMAKE_C_FLAGS "-g -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") add_subdirectory (src server)
endif(${CMAKE_C_COMPILER} MATCHES ".*gcc")
if (WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
else (WIN32)
include_directories (/usr/include/lua5.1/ /usr/include/libxml2)
endif (WIN32)
include_directories (../external ../shared/src)
set (LIB_SRCS
../external/md5.c
../external/bson/bson.c
../external/bson/numbers.c
../external/dlmalloc/malloc.c
../external/cutest/CuTest.c
../shared/src/build/gamecode.c
../shared/src/build/kernel.c
../shared/src/build/lib.c
../shared/src/build/util.c
)
set (LINK_LIBS tolua xml2 ncurses lua5.1 pthread)
if (NEED_SQLITE)
set(LIB_SRCS
${LIB_SRCS}
../external/sqlite3.c
)
else (NEED_SQLITE)
set (LINK_LIBS ${LINK_LIBS} sqlite3)
endif (NEED_SQLITE)
set (ERESSEA_SRCS
src/server.c
)
add_executable (eressea ${LIB_SRCS} ${ERESSEA_SRCS})
if (WIN32)
else (WIN32)
target_link_libraries (eressea ${LINK_LIBS})
endif (WIN32)
add_definitions(-DUNITY_BUILD)

@ -1 +1 @@
Subproject commit a6785c6b7b7773351c5229f5051a4cb8e17b8eae Subproject commit 6b57791acbe40b46392d178629b9fe805829ea71

43
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 2.6)
project (server C)
find_package (Lua51 REQUIRED)
find_package (LibXml2 REQUIRED)
find_package (SQLite3 REQUIRED)
find_package (ToLua REQUIRED)
find_package (Curses REQUIRED)
include_directories (${ERESSEA_INCLUDE_DIR})
include_directories (${CRITBIT_INCLUDE_DIR})
include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${QUICKLIST_INCLUDE_DIR})
include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR})
include_directories (${LIBXML2_INCLUDE_DIR})
include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
set (SERVER_SRC
races/races.c
races/dragons.c
races/zombies.c
races/illusion.c
main.c
bindings.c
monsters.c
spells/combatspells.c
spells/shipcurse.c
spells/regioncurse.c
spells/buildingcurse.c
spells/alp.c
spells/unitcurse.c
spells/spells.c
curses.c
)
add_executable(server ${SERVER_SRC})
target_link_libraries(server
${ERESSEA_LIBRARY}
${TOLUA_LIBRARIES}
${SQLITE3_LIBRARIES}
)

View File

@ -2,12 +2,15 @@
#include <kernel/types.h> #include <kernel/types.h>
#include "spells/shipcurse.h" #include "spells/shipcurse.h"
#include <kernel/equipment.h>
#include <kernel/faction.h>
#include <kernel/magic.h>
#include <kernel/race.h>
#include <kernel/ship.h> #include <kernel/ship.h>
#include <kernel/spellbook.h> #include <kernel/spellbook.h>
#include <kernel/unit.h> #include <kernel/unit.h>
#include <kernel/faction.h>
#include <util/quicklist.h> #include <quicklist.h>
#include <tolua.h> #include <tolua.h>

View File

@ -74,6 +74,41 @@ static int cw_read(attrib * a, void *target, storage * store)
return AT_READ_OK; return AT_READ_OK;
} }
/* ------------------------------------------------------------- */
/* Name: Feuerwand
* Stufe:
* Gebiet: Draig
* Kategorie: Region, negativ
* Flag:
* Kosten: SPC_LINEAR
* Aura:
* Komponenten:
*
* Wirkung:
* eine Wand aus Feuer entsteht in der angegebenen Richtung
*
* Was fuer eine Wirkung hat die?
*/
void wall_vigour(curse * c, double delta)
{
wallcurse *wc = (wallcurse *) c->data.v;
assert(wc->buddy->vigour == c->vigour);
wc->buddy->vigour += delta;
if (wc->buddy->vigour <= 0) {
erase_border(wc->wall);
wc->wall = NULL;
((wallcurse *) wc->buddy->data.v)->wall = NULL;
}
}
const curse_type ct_firewall = {
"Feuerwand",
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | NO_MERGE),
NULL, /* curseinfo */
wall_vigour /* change_vigour */
};
attrib_type at_cursewall = { attrib_type at_cursewall = {
"cursewall", "cursewall",
cw_init, cw_init,

View File

@ -20,6 +20,8 @@ extern "C" {
int countdown; int countdown;
} wall_data; } wall_data;
extern const struct curse_type ct_firewall;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,18 +1,19 @@
#include <platform.h> #include <platform.h>
#include <util/log.h> #include <util/log.h>
#include <kernel/types.h>
#include <eressea.h> #include <eressea.h>
#include <gmtool.h> #include <gmtool.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/save.h> #include <kernel/save.h>
#include <iniparser/iniparser.h>
#include "races/races.h" #include "races/races.h"
#include <assert.h> #include <assert.h>
#include <locale.h> #include <locale.h>
#include <wctype.h> #include <wctype.h>
#include <tests.h> #include <iniparser.h>
static const char *luafile = "setup.lua"; static const char *luafile = "setup.lua";
static const char *entry_point = NULL; static const char *entry_point = NULL;
@ -48,15 +49,13 @@ static int usage(const char *prog, const char *arg)
"-q : be quite (same as -v 0)\n" "-q : be quite (same as -v 0)\n"
"-v <level> : verbosity level\n" "-v <level> : verbosity level\n"
"-C : run in interactive mode\n" "-C : run in interactive mode\n"
"--color : force curses to use colors even when not detected\n" "--color : force curses to use colors even when not detected\n", prog);
"--tests : run testsuite\n" "--help : help\n", prog);
return -1; return -1;
} }
static int parse_args(int argc, char **argv, int *exitcode) static int parse_args(int argc, char **argv, int *exitcode)
{ {
int i; int i;
int run_tests = 0;
for (i = 1; i != argc; ++i) { for (i = 1; i != argc; ++i) {
if (argv[i][0] != '-') { if (argv[i][0] != '-') {
@ -70,9 +69,6 @@ static int parse_args(int argc, char **argv, int *exitcode)
} else if (strcmp(argv[i] + 2, "color") == 0) { } else if (strcmp(argv[i] + 2, "color") == 0) {
/* force the editor to have colors */ /* force the editor to have colors */
force_color = 1; force_color = 1;
} else if (strcmp(argv[i] + 2, "tests") == 0) {
/* force the editor to have colors */
run_tests = 1;
} else if (strcmp(argv[i] + 2, "help") == 0) { } else if (strcmp(argv[i] + 2, "help") == 0) {
return usage(argv[0], NULL); return usage(argv[0], NULL);
} else { } else {
@ -122,10 +118,6 @@ static int parse_args(int argc, char **argv, int *exitcode)
log_stderr = LOG_CPERROR|LOG_CPWARNING|LOG_CPDEBUG|LOG_CPINFO; log_stderr = LOG_CPERROR|LOG_CPWARNING|LOG_CPDEBUG|LOG_CPINFO;
break; break;
} }
if (run_tests) {
*exitcode = RunAllTests();
return 1;
}
return 0; return 0;
} }

View File

@ -31,6 +31,7 @@
/* kernel includes */ /* kernel includes */
#include <kernel/build.h> #include <kernel/build.h>
#include <kernel/curse.h>
#include <kernel/equipment.h> #include <kernel/equipment.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
@ -63,6 +64,8 @@
#include <util/rand.h> #include <util/rand.h>
#include <util/rng.h> #include <util/rng.h>
#include <quicklist.h>
/* libc includes */ /* libc includes */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -15,7 +15,7 @@
#include <kernel/config.h> #include <kernel/config.h>
#include "alp.h" #include "alp.h"
#include <kernel/config.h> #include <kernel/curse.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/magic.h> #include <kernel/magic.h>
#include <kernel/message.h> #include <kernel/message.h>

View File

@ -11,17 +11,20 @@
*/ */
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/types.h>
#include "combatspells.h" #include "combatspells.h"
/* kernel includes */ /* kernel includes */
#include <kernel/battle.h> #include <kernel/battle.h>
#include <kernel/build.h> #include <kernel/build.h>
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/curse.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/magic.h> #include <kernel/magic.h>
#include <kernel/message.h> #include <kernel/message.h>
#include <kernel/order.h> #include <kernel/order.h>
#include <kernel/race.h>
#include <kernel/region.h> #include <kernel/region.h>
#include <kernel/unit.h> #include <kernel/unit.h>
#include <kernel/move.h> #include <kernel/move.h>
@ -34,10 +37,11 @@
/* util includes */ /* util includes */
#include <util/attrib.h> #include <util/attrib.h>
#include <util/base36.h> #include <util/base36.h>
#include <util/quicklist.h>
#include <util/rand.h> #include <util/rand.h>
#include <util/rng.h> #include <util/rng.h>
#include <quicklist.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>

View File

@ -28,6 +28,7 @@
#include <util/functions.h> #include <util/functions.h>
#include <util/language.h> #include <util/language.h>
#include <util/log.h> #include <util/log.h>
#include <util/storage.h>
/* libc includes */ /* libc includes */
#include <string.h> #include <string.h>

View File

@ -13,6 +13,9 @@
#ifndef _SCURSE_H #ifndef _SCURSE_H
#define _SCURSE_H #define _SCURSE_H
#include <kernel/objtypes.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -13,13 +13,16 @@
*/ */
#include <platform.h> #include <platform.h>
#include <kernel/types.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "spells.h" #include "spells.h"
#include "../curses.h"
#include "buildingcurse.h" #include "buildingcurse.h"
#include "regioncurse.h" #include "regioncurse.h"
#include "unitcurse.h" #include "unitcurse.h"
#include "shipcurse.h" #include "shipcurse.h"
#include "combatspells.h"
/* kernel includes */ /* kernel includes */
#include <kernel/curse.h> #include <kernel/curse.h>
@ -2595,41 +2598,6 @@ static int sp_summondragon(castorder * co)
return cast_level; return cast_level;
} }
/* ------------------------------------------------------------- */
/* Name: Feuerwand
* Stufe:
* Gebiet: Draig
* Kategorie: Region, negativ
* Flag:
* Kosten: SPC_LINEAR
* Aura:
* Komponenten:
*
* Wirkung:
* eine Wand aus Feuer entsteht in der angegebenen Richtung
*
* Was fuer eine Wirkung hat die?
*/
void wall_vigour(curse * c, double delta)
{
wallcurse *wc = (wallcurse *) c->data.v;
assert(wc->buddy->vigour == c->vigour);
wc->buddy->vigour += delta;
if (wc->buddy->vigour <= 0) {
erase_border(wc->wall);
wc->wall = NULL;
((wallcurse *) wc->buddy->data.v)->wall = NULL;
}
}
const curse_type ct_firewall = {
"Feuerwand",
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR | NO_MERGE),
NULL, /* curseinfo */
wall_vigour /* change_vigour */
};
static int sp_firewall(castorder * co) static int sp_firewall(castorder * co)
{ {
connection *b; connection *b;
@ -3049,6 +3017,44 @@ static int sp_summonshadowlords(castorder * co)
return cast_level; return cast_level;
} }
static boolean chaosgate_valid(const connection * b)
{
const attrib *a = a_findc(b->from->attribs, &at_direction);
if (!a)
a = a_findc(b->to->attribs, &at_direction);
if (!a)
return false;
return true;
}
struct region *chaosgate_move(const connection * b, struct unit *u,
struct region *from, struct region *to, boolean routing)
{
if (!routing) {
int maxhp = u->hp / 4;
if (maxhp < u->number)
maxhp = u->number;
u->hp = maxhp;
}
return to;
}
border_type bt_chaosgate = {
"chaosgate", VAR_NONE,
b_transparent, /* transparent */
NULL, /* init */
NULL, /* destroy */
NULL, /* read */
NULL, /* write */
b_blocknone, /* block */
NULL, /* name */
b_rinvisible, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
chaosgate_valid,
chaosgate_move
};
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Chaossog /* Name: Chaossog
* Stufe: 14 * Stufe: 14
@ -6616,44 +6622,6 @@ static spelldata spell_functions[] = {
{ 0, 0, 0 } { 0, 0, 0 }
}; };
static boolean chaosgate_valid(const connection * b)
{
const attrib *a = a_findc(b->from->attribs, &at_direction);
if (!a)
a = a_findc(b->to->attribs, &at_direction);
if (!a)
return false;
return true;
}
struct region *chaosgate_move(const connection * b, struct unit *u,
struct region *from, struct region *to, boolean routing)
{
if (!routing) {
int maxhp = u->hp / 4;
if (maxhp < u->number)
maxhp = u->number;
u->hp = maxhp;
}
return to;
}
border_type bt_chaosgate = {
"chaosgate", VAR_NONE,
b_transparent, /* transparent */
NULL, /* init */
NULL, /* destroy */
NULL, /* read */
NULL, /* write */
b_blocknone, /* block */
NULL, /* name */
b_rinvisible, /* rvisible */
b_finvisible, /* fvisible */
b_uinvisible, /* uvisible */
chaosgate_valid,
chaosgate_move
};
static void register_spelldata(void) static void register_spelldata(void)
{ {
int i; int i;

View File

@ -13,6 +13,8 @@
#ifndef _UCURSE_H #ifndef _UCURSE_H
#define _UCURSE_H #define _UCURSE_H
#include <kernel/objtypes.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif