cmd: create ship type
This commit is contained in:
@@ -2,6 +2,7 @@ package game
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
e "github.com/iliadenisov/galaxy/pkg/error"
|
||||
@@ -111,6 +112,18 @@ func (g Game) relationInternal(hostID, opponentID uuid.UUID) (RaceRelation, erro
|
||||
return RaceRelation{}, e.NewGameStateError("Relation: host %v not found", hostID)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// validateTypeName always return v without leading and trailing spaces
|
||||
func validateTypeName(v string) (string, bool) {
|
||||
s := strings.TrimSpace(v)
|
||||
if len(s) > 0 {
|
||||
return s, true
|
||||
}
|
||||
// TODO: special symbols
|
||||
return s, false
|
||||
}
|
||||
|
||||
func (g Game) MarshalBinary() (data []byte, err error) {
|
||||
return json.Marshal(&g)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user