Simplify - remove duplicate command types in favor of a better defined Command type in proto

This commit is contained in:
Marc Di Luzio 2020-07-10 00:12:54 +01:00
parent 7d780d05bd
commit 96a137ad2f
9 changed files with 370 additions and 471 deletions

View file

@ -12,7 +12,6 @@ import (
"github.com/mdiluz/rove/pkg/atlas"
"github.com/mdiluz/rove/pkg/bearing"
"github.com/mdiluz/rove/pkg/game"
"github.com/mdiluz/rove/pkg/objects"
"github.com/mdiluz/rove/pkg/rove"
"github.com/mdiluz/rove/pkg/version"
@ -222,8 +221,8 @@ func InnerMain(command string, args ...string) error {
}
commands = append(commands,
&rove.Command{
Command: game.CommandMove,
Bearing: args[i],
Command: rove.CommandType_move,
Data: &rove.Command_Bearing{Bearing: args[i]},
},
)
case "broadcast":
@ -235,15 +234,15 @@ func InnerMain(command string, args ...string) error {
}
commands = append(commands,
&rove.Command{
Command: game.CommandBroadcast,
Message: []byte(args[i]),
Command: rove.CommandType_broadcast,
Data: &rove.Command_Message{Message: []byte(args[i])},
},
)
default:
// By default just use the command literally
commands = append(commands,
&rove.Command{
Command: args[i],
Command: rove.CommandType(rove.CommandType_value[args[i]]),
},
)
}