Alrik2002
Warlord
Hi,
I would like to add some features using the callbacks in a similar file like CvGameUtils. I´ve made a new one and have registered it, so that it all works perfectly in SP and MP, when no pitboss-host is used. If I use a pitboss-host I have OOS-Errors, because the gamestats of the pitboss differs from all the other players, when a function of my individual CvGameUtils.py is used.
While searching the code and the internet I found the following parts.
BugInit.py
BugEventManager.py
I checked the logfiles of the pitboss and saw, that it differs a lot from the logfile of the computer I use to play Civ. According to the logfile of the pitboss my individual CvGameUtils.py is loaded but there are no messages about handler registration. For me it seems like the pitboss doesn´t use my individual CvGameUtils.py and the players use them, because their computers use the default-method of Bug to register the handlers. Do you have any ideas how I could solve the problem or where I should integrate my code instead of using my individual CvGameUtils.py?
What would be the worst case if I would comment out the change in BUGinit.py like this:
Thank you very much!
I would like to add some features using the callbacks in a similar file like CvGameUtils. I´ve made a new one and have registered it, so that it all works perfectly in SP and MP, when no pitboss-host is used. If I use a pitboss-host I have OOS-Errors, because the gamestats of the pitboss differs from all the other players, when a function of my individual CvGameUtils.py is used.
While searching the code and the internet I found the following parts.
BugInit.py
Code:
def init():
"""Performs the one-time initialization of the BUG core and all mods."""
global g_initDone
if g_initDone:
BugUtil.debug("BugInit - init() already complete")
return
if not CyGame().isFinalInitialized():
BugUtil.debug("BugInit - game not fully initialized")
return
[COLOR="Red"] # K-Mod. Don't use any BUG features if this is a PitBoss server.
if CyGame().isPitbossHost():
BugUtil.debug("BugInit - BUG disabled for PitBoss host")
return
# K-Mod end[/COLOR]
BugEventManager.py
Code:
def configure(logging=None, noLogEvents=None):
# """Sets the global event manager's logging options."""
# if g_eventManager:
# g_eventManager.setLogging(logging)
# g_eventManager.setNoLogEvents(noLogEvents)
# else:
# BugUtil.error("BugEventManager - BugEventManager not setup before configure()")
# K-Mod. I've expanded the purpose of this function.
"""Sets the global event manager's logging options. And registers some BUG events handlers."""
if not g_eventManager:
BugUtil.error("BugEventManager - BugEventManager not setup before configure()")
return
g_eventManager.setLogging(logging)
g_eventManager.setNoLogEvents(noLogEvents)
[COLOR="Red"] # K-Mod. Don't use register BUG events for PitBoss host.
# (Note: actually, if this is a PitBoss host, this function won't even be called
# because the BUG core will not initialize any mod components in PitBoss mode.)
if CyGame().isPitbossHost():
BugUtil.debug("BugEventManager - skipping event registration for PitBoss host")
return
# K-Mod end[/COLOR]
I checked the logfiles of the pitboss and saw, that it differs a lot from the logfile of the computer I use to play Civ. According to the logfile of the pitboss my individual CvGameUtils.py is loaded but there are no messages about handler registration. For me it seems like the pitboss doesn´t use my individual CvGameUtils.py and the players use them, because their computers use the default-method of Bug to register the handlers. Do you have any ideas how I could solve the problem or where I should integrate my code instead of using my individual CvGameUtils.py?
What would be the worst case if I would comment out the change in BUGinit.py like this:
Code:
def init():
"""Performs the one-time initialization of the BUG core and all mods."""
global g_initDone
if g_initDone:
BugUtil.debug("BugInit - init() already complete")
return
if not CyGame().isFinalInitialized():
BugUtil.debug("BugInit - game not fully initialized")
return
[COLOR="Red"]# K-Mod. Don't use any BUG features if this is a PitBoss server.
#if CyGame().isPitbossHost():
# BugUtil.debug("BugInit - BUG disabled for PitBoss host")
# return
# K-Mod end[/COLOR]
Thank you very much!