cumulated casualties number overflow in long campaign? (Full Version)

All Forums >> [Current Games From Matrix.] >> [World War II] >> Steel Panthers World At War & Mega Campaigns



Message


deadcat -> cumulated casualties number overflow in long campaign? (9/25/2006 1:52:34 PM)

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




Procrustes -> RE: cumulated casualties number overflow in long campaign? (9/25/2006 8:14:58 PM)


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.




deadcat -> RE: cumulated casualties number overflow in long campaign? (9/25/2006 11:44:49 PM)

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.




Riun T -> RE: cumulated casualties number overflow in long campaign? (9/26/2006 12:31:47 AM)

Congradulations deadcat, for joining the ranks of fellow "score wrappers", that takes some doin!!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.53125