• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

AND2 and SVN Bug Reports - A New Dawn 2 ONLY

Take any save where some city has some extra capital commerce ( for example 1 is from WheelWright, 5 from Great Lighthouse etc., so with Great Lighthouse it will be easily visible )
Look at base commerce in City Screen ( when you click on commerce to describe it ).
Run CTRL+SHIFT+T - look how baseCommerce decreased.
If you run it several times you will see it negative.
( this is of course should be done on version before my fixes ).

Yeah, I got it in the meantime; never experienced negative values because I very seldom use recalc but I see that if I do it multiple times I get negative values. Ok, that's clear now and it looks like your fixes are working. Now I'm trying to understand why percentages of domestic and foreign commerce aren't properly calculated in the help inside the city screen. For example I have

123 base commerce
1 from capital connection
8 from domestic connection
20 from foreign connection
-10% from domestic connections from Post Scarcity
+10% from foreign connections from Post Scarcity
+10% from Power
+25% from Civics
+25% from Capital

Total is 243.20, which is correct if I don't take into account that -10% domestic and +10% foreign connections (they are different because one is domestic and the other is foreign connectedness commerce). For some reason, it doesn't calculate that percentage coming from domestic and foreign connectedness. At least it looks so, I'm checking the code now.

Edit: mmm, I think I start to understand; Afforess made this part of the code long ago, from what I can see, there's something weird in
void CvGameTextMgr::setYieldHelp(CvWStringBuffer &szBuffer, CvCity& city, YieldTypes eYieldType)

it looks like iDomesticConnectednessCommerce and iForeignConnectednessCommerce already include civics modifiers, as they are calculated in CvCity.cpp. What is displayed inside the city screen are those values without modifiers but in the process it's probably being rounded, so that value is sometimes wrong. And I'm still not sure the calculation is right toward the end of this function. I need more time (which I'm short of, actually)l
 
Last edited:
What is displayed inside the city screen are those values without modifiers but in the process it's probably being rounded, so that value is sometimes wrong.

Agree, I had exactly the same impression when I first looked at this part of code.
If you have 11 and multiply this on 10% and round you will get 12.10 rounded = 12.
But if then you'll remove this modifier back to calculate 12 / 1.10 = 10.9 and round it you'll get 10. 11 transformed to 10.

So, with all this roundings it is very easy to get incorrect result. And as all this variables are int - they are rounded. You can try change types to double to them and see.
This is just reporting of course, but this is masking some other issues.
 
Agree, I had exactly the same impression when I first looked at this part of code.
If you have 11 and multiply this on 10% and round you will get 12.10 rounded = 12.
But if then you'll remove this modifier back to calculate 12 / 1.10 = 10.9 and round it you'll get 10. 11 transformed to 10.

So, with all this roundings it is very easy to get incorrect result. And as all this variables are int - they are rounded. You can try change types to double to them and see.
This is just reporting of course, but this is masking some other issues.


Ok, the easiest solution I can find for now is to show connectedness commerce with all its modifiers included inside the city screen, the same values that are used to calculate total commerce. I'll leave alone the part where it says "+/- x% from foreign/domestic connectedness due to (civic)", I'll just add a text which explains "already included above". The underlaying problem is that connectedness calculations are a bit too complicated because they depend on many factors (civics, traits, etc); for example there's a part of the code that explains that more buildings in the same city which provide connectedness commerce aren't counted multiple times, but this is not clear in the values shown in city screen. Also something that is not shown in calculations inside the city screen is commerce change caused by imperium or redevelopment. So the best thing to show matching numbers is to use values with modifiers included, provided everyone knows that those values are correct if you take into account every modifier.
 
A fun bug I've found: When loading a custom scenario with already established cities, units, etc, you have to recalc before you gain access to any resources.
 
A fun bug I've found: When loading a custom scenario with already established cities, units, etc, you have to recalc before you gain access to any resources.

That's because mod is not designed for scenarios; the last time a scenario was updated was years ago so they're all outdated compared to current revision. :)
 
