|
|
@ -49,6 +49,7 @@ func handleConnection(conn *Connection) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
fmt.Fprintf(conn, "you are in the system %s. There are %d planets here.\n", system.name, system.planets)
|
|
|
|
fmt.Fprintf(conn, "you are in the system %s. There are %d planets here.\n", system.name, system.planets)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
READING:
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
line, err := conn.ReadString('\n')
|
|
|
|
line, err := conn.ReadString('\n')
|
|
|
|
switch err {
|
|
|
|
switch err {
|
|
|
@ -58,6 +59,8 @@ func handleConnection(conn *Connection) {
|
|
|
|
break
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
log_error("failed to read line from player %s: %v", conn.PlayerName(), err)
|
|
|
|
log_error("failed to read line from player %s: %v", conn.PlayerName(), err)
|
|
|
|
|
|
|
|
time.Sleep(time.Second)
|
|
|
|
|
|
|
|
continue READING
|
|
|
|
}
|
|
|
|
}
|
|
|
|
line = strings.TrimSpace(line)
|
|
|
|
line = strings.TrimSpace(line)
|
|
|
|
|
|
|
|
|
|
|
|