Author Topic: Pop 128 bug  (Read 632 times)

0 Members and 1 Guest are viewing this topic.

Online Buster's Uncle

  • In Buster's Orbit, I
  • Ascend
  • *
  • Posts: 49276
  • €526
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Pop 128 bug
« on: January 22, 2021, 03:36:52 AM »
I don't recall it being reported/patched.  Game-breaking bug when a base's population, at least player headquarters, reaches 128.  Pop goes to negative numbers and the game crashes within two or three before it builds back to zero, let alone one.

scient?  Anyone?

Offline scient

Re: Pop 128 bug
« Reply #1 on: February 06, 2021, 04:09:44 AM »
This is because the population variable inside the base struct is treated as signed. This alone isn't the problem. The problem is that it's a signed byte so max is 127 before it rolls over to signed. There are ~269 references to this variable across 55-60 functions. About ~150 of these references are signed. Once these references are decompiled then I can start to fix this. Initially, treating the value as unsigned. Eventually, once all the base references (as in all the Base related code since this will change struct size) are complete I think the best method will be increase this value to int.

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

If our society seems more nihilistic than that of previous eras, perhaps this is simply a sign of our maturity as a sentient species. As our collective consciousness expands beyond a crucial point, we are at last ready to accept life's fundamental truth: that life's only purpose is life itself.
~Chairman Sheng-ji Yang 'Looking God in the Eye'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 38.

[Show Queries]