"Einheit konnte sich nach Kampf nicht bewegen"

Die KAEMPFE FLIEHE logik hat drauf vertraut, das movement nur nach UFL_NOTMOVING schaut, nicht nach LONGACTION. dafuer muss aber eine Menge getan werden, das nicht wurde. Jetzt aber...
This commit is contained in:
Enno Rehling 2007-03-11 22:18:58 +00:00
parent f9a39f6717
commit 4ea302940f
7 changed files with 65 additions and 65 deletions

View File

@ -1824,7 +1824,7 @@ expandbuying(region * r, request * buyorders)
trade->number = 0;
++trade->multi;
}
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
}
free(oa);
@ -2072,7 +2072,7 @@ expandselling(region * r, request * sellorders, int limit)
}
u->n += price;
change_money(u, price);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
/* r->money -= price; --- dies wird eben nicht ausgeführt, denn die
* Produkte können auch als Steuern eingetrieben werden. In der Region
@ -2319,7 +2319,7 @@ expandstealing(region * r, request * stealorders)
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount", u, u->region, n));
}
add_income(oa[i].unit, IC_STEAL, oa[i].unit->wants, oa[i].unit->n);
fset(oa[i].unit, UFL_LONGACTION);
fset(oa[i].unit, UFL_LONGACTION|UFL_NOTMOVING);
}
free(oa);
}
@ -2822,7 +2822,7 @@ expandentertainment(region * r)
/* Nur soviel PRODUCEEXP wie auch tatsächlich gemacht wurde */
produceexp(u, SK_ENTERTAINMENT, min(u->n, u->number));
add_income(u, IC_ENTERTAIN, o->qty, u->n);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
}
@ -2915,7 +2915,7 @@ expandwork(region * r)
change_money(u, u->n);
working -= o->unit->number;
add_income(u, IC_WORK, o->qty, u->n);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
n = m * p_wage;
@ -2987,7 +2987,7 @@ expandtax(region * r, request * taxorders)
for (u = r->units; u; u = u->next) {
if (u->n >= 0) {
add_income(u, IC_TAX, u->wants, u->n);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
}
}
@ -3121,7 +3121,7 @@ produce(void)
if (a && a->data.i) {
produceexp(u, SK_TRADE, u->number);
}
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
continue;
}
}

View File

@ -3373,7 +3373,7 @@ setdefaults(unit *u)
* werden. */
if (trade == true) {
/* fset(u, UFL_LONGACTION); */
/* fset(u, UFL_LONGACTION|UFL_NOTMOVING); */
set_order(&u->thisorder, NULL);
}
/* thisorder kopieren wir nun nach lastorder. in lastorder steht

View File

@ -720,7 +720,7 @@ learn_cmd(unit * u, order * ord)
a_remove(&u->attribs, a);
a = NULL;
}
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
/* Anzeigen neuer Tränke */
/* Spruchlistenaktualiesierung ist in Regeneration */

View File

@ -2596,7 +2596,7 @@ aftermath(battle * b)
du->hp = df->run.hp;
set_order(&du->thisorder, NULL);
setguard(du, GUARD_NONE);
fset(du, UFL_LONGACTION);
fset(du, UFL_LONGACTION|UFL_NOTMOVING);
#ifdef SIMPLE_ESCAPE
if (du->status<=ST_FLEE) leave(du->region, du);
#else

View File

@ -2698,7 +2698,7 @@ magic(void)
add_castorder(&cll[(int)(sp->rank)], co);
}
}
if (casted) fset(u, UFL_LONGACTION);
if (casted) fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
}

View File

