From 5d849c255a597df463a598c1f7b7ff291be9f505 Mon Sep 17 00:00:00 2001 From: Carlo Field Date: Sat, 18 Apr 2020 14:21:42 +0200 Subject: [PATCH] add better output logging on error --- internal/item/item.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/item/item.go b/internal/item/item.go index 63e2d7b..2fcda93 100644 --- a/internal/item/item.go +++ b/internal/item/item.go @@ -7,6 +7,7 @@ import ( "fmt" "hash/crc32" "io/ioutil" + "log" "strings" "sync" @@ -212,8 +213,10 @@ func Serialize(item Item, seed int32) ([]byte, error) { if k, e := btik[strings.ToLower(item.Balance)]; e { bits := getBits(k, item.Version) for i := len(item.Generics) - 1; i >= 0; i-- { - err := w.WriteInt(getIndexFor("InventoryGenericPartData", item.Generics[i])+1, bits) + index := getIndexFor("InventoryGenericPartData", item.Generics[i]) + 1 + err := w.WriteInt(index, bits) if err != nil { + log.Printf("tried to fit index %v into %v bits for %s", index, bits, item.Generics[i]) panic(err) } }