Gregori
Chieftain
This looks awesomely gorgeous, my huge mental support for that. big time!!!

This will be the best mod I have ever seen when its done.
This looks awesomely gorgeous, my huge mental support for that. big time!!!![]()
When do you hope it will be out? A year, 6 months?
No rush, just curious!
gDLL->getInterfaceIFace()->SetDirty(GlobeLayer_DIRTY_BIT, false);
gDLL->getEngineIFace()->SetDirty(GlobeTexture_DIRTY_BIT, false);
gDLL->getEngineIFace()->SetDirty(CultureBorders_DIRTY_BIT, false);
gDLL->getEngineIFace()->SetDirty(GlobePartialTexture_DIRTY_BIT, false);
gDLL->getEngineIFace()->SetDirty(MinimapTexture_DIRTY_BIT, false);
CvMap* tempMap = m_map;
m_map = m_altMap;
m_altMap = tempMap;
GC.getMapINLINE().rebuild(15, 15, 45, -45, false, false, (WorldSizeTypes)0, (ClimateTypes)0, (SeaLevelTypes)0, 0, NULL);
for (i = 0; i < GC.getMapINLINE().numPlots(); i++)
{
GC.getMapINLINE().plotByIndex(i)->setTerrainType((TerrainTypes)GC.getInfoTypeForString("TERRAIN_GRASS"), false, false);
gDLL->getEngineIFace()->MarkPlotTextureAsDirty(GC.getMapINLINE().plotByIndex(i)->getX(), GC.getMapINLINE().plotByIndex(i)->getY());
}
gDLL->getEngineIFace()->RebuildAllPlots();
GC.getMapINLINE().setupGraphical();
gDLL->getInterfaceIFace()->SetDirty(GlobeLayer_DIRTY_BIT, true);
gDLL->getEngineIFace()->SetDirty(GlobeTexture_DIRTY_BIT, true);
gDLL->getEngineIFace()->SetDirty(CultureBorders_DIRTY_BIT, true);
gDLL->getEngineIFace()->SetDirty(GlobePartialTexture_DIRTY_BIT, true);
gDLL->getEngineIFace()->SetDirty(MinimapTexture_DIRTY_BIT, true);
Setting the dirty bits to false will not be needed. Usually you only set them to true and it is the job of the engine to set them to false once it has redone the work associated with it.A debugging update:
I tried setting the four engine dirty bits and the interface GlobeLayer_DIRTY_BIT to false before switching the maps, and then resetting them afterwards, but it had no apparent effect. I also called markPlotTextureAsDirty() on all the plots after switching the maps, but this didn't do anything either. The whole thing looks like this:
Code:gDLL->getInterfaceIFace()->SetDirty(GlobeLayer_DIRTY_BIT, false); gDLL->getEngineIFace()->SetDirty(GlobeTexture_DIRTY_BIT, false); gDLL->getEngineIFace()->SetDirty(CultureBorders_DIRTY_BIT, false); gDLL->getEngineIFace()->SetDirty(GlobePartialTexture_DIRTY_BIT, false); gDLL->getEngineIFace()->SetDirty(MinimapTexture_DIRTY_BIT, false); CvMap* tempMap = m_map; m_map = m_altMap; m_altMap = tempMap; GC.getMapINLINE().rebuild(15, 15, 45, -45, false, false, (WorldSizeTypes)0, (ClimateTypes)0, (SeaLevelTypes)0, 0, NULL); for (i = 0; i < GC.getMapINLINE().numPlots(); i++) { GC.getMapINLINE().plotByIndex(i)->setTerrainType((TerrainTypes)GC.getInfoTypeForString("TERRAIN_GRASS"), false, false); gDLL->getEngineIFace()->MarkPlotTextureAsDirty(GC.getMapINLINE().plotByIndex(i)->getX(), GC.getMapINLINE().plotByIndex(i)->getY()); } gDLL->getEngineIFace()->RebuildAllPlots(); GC.getMapINLINE().setupGraphical(); gDLL->getInterfaceIFace()->SetDirty(GlobeLayer_DIRTY_BIT, true); gDLL->getEngineIFace()->SetDirty(GlobeTexture_DIRTY_BIT, true); gDLL->getEngineIFace()->SetDirty(CultureBorders_DIRTY_BIT, true); gDLL->getEngineIFace()->SetDirty(GlobePartialTexture_DIRTY_BIT, true); gDLL->getEngineIFace()->SetDirty(MinimapTexture_DIRTY_BIT, true);
Is this how I should be calling SetDirty()? Is there anything else I should try?
Setting the dirty bits to false will not be needed. Usually you only set them to true and it is the job of the engine to set them to false once it has redone the work associated with it.
One thing I noticed in this sequence: The textures of the plots that are not in the new map are not set to be dirty. It might be worth a try to move that to before switching the map.
@LyTning94
How is this going? The C2C team is anxiously awaiting this mod so we can use the multi-map feature to use for Lunar, Mars and Galactic maps in our game. You can see more of our planning here. Thank you for doing this. It saves us a lot of time not having to invent the code ourselves.
Sounds good. I probably should have mentioned that I manually add the the settings for each plot in Python. It might have saved you some time.
I tried to find a way to actually change maps within the game and failed. Since my mod consists of a series of controlled objectives for each map, I decided that resizing the map wasn't really needed. I just made the map size as large as the largest map in the mod. Smaller maps just have their objective spaced closer together with some parts of the map (usually around the edges) not being used. The unused parts of the map still contain land, sea, etc... There is just no reason for the player to go there. Especially on time based objectives.
It should not be any problem for the AI. Oceans are already one big impassable area for land units (and there are peaks).Thanks again for the info. It appears that I'm going to have to try something like this. My initial idea was to make all the unused plots impassible, but I'm not sure how the AI would respond to this. I guess I'll have to play around with it and find a suitable solution.
It should not be any problem for the AI. Oceans are already one big impassable area for land units (and there are peaks).
I don't recall ever trying this so I'm not sure what will happen. But you might want to try setting the unused plot's PlotType to NO_PLOT. Maybe it will just cause the plot to appear as a black space that isn't part of the map - just a guess on my part.