Incorrect display of bionic energy in the bionics window
Describe the bug
There's some trouble converting joules to kilojoules.
Pay attention, the debug menu says there is 1046 J in the bionic system. That's 1.046 kJ.
And the bionics window says you have 1.46 kJ.
There's clearly an error somewhere.
Attach save file
n/a
Steps to reproduce
- Create a character and install a bionic battery on it
- Set the bionic energy value to 40J / 400J / 999J
- Make sure that the bionics window displays the energy value correctly
- Set the bionic energy value (J) to 1050J
- Get 1.5kJ in the bionics window.
Expected behavior
Correct display of bionic energy
Screenshots
No response
Versions and configuration
- OS: Windows
- OS Version: 10.0.19043 (21H1)
- Game Version: cdda-experimental-2024-05-25-0347 388ca6c [64-bit]
- Graphics Version: Tiles
- Game Language: Русский <color_dark_gray>(88,7%) [ru]
- Mods loaded: [ Тёмные Дни Впереди [dda], Отключить потребности у НПС [no_npc_food], Портальные штормы игнорируют НПС [personal_portal_storms], Медленный рост фунгалоидов [no_fungal_growth] ]
Additional context
I assume there is an error in the function that converts J to kJ, it doesn't divide by 1000, but does something like compiling the result from two different ones? I.e. it takes the finished kJ value and adds the J value? The 1050 is divided by 1kJ and 50J, then combined 1.50 kJ.
In the character window ('@'), displays the exact value in J and only the integer part in kJ:
- 999 J is displayed as 999 J
- 1999 J is displayed as 1 kJ
I don't know if this is a bug. But it is better to check if the calculations are correct. In my opinion, it is not critical.
Oh, I think I see what the problem is. The energy value is indeed divided into two parts. Conditionally: 1050 = a + b, where a = 1 kJ, b = 050 j. I think you can already see the error: b = 050 turns into b = 50. And when they are combined, you get 1.50 kJ.
So, there's no problem with displaying the value 1101. There's no leading zero that will be lost. And the value will be displayed as 1101.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.
cdda-windows-with-graphics-x64-2024-12-10-1201 The bug is still here.