forked from github/server
in the report, calculate max size of ships correctly.
This commit is contained in:
parent
d9cbbd9052
commit
d04fe741a9
|
@ -373,10 +373,15 @@ const char *shipname(const ship * sh)
|
||||||
return write_shipname(sh, ibuf, sizeof(idbuf[0]));
|
return write_shipname(sh, ibuf, sizeof(idbuf[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ship_maxsize(const ship *sh)
|
||||||
|
{
|
||||||
|
return sh->number * sh->type->construction->maxsize;
|
||||||
|
}
|
||||||
|
|
||||||
bool ship_finished(const ship *sh)
|
bool ship_finished(const ship *sh)
|
||||||
{
|
{
|
||||||
if (sh->type->construction) {
|
if (sh->type->construction) {
|
||||||
return (sh->size >= sh->number * sh->type->construction->maxsize);
|
return (sh->size >= ship_maxsize(sh));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,20 +93,20 @@ extern "C" {
|
||||||
const char *shipname(const struct ship *self);
|
const char *shipname(const struct ship *self);
|
||||||
int ship_capacity(const struct ship *sh);
|
int ship_capacity(const struct ship *sh);
|
||||||
int ship_cabins(const struct ship *sh);
|
int ship_cabins(const struct ship *sh);
|
||||||
|
int ship_maxsize(const struct ship *sh);
|
||||||
bool ship_finished(const struct ship *sh);
|
bool ship_finished(const struct ship *sh);
|
||||||
extern void getshipweight(const struct ship *sh, int *weight, int *cabins);
|
void getshipweight(const struct ship *sh, int *weight, int *cabins);
|
||||||
|
|
||||||
extern ship *new_ship(const struct ship_type *stype, struct region *r,
|
ship *new_ship(const struct ship_type *stype, struct region *r,
|
||||||
const struct locale *lang);
|
const struct locale *lang);
|
||||||
extern const char *write_shipname(const struct ship *sh, char *buffer,
|
const char *write_shipname(const struct ship *sh, char *buffer,
|
||||||
size_t size);
|
size_t size);
|
||||||
extern struct ship *findship(int n);
|
struct ship *findship(int n);
|
||||||
extern struct ship *findshipr(const struct region *r, int n);
|
|
||||||
|
|
||||||
extern const struct ship_type *findshiptype(const char *s,
|
const struct ship_type *findshiptype(const char *s,
|
||||||
const struct locale *lang);
|
const struct locale *lang);
|
||||||
|
|
||||||
extern void write_ship_reference(const struct ship *sh,
|
void write_ship_reference(const struct ship *sh,
|
||||||
struct storage *store);
|
struct storage *store);
|
||||||
|
|
||||||
void remove_ship(struct ship **slist, struct ship *s);
|
void remove_ship(struct ship **slist, struct ship *s);
|
||||||
|
|
|
@ -1737,10 +1737,10 @@ nr_ship(struct stream *out, const region *r, const ship * sh, const faction * f,
|
||||||
sbs_printf(&sbs, "%s, %s", shipname(sh), LOC(f->locale, sh->type->_name));
|
sbs_printf(&sbs, "%s, %s", shipname(sh), LOC(f->locale, sh->type->_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sh->size != sh->type->construction->maxsize) {
|
if (!ship_finished(sh)) {
|
||||||
sbs_printf(&sbs, ", %s (%d/%d)",
|
sbs_printf(&sbs, ", %s (%d/%d)",
|
||||||
LOC(f->locale, "nr_undercons"), sh->size,
|
LOC(f->locale, "nr_undercons"), sh->size,
|
||||||
sh->type->construction->maxsize);
|
ship_maxsize(sh));
|
||||||
}
|
}
|
||||||
if (sh->damage) {
|
if (sh->damage) {
|
||||||
int percent = ship_damage_percent(sh);
|
int percent = ship_damage_percent(sh);
|
||||||
|
|
Loading…
Reference in New Issue