forked from github/server
decluttering config.c (rules go into laws.c)
This commit is contained in:
parent
413f70d1a1
commit
a88bfa7a9a
2
s/build
2
s/build
|
@ -39,5 +39,5 @@ echo "build eressea"
|
||||||
cd $ROOT/$BUILD
|
cd $ROOT/$BUILD
|
||||||
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
|
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
|
||||||
cmake -DERESSEA_VERSION="$VERSION" ..
|
cmake -DERESSEA_VERSION="$VERSION" ..
|
||||||
make $MAKEOPTS && make test
|
make -k $MAKEOPTS && make test
|
||||||
cd $OLDPWD
|
cd $OLDPWD
|
||||||
|
|
|
@ -105,37 +105,6 @@ FILE *logfile;
|
||||||
bool battledebug = false;
|
bool battledebug = false;
|
||||||
int turn = -1;
|
int turn = -1;
|
||||||
|
|
||||||
int NewbieImmunity(void)
|
|
||||||
{
|
|
||||||
return config_get_int("NewbieImmunity", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsImmune(const faction * f)
|
|
||||||
{
|
|
||||||
return !fval(f, FFL_NPC) && f->age < NewbieImmunity();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExpensiveMigrants(void)
|
|
||||||
{
|
|
||||||
return config_get_int("study.expensivemigrants", 0) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int LongHunger(const struct unit *u)
|
|
||||||
{
|
|
||||||
if (u != NULL) {
|
|
||||||
if (!fval(u, UFL_HUNGER))
|
|
||||||
return false;
|
|
||||||
if (u_race(u) == get_race(RC_DAEMON))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return config_get_int("hunger.long", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int NMRTimeout(void)
|
|
||||||
{
|
|
||||||
return config_get_int("nmr.timeout", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
helpmode helpmodes[] = {
|
helpmode helpmodes[] = {
|
||||||
{ "all", HELP_ALL }
|
{ "all", HELP_ALL }
|
||||||
,
|
,
|
||||||
|
|
|
@ -164,11 +164,6 @@ struct param;
|
||||||
bool config_changed(int *cache_key);
|
bool config_changed(int *cache_key);
|
||||||
|
|
||||||
char * join_path(const char *p1, const char *p2, char *dst, size_t len);
|
char * join_path(const char *p1, const char *p2, char *dst, size_t len);
|
||||||
bool ExpensiveMigrants(void);
|
|
||||||
int NMRTimeout(void);
|
|
||||||
int LongHunger(const struct unit *u);
|
|
||||||
int NewbieImmunity(void);
|
|
||||||
bool IsImmune(const struct faction *f);
|
|
||||||
|
|
||||||
struct order *default_order(const struct locale *lang);
|
struct order *default_order(const struct locale *lang);
|
||||||
|
|
||||||
|
|
26
src/laws.c
26
src/laws.c
|
@ -117,6 +117,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
/* - exported global symbols ----------------------------------- */
|
/* - exported global symbols ----------------------------------- */
|
||||||
|
|
||||||
|
int NewbieImmunity(void)
|
||||||
|
{
|
||||||
|
return config_get_int("NewbieImmunity", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsImmune(const faction * f)
|
||||||
|
{
|
||||||
|
return !fval(f, FFL_NPC) && f->age < NewbieImmunity();
|
||||||
|
}
|
||||||
|
|
||||||
|
int NMRTimeout(void)
|
||||||
|
{
|
||||||
|
return config_get_int("nmr.timeout", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LongHunger(const struct unit *u)
|
||||||
|
{
|
||||||
|
if (u != NULL) {
|
||||||
|
if (!fval(u, UFL_HUNGER))
|
||||||
|
return false;
|
||||||
|
if (u_race(u) == get_race(RC_DAEMON))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return config_get_int("hunger.long", 0) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
static bool RemoveNMRNewbie(void)
|
static bool RemoveNMRNewbie(void)
|
||||||
{
|
{
|
||||||
int value = config_get_int("nmr.removenewbie", 0);
|
int value = config_get_int("nmr.removenewbie", 0);
|
||||||
|
|
|
@ -108,6 +108,10 @@ extern "C" {
|
||||||
#define FORCE_LEAVE_POSTCOMBAT 1
|
#define FORCE_LEAVE_POSTCOMBAT 1
|
||||||
#define FORCE_LEAVE_ALL 2
|
#define FORCE_LEAVE_ALL 2
|
||||||
bool rule_force_leave(int flag);
|
bool rule_force_leave(int flag);
|
||||||
|
bool LongHunger(const struct unit *u);
|
||||||
|
int NMRTimeout(void);
|
||||||
|
int NewbieImmunity(void);
|
||||||
|
bool IsImmune(const struct faction *f);
|
||||||
bool help_enter(struct unit *uo, struct unit *u);
|
bool help_enter(struct unit *uo, struct unit *u);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
13
src/study.c
13
src/study.c
|
@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
|
#include "laws.h"
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
|
@ -531,6 +532,16 @@ static double study_speedup(unit * u, skill_t s, study_rule_t rule)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool ExpensiveMigrants(void)
|
||||||
|
{
|
||||||
|
static bool rule;
|
||||||
|
static int cache;
|
||||||
|
if (config_changed(&cache)) {
|
||||||
|
rule = config_get_int("study.expensivemigrants", 0) != 0;
|
||||||
|
}
|
||||||
|
return rule;
|
||||||
|
}
|
||||||
|
|
||||||
int study_cmd(unit * u, order * ord)
|
int study_cmd(unit * u, order * ord)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
@ -772,7 +783,7 @@ int study_cmd(unit * u, order * ord)
|
||||||
a_remove(&u->attribs, a);
|
a_remove(&u->attribs, a);
|
||||||
a = NULL;
|
a = NULL;
|
||||||
}
|
}
|
||||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
u->flags |= (UFL_LONGACTION | UFL_NOTMOVING);
|
||||||
|
|
||||||
/* Anzeigen neuer Traenke */
|
/* Anzeigen neuer Traenke */
|
||||||
/* Spruchlistenaktualiesierung ist in Regeneration */
|
/* Spruchlistenaktualiesierung ist in Regeneration */
|
||||||
|
|
Loading…
Reference in New Issue