From d11e232cf362600637edda29ac2f30c00455bdb7 Mon Sep 17 00:00:00 2001 From: vigo Date: Mon, 9 Oct 2023 20:38:32 +0200 Subject: [PATCH] [core] castFailureHelper() doesn't needlessly format strings anymore --- sim/core/cast.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sim/core/cast.go b/sim/core/cast.go index 46a07e75e6..60714b904b 100644 --- a/sim/core/cast.go +++ b/sim/core/cast.go @@ -65,19 +65,17 @@ func (cast *Cast) EffectiveTime() time.Duration { type CastFunc func(*Simulation, *Unit) type CastSuccessFunc func(*Simulation, *Unit) bool -func (spell *Spell) castFailureHelper(sim *Simulation, gracefulFailure bool, message string, vals ...interface{}) bool { - reason := fmt.Sprintf(spell.ActionID.String()+" failed to cast: "+message, vals...) +func (spell *Spell) castFailureHelper(sim *Simulation, gracefulFailure bool, message string, vals ...any) bool { if sim.CurrentTime < 0 && spell.Unit.IsUsingAPL { - spell.Unit.Rotation.ValidationWarning(reason) - return false + spell.Unit.Rotation.ValidationWarning(fmt.Sprintf(spell.ActionID.String()+" failed to cast: "+message, vals...)) } else if gracefulFailure { if sim.Log != nil && !spell.Flags.Matches(SpellFlagNoLogs) { - spell.Unit.Log(sim, reason) + spell.Unit.Log(sim, fmt.Sprintf(spell.ActionID.String()+" failed to cast: "+message, vals...)) } - return false } else { - panic(reason) + panic(fmt.Sprintf(spell.ActionID.String()+" failed to cast: "+message, vals...)) } + return false } func (spell *Spell) makeCastFunc(config CastConfig) CastSuccessFunc {