More de-scope - remove duration on move command
This isn't even needed, as commands can just be queued up
This commit is contained in:
parent
383e834cef
commit
2f6465987d
10 changed files with 97 additions and 134 deletions
|
@ -87,9 +87,8 @@ func TestServer_Command(t *testing.T) {
|
|||
Account: acc,
|
||||
Commands: []*rove.Command{
|
||||
{
|
||||
Command: "move",
|
||||
Bearing: "NE",
|
||||
Duration: 1,
|
||||
Command: "move",
|
||||
Bearing: "NE",
|
||||
},
|
||||
},
|
||||
}, &rove.CommandsResponse{})
|
||||
|
|
|
@ -126,9 +126,8 @@ func (s *Server) Commands(ctx context.Context, req *rove.CommandsRequest) (*rove
|
|||
var cmds []game.Command
|
||||
for _, c := range req.Commands {
|
||||
cmds = append(cmds, game.Command{
|
||||
Bearing: c.Bearing,
|
||||
Command: c.Command,
|
||||
Duration: int(c.Duration)})
|
||||
Bearing: c.Bearing,
|
||||
Command: c.Command})
|
||||
}
|
||||
|
||||
if err := s.world.Enqueue(id, cmds...); err != nil {
|
||||
|
|
|
@ -44,8 +44,7 @@ var data = flag.String("data", defaultDataPath, "data location for storage (or $
|
|||
// For register command
|
||||
var name = flag.String("name", "", "used with status command for the account name")
|
||||
|
||||
// For the duration command
|
||||
var duration = flag.Int("duration", 1, "used for the move command duration")
|
||||
// For the move command
|
||||
var bearing = flag.String("bearing", "", "used for the move command bearing (compass direction)")
|
||||
|
||||
// Config is used to store internal data
|
||||
|
@ -166,9 +165,8 @@ func InnerMain(command string) error {
|
|||
Account: config.Accounts[config.Host],
|
||||
Commands: []*rove.Command{
|
||||
{
|
||||
Command: game.CommandMove,
|
||||
Duration: int32(*duration),
|
||||
Bearing: *bearing,
|
||||
Command: game.CommandMove,
|
||||
Bearing: *bearing,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -52,6 +52,5 @@ func Test_InnerMain(t *testing.T) {
|
|||
|
||||
// Move should work with arguments
|
||||
flag.Set("bearing", "N")
|
||||
flag.Set("duration", "1")
|
||||
assert.NoError(t, InnerMain("move"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue