Skip to content

Commit

Permalink
style: fix code style issues with gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Oct 15, 2024
1 parent 4bfa7ad commit 81434cc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
8 changes: 5 additions & 3 deletions src/char.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}
Expand Down
36 changes: 19 additions & 17 deletions src/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2349,29 +2349,29 @@ 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 {
out.append(OC_ex2_)
out.appendI32Op(opc, flg)
return nil
}
}); err != nil{
}); err != nil {
return bvNone(), err
}
} else {
Expand Down Expand Up @@ -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 {
Expand All @@ -2829,7 +2831,7 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string,
}
}
return nil
}); err != nil{
}); err != nil {
return bvNone(), err
}
}
Expand Down

0 comments on commit 81434cc

Please sign in to comment.