"Hide Obsolete Workers Action" BUG option glitch.

raxo2222

Time Traveller
Joined
Jun 10, 2011
Messages
9,778
Location
Poland
It seems like this option unnecessarily hides some worker actions ranging from sea tunnel to space improvement actions.
This glitch is pretty ancient - I remember it from Rise of Mankind.
Spoiler :

3UXnGEw.jpg

Aty0lLt.jpg


xqnvtZk.jpg

QM72IJx.jpg


No idea why this option would hide sea tunnels for example.

It seems like this option thinks routes evolve linearly, while there are routes dedicated to sea and space not necessarily buildable by every worker.
 
Last edited:
Yeah, known bug. You're probably right about the reason for the problem, and that's an issue for other project concepts lying in storage here. But I've never taken a look into this bug, nor into the processing for this option. I'm not sure if it's python or code based but I suspect it's in python somewhere as I've never stumbled across reference to the option in the code.
 
It seems like this option thinks routes evolve linearly, while there are routes dedicated to sea and space not necessarily buildable by every worker.
Routes do evolve linearly. That is why we had to get rid of some of the routes in RoM. The workers would spend all their time changing from one rout to the other because the XML had them at the same level and it could not cope with it.
 
Routes do evolve linearly. That is why we had to get rid of some of the routes in RoM. The workers would spend all their time changing from one rout to the other because the XML had them at the same level and it could not cope with it.
Yeah but we need to address that in the code wherever it's an issue. There are a few places where I'd like it NOT to evolve linearly and the tunnels are just one example of routes not always being entirely linear. Tunnels remain valid long after the next 'level' of route emerges.
 
Routes do evolve linearly. That is why we had to get rid of some of the routes in RoM. The workers would spend all their time changing from one rout to the other because the XML had them at the same level and it could not cope with it.
What about space routes? Each ome seems to be specialised except last one that is meant to replace all space routes.
 
Code for this faulty Hide Obsolete Option is in CvPlayer.cpp at line 11114
Code:
if (isModderOption(MODDEROPTION_HIDE_OBSOLETE_BUILDS))
    {
        if (kBuild.getRoute() != NO_ROUTE)
        {
            for (int iI = 0; iI < GC.getNumRouteInfos(); iI++)
            {
                if (GC.getRouteInfo((RouteTypes)iI).getMovementCost() < GC.getRouteInfo((RouteTypes)kBuild.getRoute()).getMovementCost())
                {
                    for (int iJ = 0; iJ < GC.getNumBuildInfos(); iJ++)
                    {
                        if (GC.getBuildInfo((BuildTypes)iJ).getRoute() == iI)
                        {
                            if (!GC.getRouteInfo((RouteTypes)GC.getBuildInfo((BuildTypes)iJ).getRoute()).isSeaTunnel())
                            {
                                if (!GC.getBuildInfo((BuildTypes)iJ).isHideObsoleteExempt())
                                {
                                    if (canBuild(pPlot, (BuildTypes)iJ, false))
                                    {
                                        return false;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        if (kBuild.getImprovement() != NO_IMPROVEMENT)
        {
            for (int iI = 0; iI < GC.getNumImprovementInfos(); iI++)
            {
                if (GC.getImprovementInfo((ImprovementTypes)kBuild.getImprovement()).getImprovementUpgrade() == iI)
                {
                    for (int iJ = 0; iJ < GC.getNumBuildInfos(); iJ++)
                    {
                        if (GC.getBuildInfo((BuildTypes)iJ).getImprovement() == iI)
                        {
                            if (!GC.getBuildInfo((BuildTypes)iJ).isHideObsoleteExempt())
                            {
                                if (canBuild(pPlot, (BuildTypes)iJ, false))
                                {
                                    return false;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Posting it here, so thunderbrd can find it later.

It assumes routes upgrade linearly, but it isn't such case.
Exception for tunnels isn't working, also there is plenty of space terrain routes.

Kation, cleanup Python folder.

I'll try to see if I can do something about this, am I correct to assume there are three independent categories? Those being normal ones (roads, railways), space ones (hyperlanes, aspatial routes) and a special one for sea tunnels?
 
There are only 3 of those Options I will ever Check (X) the box; Hide Unconstructable, Hide Untrainable, and Hide Unavailable. Checking the others just invites problems imho and experience.
 
I'll try to see if I can do something about this, am I correct to assume there are three independent categories? Those being normal ones (roads, railways), space ones (hyperlanes, aspatial routes) and a special one for sea tunnels?
Technically there are no real categories for this and that's part of the problem. There cannot be multiple route types on a particular plot (which is frustrating since I'd love to make rails and power lines different types entirely that can overlap - but then I've been warned of the complexity that presents with graphics that may not be so easily resolved.) It was all setup with the assumption, throughout the AI and more, that routes were only ever going to be a linear progression of unlocking improvements over the previous type. For the sake of making tunnels visible for workers it's not THAT hard... just means we need to make tunnels an exception to the rule of obsoletion where that obsoletion takes place. The route infos I believe has a tag that specifies the route type as a tunnel. So it's not a category, per se, but it can be an isolated detail that you can use as a category of sorts. If you want space routes to differ from terrestrial routes, might take yet further inventive ways of addressing things, perhaps including adding a new tag to identify a route type as a space route from a normal route. Might already be one but I'm not sure. I know there's MapCategoryType and perhaps that can be the categorization you need to work with to make that work.
 
This "Hide Obsolete Worker's Actions" also hides certain worker build actions - they don't upgrade linearly at certain points, but split somewhere.
@strategyonly had problems with it - he couldn't build stone tools workshop on mountain with work mules before Mountaineering (mountain mine) and after regular mines were available.
 
I don't plan to do anything ambitious, to start just make it so that the button for tunnels shows concurrently with the others.
 
I don't plan to do anything ambitious, to start just make it so that the button for tunnels shows concurrently with the others.
That'd be helpful for sure.
 
Back
Top Bottom