Advertisement
Civilization Fanatics' Center  

Welcome to Civilization Fanatics' Center.

You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support.

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Project & Mod Development > Civ4 - Fall from Heaven

Notices

Reply
 
Thread Tools
Old Sep 28, 2009, 03:02 PM   #1
Breunor
Deity
 
Breunor's Avatar
 
Join Date: Jul 2004
Location: Earth
Posts: 2,386
Would this apply to FfH II?

I saw Afforess posted this in the 3.19 bug thread. Since FfH also allows increase to capacity, I wanted to report it here.

Best wishes,

Breunor




Jdog5000, I've found the cause of a rare-ish CTD, and a possible fix for it.
In CvPlayerAI.cpp, in the function "TechTypes CvPlayerAI::AI_bestTech(int iMaxPathLength, bool bIgnoreCost, bool bAsync, TechTypes eIgnoreTech, AdvisorTypes eIgnoreAdvisor) const" There is a section where in rare instances, the formula divides by 0.

The code in question is this section:

Code:
int iNewCapacity = kLoopUnit.getMoves() * kLoopUnit.getCargoSpace();
int iOldCapacity = GC.getUnitInfo(eExistingUnit).getMoves() * GC.getUnitInfo(eExistingUnit).getCargoSpace();
iAssaultValue += (800 * (iNewCapacity - iOldCapacity)) / iOldCapacity;

In Vanilla BTS, the iOldCapacity is never 0, but in Rise of Mankind (and possibly other mods), there is a promotion that adds an extra cargo space to ships, even to ships without preexisting cargo space. If the AI gave this promotion to a ship without cargo space, the iOldCapacity would be 0, and the function would divide by 0. I fixed this by changing that segment of code into this:

Code:

int iNewCapacity = kLoopUnit.getMoves() * kLoopUnit.getCargoSpace();
int iOldCapacity = GC.getUnitInfo(eExistingUnit).getMoves() * GC.getUnitInfo(eExistingUnit).getCargoSpace();
if (iOldCapacity <= 0)
{iAssaultValue += (600 * iNewCapacity);}

else

{iAssaultValue += (800 * (iNewCapacity - iOldCapacity)) / iOldCapacity;}
That fixed the CTD and allow me to go to the next turn. I would appreciate it if this fix made it into the next UP.
__________________
Breunor is offline   Reply With Quote
Old Sep 29, 2009, 02:13 AM   #2
Skyre Noktis
Warlord
 
Skyre Noktis's Avatar
 
Join Date: Apr 2009
Posts: 271
I came across this problem when modding the naval AI. It does apply to FfH, but the current AI never encounters it because it doesn't know how to use ships properly.
Skyre Noktis is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Project & Mod Development > Civ4 - Fall from Heaven > Would this apply to FfH II?

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ffh Nes Ii Immaculate Never Ending Stories 2767 Nov 08, 2011 10:15 PM
Speeding up FfH II Wyrmhero Civ4 - Fall from Heaven 15 May 13, 2008 01:26 PM
Ffh Ii The_Astrologer Civ4 - Fall from Heaven 2 Sep 05, 2007 06:52 AM
FFH II Game of the Month... Bigben34 Civ4 - Fall from Heaven 1 May 30, 2007 09:45 PM
Ffh II spekkio Civ4 - Macintosh 8 Jul 16, 2006 09:55 AM


Advertisement

All times are GMT -6. The time now is 04:38 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR