forked from github/server
- removing unused DELAYED_OFFENSE define
- fixed duplicate units in CR - fixed ship/building/unit display in neighbor-regions
This commit is contained in:
parent
e72748a61f
commit
615d948021
3 changed files with 34 additions and 59 deletions
|
@ -629,48 +629,44 @@ xml_region(report_context * ctx, seen_region * sr)
|
|||
child = xmlNewNode(xct->ns_atl, BAD_CAST "terrain");
|
||||
xmlNewNsProp(child, xct->ns_atl, BAD_CAST "ref", (const xmlChar *)terrain_name(r));
|
||||
|
||||
for (u=r->units;u;u=u->next) {
|
||||
if (u->building || u->ship || (stealthmod>INT_MIN && cansee(ctx->f, r, u, stealthmod))) {
|
||||
xmlAddChild(node, xml_unit(ctx, u, sr->mode));
|
||||
}
|
||||
}
|
||||
|
||||
/* report all units. they are pre-sorted in an efficient manner */
|
||||
u = r->units;
|
||||
while (b) {
|
||||
while (b && (!u || u->building!=b)) {
|
||||
xmlAddChild(node, xml_building(ctx, sr, b, NULL));
|
||||
b = b->next;
|
||||
}
|
||||
if (b) {
|
||||
child = xmlAddChild(node, xml_building(ctx, sr, b, u));
|
||||
while (u && u->building==b) {
|
||||
xmlAddChild(child, xml_unit(ctx, u, sr->mode));
|
||||
u = u->next;
|
||||
if (sr->mode>see_neighbour) {
|
||||
/* report all units. they are pre-sorted in an efficient manner */
|
||||
u = r->units;
|
||||
while (b) {
|
||||
while (b && (!u || u->building!=b)) {
|
||||
xmlAddChild(node, xml_building(ctx, sr, b, NULL));
|
||||
b = b->next;
|
||||
}
|
||||
b = b->next;
|
||||
}
|
||||
}
|
||||
while (u && !u->ship) {
|
||||
if (stealthmod>INT_MIN) {
|
||||
if (u->faction == ctx->f || cansee(ctx->f, r, u, stealthmod)) {
|
||||
xmlAddChild(node, xml_unit(ctx, u, sr->mode));
|
||||
if (b) {
|
||||
child = xmlAddChild(node, xml_building(ctx, sr, b, u));
|
||||
while (u && u->building==b) {
|
||||
xmlAddChild(child, xml_unit(ctx, u, sr->mode));
|
||||
u = u->next;
|
||||
}
|
||||
b = b->next;
|
||||
}
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
while (sh) {
|
||||
while (sh && (!u || u->ship!=sh)) {
|
||||
xmlAddChild(node, xml_ship(ctx, sr, sh, NULL));
|
||||
sh = sh->next;
|
||||
}
|
||||
if (sh) {
|
||||
child = xmlAddChild(node, xml_ship(ctx, sr, sh, u));
|
||||
while (u && u->ship==sh) {
|
||||
xmlAddChild(child, xml_unit(ctx, u, sr->mode));
|
||||
u = u->next;
|
||||
while (u && !u->ship) {
|
||||
if (stealthmod>INT_MIN) {
|
||||
if (u->faction == ctx->f || cansee(ctx->f, r, u, stealthmod)) {
|
||||
xmlAddChild(node, xml_unit(ctx, u, sr->mode));
|
||||
}
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
while (sh) {
|
||||
while (sh && (!u || u->ship!=sh)) {
|
||||
xmlAddChild(node, xml_ship(ctx, sr, sh, NULL));
|
||||
sh = sh->next;
|
||||
}
|
||||
if (sh) {
|
||||
child = xmlAddChild(node, xml_ship(ctx, sr, sh, u));
|
||||
while (u && u->ship==sh) {
|
||||
xmlAddChild(child, xml_unit(ctx, u, sr->mode));
|
||||
u = u->next;
|
||||
}
|
||||
sh = sh->next;
|
||||
}
|
||||
sh = sh->next;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
static FILE *bdebug;
|
||||
#undef DELAYED_OFFENSE /* non-guarding factions cannot attack after moving */
|
||||
|
||||
#define TACTICS_BONUS 1 /* when undefined, we have a tactics round. else this is the bonus tactics give */
|
||||
#define TACTICS_RANDOM /* undefine this to deactivate */
|
||||
|
@ -3579,18 +3578,6 @@ flee(const troop dt)
|
|||
kill_troop(dt);
|
||||
}
|
||||
|
||||
#ifdef DELAYED_OFFENSE
|
||||
static boolean
|
||||
guarded_by(region * r, faction * f)
|
||||
{
|
||||
unit * u;
|
||||
for (u=r->units;u;u=u->next) {
|
||||
if (u->faction == f && getguard(u)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean
|
||||
init_battle(region * r, battle **bp)
|
||||
{
|
||||
|
@ -3631,11 +3618,6 @@ init_battle(region * r, battle **bp)
|
|||
/**
|
||||
** Fehlerbehandlung Angreifer
|
||||
**/
|
||||
#ifdef DELAYED_OFFENSE
|
||||
if (get_moved(&u->attribs) && !guarded_by(r, u->faction)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "no_attack_after_advance", ""));
|
||||
}
|
||||
#endif
|
||||
if (LongHunger(u)) {
|
||||
cmistake(u, ord, 225, MSG_BATTLE);
|
||||
continue;
|
||||
|
|
|
@ -848,9 +848,6 @@ move_unit(unit * u, region * r, unit ** ulist)
|
|||
if (u->region!=NULL) maxhp = unit_max_hp(u);
|
||||
if (!ulist) ulist = (&r->units);
|
||||
if (u->region) {
|
||||
#ifdef DELAYED_OFFENSE
|
||||
set_moved(&u->attribs);
|
||||
#endif
|
||||
setguard(u, GUARD_NONE);
|
||||
fset(u, UFL_MOVED);
|
||||
if (u->ship || u->building) leave(u->region, u);
|
||||
|
|
Loading…
Reference in a new issue