Negative Price-to-Earnings for a global stock will crash game

Technical support requests for Capitalism Lab
Post Reply
User avatar
Stylesjl
Mod Expert
Mod Expert
Posts: 1022
Joined: Sun Oct 29, 2023 4:01 am
Location: Sydney, Australia
Has thanked: 71 times
Been thanked: 117 times

Negative Price-to-Earnings for a global stock will crash game

Post by Stylesjl »

I have been making changes to the Global Stock market companies for the Magitek mod, one of the companies (Intel) has a negative P/E ratio and when I put this in the mod the game will just crash after running for a short while.

To replicate this error download the source which contains the Stocks.dbf file:
https://drive.google.com/file/d/1jbYjGG ... sp=sharing

Then run the Magitek mod with Banking and Finance DLC on with Global Stocks enabled. Start any game and wait a bit and the game will crash.

Try rebuilding the mod without a negative P/E ratio for Intel and the crash won't appear.

This is a screenshot of the crash:
Stock Crash.png
Stock Crash.png (521.09 KiB) Viewed 1233 times
On closer inspection it seems to be the case that a negative P/E ratio isn't causing the crash directly, rather the issue is that the Intel stock price keeps sliding towards zero and then when it hits zero the code can't seem to handle it. The solution is probably that the company shouldn't keep losing value, I don't think Global Stocks are supposed to go bankrupt.

Also: If you set a P/E ratio of exactly zero you almost immediately get this error:
ZeroCrash.png
ZeroCrash.png (565.54 KiB) Viewed 1232 times
Note: This was tested on the Post Release Beta and on 12.0.67 Release.
User avatar
David
Community and Marketing Manager at Enlight
Posts: 10964
Joined: Sat Jul 03, 2010 1:42 pm
Has thanked: 131 times
Been thanked: 406 times

Re: Negative Price-to-Earnings for a global stock will crash game

Post by David »

Hi Jonathan,

The bug has been fixed. Please download the new patch v12.0.68 from https://www.capitalism2.com/forum/viewtopic.php?t=10647

This new version also added a new validation system for checking small logo images in mods. During my testing, your mod triggered an error indicating that the small logo image for “Spellbound Supplies” is invalid. Please try re‑saving the PNG using a different image editor to see if that resolves the issue.

And thanks for the updated version of your mod. All the improvements sound great!
User avatar
Stylesjl
Mod Expert
Mod Expert
Posts: 1022
Joined: Sun Oct 29, 2023 4:01 am
Location: Sydney, Australia
Has thanked: 71 times
Been thanked: 117 times

Re: Negative Price-to-Earnings for a global stock will crash game

Post by Stylesjl »

Verified that the bug is fixed and I also tracked down the problem with the image (for some reason MS Paint was saving it in a way the game didn't like, I used Paint.net to save it and that fixed it)
Post Reply