[We the People] Bug reporting

I found the cause of the problem myself:
As I said here, it is already fixed. :)
A single look at the code was enough to spot the bug.

The only problem is that I currently can not commit. (Since I am in the middle of an implementation.)
I have 20 hours of work ahead of me, before my current implementation is finished and I can commit it.

In that process the bugfix will be commited as well.
Thanks again for reporting. :thumbsup:

Maybe it is not a good idea to allow cities so close the map border, I suspect this could cause all kinds of problems ...?
No, not really. You just need to code cleanly which in this case I had not. :)
(It was just a slopiness to not check for pPlot is not Null.)

Happens sometimes, but Null-Pointers are usually easy to find and fix.
(Once you know the method that crashes you can usually spot it at first sight.)
 
Last edited:
Another bug in "Plains":
The newly uploaded Americas Huge map has a "boreal forest" bonus on top of jungle terrain (to the right of the Missisippi river estuary). Sending a colonist to work there will crash the game. Changing the terrain bonus to "giant trees" will avoid the crash.
(Different backtraces depending on how I send them to work there - drag&drop or select job)
 
No, not really. You just need to code cleanly which in this case I had not. :)
(It was just a slopiness to not check for pPlot is not Null.)

Happens sometimes, but Null-Pointers are usually easy to find and fix.
(Once you know the method that crashes you can usually spot it at first sight.)

I did realise that checking for the pointer being NULL might fix the crash, but I don't really know the Civ4Col code, so I wasn't sure if there should be a nullptr return in the first place. So I was asking myself if checking for NULL might just be a "symptom fix", that is why I posted the additional information ...
But if you're sure settlements on the border are ok for everything else then this fix is fine :)
 
Another bug in "Plains":
The newly uploaded Americas Huge map has a "boreal forest" bonus on top of jungle terrain (to the right of the Missisippi river estuary).
@jooe
Please give a screenshot so it is easier to find. :thumbsup:

@Mr. ZorG
Could you please take care of this, I am drowning in work right now. :hug:
 
So I was asking myself if checking for NULL might just be a "symptom fix" ...
No, that is normal C++ programming. :)

It is not a "symptom fix", you need to check them everywhere they might occur. Basically almost everywhere you access objects.
The code literally has thousands of NULL-Pointer checks. (NULL-Pointers is pretty normal in C++. But again also easy to notice and fix normally.)
 
Please give a screenshot so it is easier to find. :thumbsup:

This might help:
Americas Huge.ColonizationWBSave:24152
Code:
BeginPlot
   x=27,y=75
   BonusType=BONUS_BOREAL_FOREST
   FeatureType=FEATURE_JUNGLE, FeatureVariety=0
   TerrainType=TERRAIN_MARSH
   PlotType=2
   TeamReveal=15,
EndPlot

should be changed to:
Code:
BonusType=BONUS_GIANT_TREE
 
@Mr. ZorG
Could you please take care of this, I am drowning in work right now. :hug:
fixed. I will send the file to Slack chat.

by the way, there are a couple more points.
1- pearl reef. the map does not show in any way that pearls can be mined there.
upload_2021-12-29_10-55-53.png

2 - there is a resource "sea otters". however, it is impossible to appoint a colonist to extract premium fur from them.
upload_2021-12-29_10-54-41.png

upload_2021-12-29_10-59-48.png

although it is still possible to mine premium fur on the ground.
 
1- pearl reef. the map does not show in any way that pearls can be mined there.
Activate Yield display. :thumbsup:

there is a resource "sea otters". however, it is impossible to appoint a colonist to extract premium fur from them.
Sea Otters are now:
Lakes, Large Rivers, Ice Lakes...

They are not valid anymore for:
Coast, Shallow Coast ...

----

By the way guys:

STOP sending bugs of "Fixed Scenario Maps" from "Plains" please.
There is absolutley no point in it right now.

The Maps in Plains have not yet been corrected.
And especially the "Fixed Versions" might even have to be recreated from almost scratch.
Until this has happened there is absolutely no point in "bug reports" of Maps in Plains.

In 2 months, after we corrected the Maps, we may talk about bugs of Maps.
But before somebody corrected them all systematically, this is wasted time.

As I said uncounted times:
"Plains" is an "alpha" for feature development. It is not ready to be played regularly.
(e.g. nobody invested yet any systematic effort to correct maps.)

----

Summary:

