Gewicht auf Schiffen wird im Report abgerundet.
This commit is contained in:
Enno Rehling 2005-04-17 16:02:13 +00:00
parent 4e2a3beaa9
commit afa1c2a804
4 changed files with 68 additions and 68 deletions

View File

@ -2330,27 +2330,24 @@ report(FILE *F, faction * f, const faction_list * addresses,
/* Schiffe und ihre Einheiten */ /* Schiffe und ihre Einheiten */
for (sh = r->ships; sh; sh = sh->next) { for (sh = r->ships; sh; sh = sh->next) {
int w = 0;
faction *of = NULL; faction *of = NULL;
rnl(F); rnl(F);
/* Gewicht feststellen */ /* Gewicht feststellen */
for (u = r->units; u; u = u->next) for (u = r->units; u; u = u->next) {
if (u->ship == sh && fval(u, UFL_OWNER)) { if (u->ship == sh && fval(u, UFL_OWNER)) {
of = u->faction; of = u->faction;
break; break;
} }
}
if (of == f) { if (of == f) {
for (u = r->units; u; u = u->next) { int n = 0, p = 0;
if (u->ship == sh) { getshipweight(sh, &n, &p);
w += weight(u);
} sprintf(buf, "%s, %s, (%d/%d)", shipname(sh),
} LOC(f->locale, sh->type->name[0]), n / 100, shipcapacity(sh) / 100);
sprintf(buf, "%s, %s, (%d/%d)",
shipname(sh), LOC(f->locale, sh->type->name[0]),
(w + 99) / 100, shipcapacity(sh) / 100);
} else { } else {
sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0])); sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0]));
} }
@ -2386,15 +2383,18 @@ report(FILE *F, faction * f, const faction_list * addresses,
print_curses(F,f,sh,TYP_SHIP,4); print_curses(F,f,sh,TYP_SHIP,4);
for (u = r->units; u; u = u->next) for (u = r->units; u; u = u->next) {
if (u->ship == sh && fval(u, UFL_OWNER)) { if (u->ship == sh && fval(u, UFL_OWNER)) {
rpunit(F, f, u, 6, sd->mode); rpunit(F, f, u, 6, sd->mode);
break; break;
} }
for (u = r->units; u; u = u->next) }
if (u->ship == sh && !fval(u, UFL_OWNER)) for (u = r->units; u; u = u->next) {
if (u->ship == sh && !fval(u, UFL_OWNER)) {
rpunit(F, f, u, 6, sd->mode); rpunit(F, f, u, 6, sd->mode);
} }
}
}
rnl(F); rnl(F);
rpline(F); rpline(F);

View File

@ -1159,6 +1159,7 @@ entership(unit * u, ship * sh, struct order * ord, boolean lasttry)
getshipweight(sh, &sweight, &scabins); getshipweight(sh, &sweight, &scabins);
sweight += weight(u); sweight += weight(u);
scabins += u->number; scabins += u->number;
sweight = (sweight/100) * 100; /* Silberreste abrunden */
if (sweight > mweight || scabins > mcabins) { if (sweight > mweight || scabins > mcabins) {
if (lasttry) cmistake(u, ord, 34, MSG_MOVE); if (lasttry) cmistake(u, ord, 34, MSG_MOVE);

View File

@ -433,6 +433,7 @@ cansail(const region * r, ship * sh)
if (sh->type->construction && sh->size!=sh->type->construction->maxsize) if (sh->type->construction && sh->size!=sh->type->construction->maxsize)
return false; return false;
getshipweight(sh, &n, &p); getshipweight(sh, &n, &p);
n = (n/100) * 100; /* Silberreste abrunden */
if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) ) { if( is_cursed(sh->attribs, C_SHIP_FLYING, 0) ) {
if (sh->type->cargo>500*100) if (sh->type->cargo>500*100)

View File

@ -338,8 +338,6 @@ update_subscriptions(void)
int int
process_orders() process_orders()
{ {
struct summary * begin, * end;
if (turn == 0) srand(time((time_t *) NULL)); if (turn == 0) srand(time((time_t *) NULL));
else srand(turn); else srand(turn);