[BTS] Thread divides by 0 when AI tries to pick tech?

Darthrafael

Chieftain
Joined
Jun 2, 2012
Messages
31
Location
I have no idea
Sorry if this is the wrong place to post this. I'm running into a very weird crash.

My mod seems to be very insistent on dividing by 0 several turns in, at around the same time the AI tries to pick something to research after Bronze Working. When I play without an AI, the game does not crash. And when the AI takes their time to go for Bronze Working, it only crashes when it has finished bronze working and has to pick the next tech.

Yet, I have not (directly) altered the techs. I've added units that become available, but I haven't altered any techs, so I do not understand where the crash comes from. Any help with this would be appreciated, as because of this I am unable to actually play.

Below is what the dump file tells me, which is quite very little.

upload_2021-2-20_11-25-25.png
 
Since you already know how to compile a debug DLL, I would recommend attaching a debugger in order to locate the division by 0 in the C++ source code. Assuming that the project file from Leoreth's thread is used, the following procedure should work: Open the "Project Properties" in Visual Studio and select "Debugging" under the "Configuration Properties" of the "Debug" configuration. Copy the full path of the BtS EXE into the command field and mod=\ followed by the name of your mod into the arguments field; screenshot attached. Then "Start Debugging" from the "Debug" menu (or F5) starts the debugger. When the crash occurs, Visual Studio should show a popup that allows you to inspect the line that caused the crash; another screenshot attached. Windowed mode makes it easier to switch focus between Civ and Visual Studio.
[...] I've added units that become available, but I haven't altered any techs, so I do not understand where the crash comes from.
The AI might evaluate the new units when choosing the next tech to research.
 

Attachments

  • debug-config-in-VS2010.jpg
    debug-config-in-VS2010.jpg
    164.4 KB · Views: 34
  • div-by-0-in-debugger.jpg
    div-by-0-in-debugger.jpg
    198.6 KB · Views: 34
Since you already know how to compile a debug DLL, I would recommend attaching a debugger in order to locate the division by 0 in the C++ source code. Assuming that the project file from Leoreth's thread is used, the following procedure should work: Open the "Project Properties" in Visual Studio and select "Debugging" under the "Configuration Properties" of the "Debug" configuration. Copy the full path of the BtS EXE into the command field and mod=\ followed by the name of your mod into the arguments field; screenshot attached. Then "Start Debugging" from the "Debug" menu (or F5) starts the debugger.

I've got this part mostly down, only, I'm running into an issue whenever I try to start debugging;
upload_2021-2-21_10-20-1.png


Does this perhaps not work with the steam version of Civ4? Or could it be because my mod's name has spaces in it?
upload_2021-2-21_10-21-58.png
 
Reportedly, Steamless allows debugging with the Steam version. Downloads | Readme
(Forgot to mention that. :blush:) Spaces – if that's a problem, then BtS should still launch without loading the mod. Could try quotation marks then.
 
Top Bottom