Where is the code for the combat log screen?

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
Hi everyone.

I'm looking for the code that displays the Events/Combat/Chat log popup screen, but I can't find it. I need to turn off something displayed in the main interface screen when the Events Log is displayed because it's in the way and obscures the Events Log.

I would have thought that it would be in CvMainInterface.py, but I can't find it. It also isn't listed in the screen enums.

Anyone know where it is?
 
I think it is actually in the .exe.

If you click in the button defined in CvMainInterface.py, what happens is that in the DLL it is actually activated via
Code:
	case CONTROL_TURN_LOG:
		if (!gDLL->GetWorldBuilderMode() || gDLL->getInterfaceIFace()->isInAdvancedStart())
		{
			gDLL->getInterfaceIFace()->toggleTurnLog();
		}
		break;
in CvGame::doControl.

You may be able to find out if it is currently up or not with some simple function call, but I don't know how. The various interface elements are shown/hidden via the "screen.hide(foo)" and "screen.show(foo)" but I don't see anything like "screen.isHidden(foo)" or whatever. (The "screen" in that stuff is actually an alias for "CyGInterfaceScreen", which is listed in the Python API.)
 
Thanks G-E. I found it and I was able to make it work, until the screen refreshes and draws the text back over top of the turn log screen again.

I guess I'll have to add a function to the dll to read when the turn log is visible and expose it to python. :(

Thanks for your help! :)
 
You could try adjusting the CvMainInterface.py file so that every time the event log is shown or hidden it changes some value (like "bEventLogShowing" or whatever) and just use that. This should be all it takes if what you need to do is only in CvMainInterface.py.

If you need access to this from somewhere else, you could attach the value to some global object like the event manager object (presumably actually the BUG event manager unless you have some secret non-BUG project). Something like:
Code:
	oEventManager = CvEventInterface.getEventManager()

	oEventManager.bEventLog = true # true = it is showing, false = it is not

	if oEventManager.bEventLog :
		blah
		blah
		blah
The first line locates the object. The second statement sets a variable associated with the object that is visible from anywhere you can see the object (which should be everywhere, you just need to use the first line to find the object). The third thing uses it. You'd need to "import CvEventInterface" into any .py file that doesn't have access to it already.
 
You could try adjusting the CvMainInterface.py file so that every time the event log is shown or hidden it changes some value (like "bEventLogShowing" or whatever) and just use that. This should be all it takes if what you need to do is only in CvMainInterface.py.

If you need access to this from somewhere else, you could attach the value to some global object like the event manager object (presumably actually the BUG event manager unless you have some secret non-BUG project). Something like:
Code:
	oEventManager = CvEventInterface.getEventManager()

	oEventManager.bEventLog = true # true = it is showing, false = it is not

	if oEventManager.bEventLog :
		blah
		blah
		blah
The first line locates the object. The second statement sets a variable associated with the object that is visible from anywhere you can see the object (which should be everywhere, you just need to use the first line to find the object). The third thing uses it. You'd need to "import CvEventInterface" into any .py file that doesn't have access to it already.
That's an even better idea than what I was doing. I'll try that.
 
Back
Top Bottom