Great job guys!
Maybe valergrad can help with other bugs too? Like Movement Limit not always working.

I am newbie, so it requires for me too much time now... So, can't promise.
I currently trying to understand this new interesting bug I've faced right now. Let's call it "invisible trebushet".

On this save that I've attached . If you look at capital - I have two catapults. But if you go to F5 - Military Advisor, you'll see that I actually have also 1 Trebushet.
How this happened that I don't see it at map and can't select? I don't know. But I just bought this Trebushet from Boudica for 360 gold. Usually buying units works fine - you just get unit in your capital. But not this time.
 

Attachments

Is the updater/launcher working for you all? I didn't change anything in rev1088 but for some reason it keeps checking all files again and again saying there was something wrong in the last updating process, so the launcher doesn't work anymore. And for some reason some system files appeared in the main RAND folder, files that usually are inside the checker folder.
 
About this Invisible Trebushet issue - Trebushet probably was in transport when I've bought it.
I've found cycling between units by ',' and '.', and button "unload" was active on him.
So, we need either change this status somehow during buying, or simple restrict to sell units when they are in transport.
 
That's because mod is not designed for scenarios; the last time a scenario was updated was years ago so they're all outdated compared to current revision. :)
Sorry, I didn't make myself clear. You can test this yourself. Load a game that you are playing, go into WB, save it as a scenario. Exit out of game, jump back in, play the scenario you just saved in WB, it will not have resources available to cities until you recalc.
 
Is the updater/launcher working for you all? I didn't change anything in rev1088 but for some reason it keeps checking all files again and again saying there was something wrong in the last updating process, so the launcher doesn't work anymore. And for some reason some system files appeared in the main RAND folder, files that usually are inside the checker folder.

No it isn't. I actually posted in the other topic asking the roughly the same question.
Now... If I do delete the file 0-byte file called "Updating", I can launch the game, and I can load my save, and I can do a recalc to see suddenly all the numbers no longer negative in the city screen (and my science actually skyrocketing to the values I was getting with Leonardo's Workshop "bug") but I can't confirm that yet because ending the turn makes the game crash.
Which is possibly due to the update creating conflicting files, I don't know. I imagine a clean install is needed at this point.

But it's my hope & guess that Valergrad fixes actually "fixed" what I was thinking was a bug with Leonardo's Workshop while it actually was just that my old save, on which I did numerous recalcs (especially when I was hoping it'll fix my "imperium" bug problems) created me quite some negative commerce that was real. Not just "fake" in the city screen.
 
Hello,

Been looking around here for the past few hours, but can't find anything concrete...

(Not even sure if this is where I should put this) but my AND 2.2 build 1087 Standard Speed Game on a Gigantic map (likely the problem) on turn 907 (even more the problem) crashes on clicking next turn, to get to turn 908. The game speed got really bad on the past 150 or so turns, but had not be crashing 100% consistently until this point.

Is there something in the .ini I can change? Or could someone point me in the right direction?

CH
 
Is the updater/launcher working for you all? I didn't change anything in rev1088 but for some reason it keeps checking all files again and again saying there was something wrong in the last updating process, so the launcher doesn't work anymore. And for some reason some system files appeared in the main RAND folder, files that usually are inside the checker folder.
Noup.. cant upadate and I get runtime error for updater
 
Ok, the easiest solution I can find for now is to show connectedness commerce with all its modifiers included inside the city screen, the same values that are used to calculate total commerce. I'll leave alone the part where it says "+/- x% from foreign/domestic connectedness due to (civic)", I'll just add a text which explains "already included above". The underlaying problem is that connectedness calculations are a bit too complicated because they depend on many factors (civics, traits, etc); for example there's a part of the code that explains that more buildings in the same city which provide connectedness commerce aren't counted multiple times, but this is not clear in the values shown in city screen. Also something that is not shown in calculations inside the city screen is commerce change caused by imperium or redevelopment. So the best thing to show matching numbers is to use values with modifiers included, provided everyone knows that those values are correct if you take into account every modifier.

Actually I believe we can fix this and still leave underlying information. We need just to calculate everything correctly, take into account all integer arithmetic and rounding issues, fix all bugs in general.
I've got this problem now in my game ( after I've converted to imperium), so I spent some time with code and I believe I've fixed this ( at least several bugs ) in this reporting.
See how it looked before and after:

upload_2020-4-13_1-26-27.png


So, before foreign city connections are incorrect. It showed 29, but correct value is 30 - it was rounding issue. When you divide to get "before-modifiers" value you need to round to ceil ( and default convertation to integer rounds to floor ). Also if you have several modifiers, you need to sum up all modifiers and divide it once - olny then you'll get "before-modifiers" value. ( this is the reason I've added in code iDomesticConnectednessModifier and iForeignConnectednessModifier variables ).

