diff options
| author | historia <[not public]> | 2026-06-11 04:46:27 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-11 08:58:37 +0000 |
| commit | 1b9e2da3b3c438d8dc53d3489725dd5ba0022777 (patch) | |
| tree | 62264f24420bf4cfaa734942c65cc8dd45ba3d3b /internal/game/utils.go | |
| parent | 06c02a697e5daf8832a462de5970dd4c0e13a02c (diff) | |
| download | thehouseoficarus-1b9e2da3b3c438d8dc53d3489725dd5ba0022777.tar.gz | |
feat: web client, get/drop updates and fixes
Diffstat (limited to 'internal/game/utils.go')
| -rw-r--r-- | internal/game/utils.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/game/utils.go b/internal/game/utils.go index 0559f4f..c78889d 100644 --- a/internal/game/utils.go +++ b/internal/game/utils.go @@ -3,6 +3,8 @@ package game import ( "fmt" "math/rand" + "strconv" + "strings" "thirdcollapse/internal/net" "thirdcollapse/internal/object" @@ -43,6 +45,16 @@ func plural(n int) string { return "s" } +func parseQty(input string) (int, string) { + parts := strings.Fields(input) + if len(parts) > 1 { + if n, err := strconv.Atoi(parts[0]); err == nil && n > 0 { + return n, strings.Join(parts[1:], " ") + } + } + return 0, input +} + func parseIndex(s string) (int, error) { var idx int _, err := fmt.Sscanf(s, "%d", &idx) |
