Single Player bugs and crashes v40 download - After Oct 2019

@Toffer90 it appears your recent change (mountains game option cleanup) broke rivers - they don't give fresh water anymore.

Spoiler :

Civ4BeyondSword 2019-12-28 19-12-45-98.png
Civ4BeyondSword 2019-12-28 19-15-42-88.png

 

Attachments

@Toffer90 it appears your recent change (mountains game option cleanup) broke rivers - they don't give fresh water anymore.

I'm showing fresh water on all those tiles. I've made a few local code changes but I don't see why my changes would have impacted those particular plots... well... if I do, then it's possible that I need to check another scenario.

EDIT: Nope... seems it all appears to be working right now. I'll commit what I've changed and you can check against the difference. I'm not sure why my adjustment would have fixed things but there's a few spots with some odd logic that I ironed out and although I'm not sure how it would've caused the plots you show to not have access to fresh water, somehow it sorts it out.
 
I'm showing fresh water on all those tiles. I've made a few local code changes but I don't see why my changes would have impacted those particular plots... well... if I do, then it's possible that I need to check another scenario.
Update to latest github/SVN version.

It won't show, that its fresh water plot, as showed in screenshot.
This may be related.
 
Update to latest github/SVN version.

It won't show, that its fresh water plot, as showed in screenshot.
This may be related.
I'm on the latest. Of course.

EDIT: Well... I thought I was... I did a pull but now trying to push my commit it's telling me I'm not up to date. Ugh.. will check again. Either way, what I changed will help for some future stuff.
 
EDIT: Nope... seems it all appears to be working right now. I'll commit what I've changed and you can check against the difference. I'm not sure why my adjustment would have fixed things but there's a few spots with some odd logic that I ironed out and although I'm not sure how it would've caused the plots you show to not have access to fresh water, somehow it sorts it out.
You're the one that pushed the change to master, but yeah, I'll look into the possibility one of the changes in that pull request may cause the fresh water strangeness.
Well, I didn't notice weirdness with fresh water in beginning.

TB, I guess code was bit wonky somewhere.
 
Well, I didn't notice weirdness with fresh water in beginning.

TB, I guess code was bit wonky somewhere.
Yeah I don't know what happened with my first pull... is it possible that it only pulls part of the updates then later you have to again? That was weird.

Anyhow... now that I check again, indeed there seems to be a problem still. How python is at all related to that is... baffling.

OH - NOW I can see more change histories on CvPlot... there may be something here to find that explains this.
 
Yeah I don't know what happened with my first pull... is it possible that it only pulls part of the updates then later you have to again? That was weird.

Anyhow... now that I check again, indeed there seems to be a problem still. How python is at all related to that is... baffling.

OH - NOW I can see more change histories on CvPlot... there may be something here to find that explains this.
This didn't fix fresh water issue on plots yet - rivers don't provide fresh water, same with lakes, peaks and ice feature.
 
Code:
    if (!GC.getGameINLINE().isOption(GAMEOPTION_MOUNTAINS))
    {
        if (isPeak2(true))
        {
            return true;
        }
    }
    else if (isPeak2(true))
    {
        if (eTeam == NO_TEAM || !GET_TEAM(eTeam).isCanPassPeaks())
        {
            return true;
        }
    }
!=
Code:
    if (eTeam == NO_TEAM || isPeak2(true) && !GET_TEAM(eTeam).isCanPassPeaks())
    {
        return true;
    }
That's one item... may not be THE item... but it's one item.

Should be:
if (isPeak2(true) && (eTeam == NO_TEAM || !GET_TEAM(eTeam).isCanPassPeaks()))
{
return true;
}
The first check is if it's a peak, not if it's a plot owned by a team. The check if its a plot owned by a team is not necessary unless we know the plot is a peak already. This might make plots that aren't owned completely impassable entirely. I'm not sure how the || and && come up in the hierarchy of the statement evaluations though.

This may well be the issue. Checking on that now.

