From afa1c2a804a1f97400954bea1e8c4d3065aca574 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 17 Apr 2005 16:02:13 +0000 Subject: [PATCH] http://eressea.upb.de/mantis/view.php?id=449 Gewicht auf Schiffen wird im Report abgerundet. --- src/common/gamecode/report.c | 130 +++++++++++++++++------------------ src/common/kernel/build.c | 1 + src/common/kernel/movement.c | 3 +- src/eressea/server.cpp | 2 - 4 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 4493b7414..17d467b7e 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2330,83 +2330,83 @@ report(FILE *F, faction * f, const faction_list * addresses, /* Schiffe und ihre Einheiten */ for (sh = r->ships; sh; sh = sh->next) { - int w = 0; faction *of = NULL; rnl(F); /* Gewicht feststellen */ - for (u = r->units; u; u = u->next) - if (u->ship == sh && fval(u, UFL_OWNER)) { - of = u->faction; - break; - } - if (of == f) { - for (u = r->units; u; u = u->next) { - if (u->ship == sh) { - w += weight(u); - } - } - sprintf(buf, "%s, %s, (%d/%d)", - shipname(sh), LOC(f->locale, sh->type->name[0]), - (w + 99) / 100, shipcapacity(sh) / 100); - } else { - sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0])); - } + for (u = r->units; u; u = u->next) { + if (u->ship == sh && fval(u, UFL_OWNER)) { + of = u->faction; + break; + } + } + if (of == f) { + int n = 0, p = 0; + getshipweight(sh, &n, &p); - assert(sh->type->construction->improvement==NULL); /* sonst ist construction::size nicht ship_type::maxsize */ - if (sh->size!=sh->type->construction->maxsize) { - sprintf(buf+strlen(buf), ", %s (%d/%d)", - LOC(f->locale, "nr_undercons"), sh->size, - sh->type->construction->maxsize); - } - if (sh->damage) { - sprintf(buf+strlen(buf), ", %d%% %s", - sh->damage*100/(sh->size*DAMAGE_SCALE), - LOC(f->locale, "nr_damaged")); - } - if (rterrain(r) != T_OCEAN) { - if (sh->coast != NODIRECTION) { - scat(", "); - scat(LOC(f->locale, coasts[sh->coast])); - } - } - ch = 0; - if (sh->display[0]) { - scat("; "); - scat(sh->display); + sprintf(buf, "%s, %s, (%d/%d)", shipname(sh), + LOC(f->locale, sh->type->name[0]), n / 100, shipcapacity(sh) / 100); + } else { + sprintf(buf, "%s, %s", shipname(sh), LOC(f->locale, sh->type->name[0])); + } - ch = sh->display[strlen(sh->display) - 1]; - } - if (ch != '!' && ch != '?' && ch != '.') - scat("."); + assert(sh->type->construction->improvement==NULL); /* sonst ist construction::size nicht ship_type::maxsize */ + if (sh->size!=sh->type->construction->maxsize) { + sprintf(buf+strlen(buf), ", %s (%d/%d)", + LOC(f->locale, "nr_undercons"), sh->size, + sh->type->construction->maxsize); + } + if (sh->damage) { + sprintf(buf+strlen(buf), ", %d%% %s", + sh->damage*100/(sh->size*DAMAGE_SCALE), + LOC(f->locale, "nr_damaged")); + } + if (rterrain(r) != T_OCEAN) { + if (sh->coast != NODIRECTION) { + scat(", "); + scat(LOC(f->locale, coasts[sh->coast])); + } + } + ch = 0; + if (sh->display[0]) { + scat("; "); + scat(sh->display); - rparagraph(F, buf, 2, 0); + ch = sh->display[strlen(sh->display) - 1]; + } + if (ch != '!' && ch != '?' && ch != '.') + scat("."); - print_curses(F,f,sh,TYP_SHIP,4); + rparagraph(F, buf, 2, 0); - for (u = r->units; u; u = u->next) - if (u->ship == sh && fval(u, UFL_OWNER)) { - rpunit(F, f, u, 6, sd->mode); - break; - } - for (u = r->units; u; u = u->next) - if (u->ship == sh && !fval(u, UFL_OWNER)) - rpunit(F, f, u, 6, sd->mode); - } + print_curses(F,f,sh,TYP_SHIP,4); - rnl(F); - rpline(F); - } - if (f->no != MONSTER_FACTION) { - if (!anyunits) { - rnl(F); - rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 0); - } else { - list_address(F, f, addresses); - } - } + for (u = r->units; u; u = u->next) { + if (u->ship == sh && fval(u, UFL_OWNER)) { + rpunit(F, f, u, 6, sd->mode); + break; + } + } + for (u = r->units; u; u = u->next) { + if (u->ship == sh && !fval(u, UFL_OWNER)) { + rpunit(F, f, u, 6, sd->mode); + } + } + } + + rnl(F); + rpline(F); + } + if (f->no != MONSTER_FACTION) { + if (!anyunits) { + rnl(F); + rparagraph(F, LOC(f->locale, "nr_youaredead"), 0, 0); + } else { + list_address(F, f, addresses); + } + } } FILE * diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 516f3cce3..b7e73b481 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -1159,6 +1159,7 @@ entership(unit * u, ship * sh, struct order * ord, boolean lasttry) getshipweight(sh, &sweight, &scabins); sweight += weight(u); scabins += u->number; + sweight = (sweight/100) * 100; /* Silberreste abrunden */ if (sweight > mweight || scabins > mcabins) { if (lasttry) cmistake(u, ord, 34, MSG_MOVE); diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index a88cdc186..67514daf2 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -433,8 +433,9 @@ cansail(const region * r, ship * sh) if (sh->type->construction && sh->size!=sh->type->construction->maxsize) return false; 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) assert(!"Ein Schiff wurde verzaubert, das zu groß ist"); if (n > 10000) return false; diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index d0bd06b44..91ba8f99a 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -338,8 +338,6 @@ update_subscriptions(void) int process_orders() { - struct summary * begin, * end; - if (turn == 0) srand(time((time_t *) NULL)); else srand(turn);