From 935aabac4ebc837fc651885f79b56db3f11cd4a4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 4 Nov 2006 21:23:45 +0000 Subject: [PATCH] produce-xp abschaltbar gemacht fehlender return-value in learn() --- src/common/gamecode/study.c | 2 +- src/common/kernel/eressea.c | 6 ++++-- src/common/kernel/eressea.h | 2 +- src/common/kernel/xmlreader.c | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/gamecode/study.c b/src/common/gamecode/study.c index fdebc8909..219218943 100644 --- a/src/common/gamecode/study.c +++ b/src/common/gamecode/study.c @@ -454,7 +454,7 @@ learn_cmd(unit * u, order * ord) skill_t sk; int maxalchemy = 0; - if (u->number==0) return; + if (u->number==0) return 0; if (fval(r->terrain, SEA_REGION)) { /* sonderbehandlung aller die auf Ozeanen lernen können */ if (u->race!=new_race[RC_AQUARIAN] && !(u->race->flags & RCF_SWIM)) { diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 0f8007c11..084c66617 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -3052,8 +3052,10 @@ reorder_owners(region * r) int produceexp(struct unit * u, skill_t sk, int n) { - if (n==0 || !playerrace(u->race)) return 0; - learn_skill(u, sk, PRODUCEEXP/30.0); + if (global.producexpchance>0.0F) { + if (n==0 || !playerrace(u->race)) return 0; + learn_skill(u, sk, global.producexpchance); + } return 0; } diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index caa86fbfd..70deb9c45 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -336,7 +336,6 @@ extern void plagues(struct region * r, boolean ismagic); #define CMDSIZE (DISPLAYSIZE*2+1) #define STARTMONEY 5000 -#define PRODUCEEXP 10 #define TAVERN_MAINTENANCE 14 /* Man gibt in einer Taverne mehr Geld aus! */ @@ -1088,6 +1087,7 @@ typedef struct settings { boolean disabled[MAXKEYWORDS]; struct param * parameters; void * vm_state; + float producexpchance; struct global_functions { int (*wage)(const struct region *r, const struct faction * f, const struct race * rc); diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index 404b2dbd6..d4e571a09 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -1896,6 +1896,7 @@ parse_main(xmlDocPtr doc) } global.unitsperalliance = xml_bvalue(node, "unitsperalliance", false); + global.producexpchance = (float)xml_fvalue(node, "learningbydoing", 1.0/3); global.maxunits = xml_ivalue(node, "units", INT_MAX); property = xmlGetProp(node, BAD_CAST "name");