- fix, damit es mit jam kompiliert

- neue implementierung des heilwassers (vernuenftige use-funktion, reste auf
  andere einheiten verteilen)
This commit is contained in:
Enno Rehling 2003-08-17 15:52:25 +00:00
parent 5d02ad1b67
commit a801d02905
3 changed files with 33 additions and 5 deletions

View File

@ -91,7 +91,7 @@ static attrib_type at_creator = {
/* Rest ist NULL; temporäres, nicht alterndes Attribut */ /* Rest ist NULL; temporäres, nicht alterndes Attribut */
}; };
static int static int
MaxAge() { MaxAge(void) {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
value = atoi(get_param(global.parameters, "MaxAge")); value = atoi(get_param(global.parameters, "MaxAge"));
@ -100,7 +100,7 @@ MaxAge() {
} }
int int
LongHunger() { LongHunger(void) {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
value = atoi(get_param(global.parameters, "hunger.long")); value = atoi(get_param(global.parameters, "hunger.long"));
@ -119,7 +119,7 @@ SkillCap(skill_t sk) {
} }
boolean boolean
TradeDisabled() { TradeDisabled(void) {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
value = (boolean)atoi(get_param(global.parameters, "trade.disabled")); value = (boolean)atoi(get_param(global.parameters, "trade.disabled"));
@ -128,7 +128,7 @@ TradeDisabled() {
} }
int int
NMRTimeout() { NMRTimeout(void) {
static int value = -1; static int value = -1;
if (value<0) { if (value<0) {
value = atoi(get_param(global.parameters, "nmr.timeout")); value = atoi(get_param(global.parameters, "nmr.timeout"));

View File

@ -1934,6 +1934,33 @@ static const char *potiontext[MAXPOTIONS] =
"Verletzung angewandt.", "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 static int
use_warmthpotion(struct unit *u, const struct potion_type *ptype, int amount, const char *cmd) 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; if (p==P_FOOL) itype->useonother = &use_foolpotion;
} }
oldpotiontype[P_WARMTH]->use = &use_warmthpotion; oldpotiontype[P_WARMTH]->use = &use_warmthpotion;
oldpotiontype[P_WARMTH]->use = &use_healingpotion;
oldpotiontype[P_BAUERNBLUT]->use = &use_bloodpotion; oldpotiontype[P_BAUERNBLUT]->use = &use_bloodpotion;
} }

View File

@ -100,7 +100,7 @@ create_xmas2000(int x, int y)
u = createunit(r, f, 2, f->race); u = createunit(r, f, 2, f->race);
if (f->race==new_race[RC_DAEMON]) u->irace = new_race[RC_HUMAN]; 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))); 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); set_string(&u->name, zText);
} }
make_gates(r); make_gates(r);