Yeah, that's the issue but I still have it a little wrong. Should be:
Code:
bool CvPlot::isImpassable(TeamTypes eTeam) const
{
    if (isPeak2(true))
    {
        if (eTeam != NO_TEAM && GET_TEAM(eTeam).isCanPassPeaks())
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    if (getTerrainType() == NO_TERRAIN)
    {
        return false;
    }

    return ((getFeatureType() == NO_FEATURE) ? GC.getTerrainInfo(getTerrainType()).isImpassable() : GC.getFeatureInfo(getFeatureType()).isImpassable());
}
This might not be the 'cleanest' way to express it all on one line but I usually find that such attempts just obfuscate the logic further anyhow. Easier to think through the steps of validation when they are more clearly isolated from each other.

EDIT: Actually... STILL not enough... I need to add the team definition and not let it go to default when checking isImpassable()...:
Code:
    TeamTypes eTeam = getTeam();

    if (isWater() || isImpassable(eTeam))
 
Last edited:
If it's not already fixed here's my first comment:
I just took quick look. Each city has an int to represent fresh water. That int is changed in one spot in the code - during the CvCity:: processBuilding() method.
I'm not sure if stuff will check the plot or the city for fresh water.
If something like building req checks the city int then the plot doesn't matter atm because the int can only be changed by buildings.

If you guys wanna make mountain plots fresh water if it has a city and an adjacent fresh water plot I think I can do that but it may not fix problem.
 
Last edited:
If it's not already fixed here's my first comment:

I'm not sure if stuff will check the plot or the city for fresh water.
If something like building req checks the city int then the plot doesn't matter atm because the int can only be changed by buildings.

If you guys wanna make mountain plots fresh water if it has a city and an adjacent fresh water plot I think I can do that but it may not fix problem.
It works for rivers and lakes now.

Peaks themselves aren't considered as source of fresh water.
 
I'm not sure if stuff will check the plot or the city for fresh water
Depends on the stuff. Buildings (for prereqs) check the city but were checking the plot the city is on and that was a part of the problem. The rest of the problem was in the plot itself and a few rules regarding peaks were being problematic from way back, and also in how a few rule rewrites were written recently that were causing major problems for almost all the plots in the game.
If something like building req checks the city int then the plot doesn't matter atm because the int can only be changed by buildings.
Ultimately, although it's a little 'taking the long road', cities were being checked by the plot check so it would ask the plot which would in turn ask the city... oy vey. That somewhat makes sense still though in one place I just said, check the city instead.

But the bugs we were really trying to address were more numerous than just prereqs.
If you guys wanna make mountain plots fresh water if it has a city and an adjacent fresh water plot I think I can do that but it may not fix problem.
The rule settles on enabling peaks to potentially have freshwater access if:
a) It's a city that has freshwater access
or
b) It's a plot that would have freshwater access normally AND the player is at a tech level that enables peaks to be passed by units. Otherwise, if the plot is normally impassable, it does not qualify for freshwater access.
 
The rule settles on enabling peaks to potentially have freshwater access if:
a) It's a city that has freshwater access
or
b) It's a plot that would have freshwater access normally AND the player is at a tech level that enables peaks to be passed by units. Otherwise, if the plot is normally impassable, it does not qualify for freshwater access.

I settled on peak in that information era save, didn't get access to fresh water, so I can't build water pipes in that city on peak, that isn't considered as tile with fresh water.

By the way free building tag seems to be inconsistent with adding buildings, as if only some requirements are ignored when adding free buildings to new city.
That save had water department NW built, and city on peak got some buildings but not water pipes.

There are fresh water providing buildings:
Aqueduct - obsoletes at Megacities (Information)
Town Well - obsoletes at Clockworks (Medieval) -> Artesian Well - obsoletes at Civil Engineering (Industrial)
Cistern - obsoletes at Agricultural Engineering (Industrial) -> Reservoir (no obsoletion, needs Steam Power tech, and Marble/Stone/Brick/Cement, no other requirements)
 
Last edited:
I settled on peak in that information era save, didn't get access to fresh water, so I can't build water pipes in that city on peak, that isn't considered as tile with fresh water.
Cities alone do not give access to fresh water. If there isn't a river or water source next to the city, even if on a peak, it doesn't automatically get that.

Can you build that Reservoir?
Reservoir (no obsoletion, needs Steam Power tech, and Marble/Stone/Brick/Cement, no other requirements)

By the way free building tag seems to be inconsistent with adding buildings, as if only some requirements are ignored when adding free buildings to new city.
Are we sure that the free building tag is inconsistent or that perhaps it was that the fresh water access was being denied to cities if they were on hills or peaks? It appeared that was potentially the case. Most of the bugs we've had reported on this was about the pipes and perhaps other fresh water issues.
 
Cities alone do not give access to fresh water. If there isn't a river or water source next to the city, even if on a peak, it doesn't automatically get that.

Can you build that Reservoir?



Are we sure that the free building tag is inconsistent or that perhaps it was that the fresh water access was being denied to cities if they were on hills or peaks? It appeared that was potentially the case. Most of the bugs we've had reported on this was about the pipes and perhaps other fresh water issues.
Reservoir needs pop size of 6, when newly placed city has pop size of 3 in Information era, it will take a while on that 6000 turn long game.

And looks like free buildings must respect fresh water requirement unlike other requirements (water pipes needs fresh water, and it is free building given by Water Department NW).
Free buildings ignore population and building requirements.
Fresh water requirement isn't ignored, otherwise Water Pipes would be automatically built, since it is given for free as Water Department is built.
No idea if terrain/feature requirements are ignored by free building tag.
Spoiler :

Civ4BeyondSword 2019-12-28 22-29-01-67.png

 

Attachments

Last edited:
Reservoir needs pop size of 6, when newly placed city has pop size of 3 in Information era, it will take a while on that 6000 turn long game.

And looks like free buildings must respect fresh water requirement unlike other requirements.
Most free buildings do need to respect requirements... it sorta depends on the prereq and how it's applied. It's on a tag by tag rule basis that really should be mapped out again at some point for modders to refer to.

In the modern world, one of the first things you'd do is build a well in a new city to give public access. the Size requirement makes sense for an upgrade but a Pumphouse building or something that would be accessed at the first population seems in order before it would later be upgraded to support a larger community. I wonder how we could require the upgrading...
 
Back
Top Bottom