forked from github/server
Merge branch 'develop' of https://github.com/ennorehling/eressea.git
This commit is contained in:
commit
7d789d9896
7 changed files with 19 additions and 28 deletions
|
@ -496,7 +496,7 @@ unit *read_unit(gamedata *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
READ_INT(data->store, &n);
|
READ_INT(data->store, &n);
|
||||||
setstatus(u, n);
|
unit_setstatus(u, n);
|
||||||
READ_INT(data->store, &u->flags);
|
READ_INT(data->store, &u->flags);
|
||||||
u->flags &= UFL_SAVEMASK;
|
u->flags &= UFL_SAVEMASK;
|
||||||
if ((u->flags & UFL_ANON_FACTION) && !rule_stealth_anon()) {
|
if ((u->flags & UFL_ANON_FACTION) && !rule_stealth_anon()) {
|
||||||
|
|
|
@ -1531,7 +1531,7 @@ unit *create_unit(region * r, faction * f, int number, const struct race *urace,
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
/* erbt Kampfstatus */
|
/* erbt Kampfstatus */
|
||||||
setstatus(u, creator->status);
|
unit_setstatus(u, creator->status);
|
||||||
|
|
||||||
/* erbt Gebaeude/Schiff */
|
/* erbt Gebaeude/Schiff */
|
||||||
if (creator->region == r) {
|
if (creator->region == r) {
|
||||||
|
@ -1986,14 +1986,6 @@ bool has_horses(const unit * u)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setstatus(unit *u, int status)
|
|
||||||
{
|
|
||||||
assert(status >= ST_AGGRO && status <= ST_FLEE);
|
|
||||||
if (u->status != status) {
|
|
||||||
u->status = (status_t)status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAINTENANCE 10
|
#define MAINTENANCE 10
|
||||||
int maintenance_cost(const struct unit *u)
|
int maintenance_cost(const struct unit *u)
|
||||||
{
|
{
|
||||||
|
|
|
@ -267,7 +267,6 @@ extern "C" {
|
||||||
int getunit(const struct region * r, const struct faction * f, struct unit **uresult);
|
int getunit(const struct region * r, const struct faction * f, struct unit **uresult);
|
||||||
int read_unitid(const struct faction *f, const struct region *r);
|
int read_unitid(const struct faction *f, const struct region *r);
|
||||||
|
|
||||||
void setstatus(struct unit *u, int status);
|
|
||||||
/* !< sets combatstatus of a unit */
|
/* !< sets combatstatus of a unit */
|
||||||
int besieged(const struct unit *u);
|
int besieged(const struct unit *u);
|
||||||
bool has_horses(const struct unit *u);
|
bool has_horses(const struct unit *u);
|
||||||
|
|
16
src/laws.c
16
src/laws.c
|
@ -2438,22 +2438,22 @@ int status_cmd(unit * u, struct order *ord)
|
||||||
s = gettoken(token, sizeof(token));
|
s = gettoken(token, sizeof(token));
|
||||||
switch (findparam(s, u->faction->locale)) {
|
switch (findparam(s, u->faction->locale)) {
|
||||||
case P_NOT:
|
case P_NOT:
|
||||||
setstatus(u, ST_AVOID);
|
unit_setstatus(u, ST_AVOID);
|
||||||
break;
|
break;
|
||||||
case P_BEHIND:
|
case P_BEHIND:
|
||||||
setstatus(u, ST_BEHIND);
|
unit_setstatus(u, ST_BEHIND);
|
||||||
break;
|
break;
|
||||||
case P_FLEE:
|
case P_FLEE:
|
||||||
setstatus(u, ST_FLEE);
|
unit_setstatus(u, ST_FLEE);
|
||||||
break;
|
break;
|
||||||
case P_CHICKEN:
|
case P_CHICKEN:
|
||||||
setstatus(u, ST_CHICKEN);
|
unit_setstatus(u, ST_CHICKEN);
|
||||||
break;
|
break;
|
||||||
case P_AGGRO:
|
case P_AGGRO:
|
||||||
setstatus(u, ST_AGGRO);
|
unit_setstatus(u, ST_AGGRO);
|
||||||
break;
|
break;
|
||||||
case P_VORNE:
|
case P_VORNE:
|
||||||
setstatus(u, ST_FIGHT);
|
unit_setstatus(u, ST_FIGHT);
|
||||||
break;
|
break;
|
||||||
case P_HELP:
|
case P_HELP:
|
||||||
if (getparam(u->faction->locale) == P_NOT) {
|
if (getparam(u->faction->locale) == P_NOT) {
|
||||||
|
@ -2469,7 +2469,7 @@ int status_cmd(unit * u, struct order *ord)
|
||||||
msg_feedback(u, ord, "unknown_status", ""));
|
msg_feedback(u, ord, "unknown_status", ""));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setstatus(u, ST_FIGHT);
|
unit_setstatus(u, ST_FIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2940,7 +2940,7 @@ void maketemp_cmd(unit *u, order **olist)
|
||||||
if (sh) {
|
if (sh) {
|
||||||
set_leftship(u2, sh);
|
set_leftship(u2, sh);
|
||||||
}
|
}
|
||||||
setstatus(u2, u->status);
|
unit_setstatus(u2, u->status);
|
||||||
|
|
||||||
/* copy orders until K_END from u to u2 */
|
/* copy orders until K_END from u to u2 */
|
||||||
ordp = &makeord->next;
|
ordp = &makeord->next;
|
||||||
|
|
|
@ -615,11 +615,11 @@ static void recruit_dracoids(unit * dragon, int size)
|
||||||
change_money(dragon, -un->number * 50);
|
change_money(dragon, -un->number * 50);
|
||||||
equip_unit(un, get_equipment("new_dracoid"));
|
equip_unit(un, get_equipment("new_dracoid"));
|
||||||
|
|
||||||
setstatus(un, ST_FIGHT);
|
unit_setstatus(un, ST_FIGHT);
|
||||||
for (weapon = un->items; weapon; weapon = weapon->next) {
|
for (weapon = un->items; weapon; weapon = weapon->next) {
|
||||||
const weapon_type *wtype = weapon->type->rtype->wtype;
|
const weapon_type *wtype = weapon->type->rtype->wtype;
|
||||||
if (wtype && wtype->flags & WTF_MISSILE) {
|
if (wtype && wtype->flags & WTF_MISSILE) {
|
||||||
setstatus(un, ST_BEHIND);
|
unit_setstatus(un, ST_BEHIND);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,7 +518,7 @@ static unit * make_familiar(unit * mage, region *r, const race *rc, const char *
|
||||||
unit *fam;
|
unit *fam;
|
||||||
|
|
||||||
fam = create_unit(r, mage->faction, 1, rc, 0, name, mage);
|
fam = create_unit(r, mage->faction, 1, rc, 0, name, mage);
|
||||||
setstatus(fam, ST_FLEE);
|
unit_setstatus(fam, ST_FLEE);
|
||||||
fset(fam, UFL_LOCKED);
|
fset(fam, UFL_LOCKED);
|
||||||
|
|
||||||
/* triggers: */
|
/* triggers: */
|
||||||
|
@ -2161,7 +2161,7 @@ static int sp_ironkeeper(castorder * co)
|
||||||
create_unit(r, mage->faction, 1, get_race(RC_IRONKEEPER), 0, NULL, mage);
|
create_unit(r, mage->faction, 1, get_race(RC_IRONKEEPER), 0, NULL, mage);
|
||||||
|
|
||||||
/*keeper->age = cast_level + 2; */
|
/*keeper->age = cast_level + 2; */
|
||||||
setstatus(keeper, ST_AVOID); /* kaempft nicht */
|
unit_setstatus(keeper, ST_AVOID); /* kaempft nicht */
|
||||||
setguard(keeper, true);
|
setguard(keeper, true);
|
||||||
fset(keeper, UFL_ISNEW);
|
fset(keeper, UFL_ISNEW);
|
||||||
/* Parteitarnen, damit man nicht sofort wei<65>, wer dahinter steckt */
|
/* Parteitarnen, damit man nicht sofort wei<65>, wer dahinter steckt */
|
||||||
|
@ -4630,7 +4630,7 @@ int sp_clonecopy(castorder * co)
|
||||||
clone =
|
clone =
|
||||||
create_unit(target_region, mage->faction, 1, get_race(RC_CLONE), 0, name,
|
create_unit(target_region, mage->faction, 1, get_race(RC_CLONE), 0, name,
|
||||||
mage);
|
mage);
|
||||||
setstatus(clone, ST_FLEE);
|
unit_setstatus(clone, ST_FLEE);
|
||||||
fset(clone, UFL_LOCKED);
|
fset(clone, UFL_LOCKED);
|
||||||
|
|
||||||
create_newclone(mage, clone);
|
create_newclone(mage, clone);
|
||||||
|
|
|
@ -731,7 +731,7 @@ static fighter *summon_allies(const fighter *fi, const race *rc, int number) {
|
||||||
unit *u =
|
unit *u =
|
||||||
create_unit(r, mage->faction, number, rc, 0, NULL, mage);
|
create_unit(r, mage->faction, number, rc, 0, NULL, mage);
|
||||||
leave(u, true);
|
leave(u, true);
|
||||||
setstatus(u, ST_FIGHT);
|
unit_setstatus(u, ST_FIGHT);
|
||||||
|
|
||||||
u->hp = u->number * unit_max_hp(u);
|
u->hp = u->number * unit_max_hp(u);
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@ int sp_shadowknights(struct castorder * co)
|
||||||
u =
|
u =
|
||||||
create_unit(r, mage->faction, force, get_race(RC_SHADOWKNIGHT), 0, NULL,
|
create_unit(r, mage->faction, force, get_race(RC_SHADOWKNIGHT), 0, NULL,
|
||||||
mage);
|
mage);
|
||||||
setstatus(u, ST_FIGHT);
|
unit_setstatus(u, ST_FIGHT);
|
||||||
|
|
||||||
u->hp = u->number * unit_max_hp(u);
|
u->hp = u->number * unit_max_hp(u);
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ int sp_appeasement(struct castorder * co)
|
||||||
}
|
}
|
||||||
/* und bewachen nicht */
|
/* und bewachen nicht */
|
||||||
setguard(mage, false);
|
setguard(mage, false);
|
||||||
setstatus(mage, ST_FLEE);
|
unit_setstatus(mage, ST_FLEE);
|
||||||
|
|
||||||
/* wir tun so, als w<>re die Person geflohen */
|
/* wir tun so, als w<>re die Person geflohen */
|
||||||
fi->flags |= FIG_NOLOOT;
|
fi->flags |= FIG_NOLOOT;
|
||||||
|
@ -1624,7 +1624,7 @@ int sp_undeadhero(struct castorder * co)
|
||||||
else {
|
else {
|
||||||
unit_setinfo(u, NULL);
|
unit_setinfo(u, NULL);
|
||||||
}
|
}
|
||||||
setstatus(u, du->status);
|
unit_setstatus(u, du->status);
|
||||||
setguard(u, false);
|
setguard(u, false);
|
||||||
for (ilist = &du->items; *ilist;) {
|
for (ilist = &du->items; *ilist;) {
|
||||||
item *itm = *ilist;
|
item *itm = *ilist;
|
||||||
|
|
Loading…
Reference in a new issue