[SDK] changing city culture border shape

I don't think so. I recall having searched - in vain - for a way to show the borders in Globe view. Cultural borders are apparently not tied to AreaBorderLayers, PlotStyleTypes and CvGame::updateColoredPlots. I also don't think there's a way to disable cultural borders in non-Globe view. So, at most, one could try putting a different graphical representation (through updateColoredPlots) on top of (or underneath) the borders drawn by the EXE.
 
hummm

how about,
color the plot, when setculture for plot is fired?
ina function call similar to your nukerange?


Code:
//keldath - color city states plots
void CvGame::updateCityStatesColoredPlots(CvPlot const* pPlot) const
{
  
   CvDLLEngineIFaceBase& kEngine = *gDLL->getEngineIFace();
    CvDLLInterfaceIFaceBase& kUI = gDLL->UI();
    CvDLLEngineIFaceBase& kEngine = *gDLL->getEngineIFace();
    CvDLLInterfaceIFaceBase& kUI = gDLL->UI();

    kEngine.clearAreaBorderPlots(AREA_BORDER_LAYER_RANGED);
 
    NiColorA color(GC.getInfo(GC.getColorType("YELLOW")).getColor());
    color.a = 0.5f;
    kEngine.fillAreaBorderPlot(pPlot->getX(), pPlot->getY(),
        color, AREA_BORDER_LAYER_RANGED);
}

( i saw there are some python caller fn, i wonder if i need it)
and in setculture:

Code:
if (getCultureLevel() != NO_CULTURELEVEL)
    {
        for (ScanLinePlotIterator itPlot(getPlot(), getCultureLevel());
            itPlot.hasNext(); ++itPlot)
        {
            int iCultureRange = cultureDistance(itPlot.currXDist(), itPlot.currYDist());
            if (iCultureRange > eOldValue && iCultureRange <= getCultureLevel())
            {
                FAssert(iCultureRange <= GC.getNumCultureLevelInfos());
                itPlot->changeCultureRangeCities(getOwner(), (CultureLevelTypes)
                        iCultureRange, 1, bUpdatePlotGroups);

                updateCityStatesColoredPlots(itPlot);
            }
        }

i also tried addColoredPlot
but it didnt color the plots . strange.
 
Last edited:
Maybe because you clear the entire AREA_BORDER_LAYER_RANGED each time that you color a single plot. If you want to do the update outside of updateColoredPlots, then I think you'll need to add a new AreaBorderLayers enumerator in CvEnums.h. Because updateColoredPlots will clear the RANGED layer, and that'll remove whatever color you've added elsewhere. Either way, CvPlot::setOwner is probably the function where the update should be triggered, not setCulture. The (cultural) owner of a plot can change without a change in plot culture, e.g. when a vassal agreement is signed (vassal cities can then no longer steal plots from the master).

(In case that someone is puzzled by the code snippets: they're from the AdvCiv mod. There's no ScanLinePlotIterator in BtS, and no CvDLLUtilityIFaceBase::UI function.)
 
hey,

yup i added new enums already.
also moved to setowner, thanks.

Code:
//keldath - color city states plots - START
    NiColorA color = GC.getInfo(GC.getInfo(GET_PLAYER(getOwner()).getPlayerColor()).getColorTypePrimary()).getColor();
    bool changeIt = false;
    if (!isOwned())
    {
        // color default, but it is ignored -> its cause i didnt know how to give it a defaul null - int to plot error something
        color = (GC.getInfo(GC.getColorType("black")).getColor());
        changeIt = true;
    }
    GC.getGame().updateCityStatesColoredPlots(changeIt, *this, color);
//keldath - color city states plots - END

and :

Code:
//keldath - color city states plots
void CvGame::updateCityStatesColoredPlots(bool clearPlot, CvPlot const& kPlot, NiColorA &color) const
{
    CvDLLEngineIFaceBase& kEngine = *gDLL->getEngineIFace();
    if (clearPlot)
    {
        //turn tiles to no color - for that any color will do - just the alpha needs to be 0
        NiColorA color(GC.getInfo(GC.getColorType("WHITE")).getColor());
        color.a = 0.0f;
        kEngine.fillAreaBorderPlot(kPlot.getX(), kPlot.getY(),
            color, AREA_BORDER_CITY_STATE);
        return;
    }

//    kEngine.clearAreaBorderPlots(AREA_BORDER_CITY_STATE);
//  kEngine.clearColoredPlots(PLOT_LANDSCAPE_LAYER_BASE);
    color.a = 0.8f;
    kEngine.fillAreaBorderPlot(kPlot.getX(), kPlot.getY(),
        color, AREA_BORDER_CITY_STATE);
    
    //CvMap const& kMap = GC.getMap();
    //CvPlot& kPlotNum = kMap.getPlotByIndex(kPlot.plotNum());
    //kEngine.addColoredPlot(kPlotNum.getX(), kPlotNum.getY(),color,
    //    PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_CITY_STATE);
}

though this part - didnt work - the coloring of the plots gets removed after a nano second .
(i prefer the plot color rather then the area)

Code:
    //CvMap const& kMap = GC.getMap();
    //CvPlot& kPlotNum = kMap.getPlotByIndex(kPlot.plotNum());
    //kEngine.addColoredPlot(kPlotNum.getX(), kPlotNum.getY(),color,
    //    PLOT_STYLE_CIRCLE, PLOT_LANDSCAPE_LAYER_CITY_STATE);
what am i missing?

In case that someone is puzzled
:)
 
Hehehi Nexus,

Im building a City State mechanizem.
Which I'm near completion.

I wanted to distinct the culture border of City States.
Which i managed to do basically.
Owned plots of a city states will now show as the ranged attack area from air combat, but with the same color of that city state player
Its kinda cool,
It gives some nice touch of different style of a border.

Ill explain the City States mechanics once i finish it as a part of my Doto 1.10,advc based.

Thank you Nexus :)
 
So, with fillAreaBorderPlot, it works, but, with addColoredPlot, it doesn't? I suppose that the PlotLandscapeLayers enum isn't extensible:
Code:
//Warning: these values are used as an index into a fixed array
enum PlotLandscapeLayers
{
   PLOT_LANDSCAPE_LAYER_ALL = -1,
   PLOT_LANDSCAPE_LAYER_BASE = 0,
   PLOT_LANDSCAPE_LAYER_RECOMMENDED_PLOTS = 1,
   PLOT_LANDSCAPE_LAYER_WORLD_BUILDER = 2,
   PLOT_LANDSCAPE_LAYER_NUMPAD_HELP = 2,
   PLOT_LANDSCAPE_LAYER_REVEALED_PLOTS = 1,
};
The comment on top is from BtS (from the Civ 4 base game, to be exact).
Maybe you could follow the example of worked plots being highlighted (isCityScreenUp branch of CvGame::updateColoredPlots). The update would then happen through updateColoredPlots and would have to be triggered in CvPlot::setOwner through
gDLL->getInterfaceIFace()->setDirty(ColoredPlots_DIRTY_BIT, true);
(or briefer: gDLL->UI()... in AdvCiv). That will update a bunch of colors unnecessarily, but I guess that's not really a problem; tile ownership doesn't change that frequently.
 
hey,
sound promising.
i looked how other addcolor is done,
i have a hunch that addcolor, overwrites a previous addcolor.
so it might be the cause.
in that case ill have to place this somewhere in the updatecolors.

but for now, the fill works just as well for city states 1.0 :)
 
Back
Top Bottom