forked from github/server
rounding error calculating ship damage
This commit is contained in:
parent
bd8a4d7e77
commit
f5800c7831
|
@ -246,7 +246,7 @@ shipname(const ship * sh)
|
||||||
int
|
int
|
||||||
shipcapacity (const ship * sh)
|
shipcapacity (const ship * sh)
|
||||||
{
|
{
|
||||||
int i;
|
int i = sh->type->cargo;
|
||||||
|
|
||||||
/* sonst ist construction:: size nicht ship_type::maxsize */
|
/* sonst ist construction:: size nicht ship_type::maxsize */
|
||||||
assert(!sh->type->construction || sh->type->construction->improvement==NULL);
|
assert(!sh->type->construction || sh->type->construction->improvement==NULL);
|
||||||
|
@ -255,12 +255,9 @@ shipcapacity (const ship * sh)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef SHIPDAMAGE
|
#ifdef SHIPDAMAGE
|
||||||
i = ((sh->size * DAMAGE_SCALE - sh->damage) / DAMAGE_SCALE)
|
if (sh->damage) {
|
||||||
* sh->type->cargo / sh->size;
|
i = (int)ceil(i * (1.0 - sh->damage / sh->size / (double)DAMAGE_SCALE));
|
||||||
i += ((sh->size * DAMAGE_SCALE - sh->damage) % DAMAGE_SCALE)
|
}
|
||||||
* sh->type->cargo / (sh->size*DAMAGE_SCALE);
|
|
||||||
#else
|
|
||||||
i = sh->type->cargo;
|
|
||||||
#endif
|
#endif
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue