Page 1 of 1

cumulated casualties number overflow in long campaign?

Posted: Mon Sep 25, 2006 10:52 am
by deadcat
hello,

playing 8.4 long campaign, german side.
the result screen after each scenario shows, as i understood, cumulated casualties for my and the enemy side for the entire campaign.
now, the number of casualties i incurred on the oponent went over 32.767 and the number switched negative and subsequent casualties incurred on the oponent are being now substracted from -32.767 (or 32.768?).

anyone else noticed this?
cheers

RE: cumulated casualties number overflow in long campaign?

Posted: Mon Sep 25, 2006 5:14 pm
by Procrustes

Cool - the number of casualties must be stored in a two-byte var (2^15=32768) - when you went over it switched the sign bit.  I expect it will keep working - let us know.

RE: cumulated casualties number overflow in long campaign?

Posted: Mon Sep 25, 2006 8:44 pm
by deadcat
yeah i thought that the data type for the casualties variable is a "short int" ("unsigned short int" would've made more sense tho).
it does work in subsequent scenarios. by now, i have to calculate the overall casualties with the formula 32767 + modulo(32767 - modulo(shown_total)).
i was a bit perplexed when i first noticed the - in front of the figure, but then i remembered 2^15 is a *magic* number, hehehe.
would've made sense to make the variable an unsigned int, i guess, as it should't ever be negative.

RE: cumulated casualties number overflow in long campaign?

Posted: Mon Sep 25, 2006 9:31 pm
by Riun T
Congradulations deadcat, for joining the ranks of fellow "score wrappers", that takes some doin!!