Too much has changed in the maps anyways, Terrains, Terrain Features, Bonus Ressources, ...
Most likely the "Fixed Scenario Maps versions" (with fixed Terrain Features and fixed Bonus Ressources) need to be thrown away completely or completely overhauled from scratch.
The "Random Scenario Maps versions" (with random Terrain Features and random Bonus Ressources) will still work by just adjusting the base Terrains.
 
Last edited:
if you look at the screenshot I attached, you can see that they are enabled.
You activated "Bonus Ressource Display", but you did not activate "Yield Display".
"Pearl Reef" is a Feature (like a Forrest), it is not a "Bonus Ressource" (like Deer).

-----
Please do as I said:
Activate "Yield Display". :thumbsup:

"Yield Display" ---> show all the small "Yield Icons" on the screen.
 
I finally found some time to try fixing the bug I reported in #1078 above.

There are a few more code locations where pPlot is not checked for being NULL, I found:
CvCity::getCityHealthChangeFromRessourcesInCityRadius()
CvCity::getMonasteryCrossBonusForCity()
CvCity::getFortDefenseBonusForCity()
CvCity::getImprovementFoodModifierForCity()
CvCity::getImprovementHammersModifierForCity()
CvCity::getImprovementToolsModifierForCity()

Fixing all of these places by a check for (pPlot != NULL) allows cities to be founded directly adjacent to the map border.

I have a git diff for this, but I have no experience with github pull requests, so I'm just posting it here as code in case someone would like to apply the fix.
Spoiler :
Code:
diff --git a/Project Files/DLLSources/CvCity.cpp b/Project Files/DLLSources/CvCity.cpp
index 84305a77..12ee1bf1 100644
--- a/Project Files/DLLSources/CvCity.cpp  
+++ b/Project Files/DLLSources/CvCity.cpp  
@@ -9389,8 +9389,8 @@ int CvCity::getCityHealthChangeFromRessourcesInCityRadius() const
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
-      
+       if(CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
             if(pLoopPlot->getBonusType() != NO_BONUS)
             {
                 // only if worked
@@ -9400,6 +9400,7 @@ int CvCity::getCityHealthChangeFromRessourcesInCityRadius() const
                 }
             }
         }
+   }
     return iCityHealthChangeFromRessourcesInCityRadius;
 }
@@ -9469,7 +9470,8 @@ int CvCity::getMonasteryCrossBonusForCity() const
     int iMonsasteryCrossBonusModifier = GC.getDefineINT("MONASTERY_CROSSES_MODIFIER_FOR_CITY");
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
+       if (CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
             // if it has a Monastery and a Missionary in it
             if(pLoopPlot->isMonastery() && (pLoopPlot->getMonasteryMissionary() != NULL))
             {
@@ -9485,6 +9487,7 @@ int CvCity::getMonasteryCrossBonusForCity() const
                 }
             }
         }
+   }
     return iMonsasteryCrossBonus;
 }
@@ -9500,7 +9503,8 @@ int CvCity::getFortDefenseBonusForCity() const
     int iFortDefenseBonusModifier = GC.getDefineINT("FORT_DEFENSE_MODIFIER_FOR_CITY");
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
+       if (CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
                                 // if it has a Fort that is protected
             if(pLoopPlot->isFort() && (pLoopPlot->getFortDefender() != NULL))
             {
@@ -9516,6 +9520,7 @@ int CvCity::getFortDefenseBonusForCity() const
                 }
             }
         }
+   }
     return iFortDefenseBonus;
 }
 // WTP, ray, Improvements give Bonus to their City - END
@@ -9533,7 +9538,8 @@ int CvCity::getImprovementFoodModifierForCity() const
     int FoodModifierForCity = 0;
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
+       if(CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
             ImprovementTypes eImprovement = pLoopPlot->getImprovementType();
             if(eImprovement != NO_IMPROVEMENT)
             {
@@ -9548,6 +9554,7 @@ int CvCity::getImprovementFoodModifierForCity() const
                 }
             }
         }
+   }
     return FoodModifierForCity;
 }
@@ -9562,7 +9569,8 @@ int CvCity::getImprovementHammersModifierForCity() const
     int HammersModifierForCity = 0;
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
+       if(CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
             ImprovementTypes eImprovement = pLoopPlot->getImprovementType();
             if(eImprovement != NO_IMPROVEMENT)
             {
@@ -9577,6 +9585,7 @@ int CvCity::getImprovementHammersModifierForCity() const
                 }
             }
         }
