]> Skullheadx's Git Forge - monopoly-web.git/commitdiff
event types and stack
authorSkullheadx <admonty1@protonmail.com>
Sat, 6 Jun 2026 19:51:10 +0000 (15:51 -0400)
committerSkullheadx <admonty1@protonmail.com>
Sat, 6 Jun 2026 19:51:10 +0000 (15:51 -0400)
game/config.go
game/types.go

index 16fcf9db4f2ee8d5c3228ec07fc78584b0d4c5e4..5644f4fa04fee9f215ee987501a6a22b58cc65fa 100644 (file)
@@ -4,6 +4,13 @@ const (
        StartingDiceRolls int32 = 1
 )
 
+const (
+       EventEndTurn EventType = iota
+       EventRollDice
+       EventLandUnowned
+       EventJail
+)
+
 // Board config
 const (
        TypeGo PropertyType = iota
index fd0ad19139e4ffed1869e63742205d7d7a9ba182..20c2cf0d769876fada137fde880af61983282b07 100644 (file)
@@ -12,6 +12,19 @@ type Player struct {
 }
 
 type PropertyType int
+
+type EventType int32
+
+func (ctx *Context) EventPeek() EventType {
+       return ctx.Turn.EventStack[len(ctx.Turn.EventStack)-1]
+}
+
+func (ctx *Context) EventPop() EventType {
+       last := ctx.Turn.EventStack[len(ctx.Turn.EventStack)-1]
+       ctx.Turn.EventStack = ctx.Turn.EventStack[:len(ctx.Turn.EventStack)]
+       return last
+}
+
 type Space struct {
        PropertyType PropertyType
        SubIndexID   int32 // FK to resp. OwnableProperty types
@@ -145,6 +158,7 @@ type Turn struct {
        NumDiceRolled      int32
        RolledDoubles      bool
        MoveQueue          []int32
+       EventStack         []EventType
        InDebt             bool
        Modifier           Modifiers
 }