From bd5647fb0656e864e5567b4c05df1ed2fe779124 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 6 Feb 2022 15:39:51 +0000 Subject: [PATCH] Fix premium items reroll on level change Bug introduced a few commits ago in 1519e995cffeaa0d7bdfe93d2ad08ad09c2a9b4b Fixes #4036 --- Source/diablo.cpp | 1 + Source/stores.cpp | 5 ++++- Source/stores.h | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 4c7a5ab8c..62439b01a 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1991,6 +1991,7 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir) InitInv(); InitQuestText(); InitInfoBoxGfx(); + InitStores(); InitAutomapOnce(); InitHelp(); } diff --git a/Source/stores.cpp b/Source/stores.cpp index 961a6a34e..79ed6f9c7 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -2279,7 +2279,7 @@ void AddStoreHoldRepair(Item *itm, int8_t i) storenumh++; } -void SetupTownStores() +void InitStores() { ClearSText(0, STORE_LINES); stextflag = STORE_NONE; @@ -2293,7 +2293,10 @@ void SetupTownStores() boyitem._itype = ItemType::None; boylevel = 0; +} +void SetupTownStores() +{ auto &myPlayer = Players[MyPlayerId]; int l = myPlayer._pLevel / 2; diff --git a/Source/stores.h b/Source/stores.h index ddfd3e9f2..e842a0e51 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -101,8 +101,15 @@ extern int boylevel; extern Item boyitem; void AddStoreHoldRepair(Item *itm, int8_t i); + +/** Clears premium items sold by Griswold and Wirt. */ +void InitStores(); + +/** Spawns items sold by vendors, including premium items sold by Griswold and Wirt. */ void SetupTownStores(); + void FreeStoreMem(); + void PrintSString(const Surface &out, int margin, int line, const char *text, UiFlags flags, int price = 0); void DrawSLine(const Surface &out, int sy); void DrawSTextHelp();