God-Emperor
Deity
As nearly everyone is aware, signs have a tendency to disappear after a while whether added manually or by the "event signs" BUG option or the "personalized map" game option.
I have not fixed this, but I have noticed something.
EDIT: OK, so a few posts down (#5) I have a partial fix. It is just a Python adjustment.
The cvInternalGlobals::reprocessSigns function apparently does nothing at all. It looks like it is doing something, but the net result is nothing.
This is the function:
So what this does one of two things.
First, reprocessSigns may do nothing due to m_bSignsCleared being false. The only ways it is set to true is by the function right before this one: cvInternalGlobals::clearSigns. That is not called in many places, just on initializing things, viewport changes, and in CvInitCore::write. That last one is possibly the important one since it may be called during an autosave. If that is the case, then the signs are probably disappearing every time an autosave is done or the viewport moves (if using viewports). In theory, I think it is then relying on reprocessSigns to put them back, which should be happening in the second thing that can happen:
Second, reprocessSigns can call the AddSign function in the CvAppInterface.py file (since that is the one which PYCivModule points to).
When calling the AddSign function the arguments it passes are a CyPlot that does not point to a real plot, the NO_PLAYER value (which is the integer -1), and an empty text string.
In CvAppInterface the AddSign function just calls the AddSign function in the EventSigns.py file, passing it the same data.
This is that function:
The important part is what I have set to be bold red text. Since the PyPlot which is passed does not point to a real plot the call to pPlot.isNone will be True so this first highlighted "if" will take effect and all it does it add a message to a log file if the BUG message logging is set to show warnings and then exit the function, returning the value False.
So even if m_bSignsCleared is true reprocessSigns still does nothing (well, it wastes a little time since it calls a Python function which calls another one which checks a value and then maybe logs something and exits).
It looks to me like this was supposed to do something else, by nobody ever got around to having it do whatever it is supposed to do. Probably because figuring out how to make it do what it should do when a viewport moves takes a lot of messing around since it saves signs by plot location (a tuple of (x,y) coordinates is the index) and what actual plot each location really is changes when the viewport moves.
It is possible that the fix could be as simple as having the AddSign in EventSigns.py check for this specific set of arguments and if found regenerate the signs from the "gSavedSigns" global's data (something like "gSavedSigns.processSigns(g_bShowSigns)", if gSavedSigns is not null). But I think it may be more complicated because there may also be some issue with saving the data, otherwise all the signs should probably show up for at least the first turn every time you load a save.
Or this might all be a red herring...
I may be fiddling with this a bit more to at least check my possible simple fix.
I have not fixed this, but I have noticed something.
EDIT: OK, so a few posts down (#5) I have a partial fix. It is just a Python adjustment.
The cvInternalGlobals::reprocessSigns function apparently does nothing at all. It looks like it is doing something, but the net result is nothing.
This is the function:
Code:
void cvInternalGlobals::reprocessSigns(void)
{
if ( m_bSignsCleared )
{
PYTHON_ACCESS_LOCK_SCOPE
CyArgsList argsList;
CyPlot* pyPlot = new CyPlot(NULL);
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyPlot));
argsList.add(NO_PLAYER);
argsList.add("");
PYTHON_CALL_FUNCTION(__FUNCTION__, PYCivModule, "AddSign", argsList.makeFunctionArgs());
delete pyPlot;
m_bSignsCleared = false;
}
}
So what this does one of two things.
First, reprocessSigns may do nothing due to m_bSignsCleared being false. The only ways it is set to true is by the function right before this one: cvInternalGlobals::clearSigns. That is not called in many places, just on initializing things, viewport changes, and in CvInitCore::write. That last one is possibly the important one since it may be called during an autosave. If that is the case, then the signs are probably disappearing every time an autosave is done or the viewport moves (if using viewports). In theory, I think it is then relying on reprocessSigns to put them back, which should be happening in the second thing that can happen:
Second, reprocessSigns can call the AddSign function in the CvAppInterface.py file (since that is the one which PYCivModule points to).
When calling the AddSign function the arguments it passes are a CyPlot that does not point to a real plot, the NO_PLAYER value (which is the integer -1), and an empty text string.
In CvAppInterface the AddSign function just calls the AddSign function in the EventSigns.py file, passing it the same data.
This is that function:
Code:
def addSign (pPlot, ePlayer, szCaption):
""" Wrapper for CyEngine.addSign() which stores sign data.
If -1 is passed for ePlayer, the sign is assumed to be a landmark that everyone can see.
"""
#BugUtil.debug("EventSigns.addSign(pPlot = %s, ePlayer = %s, szCaption = %s)" % (str(pPlot), str(ePlayer), szCaption))
[B][COLOR="DarkRed"]if not pPlot or pPlot.isNone():
BugUtil.warn("EventSigns.addSign() was passed an invalid plot: %s" % (str(pPlot)))
return False[/COLOR][/B]
if gSavedSigns == None:
BugUtil.warn("EventSigns.addSign() gSavedSigns is not initialized!")
return False
gSavedSigns.storeSign(pPlot, ePlayer, szCaption)
gSavedSigns.displaySign(pPlot, ePlayer)
SdToolKit.sdSetGlobal(SD_MOD_ID, SD_VAR_ID, gSavedSigns)
return True
The important part is what I have set to be bold red text. Since the PyPlot which is passed does not point to a real plot the call to pPlot.isNone will be True so this first highlighted "if" will take effect and all it does it add a message to a log file if the BUG message logging is set to show warnings and then exit the function, returning the value False.
So even if m_bSignsCleared is true reprocessSigns still does nothing (well, it wastes a little time since it calls a Python function which calls another one which checks a value and then maybe logs something and exits).
It looks to me like this was supposed to do something else, by nobody ever got around to having it do whatever it is supposed to do. Probably because figuring out how to make it do what it should do when a viewport moves takes a lot of messing around since it saves signs by plot location (a tuple of (x,y) coordinates is the index) and what actual plot each location really is changes when the viewport moves.
It is possible that the fix could be as simple as having the AddSign in EventSigns.py check for this specific set of arguments and if found regenerate the signs from the "gSavedSigns" global's data (something like "gSavedSigns.processSigns(g_bShowSigns)", if gSavedSigns is not null). But I think it may be more complicated because there may also be some issue with saving the data, otherwise all the signs should probably show up for at least the first turn every time you load a save.
Or this might all be a red herring...
I may be fiddling with this a bit more to at least check my possible simple fix.