feat: validate user input for entity names
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
e "github.com/iliadenisov/galaxy/internal/error"
|
||||
"github.com/iliadenisov/galaxy/internal/model/game"
|
||||
"github.com/iliadenisov/galaxy/internal/number"
|
||||
)
|
||||
|
||||
func (c *Cache) CreateShips(ri int, shipTypeName string, planetNumber uint, quantity int) error {
|
||||
@@ -154,7 +155,7 @@ func (c *Cache) JoinEqualGroups(ri int) {
|
||||
for i := 0; i < len(raceGroups)-1; i++ {
|
||||
for j := len(raceGroups) - 1; j > i; j-- {
|
||||
if raceGroups[i].Equal(raceGroups[j]) {
|
||||
raceGroups[i].Index = maxUint(raceGroups[i].Index, raceGroups[j].Index)
|
||||
raceGroups[i].Index = number.Max(raceGroups[i].Index, raceGroups[j].Index)
|
||||
raceGroups[i].Number += raceGroups[j].Number
|
||||
raceGroups = append(raceGroups[:j], raceGroups[j+1:]...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user