From a801d02905b48d8fa77174520edbd3a9589eab35 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 17 Aug 2003 15:52:25 +0000 Subject: [PATCH] - fix, damit es mit jam kompiliert - neue implementierung des heilwassers (vernuenftige use-funktion, reste auf andere einheiten verteilen) --- src/common/kernel/eressea.c | 8 ++++---- src/common/kernel/item.c | 28 ++++++++++++++++++++++++++++ src/common/modules/xmas2000.c | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/common/kernel/eressea.c b/src/common/kernel/eressea.c index 9ab35fc16..4908ad241 100644 --- a/src/common/kernel/eressea.c +++ b/src/common/kernel/eressea.c @@ -91,7 +91,7 @@ static attrib_type at_creator = { /* Rest ist NULL; temporäres, nicht alterndes Attribut */ }; static int -MaxAge() { +MaxAge(void) { static int value = -1; if (value<0) { value = atoi(get_param(global.parameters, "MaxAge")); @@ -100,7 +100,7 @@ MaxAge() { } int -LongHunger() { +LongHunger(void) { static int value = -1; if (value<0) { value = atoi(get_param(global.parameters, "hunger.long")); @@ -119,7 +119,7 @@ SkillCap(skill_t sk) { } boolean -TradeDisabled() { +TradeDisabled(void) { static int value = -1; if (value<0) { value = (boolean)atoi(get_param(global.parameters, "trade.disabled")); @@ -128,7 +128,7 @@ TradeDisabled() { } int -NMRTimeout() { +NMRTimeout(void) { static int value = -1; if (value<0) { value = atoi(get_param(global.parameters, "nmr.timeout")); diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index fc0ed5535..69d0366ba 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -1934,6 +1934,33 @@ static const char *potiontext[MAXPOTIONS] = "Verletzung angewandt.", }; +static int +heal(unit * user, int effect) +{ + int req = unit_max_hp(user) * user->number - user->hp; + if (req>0) { + req = min(req, effect); + effect -= req; + user->hp += req; + } + return effect; +} + +static int +use_healingpotion(struct unit *user, const struct potion_type *ptype, int amount, const char *cmd) +{ + int effect = amount * 400; + unit * u = user->region->units; + effect = heal(user, effect); + while (effect>0 && u!=NULL) { + if (u->faction==user->faction) { + effect = heal(u, effect); + } + u = u->next; + } + return 0; +} + static int use_warmthpotion(struct unit *u, const struct potion_type *ptype, int amount, const char *cmd) { @@ -2096,6 +2123,7 @@ init_oldpotions(void) if (p==P_FOOL) itype->useonother = &use_foolpotion; } oldpotiontype[P_WARMTH]->use = &use_warmthpotion; + oldpotiontype[P_WARMTH]->use = &use_healingpotion; oldpotiontype[P_BAUERNBLUT]->use = &use_bloodpotion; } diff --git a/src/common/modules/xmas2000.c b/src/common/modules/xmas2000.c index e293036f4..5a8da56a1 100644 --- a/src/common/modules/xmas2000.c +++ b/src/common/modules/xmas2000.c @@ -100,7 +100,7 @@ create_xmas2000(int x, int y) u = createunit(r, f, 2, f->race); if (f->race==new_race[RC_DAEMON]) u->irace = new_race[RC_HUMAN]; sprintf(zText, "%s %s", prefix[rand()%prefixes], LOC(u->faction->locale, rc_name(u->irace, 1))); - fset(u, FL_PARTEITARNUNG); + fset(u, UFL_PARTEITARNUNG); set_string(&u->name, zText); } make_gates(r);