예제 #1
0
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.

	Fix by God-Emperor
	"""
    # G-E fix: if not pPlot or pPlot.isNone():
    if not pPlot:
        BugUtil.warn("EventSigns.addSign() was passed an invalid plot")
        return False
    if gSavedSigns == None:
        BugUtil.warn("EventSigns.addSign() gSavedSigns is not initialized!")
        return False
    if pPlot.isNone():  # G-E fix
        if ePlayer == -1 and len(szCaption) == 0:
            global g_bForceUpdate
            g_bForceUpdate = True
            return True
        BugUtil.warn(
            "EventSigns.addSign() was passed an invalid plot: isNone = True")
        return False
    gSavedSigns.storeSign(pPlot, ePlayer, szCaption)
    gSavedSigns.displaySign(pPlot, ePlayer)
    SdToolKit.sdSetGlobal(SD_MOD_ID, SD_VAR_ID, gSavedSigns)
    return True
예제 #2
0
    def onPreSave(self, argsList):
        """
		Save reminders.
		"""
        if self.reminders.isEmpty():
            SdToolKit.sdDelGlobal(SD_MOD_ID, SD_QUEUES_ID)
        else:
            SdToolKit.sdSetGlobal(SD_MOD_ID, SD_QUEUES_ID, self.reminders)
	def onPreSave(self, argsList):
		"""
		Save reminders.
		"""
		if self.reminders.isEmpty():
			SdToolKit.sdDelGlobal(SD_MOD_ID, SD_QUEUES_ID)
		else:
			SdToolKit.sdSetGlobal(SD_MOD_ID, SD_QUEUES_ID, self.reminders)
예제 #4
0
	def onPreSave(self, argsList):
		""" Called before a game is actually saved """
		#BugUtil.debug("FavoriteCivicDetectorEvent.onPreSave()")
		if gDetectionNecessary:
			if (gFavoriteByPlayer):
				bNeedToSave = False
				for iPlayer in range(gc.getMAX_PLAYERS()):
					if not gFavoriteByPlayer[iPlayer].isInitialState():
						bNeedToSave = True
						break
				if (bNeedToSave):
					SdToolKit.sdSetGlobal(SD_MOD_ID, SD_VAR_ID, gFavoriteByPlayer)
예제 #5
0
 def onPreSave(self, argsList):
     """ Called before a game is actually saved """
     #BugUtil.debug("FavoriteCivicDetectorEvent.onPreSave()")
     if gDetectionNecessary:
         if (gFavoriteByPlayer):
             bNeedToSave = False
             for iPlayer in range(gc.getMAX_PLAYERS()):
                 if not gFavoriteByPlayer[iPlayer].isInitialState():
                     bNeedToSave = True
                     break
             if (bNeedToSave):
                 SdToolKit.sdSetGlobal(SD_MOD_ID, SD_VAR_ID,
                                       gFavoriteByPlayer)
예제 #6
0
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))
	if not pPlot or pPlot.isNone():
		BugUtil.warn("EventSigns.addSign() was passed an invalid plot: %s" % (str(pPlot)))
		return False
	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
예제 #7
0
	def onLoadGame(self, argsList):
		""" Called when a game is loaded """
		#BugUtil.debug("FavoriteCivicDetectorEvent.onLoadGame()")
		initHelpers()
		if gDetectionNecessary:
			data = SdToolKit.sdGetGlobal(SD_MOD_ID, SD_VAR_ID)
			if (data):
				global gFavoriteByPlayer
				gFavoriteByPlayer = data
				SdToolKit.sdSetGlobal(SD_MOD_ID, SD_VAR_ID, None)
				#BugUtil.debug("Data Loaded:")
				#dump()
			else:
				#BugUtil.debug("No saved data. Initializing new data.")
				initData()
예제 #8
0
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))
	if not pPlot or pPlot.isNone():
		BugUtil.warn("EventSigns.addSign() was passed an invalid plot: %s" % (str(pPlot)))
		return False
	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
예제 #9
0
 def onPreSave(self, argsList):
     if self.reminders.isEmpty():
         SdToolKit.sdDelGlobal("Reminders", "queues")
     else:
         SdToolKit.sdSetGlobal("Reminders", "queues", self.reminders)
예제 #10
0
 def write(self):
     if self.dirty:
         SdToolKit.sdSetGlobal(self.MOD_SAVE_ID, self.CITY_SAVE_ID,
                               self.cities)
         self.dirty = False
예제 #11
0
	def write(self):
		if self.dirty:
			SdToolKit.sdSetGlobal("StrategyOverlay", "CityDataDict", self.cities)
			self.dirty = False
	def write(self):
		if self.dirty:
			SdToolKit.sdSetGlobal(self.MOD_SAVE_ID, self.CITY_SAVE_ID, self.cities)
			self.dirty = False