Culture problem by loading scenarios ?!

xaster

Warlord
Joined
Oct 5, 2003
Messages
128
Hi all,
I think i just found an issue in the culture system, but not sure.
Is it possible that a city losing the culture at plots ??!?! LINK

I have an existing gamesave and create a new worldbuildersave from this.
So simple to say this is a scenario. The citys have a higher culture already around 40-60k.
When I load a new game with this scenario the citys losing culture at plots and cannot get it back :cry:

Does somebody have the same issue with K-Mod?
May this is related to the new K-Mod culture system ?
 
here is another screenshot by using the worldbuilder and K-mod without any modification or something.
Just a city and move the culture from 0 to 45000, this is total mad :wallbash: LINK

This issue is not visible with unmodded BTS or Next War.
So the K-Mod Culture System seems to be incorrect. Is there a chance to turn it of in XML or something ?

@f1rpo, I checked your Advanced Civ mod and shows the same issue as well :hmm:
 
Last edited:
I can reproduce this. It's an integer overflow in CvCity::doPlotCultureTimes100, a function "essentially rewritten for K-Mod" according to a comment. You should be able to work around it by adding the culture in smaller chunks. I've tried 25000 at a time and it worked correctly. Since Great Artists don't add that much culture at once, I don't think this can ever be a problem in a regular game, but it would still be better to fix it in the K-Mod DLL:
Spoiler :
// K-Mod code:
//int iCultureToAdd = iCultureRateTimes100*((iScale-1)*(iDistance-iCultureRange)*(iDistance-iCultureRange) + iCultureRange*iCultureRange)/ (100*iCultureRange*iCultureRange);
// Replacement:
double dCultureToAdd = iCultureRateTimes100 / (100.0*iCultureRange*iCultureRange);
int delta = iDistance-iCultureRange;
dCultureToAdd *= (iScale-1)*delta*delta + iCultureRange*iCultureRange;
int iCultureToAdd = (int)dCultureToAdd;
 
@f1rpo very nice and smart :goodjob: Happy to have such a good supporter here.
will apply this DDL fix soon :eek:
If this works it will be essencial for scenarios when citys are build with higher culture already!!!!
Do you will use this new code in next Advanced Civ version as well?
 
Last edited:
@f1rpo, I just apply your new code to the CvCity.cpp in DLL

Code:
//
K-Mod code:
                            int iCultureToAdd =
                                iCultureRateTimes100*((iScale-1)*(iDistance-iCultureRange)*(iDistance-iCultureRange) + iCultureRange*iCultureRange)/(100*iCultureRange*iCultureRange);


// f1rpo Replacement:
                            double dCultureToAdd = iCultureRateTimes100 / (100.0*iCultureRange*iCultureRange);
                            int delta = iDistance-iCultureRange;
                            dCultureToAdd *= (iScale-1)*delta*delta + iCultureRange*iCultureRange;
                            int iCultureToAdd = (int)dCultureToAdd;

Compile the DLL and test it quickly with a new game, Setup one city with worldbuilder and add 10 000 000 culture at one time......:crazyeye:
It looks like that the culture borders are correctly now :thumbsup:
Please check the code at your machine as well. For the moment, it seems for me you get it fixed once again !!!!:bowdown::worship::clap:


EDIT.... just to make it complete :lol:
At a single culture adding of 2 700 000 the world view losing some plots LINK
But at the out zoom only.... the play map has still all in player culture :thumbsup:

 
Last edited:
Top Bottom