refactor: load/save state as ptr

This commit is contained in:
Ilia Denisov
2026-01-12 19:30:50 +02:00
parent ac60bb3020
commit 4451850f22
18 changed files with 71 additions and 57 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ import (
func TestCreateScience(t *testing.T) {
race := "race_01"
typeName := "First Step"
g(t, func(p func(*controller.Param), g func() mg.Game) {
g(t, func(p func(*controller.Param), g func() *mg.Game) {
err := game.DeleteScience(p, race, typeName)
assert.ErrorContains(t, err, e.GenericErrorText(e.ErrInputEntityNotExists))
err = game.CreateScience(p, unknownRaceName, " "+typeName+" ", 1, 0, 0, 0) // TODO: test on dead race
@@ -74,7 +74,7 @@ func TestCreateScienceValidation(t *testing.T) {
{typeName, 0, 0, 0, -1, e.GenericErrorText(e.ErrInputCargoValue)},
{typeName, 0, 1, 1, -1, e.GenericErrorText(e.ErrInputCargoValue)},
}
g(t, func(p func(*controller.Param), g func() mg.Game) {
g(t, func(p func(*controller.Param), g func() *mg.Game) {
for i, tc := range table {
if tc.err == "" {
err := game.CreateScience(p, race, tc.name+strconv.Itoa(i), tc.d, tc.w, tc.s, tc.c)