|
|
@ -3,6 +3,7 @@ package main
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"io"
|
|
|
|
"net"
|
|
|
|
"net"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
@ -137,6 +138,28 @@ func (c *Connection) SendBomb(target *System) {
|
|
|
|
fmt.Fprintf(c, "sending bomb to system %v\n", target.Label())
|
|
|
|
fmt.Fprintf(c, "sending bomb to system %v\n", target.Label())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Connection) ReadLines(out chan []string) {
|
|
|
|
|
|
|
|
defer close(out)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
|
|
|
line, err := c.ReadString('\n')
|
|
|
|
|
|
|
|
switch err {
|
|
|
|
|
|
|
|
case io.EOF:
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
case nil:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
log_error("unable to read line on connection: %v", err)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
line = strings.TrimSpace(line)
|
|
|
|
|
|
|
|
if line == "" {
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
out <- strings.Split(line, " ")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (c *Connection) land() {
|
|
|
|
func (c *Connection) land() {
|
|
|
|
fmt.Fprintf(c, "you have arrived at %v\n", c.dest.Label())
|
|
|
|
fmt.Fprintf(c, "you have arrived at %v\n", c.dest.Label())
|
|
|
|
c.location = c.dest
|
|
|
|
c.location = c.dest
|
|
|
|