Fix format-string arg errors in battle notifies
Two notify calls would raise TypeError instead of logging when their (already exceptional) branch runs. DistributedLevelBattle: '...%s...%s...' % self.levelDoId, self.doId binds the % tighter than the comma, so it formats two specifiers against the single int self.levelDoId (crash) and passes self.doId as a stray second arg to warning(). Wrapped both operands in a tuple. TownBattleAttackPanel: the operand was a list [track, level]; % only unpacks a tuple, so two %s against one list crashed before the error message could be built. Changed to a tuple.
This commit is contained in:
parent
a5ecbb8b1e
commit
e3521ffe24
|
|
@ -41,7 +41,7 @@ class DistributedLevelBattle(DistributedBattle.DistributedBattle):
|
|||
|
||||
level = base.cr.doId2do.get(self.levelDoId)
|
||||
if level is None:
|
||||
self.notify.warning('level %s not in doId2do yet, battle %s will be mispositioned.' % self.levelDoId, self.doId)
|
||||
self.notify.warning('level %s not in doId2do yet, battle %s will be mispositioned.' % (self.levelDoId, self.doId))
|
||||
self.levelRequest = self.cr.relatedObjectMgr.requestObjects([self.levelDoId], doPlacement)
|
||||
else:
|
||||
doPlacement([level])
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class TownBattleAttackPanel(StateData.StateData):
|
|||
doneStatus['level'] = level
|
||||
messenger.send(self.doneEvent, [doneStatus])
|
||||
else:
|
||||
self.notify.error("An item we don't have: track %s level %s was selected." % [track, level])
|
||||
self.notify.error("An item we don't have: track %s level %s was selected." % (track, level))
|
||||
|
||||
def __handleHide(self):
|
||||
if AttackPanelHidden:
|
||||
|
|
|
|||
Loading…
Reference in New Issue