@ -94,7 +94,7 @@ get_followers(unit * target, region * r, region_list * route_end, follower ** fo
{
unit * uf;
for (uf=r->units;uf;uf=uf->next) {
if (fval(uf, UFL_FOLLOWING) && !fval(uf, UFL_LONGACTION)) {
if (fval(uf, UFL_FOLLOWING) && !fval(uf, UFL_NOTMOVING)) {
const attrib * a = a_findc(uf->attribs, &at_follow);
if (a && a->data.v == target) {
follower * fnew = malloc(sizeof(follower));
@ -994,10 +994,10 @@ init_transportation(void)
unit *u;
/* This is just a simple check for non-corresponding K_TRANSPORT/
* K_DRIVE. This is time consuming for an error check, but there
* doesn't seem to be an easy way to speed this up. */
* K_DRIVE. This is time consuming for an error check, but there
* doesn't seem to be an easy way to speed this up. */
for (u=r->units; u; u=u->next) {
if (get_keyword(u->thisorder) == K_DRIVE && can_move(u) && !fval(u, UFL_LONGACTION) && !LongHunger(u)) {
if (get_keyword(u->thisorder) == K_DRIVE && can_move(u) && !fval(u, UFL_NOTMOVING) && !LongHunger(u)) {
unit * ut;
init_tokens(u->thisorder);
@ -1034,7 +1034,7 @@ init_transportation(void)
unit * ut = getunit(r, u->faction);
if (ut == NULL) break;
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut) && !fval(ut, UFL_LONGACTION) && !LongHunger(ut)) {
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut) && !fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
init_tokens(ut->thisorder);
skip_token();
if (getunit(r, ut->faction) == u) {
@ -1507,7 +1507,7 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
/* make orders for the followers */
}
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
setguard(u, GUARD_NONE);
assert(u->region == current);
return iroute;
@ -1961,7 +1961,7 @@ travel_i(unit * u, region_list * route_begin, region_list * route_end, order * o
if (ut!=NULL) {
boolean found = false;
if (get_keyword(ut->thisorder) == K_DRIVE && can_move(ut)) {
if (!fval(ut, UFL_LONGACTION) && !LongHunger(ut)) {
if (!fval(ut, UFL_NOTMOVING) && !LongHunger(ut)) {
init_tokens(ut->thisorder);
skip_token();
if (getunit(u->region, ut->faction) == u) {
@ -2076,7 +2076,7 @@ move(unit * u, boolean move_on_land)
travel(u, &route);
}
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
set_order(&u->thisorder, NULL);
if (route!=NULL) free_regionlist(route);
@ -2281,23 +2281,23 @@ hunt(unit *u, order * ord)
char command[256];
direction_t dir;
if (fval(u, UFL_LONGACTION)) {
if (fval(u, UFL_NOTMOVING)) {
return 0;
} else if (u->ship == NULL) {
cmistake(u, ord, 144, MSG_MOVE);
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
} else if (!fval(u, UFL_OWNER)) {
cmistake(u, ord, 146, MSG_MOVE);
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
} else if (fval(u, UFL_NOTMOVING)) {
cmistake(u, ord, 319, MSG_MOVE);
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
} else if (!can_move(u)) {
cmistake(u, ord, 55, MSG_MOVE);
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
}
@ -2305,7 +2305,7 @@ hunt(unit *u, order * ord)
if (id <= 0) {
cmistake(u, ord, 20, MSG_MOVE);
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
}
@ -2316,7 +2316,7 @@ hunt(unit *u, order * ord)
if (sh == NULL || sh->region!=rc) {
cmistake(u, ord, 20, MSG_MOVE);
}
fset(u, UFL_LONGACTION); /* FOLGE SCHIFF ist immer lang */
fset(u, UFL_LONGACTION|UFL_NOTMOVING); /* FOLGE SCHIFF ist immer lang */
return 0;
}
@ -2397,7 +2397,7 @@ move_hunters(void)
/* wir folgen definitiv einem Schiff. */
if (fval(u, UFL_LONGACTION)) {
if (fval(u, UFL_NOTMOVING)) {
cmistake(u, ord, 52, MSG_MOVE);
break;
} else if (!can_move(u)) {
@ -2405,7 +2405,7 @@ move_hunters(void)
break;
}
if (!fval(u, UFL_LONGACTION) && !LongHunger(u) && hunt(u, ord)) {
if (!fval(u, UFL_NOTMOVING) && !LongHunger(u) && hunt(u, ord)) {
up = &r->units;
break;
}
@ -2431,9 +2431,9 @@ move_pirates(void)
while (*up) {
unit *u = *up;
if (!fval(u, UFL_LONGACTION) && get_keyword(u->thisorder) == K_PIRACY) {
if (!fval(u, UFL_NOTMOVING) && get_keyword(u->thisorder) == K_PIRACY) {
piracy_cmd(u, u->thisorder);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
}
if (*up == u) {
@ -2487,10 +2487,11 @@ movement(void)
* UFL_NOTMOVING is set in combat if the unit is not allowed
* to move because it was involved in a battle.
*/
if (fval(u, UFL_LONGACTION)) {
cmistake(u, u->thisorder, 52, MSG_MOVE);
set_order(&u->thisorder, NULL);
} else if (fval(u, UFL_NOTMOVING)) {
if (fval(u, UFL_NOTMOVING)) {
if (fval(u, UFL_LONGACTION)) {
cmistake(u, u->thisorder, 52, MSG_MOVE);
set_order(&u->thisorder, NULL);
}
cmistake(u, u->thisorder, 319, MSG_MOVE);
set_order(&u->thisorder, NULL);
} else if (fval(u, UFL_MOVED)) {
@ -2554,7 +2555,7 @@ follow_unit(unit * u)
attrib * a = NULL;
order * ord;
if (fval(u, UFL_LONGACTION) || LongHunger(u)) return;
if (fval(u, UFL_NOTMOVING) || LongHunger(u)) return;
for (ord=u->orders;ord;ord=ord->next) {
const struct locale * lang = u->faction->locale;

View File

@ -264,7 +264,7 @@ destroy_unit(unit * u)
if (a!=NULL) a_remove(&u->attribs, a);
a = a_find(clone->attribs, &at_clonemage);
if (a!=NULL) a_remove(&clone->attribs, a);
fset(u, UFL_LONGACTION);
fset(u, UFL_LONGACTION|UFL_NOTMOVING);
set_number(clone, 0);
} else
#endif
@ -727,50 +727,49 @@ urace(const struct unit * u)
boolean
can_survive(const unit *u, const region *r)
{
if ((fval(r->terrain, WALK_INTO)
&& (u->race->flags & RCF_WALK)) ||
(fval(r->terrain, SWIM_INTO)
&& (u->race->flags & RCF_SWIM)) ||
(fval(r->terrain, FLY_INTO)
&& (u->race->flags & RCF_FLY))) {
if ((fval(r->terrain, WALK_INTO) && (u->race->flags & RCF_WALK))
|| (fval(r->terrain, SWIM_INTO) && (u->race->flags & RCF_SWIM))
|| (fval(r->terrain, FLY_INTO) && (u->race->flags & RCF_FLY)))
{
if (get_item(u, I_HORSE) && !fval(r->terrain, WALK_INTO))
return false;
if (get_item(u, I_HORSE) && !fval(r->terrain, WALK_INTO))
return false;
if (fval(u->race, RCF_UNDEAD) && is_cursed(r->attribs, C_HOLYGROUND, 0))
return false;
if (fval(u->race, RCF_UNDEAD) && is_cursed(r->attribs, C_HOLYGROUND, 0))
return false;
return true;
}
return false;
return true;
}
return false;
}
void
move_unit(unit * u, region * r, unit ** ulist)
{
int maxhp = 0;
assert(u && r);
int maxhp = 0;
assert(u && r);
if (u->region == r) return;
if (u->region!=NULL) maxhp = unit_max_hp(u);
if (!ulist) ulist = (&r->units);
if (u->region) {
if (u->region == r) return;
if (u->region!=NULL) maxhp = unit_max_hp(u);
if (!ulist) ulist = (&r->units);
if (u->region) {
#ifdef DELAYED_OFFENSE
set_moved(&u->attribs);
set_moved(&u->attribs);
#endif
setguard(u, GUARD_NONE);
fset(u, UFL_MOVED);
if (u->ship || u->building) leave(u->region, u);
translist(&u->region->units, ulist, u);
} else
addlist(ulist, u);
setguard(u, GUARD_NONE);
fset(u, UFL_MOVED);
if (u->ship || u->building) leave(u->region, u);
translist(&u->region->units, ulist, u);
} else {
addlist(ulist, u);
}
#ifdef SMART_INTERVALS
update_interval(u->faction, r);
#endif
u->region = r;
/* keine automatische hp reduzierung bei bewegung */
/* if (maxhp>0) u->hp = u->hp * unit_max_hp(u) / maxhp; */
u->region = r;
/* keine automatische hp reduzierung bei bewegung */
/* if (maxhp>0) u->hp = u->hp * unit_max_hp(u) / maxhp; */
}
/* ist mist, aber wegen nicht skalierender attirbute notwendig: */