Project

General

Profile

Actions

Bug #1654

closed

tech upkeep seems to overflow at 2^16

Added by Marco Schuler 9 days ago. Updated 2 days ago.

Status:
Closed
Priority:
Normal
Category:
General
Target version:
Start date:
08/17/2025
Due date:
% Done:

0%

Estimated time:

Description

I have a game on a rather large map and a ruleset with tech upkeep.

I have a save-game where I produce 65532 bulbs of which 64464 are required for tech upkeep, resulting in a net plus of 1068 bulbs. Everything works as expected. (see screenshot stat_a.png)

When increasing research income via city settings, I get 65730 bulbs, still requiring 64464 as upkeep, resulting in a net plus of 1266 bulbs. Still, everything is fine. Note that the research income is above 2^16. (see stat_b.png)

After researching one more tech and further increasing research income there seems to be a problemn. My research income is now 69581 bulbs (which is correct) but my upkeep cost is now reduced to 2720, resulting in a net plus of 66861 bulbs. I assume, the correct value for the upkeep cost would be 68256 (2720 + 65536) and the actual number I get seems to be the result of an overflow. (see stat_c.png)

Two according savegames are attached. The first (year 2296) with the initial setting (both numbers below 2^16) and the second (year 2298) with the bug (both numbers above 2^16 but the upkeep is wrong).

The game identifies as:
Dies ist Freeciv Version 3.0.6, gui-gtk-3.22-Klient.
Built against gtk+ 3.24.36, using 3.24.38
Built against glib 2.74.5, using 2.74.6


Files

stat_a.png (20.8 KB) stat_a.png both below Marco Schuler, 08/17/2025 10:02 AM
stat_b.png (20 KB) stat_b.png one above, one below Marco Schuler, 08/17/2025 10:02 AM
stat_c.png (20.7 KB) stat_c.png both above, but not Marco Schuler, 08/17/2025 10:02 AM
freeciv-T0722-Y02296-manual.sav.xz (751 KB) freeciv-T0722-Y02296-manual.sav.xz Marco Schuler, 08/17/2025 10:05 AM
freeciv-T0724-Y02298-manual.sav.xz (753 KB) freeciv-T0724-Y02298-manual.sav.xz Marco Schuler, 08/17/2025 10:06 AM
0030-Protocol-Make-tech_upkeep-a-32-bit-value.patch (802 Bytes) 0030-Protocol-Make-tech_upkeep-a-32-bit-value.patch main, S3_3 Marko Lindqvist, 08/17/2025 03:09 PM
0010-Protocol-Make-tech_upkeep-a-32-bit-value.patch (2.89 KB) 0010-Protocol-Make-tech_upkeep-a-32-bit-value.patch S3_2 Marko Lindqvist, 08/17/2025 03:09 PM
0009-Protocol-Make-tech_upkeep-a-32-bit-value.patch (2.88 KB) 0009-Protocol-Make-tech_upkeep-a-32-bit-value.patch S3_1 Marko Lindqvist, 08/17/2025 03:10 PM
Actions

Also available in: Atom PDF