Alpha Centauri 2

Sid Meier's Alpha Centauri & Alien Crossfire => Modding => Bug/Patch Discussion => Topic started by: Buster's Uncle on April 25, 2013, 06:47:09 PM

Title: Number rollover in Security Nexus
Post by: Buster's Uncle on April 25, 2013, 06:47:09 PM
I've got approximately 327 superantigravhovertankformers ("Former") in my latest game - check the numbers in the F7 Security Nexus screen:

(http://alphacentauri2.info/MGalleryItem.php?id=577)

That screeny's from v 2.0.  I checked it in my scient-Iffic beta copy, and the problem is still present. 

Obviously, the numbers roll over at 255.  If anyone wants to go to the trouble to do an actual count, they're all parked in bases in the save attached.  The numbers down in the corner clearly didn't roll over at 255, but certainly don't add up to reflect the reality.

-Also obviously, people mostly aren't obsessive-compulsive enough to run out the clock on won games and won't accumulate these kinds of 255+ unit numbers, so this one isn't highest priority to fix.  But still, a bug's a bug, and gotta report these glitches when we find them...
Title: Re: Number rollover in Security Nexus
Post by: scient on April 25, 2013, 08:01:28 PM
The information is stored in a BYTE so maximum you'll ever be able to see is 255.  The information is lost when it rolls, so this isn't a matter of information not being displayed.  You'd have to restructure the massive FACTION internal structure to solve this issue beyond simple band aid patch to fix roll over issue.  I don't really see a point since this only will happen in rare late game circumstances and it won't even be a correct value anyway.
Title: Re: Number rollover in Security Nexus
Post by: gwillybj on April 25, 2013, 08:05:02 PM
-Also obviously, people mostly aren't obsessive-compulsive enough to run out the clock on won games-
I wondered why my ears were ringing ??? The game ain't over 'til it's over ;nutz; OCD is one of a few wonderful things I take special pills for :help: :P ;aaa ;lol
Title: Re: Number rollover in Security Nexus
Post by: Buster's Uncle on April 25, 2013, 08:07:24 PM
I can usually turn those tendencies on and off at will, but why should I when I'm having fun?


The information is stored in a BYTE so maximum you'll ever be able to see is 255.  The information is lost when it rolls, so this isn't a matter of information not being displayed.  You'd have to restructure the massive FACTION internal structure to solve this issue beyond simple band aid patch to fix roll over issue.  I don't really see a point since this only will happen in rare late game circumstances and it won't even be a correct value anyway.
No big thang - I know you like to look into anomalies for a greater understanding of the program - I haven't reported many bugs I actually care about seeing fixed...
Title: Re: Number rollover in Security Nexus
Post by: Yitzi on April 25, 2013, 09:14:53 PM
The information is stored in a BYTE so maximum you'll ever be able to see is 255.  The information is lost when it rolls, so this isn't a matter of information not being displayed.  You'd have to restructure the massive FACTION internal structure to solve this issue beyond simple band aid patch to fix roll over issue.  I don't really see a point since this only will happen in rare late game circumstances and it won't even be a correct value anyway.

Is it stored in the unit structure or the faction structure?  If in the unit structure, that might make the restructuring somewhat easier, though still probably fairly difficult.
Title: Re: Number rollover in Security Nexus
Post by: scient on April 25, 2013, 09:43:50 PM
No, faction.  It should be a 512 byte array (maximum # of diff type of units).  I dunno why they made the "units lost" array a WORD and "active" a BYTE.  I guess they figured no one would have more than 255 of same type of units in a normal game.

0096D238 ; char FACT_struct_stats_unit_type_active[]

0096D638 FACT_struct_stats_unit_type_lost dw 512 dup( ?)
Title: Re: Number rollover in Security Nexus
Post by: Yitzi on April 25, 2013, 10:02:23 PM
No, faction.  It should be a 512 byte array (maximum # of diff type of units).

But aren't there a maximum of 128 types for a single faction?  (64 premade and 64 from the workshop)?
Title: Re: Number rollover in Security Nexus
Post by: scient on April 25, 2013, 10:05:34 PM
Oh, maybe.  That actually makes more sense.  The array for units lost is 512 WORDs tho.
Title: Re: Number rollover in Security Nexus
Post by: Yitzi on April 29, 2013, 02:28:36 PM
It occurred to me...it may be possible to bypass the "units active" array entirely when it's 255 or over (which can be done just by having it not increment after 255, and bypass if it's past 255), and just count them directly from the unit data.  The only concern is that if you have a huge number of units, it may slow down the game.
Templates: 1: Printpage (default).
Sub templates: 4: init, print_above, main, print_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 31 - 840KB. (show)
Queries used: 15.

[Show Queries]