- removing unused DELAYED_OFFENSE define

- fixed duplicate units in CR
- fixed ship/building/unit display in neighbor-regions
This commit is contained in:
Enno Rehling 2008-06-16 08:58:56 +00:00
parent e72748a61f
commit 615d948021
3 changed files with 34 additions and 59 deletions

View File

@ -629,48 +629,44 @@ xml_region(report_context * ctx, seen_region * sr)
child = xmlNewNode(xct->ns_atl, BAD_CAST "terrain"); child = xmlNewNode(xct->ns_atl, BAD_CAST "terrain");
xmlNewNsProp(child, xct->ns_atl, BAD_CAST "ref", (const xmlChar *)terrain_name(r)); xmlNewNsProp(child, xct->ns_atl, BAD_CAST "ref", (const xmlChar *)terrain_name(r));
for (u=r->units;u;u=u->next) { if (sr->mode>see_neighbour) {
if (u->building || u->ship || (stealthmod>INT_MIN && cansee(ctx->f, r, u, stealthmod))) { /* report all units. they are pre-sorted in an efficient manner */
xmlAddChild(node, xml_unit(ctx, u, sr->mode)); u = r->units;
} while (b) {
} while (b && (!u || u->building!=b)) {
xmlAddChild(node, xml_building(ctx, sr, b, NULL));
/* report all units. they are pre-sorted in an efficient manner */ b = b->next;
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;
} }
b = b->next; if (b) {
} child = xmlAddChild(node, xml_building(ctx, sr, b, u));
} while (u && u->building==b) {
while (u && !u->ship) { xmlAddChild(child, xml_unit(ctx, u, sr->mode));
if (stealthmod>INT_MIN) { u = u->next;
if (u->faction == ctx->f || cansee(ctx->f, r, u, stealthmod)) { }
xmlAddChild(node, xml_unit(ctx, u, sr->mode)); b = b->next;
} }
} }
u = u->next; while (u && !u->ship) {
} if (stealthmod>INT_MIN) {
while (sh) { if (u->faction == ctx->f || cansee(ctx->f, r, u, stealthmod)) {
while (sh && (!u || u->ship!=sh)) { xmlAddChild(node, xml_unit(ctx, u, sr->mode));
xmlAddChild(node, xml_ship(ctx, sr, sh, NULL)); }
sh = sh->next; }
} u = u->next;
if (sh) { }
child = xmlAddChild(node, xml_ship(ctx, sr, sh, u)); while (sh) {
while (u && u->ship==sh) { while (sh && (!u || u->ship!=sh)) {
xmlAddChild(child, xml_unit(ctx, u, sr->mode)); xmlAddChild(node, xml_ship(ctx, sr, sh, NULL));
u = u->next; 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; return node;

View File

@ -67,7 +67,6 @@
#include <sys/stat.h> #include <sys/stat.h>
static FILE *bdebug; 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_BONUS 1 /* when undefined, we have a tactics round. else this is the bonus tactics give */
#define TACTICS_RANDOM /* undefine this to deactivate */ #define TACTICS_RANDOM /* undefine this to deactivate */
@ -3579,18 +3578,6 @@ flee(const troop dt)
kill_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 static boolean
init_battle(region * r, battle **bp) init_battle(region * r, battle **bp)
{ {
@ -3631,11 +3618,6 @@ init_battle(region * r, battle **bp)
/** /**
** Fehlerbehandlung Angreifer ** 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)) { if (LongHunger(u)) {
cmistake(u, ord, 225, MSG_BATTLE); cmistake(u, ord, 225, MSG_BATTLE);
continue; continue;

View File

@ -848,9 +848,6 @@ move_unit(unit * u, region * r, unit ** ulist)
if (u->region!=NULL) maxhp = unit_max_hp(u); if (u->region!=NULL) maxhp = unit_max_hp(u);
if (!ulist) ulist = (&r->units); if (!ulist) ulist = (&r->units);
if (u->region) { if (u->region) {
#ifdef DELAYED_OFFENSE
set_moved(&u->attribs);
#endif
setguard(u, GUARD_NONE); setguard(u, GUARD_NONE);
fset(u, UFL_MOVED); fset(u, UFL_MOVED);
if (u->ship || u->building) leave(u->region, u); if (u->ship || u->building) leave(u->region, u);