From: Skullheadx Date: Sat, 6 Jun 2026 19:51:10 +0000 (-0400) Subject: event types and stack X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=5043c09c624fdcad856e268fc59137a11173107b;p=monopoly-web.git event types and stack --- diff --git a/game/config.go b/game/config.go index 16fcf9d..5644f4f 100644 --- a/game/config.go +++ b/game/config.go @@ -4,6 +4,13 @@ const ( StartingDiceRolls int32 = 1 ) +const ( + EventEndTurn EventType = iota + EventRollDice + EventLandUnowned + EventJail +) + // Board config const ( TypeGo PropertyType = iota diff --git a/game/types.go b/game/types.go index fd0ad19..20c2cf0 100644 --- a/game/types.go +++ b/game/types.go @@ -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 }