forked from github/server
Merge pull request #765 from ennorehling/develop
Mac builds, Braineater diet
This commit is contained in:
commit
82be89e9ed
3 changed files with 34 additions and 11 deletions
10
s/cmake-init
10
s/cmake-init
|
@ -51,7 +51,7 @@ LUA_DIR=/usr
|
||||||
if [ -d /usr/include/lua5.1 ]; then
|
if [ -d /usr/include/lua5.1 ]; then
|
||||||
LUA_VERSION="5.1"
|
LUA_VERSION="5.1"
|
||||||
elif [ -d /usr/local/include/lua5.1 ]; then
|
elif [ -d /usr/local/include/lua5.1 ]; then
|
||||||
LUA_DIR=/usr/local
|
export LUA_DIR=/usr/local
|
||||||
LUA_VERSION="5.1"
|
LUA_VERSION="5.1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -64,8 +64,6 @@ SET (CMAKE_LIBRARY_PATH "$LIBRARY_PATH" CACHE PATH "")
|
||||||
SET (CMAKE_PREFIX_PATH "$PREFIX_PATH" CACHE PATH "")
|
SET (CMAKE_PREFIX_PATH "$PREFIX_PATH" CACHE PATH "")
|
||||||
HEREDOC
|
HEREDOC
|
||||||
|
|
||||||
#echo 'SET (LUA_DIR "$LUA_DIR" PATH)' >> $BUILD/config.cmake
|
|
||||||
|
|
||||||
path="$(which tolua)"
|
path="$(which tolua)"
|
||||||
if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
|
if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
|
||||||
echo "tolua is not installed, building from source"
|
echo "tolua is not installed, building from source"
|
||||||
|
@ -77,7 +75,11 @@ if [ "$HAVE_TOLUA" = "0" ] || [ -z $path ] ; then
|
||||||
echo "building tolua..."
|
echo "building tolua..."
|
||||||
cd tolua
|
cd tolua
|
||||||
make
|
make
|
||||||
echo 'SET(PC_TOLUA_DIR "$ROOT/tolua" CACHE PATH "tolua root")' >> $BUILD/config.cmake
|
cd -
|
||||||
|
cat >> $BUILD/config.cmake <<TOLUA
|
||||||
|
SET(PC_TOLUA_DIR "$ROOT/tolua" CACHE PATH "tolua root")
|
||||||
|
TOLUA
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "tolua is $path"
|
echo "tolua is $path"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,9 +5,8 @@ include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
include_directories (${CJSON_INCLUDE_DIR})
|
include_directories (${CJSON_INCLUDE_DIR})
|
||||||
include_directories (${CLIBS_INCLUDE_DIR})
|
include_directories (${CLIBS_INCLUDE_DIR})
|
||||||
include_directories (${STORAGE_INCLUDE_DIR})
|
include_directories (${STORAGE_INCLUDE_DIR})
|
||||||
include_directories (${LUA_INCLUDE_DIR})
|
|
||||||
include_directories (${TOLUA_INCLUDE_DIR})
|
include_directories (${TOLUA_INCLUDE_DIR})
|
||||||
include_directories (${BSON_INCLUDE_DIR})
|
include_directories (${LUA_INCLUDE_DIR})
|
||||||
include_directories (${INIPARSER_INCLUDE_DIR})
|
include_directories (${INIPARSER_INCLUDE_DIR})
|
||||||
|
|
||||||
IF(DEFINED ERESSEA_VERSION)
|
IF(DEFINED ERESSEA_VERSION)
|
||||||
|
|
|
@ -141,24 +141,46 @@ region_list *all_in_range(const region * r, int n,
|
||||||
return rlist;
|
return rlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX_BRAIN_SIZE 100
|
||||||
|
|
||||||
void spawn_braineaters(float chance)
|
void spawn_braineaters(float chance)
|
||||||
{
|
{
|
||||||
|
const race * rc_brain = get_race(RC_HIRNTOETER);
|
||||||
region *r;
|
region *r;
|
||||||
faction *f0 = get_monsters();
|
faction *f = get_monsters();
|
||||||
int next = rng_int() % (int)(chance * 100);
|
int next = rng_int() % (int)(chance * 100);
|
||||||
|
|
||||||
if (f0 == NULL)
|
if (f == NULL || rc_brain == NULL) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
|
unit *u, *ub = NULL;
|
||||||
if (!is_astral(r) || fval(r->terrain, FORBIDDEN_REGION))
|
if (!is_astral(r) || fval(r->terrain, FORBIDDEN_REGION))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
for (u = r->units; u; u = u->next) {
|
||||||
|
if (u->_race == rc_brain) {
|
||||||
|
if (!ub) {
|
||||||
|
ub = u;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
int n = u->number + ub->number;
|
||||||
|
if (n <= MAX_BRAIN_SIZE) {
|
||||||
|
scale_number(ub, n);
|
||||||
|
u->number = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ub = u;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Neues Monster ? */
|
/* Neues Monster ? */
|
||||||
if (next-- == 0) {
|
if (next-- == 0) {
|
||||||
unit *u =
|
u = create_unit(r, f, 1 + rng_int() % 10 + rng_int() % 10,
|
||||||
create_unit(r, f0, 1 + rng_int() % 10 + rng_int() % 10,
|
rc_brain, 0, NULL, NULL);
|
||||||
get_race(RC_HIRNTOETER), 0, NULL, NULL);
|
|
||||||
equip_unit(u, get_equipment("seed_braineater"));
|
equip_unit(u, get_equipment("seed_braineater"));
|
||||||
|
|
||||||
next = rng_int() % (int)(chance * 100);
|
next = rng_int() % (int)(chance * 100);
|
||||||
|
|
Loading…
Reference in a new issue