i was tried to recompile SDK with defined
FASTER_VISIBILITY_NON_SAVE_COMPATABLE
but compilation failed in CvPlot::changeAdjacentSigh
Code:
ifdef FASTER_VISIBILITY_NON_SAVE_COMPATABLE
// get list of visible plots
CLinkList<CvPlot*> visiblePlotList;
[B]getVisiblePlotsList(visiblePlotList, eTeam, iRange);[/B]
// change visibility
for (CLLNode<CvPlot*>* pNode = visiblePlotList.head(); (pNode != NULL); pNode = visiblePlotList.next(pNode))
{
pNode->m_data->changeVisibilityCount(eTeam, ((bIncrement) ? 1 : -1), eSeeInvisible);
}
return;
#endif
getVisiblePlotsList identifier not found --- this function is not declared nor defined in SDK code
was previously defined in CvPlot.h in rev. 255, then removed in revision 269
Sorry about that. I put that #define in to test how much of a speed increase there was when using my much faster algorithm for doing the calculations of which plots are visible. (It is not save file compatible to do it though). I still use that algorithm in cases where the actual visiblity count does not matter, like when I want to build a list of the plots you can see from somewhere, for the new explorer code. But I have to use the slower method when calcualting actual visibility, as for the fogbusting algorithm, and the actual visiblity calcs (although I did speed that up by only doing it once per unit on a plot with the same visibility range).
For right now, I am going to say that #define does not work. I could make it work, if someone wanted to do some extensive speed testing with it, but right now, it is not properly implemented. Being as there are many ways to speed it up, depending on how much you want to redo, I did not continue to pursue in that direction, at least until post 1.0 release. One of the things I want to do for CvPlotRegion is to convert it to run encoded regions, making them super fast.
All that said, you can make the #define work if you want by using the new function with similar parameters, and convert the iteration to use the new data structure:
Code:
// get list of visible plots
CvPlotRegion visiblePlotRegion;
addVisiblePlots(visiblePlotRegion, iRange, eTeam);
// change visibility
for (CvPlotRegionConstIterator it = visiblePlotRegion.begin(); it != visiblePlotRegion.end(); it++)
{
XYCoords xy(getXYCoords(it));
CvPlot* pLoopPlot = GC.getMapINLINE().plotSorenINLINE(xy.iX, xy.iY);
pLoopPlot->changeVisibilityCount(eTeam, ((bIncrement) ? 1 : -1), eSeeInvisible);
}
return;
Please note, I added that for my own curiousity, to see how much of a speed improvement it gave on AI turns. It is not as well tested as using the regular method. (It speed up the turn from 1 minute to 40 seconds, but that one just the one test, I did not repeat it, so for all I know, it could have just been a caching issue, totally unrelated to this change).
Note, if you are going to test with this, you probably want to either #undefine NEW_VISIBILITY_IMPLEMENTATION, or update it to do things the faster way by changing
void addVisiblePlots(CvPlotDataRegion& visiblePlots, int iX, int iY, int iRange, int iObserverCount, TeamTypes eTeam) to work like
void addVisiblePlots(CvPlotRegion& visiblePlots, int iX, int iY, int iRange, TeamTypes eTeam)
, which uses the faster algorithm. (You can just replace all the guts, and change the insert to also set the value to
iObserverCount at each plot). In fact, you almost certainly are going to have to change
addVisiblePlots(CvPlotDataRegion, ...) or the fogbusting code will make some silly mistakes.
If you do make this change, your save files will be storing different values in the visibility field, so they will not be compatible with a regular save. And you probably want to start a fresh game, or force a recalculation (it does a full recalc when your visibility over water goes up by one). If you like, you can just call that function when loading from a save, but make sure you call it after teams are loaded, I would suggest calling it from CvGame::setFinalInitialized, you can see the lines there commented out that you would need.
There will be no warning that your save file is not compatible, visibility will just have all sorts of strange bugs if you use a save from the wrong version.
-Iustus