Also total commerce was incorrect because in code they forgot to add to iBaseProduction extra value appeared after modificators ( civics, traits etc. ). So, I've fixed this.
45°38'N-13°47'E, Could you look? For example check how this works on your complicated save with a lot of traits and modifiers. If it is needed I can explain all changes in skype, for example.

Also as you see, to this modifiers I am showing not only percentage, but extra value that we got. For example, we have foreign commerce 30, imperium add 33% = this means 9.90 rounded to 9 extra value. So I am showing +33%(9) - this required several small fixes in XML.

Sending you changed files: CvGameTextMgr.txt it is of course should be renamed to .cpp.
XMLs are from XML/Text
 

Attachments

Great work!

Just a little cosmetics thing.

Maybe
+33% :commerce: from foreign city connections due to Imperium (+9:commerce:)
would be clearer.

Agree, that looks better. Good part that it can be done just by changing .xml-s. Bad part that there are 17 languages there)
 
Actually I believe we can fix this and still leave underlying information. We need just to calculate everything correctly, take into account all integer arithmetic and rounding issues, fix all bugs in general.
I've got this problem now in my game ( after I've converted to imperium), so I spent some time with code and I believe I've fixed this ( at least several bugs ) in this reporting.
See how it looked before and after:

View attachment 551942

So, before foreign city connections are incorrect. It showed 29, but correct value is 30 - it was rounding issue. When you divide to get "before-modifiers" value you need to round to ceil ( and default convertation to integer rounds to floor ). Also if you have several modifiers, you need to sum up all modifiers and divide it once - olny then you'll get "before-modifiers" value. ( this is the reason I've added in code iDomesticConnectednessModifier and iForeignConnectednessModifier variables ).

Also total commerce was incorrect because in code they forgot to add to iBaseProduction extra value appeared after modificators ( civics, traits etc. ). So, I've fixed this.
45°38'N-13°47'E, Could you look? For example check how this works on your complicated save with a lot of traits and modifiers. If it is needed I can explain all changes in skype, for example.

Also as you see, to this modifiers I am showing not only percentage, but extra value that we got. For example, we have foreign commerce 30, imperium add 33% = this means 9.90 rounded to 9 extra value. So I am showing +33%(9) - this required several small fixes in XML.

Sending you changed files: CvGameTextMgr.txt it is of course should be renamed to .cpp.
XMLs are from XML/Text

Thanks valergrad, I'll have a look and will run some test to check everything works smoothly. If everything goes well, I'll release a new revision. Thanks again.
 
About the installer/launcher, as @Zepolak suggested above, just delete "updating" file in main RAND folder. The mod gets updated when running the updater, but for some reason that file is not being deleted and hence the launcher thinks the update is not complete (while in fact it is). I'll try to understand what's broken in the launcher/installer/updater but it might take some time. For now, just delete that file after you've updated the mod.
 
Back
Top Bottom