From 81434ccbc28b27b47dc343f22cf7c1cf1da12673 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 15 Oct 2024 22:45:13 +0000 Subject: [PATCH] style: fix code style issues with gofmt --- src/char.go | 8 +++++--- src/compiler.go | 36 +++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/char.go b/src/char.go index a2d84164a..7622d6476 100644 --- a/src/char.go +++ b/src/char.go @@ -3845,7 +3845,9 @@ func (c *Char) projVar(pid BytecodeValue, idx BytecodeValue, flag BytecodeValue, // See compiler.go:ProjVar var id int32 = pid.ToI() - if(id > 0){ id--; } + if id > 0 { + id-- + } var i = idx.ToI() var fl int32 = flag.ToI() @@ -3934,9 +3936,9 @@ func (c *Char) projVar(pid BytecodeValue, idx BytecodeValue, flag BytecodeValue, case OC_ex2_projvar_teamside: v = BytecodeInt(int32(p.hitdef.teamside)) case OC_ex2_projvar_guardflag: - v = BytecodeBool(p.hitdef.guardflag & fl != 0) + v = BytecodeBool(p.hitdef.guardflag&fl != 0) case OC_ex2_projvar_hitflag: - v = BytecodeBool(p.hitdef.hitflag & fl != 0) + v = BytecodeBool(p.hitdef.hitflag&fl != 0) } break } diff --git a/src/compiler.go b/src/compiler.go index ea933799d..f02f2e139 100644 --- a/src/compiler.go +++ b/src/compiler.go @@ -2349,21 +2349,21 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, } isFlag := false switch param { - case "guardflag": - opc = OC_ex2_hitdefvar_guardflag - isFlag = true - case "hitflag": - opc = OC_ex2_hitdefvar_hitflag - isFlag = true - case "hitdamage": - opc = OC_ex2_hitdefvar_hitdamage - case "guarddamage": - opc = OC_ex2_hitdefvar_guarddamage - default: - return bvNone(), Error("Invalid data: " + c.token) + case "guardflag": + opc = OC_ex2_hitdefvar_guardflag + isFlag = true + case "hitflag": + opc = OC_ex2_hitdefvar_hitflag + isFlag = true + case "hitdamage": + opc = OC_ex2_hitdefvar_hitdamage + case "guarddamage": + opc = OC_ex2_hitdefvar_guarddamage + default: + return bvNone(), Error("Invalid data: " + c.token) } if isFlag { - if err := eqne(func () error { + if err := eqne(func() error { if flg, err := flagSub(); err != nil { return err } else { @@ -2371,7 +2371,7 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, out.appendI32Op(opc, flg) return nil } - }); err != nil{ + }); err != nil { return bvNone(), err } } else { @@ -2814,11 +2814,13 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, // I do not know why this happens. // It happened with clsnVar. idx := bv1.ToI() - if(idx >= 0){ bv1.SetI(idx+1); } + if idx >= 0 { + bv1.SetI(idx + 1) + } bv3 := BytecodeInt(0) if isFlag { - if err := eqne2(func (not bool) error { + if err := eqne2(func(not bool) error { if flg, err := flagSub(); err != nil { return err } else { @@ -2829,7 +2831,7 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, } } return nil - }); err != nil{ + }); err != nil { return bvNone(), err } }