+   }
     return HammersModifierForCity;
 }
@@ -9591,7 +9600,8 @@ int CvCity::getImprovementToolsModifierForCity() const
     int ToolsModifierForCity = 0;
     for (int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
     {
-       CvPlot* pLoopPlot = getCityIndexPlot(iJ);
+       if(CvPlot* pLoopPlot = getCityIndexPlot(iJ))
+       {
             ImprovementTypes eImprovement = pLoopPlot->getImprovementType();
             if(eImprovement != NO_IMPROVEMENT)
             {
@@ -9606,6 +9616,7 @@ int CvCity::getImprovementToolsModifierForCity() const
                 }
             }
         }
+   }
     return ToolsModifierForCity;
 }
 // WTP, ray, Improvements give Bonus to their City - PART 2 - END
 
Last edited:
Next CTD bug in "Plains":
PUF_makeInfoBarDirty is for some reason called with (pUnit = NULL)
If I add a NULL check here, the game crashes when CvUnit->plot() is called (no idea from where, I don't get a complete backtrace).

//EDIT: seems it might be connected with units of the Cherokee player, at least trying to switch to that player does cause some errors before the crash ...

Save game attached. (will trigger after clicking next turn)
 

Attachments

Last edited:
There are a few more code locations where pPlot is not checked for being NULL, I found:
Thanks for reporting. :thumbsup:
I will fix those in "Plains".

As I said, I am currently still working on something big and my code is full of unfinished stuff.
(Thus at the moment not able to commit source code until my current implementation is done.)

EDIT:
The CTD (Nullpointers) here are now all fixed. :)
(It is just not commited as explained above.)

CvCity::getCityHealthChangeFromRessourcesInCityRadius()
CvCity::getMonasteryCrossBonusForCity()
CvCity::getFortDefenseBonusForCity()
CvCity::getImprovementFoodModifierForCity()
CvCity::getImprovementHammersModifierForCity()
CvCity::getImprovementToolsModifierForCity()

-----

I have a git diff for this, but I have no experience with github pull requests,

That is not necessary. It is all already fixed now. :)
All I needed to know was the names of the methods (to check them again). :thumbsup:
 
Last edited:
Next CTD bug in "Plains":
@Nightinggale
Could you please check this one here the next days?
I am really drowning in work right now and can not handle too many things in parallel.
 
@jooe
Since you are now modding as well, would you like to join our internal WTP modding community (team chat)?
If yes, please send me a private conversation message here at CivFanatics and tell me your eMail so I can send you the invitation to our team chat.

Just to avoid any misunderstanding:
Do NOT post your eMail publically in any forum post.
(Sorry, but I learned to be careful with this. It happened once.)
 
My game always crashes at the exact same turn and I cannot seem to change this. Is there a way to fix this?
Up until this point it was a great game. Thanks for your great work!
 

Attachments

My game always crashes at the exact same turn and I cannot seem to change this. Is there a way to fix this?
Up until this point it was a great game. Thanks for your great work!
Hi Latitudero,
could you give us a little bit more information? What version of the mod are you using now? (3.0.1?)
Are you using the Steam version of the game or the "Original version" as described here?
Do you get any error messages when it crashes?
I could then try to look into it with the exact same settings you are using ...
 
Hi Latitudero,
could you give us a little bit more information? What version of the mod are you using now? (3.0.1?)
Are you using the Steam version of the game or the "Original version" as described here?
Do you get any error messages when it crashes?
I could then try to look into it with the exact same settings you are using ...

Of course: I am using the newest Steam version of the game and WTP 3.01. I don’t get any error messages. After loading for about 2 seconds after end of turn it crashes straight to desktop.

I assume some AI-move happens which leads to the crash but I leave further analysis to the experts.

I tried to go a few moves back but it still crashes after the end of the same turn.

I just saw the advice regarding not using the newest steam version. Maybe it solves the problem, I will check that out asap.

EDIT: I tested using the "Original version". Still the same problem.
 
Last edited:
EDIT: I tested using the "Original version".
Please continue to use the "Original version" only - if you do not you will definitely have bugs in the next release. :)

Still the same problem.
Thanks for trying, so we are already smarter that it is not related to Steam version. :thumbsup:
Ok, then the only thing that will help is to debug the save.

-----

@jooe
Thanks for offering to check / debug this savegame. :hug:
It does not hurry though, it is already almost new year. :crazyeye:
 
Back
Top Bottom