aboutsummaryrefslogtreecommitdiff
path: root/internal/game/core_validate.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 17:48:26 -0400
committerhistoria <[not public]>2026-09-18 17:48:26 -0400
commit8fe9e3c3fef0049df82281a62afe35dda516dfe2 (patch)
treedd269f2c0710f334e19f00a191260ebc46284a90 /internal/game/core_validate.go
parent194164a77eb4f2479b94c19e6f0e1278ab608781 (diff)
downloadthehouseoficarus-8fe9e3c3fef0049df82281a62afe35dda516dfe2.tar.gz
fix: close combat ghost, admin traversal, login throttle, journal double-pay, and quality/economy gaps
Diffstat (limited to 'internal/game/core_validate.go')
-rw-r--r--internal/game/core_validate.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/game/core_validate.go b/internal/game/core_validate.go
index b6cb3b9..a858933 100644
--- a/internal/game/core_validate.go
+++ b/internal/game/core_validate.go
@@ -16,13 +16,18 @@ func (g *Game) validationSource() validate.Source {
courseViews := make([]validate.CourseView, 0, len(courses))
for id, cfg := range courses {
rooms := make([]int, 0, len(cfg.Obstacles))
+ failRooms := make([]int, 0, len(cfg.Obstacles))
for _, obs := range cfg.Obstacles {
rooms = append(rooms, obs.RoomID)
+ if obs.OnFailRoom > 0 {
+ failRooms = append(failRooms, obs.OnFailRoom)
+ }
}
courseViews = append(courseViews, validate.CourseView{
ID: id,
StartRoom: cfg.StartRoom,
ObstacleRooms: rooms,
+ OnFailRooms: failRooms,
})
}
@@ -39,6 +44,7 @@ func (g *Game) validationSource() validate.Source {
moduleElements := make(map[string]bool)
moduleDestinations := make(map[string]int)
+ transportModules := make(map[string]bool)
for _, m := range AllMods {
if m.Element != "" {
moduleElements[m.Element] = true
@@ -46,6 +52,16 @@ func (g *Game) validationSource() validate.Source {
if m.Destination > 0 {
moduleDestinations[m.ID] = m.Destination
}
+ if m.Category == ModTransport {
+ transportModules[m.ID] = true
+ }
+ }
+
+ knownFieldTargets := []validate.KnownFieldTarget{
+ {SubDir: "techs", Label: "tech", NewDef: func() any { return new(TechDef) }},
+ {SubDir: "modules", Label: "module", NewDef: func() any { return new(ModDef) }},
+ {SubDir: "courses", Label: "course", NewDef: func() any { return new(CourseConfig) }},
+ {SubDir: "help", Label: "help topic", NewDef: func() any { return new(helpRaw) }},
}
return validate.Source{
@@ -61,5 +77,7 @@ func (g *Game) validationSource() validate.Source {
IgnoreUnreachable: g.ValidationConfig.IgnoreUnreachable,
ModuleElements: moduleElements,
ModuleDestinations: moduleDestinations,
+ TransportModules: transportModules,
+ KnownFieldTargets: knownFieldTargets,
}
}