forked from github/server
"Partei fehlt im Report" Behandlung von Turmregionen. Hoffentlich richtig.
This commit is contained in:
parent
0cd853e38d
commit
3567e3f783
|
@ -71,6 +71,7 @@
|
|||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -1252,7 +1253,6 @@ report_computer(const char * filename, report_context * ctx)
|
|||
}
|
||||
for (;sr!=NULL;sr=sr->next) {
|
||||
region * r = sr->r;
|
||||
int modifier = 0;
|
||||
const char * tname;
|
||||
|
||||
if (!rplane(r)) {
|
||||
|
@ -1288,6 +1288,7 @@ report_computer(const char * filename, report_context * ctx)
|
|||
if (sr->mode == see_neighbour) {
|
||||
cr_borders(ctx->seen, r, f, sr->mode, F);
|
||||
} else {
|
||||
int stealthmod = stealth_modifier(sr->mode);
|
||||
#define RESOURCECOMPAT
|
||||
char cbuf[8192], *pos = cbuf;
|
||||
#ifdef RESOURCECOMPAT
|
||||
|
@ -1456,23 +1457,10 @@ report_computer(const char * filename, report_context * ctx)
|
|||
|
||||
/* visible units */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
boolean visible = true;
|
||||
switch (sr->mode) {
|
||||
case see_unit:
|
||||
modifier=0;
|
||||
break;
|
||||
case see_far:
|
||||
case see_lighthouse:
|
||||
modifier = -2;
|
||||
break;
|
||||
case see_travel:
|
||||
modifier = -1;
|
||||
break;
|
||||
default:
|
||||
visible=false;
|
||||
|
||||
if (u->building || u->ship || (stealthmod>INT_MIN && cansee(f, r, u, stealthmod))) {
|
||||
cr_output_unit(F, r, f, u, sr->mode);
|
||||
}
|
||||
if (u->building || u->ship || (visible && cansee(f, r, u, modifier)))
|
||||
cr_output_unit(F, r, f, u, sr->mode);
|
||||
}
|
||||
} /* region traversal */
|
||||
}
|
||||
|
|
|
@ -1989,29 +1989,12 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
}
|
||||
for (;sr!=NULL;sr=sr->next) {
|
||||
region * r = sr->r;
|
||||
boolean unit_in_region = false;
|
||||
boolean durchgezogen_in_region = false;
|
||||
int turm_sieht_region = false;
|
||||
int stealthmod = stealth_modifier(sr->mode);
|
||||
|
||||
switch (sr->mode) {
|
||||
case see_lighthouse:
|
||||
turm_sieht_region = true;
|
||||
break;
|
||||
case see_far:
|
||||
break;
|
||||
case see_travel:
|
||||
durchgezogen_in_region = true;
|
||||
break;
|
||||
case see_unit:
|
||||
unit_in_region = true;
|
||||
anyunits = true;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
if (sr->mode<see_lighthouse) continue;
|
||||
/* Beschreibung */
|
||||
|
||||
if (unit_in_region) {
|
||||
if (sr->mode==see_unit) {
|
||||
describe(F, r, 0, f);
|
||||
if (!TradeDisabled() && !fval(r->terrain, SEA_REGION) && rpeasants(r)/TRADE_FRACTION > 0) {
|
||||
rnl(F);
|
||||
|
@ -2026,7 +2009,7 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
guards(F, r, f);
|
||||
durchreisende(F, r, f);
|
||||
}
|
||||
else if (turm_sieht_region) {
|
||||
else if (sr->mode==see_lighthouse) {
|
||||
describe(F, r, 2, f);
|
||||
durchreisende(F, r, f);
|
||||
} else {
|
||||
|
@ -2036,12 +2019,12 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
}
|
||||
/* Statistik */
|
||||
|
||||
if (wants_stats && unit_in_region == 1)
|
||||
if (wants_stats && sr->mode==see_unit)
|
||||
statistics(F, r, f);
|
||||
|
||||
/* Nachrichten an REGION in der Region */
|
||||
|
||||
if (unit_in_region || durchgezogen_in_region) {
|
||||
if (sr->mode==see_unit || sr->mode==see_travel) {
|
||||
message_list * mlist = r_getmessages(r, f);
|
||||
rp_messages(F, r->msgs, f, 0, true);
|
||||
if (mlist) rp_messages(F, mlist, f, 0, true);
|
||||
|
@ -2055,15 +2038,10 @@ report_plaintext(const char * filename, report_context * ctx)
|
|||
|
||||
/* Restliche Einheiten */
|
||||
|
||||
if (sr->mode>=see_lighthouse) {
|
||||
if (stealthmod>INT_MIN) {
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (!u->building && !u->ship) {
|
||||
if ((u->faction == f) ||
|
||||
(unit_in_region && cansee(f, r, u, 0)) ||
|
||||
(durchgezogen_in_region && cansee(f, r, u, -1)) ||
|
||||
(sr->mode==see_far && cansee(f, r, u, -2)) ||
|
||||
(turm_sieht_region && cansee(f, r, u, -2)))
|
||||
{
|
||||
if (u->faction == f || cansee(f, r, u, stealthmod)) {
|
||||
if (dh == 0 && !(rbuildings(r) || r->ships)) {
|
||||
dh = 1;
|
||||
/* rnl(F); */
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
@ -824,6 +825,22 @@ add_faction(faction_list ** flist, faction * sf)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
stealth_modifier(int seen_mode)
|
||||
{
|
||||
switch (seen_mode) {
|
||||
case see_unit:
|
||||
return 0;
|
||||
case see_far:
|
||||
case see_lighthouse:
|
||||
return -2;
|
||||
case see_travel:
|
||||
return -1;
|
||||
default:
|
||||
return INT_MIN;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_addresses(report_context * ctx)
|
||||
{
|
||||
|
@ -840,8 +857,20 @@ get_addresses(report_context * ctx)
|
|||
}
|
||||
|
||||
for (;sr!=NULL;sr=sr->next) {
|
||||
int stealthmod = stealth_modifier(sr->mode);
|
||||
r = sr->r;
|
||||
if (sr->mode==see_travel) {
|
||||
if (sr->mode==see_lighthouse) {
|
||||
unit * u = r->units;
|
||||
for (;u;u=u->next) {
|
||||
faction * sf = visible_faction(ctx->f, u);
|
||||
if (lastf!=sf) {
|
||||
if (u->building || u->ship || (stealthmod>INT_MIN && cansee(ctx->f, r, u, stealthmod))) {
|
||||
add_faction(&flist, sf);
|
||||
lastf = sf;
|
||||
}
|
||||
}
|
||||
}
|
||||
} if (sr->mode==see_travel) {
|
||||
unit * u = r->units;
|
||||
while (u) {
|
||||
faction * sf = visible_faction(ctx->f, u);
|
||||
|
@ -851,7 +880,7 @@ get_addresses(report_context * ctx)
|
|||
while (a && a->type==&at_travelunit) {
|
||||
unit * u2 = (unit*)a->data.v;
|
||||
if (u2->faction==ctx->f) {
|
||||
if (cansee_unit(u2, u, 0)) {
|
||||
if (cansee_unit(u2, u, stealthmod)) {
|
||||
add_faction(&flist, sf);
|
||||
lastf = sf;
|
||||
break;
|
||||
|
@ -868,7 +897,7 @@ get_addresses(report_context * ctx)
|
|||
if (u->faction!=ctx->f) {
|
||||
faction * sf = visible_faction(ctx->f, u);
|
||||
boolean ballied = sf && sf!=ctx->f && sf!=lastf
|
||||
&& !fval(u, UFL_PARTEITARNUNG) && cansee(ctx->f, r, u, 0);
|
||||
&& !fval(u, UFL_PARTEITARNUNG) && cansee(ctx->f, r, u, stealthmod);
|
||||
if (ballied || ALLIED(ctx->f, sf)) {
|
||||
add_faction(&flist, sf);
|
||||
lastf = sf;
|
||||
|
|
|
@ -67,6 +67,7 @@ enum {
|
|||
see_unit,
|
||||
see_battle
|
||||
};
|
||||
extern int stealth_modifier(int seen_mode);
|
||||
|
||||
typedef struct seen_region {
|
||||
struct seen_region * nextHash;
|
||||
|
|
|
@ -1067,10 +1067,10 @@ readunit(FILE * F)
|
|||
orderp = &ord->next;
|
||||
ord = NULL;
|
||||
} else if (p==MAXPERSISTENT) {
|
||||
log_error(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT));
|
||||
log_warning(("%s had %d or more persistent orders\n", unitname(u), MAXPERSISTENT));
|
||||
}
|
||||
} else if (n==MAXORDERS) {
|
||||
log_error(("%s had %d or more orders\n", unitname(u), MAXORDERS));
|
||||
log_warning(("%s had %d or more orders\n", unitname(u), MAXORDERS));
|
||||
}
|
||||
if (ord!=NULL) free_order(ord);
|
||||
}
|
||||
|
@ -1516,7 +1516,7 @@ readfaction(FILE * F)
|
|||
|
||||
rds(F, &email);
|
||||
if (set_email(&f->email, email)!=0) {
|
||||
log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email));
|
||||
log_warning(("Invalid email address for faction %s: %s\n", itoa36(f->no), email));
|
||||
set_email(&f->email, "");
|
||||
}
|
||||
free(email);
|
||||
|
|
Loading…
Reference in New Issue