Merge pull request #35 from mdiluz/fix-starting-wind
Add the starting wind as north and ensure it's only updated the next day
This commit is contained in:
commit
abf67f7f37
1 changed files with 6 additions and 5 deletions
|
@ -59,6 +59,7 @@ func NewWorld(chunkSize int) *World {
|
||||||
TicksPerDay: 24,
|
TicksPerDay: 24,
|
||||||
CurrentTicks: 0,
|
CurrentTicks: 0,
|
||||||
Accountant: accounts.NewSimpleAccountant(),
|
Accountant: accounts.NewSimpleAccountant(),
|
||||||
|
Wind: roveapi.Bearing_North,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,11 +618,6 @@ func (w *World) Tick() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the wind every day
|
|
||||||
if (w.CurrentTicks % w.TicksPerDay) == 0 {
|
|
||||||
w.Wind = roveapi.Bearing((rand.Int() % 8) + 1) // Random cardinal bearing
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move all the rovers based on current wind and sails
|
// Move all the rovers based on current wind and sails
|
||||||
for n, r := range w.Rovers {
|
for n, r := range w.Rovers {
|
||||||
// Skip if we're not catching the wind
|
// Skip if we're not catching the wind
|
||||||
|
@ -675,6 +671,11 @@ func (w *World) Tick() {
|
||||||
|
|
||||||
// Increment the current tick count
|
// Increment the current tick count
|
||||||
w.CurrentTicks++
|
w.CurrentTicks++
|
||||||
|
|
||||||
|
// Change the wind every day
|
||||||
|
if (w.CurrentTicks % w.TicksPerDay) == 0 {
|
||||||
|
w.Wind = roveapi.Bearing((rand.Int() % 8) + 1) // Random cardinal bearing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteCommand will execute a single command
|
// ExecuteCommand will execute a single command
|
||||||
|
|
Loading…
Add table
Reference in a new issue