From 9e6aa7c8d6d8a7112c3f63f1d581327f49182fa7 Mon Sep 17 00:00:00 2001 From: obligaron Date: Mon, 13 Dec 2021 21:12:26 +0100 Subject: [PATCH] Add OptionEntries for Poition Pickup --- Source/options.cpp | 26 ++++++++++++-------------- Source/options.h | 12 ++++++------ Source/qol/autopickup.cpp | 12 ++++++------ 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/Source/options.cpp b/Source/options.cpp index ba4bb1f49..4d4f963f5 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -307,12 +307,6 @@ void LoadOptions() #endif sgOptions.Gameplay.nTickRate = GetIniInt("Game", "Speed", 20); - sgOptions.Gameplay.numHealPotionPickup = GetIniInt("Game", "Heal Potion Pickup", 0); - sgOptions.Gameplay.numFullHealPotionPickup = GetIniInt("Game", "Full Heal Potion Pickup", 0); - sgOptions.Gameplay.numManaPotionPickup = GetIniInt("Game", "Mana Potion Pickup", 0); - sgOptions.Gameplay.numFullManaPotionPickup = GetIniInt("Game", "Full Mana Potion Pickup", 0); - sgOptions.Gameplay.numRejuPotionPickup = GetIniInt("Game", "Rejuvenation Potion Pickup", 0); - sgOptions.Gameplay.numFullRejuPotionPickup = GetIniInt("Game", "Full Rejuvenation Potion Pickup", 0); GetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress, sizeof(sgOptions.Network.szBindAddress), "0.0.0.0"); sgOptions.Network.nPort = GetIniInt("Network", "Port", 6112); @@ -367,13 +361,6 @@ void SaveOptions() SetIniValue("Game", "Speed", sgOptions.Gameplay.nTickRate); - SetIniValue("Game", "Heal Potion Pickup", sgOptions.Gameplay.numHealPotionPickup); - SetIniValue("Game", "Full Heal Potion Pickup", sgOptions.Gameplay.numFullHealPotionPickup); - SetIniValue("Game", "Mana Potion Pickup", sgOptions.Gameplay.numManaPotionPickup); - SetIniValue("Game", "Full Mana Potion Pickup", sgOptions.Gameplay.numFullManaPotionPickup); - SetIniValue("Game", "Rejuvenation Potion Pickup", sgOptions.Gameplay.numRejuPotionPickup); - SetIniValue("Game", "Full Rejuvenation Potion Pickup", sgOptions.Gameplay.numFullRejuPotionPickup); - SetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress); SetIniValue("Network", "Port", sgOptions.Network.nPort); SetIniValue("Network", "Previous Host", sgOptions.Network.szPreviousHost); @@ -799,7 +786,12 @@ GameplayOptions::GameplayOptions() , autoRefillBelt("Auto Refill Belt", OptionEntryFlags::None, N_("Auto Refill Belt"), N_("Refill belt from inventory when belt item is consumed."), false) , disableCripplingShrines("Disable Crippling Shrines", OptionEntryFlags::None, N_("Disable Crippling Shrines"), N_("When enabled Cauldrons, Fascinating Shrines, Goat Shrines, Ornate Shrines and Sacred Shrines are not able to be clicked on and labeled as disabled."), false) , quickCast("Quick Cast", OptionEntryFlags::None, N_("Quick Cast"), N_("Spell hotkeys instantly cast the spell, rather than switching the readied spell."), false) - + , numHealPotionPickup("Heal Potion Pickup", OptionEntryFlags::None, N_("Heal Potion Pickup"), N_("Number of Healing potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) + , numFullHealPotionPickup("Full Heal Potion Pickup", OptionEntryFlags::None, N_("Full Heal Potion Pickup"), N_("Number of Full Healing potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) + , numManaPotionPickup("Mana Potion Pickup", OptionEntryFlags::None, N_("Mana Potion Pickup"), N_("Number of Mana potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) + , numFullManaPotionPickup("Full Mana Potion Pickup", OptionEntryFlags::None, N_("Full Mana Potion Pickup"), N_("Number of Mana potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) + , numRejuPotionPickup("Rejuvenation Potion Pickup", OptionEntryFlags::None, N_("Heal Rejuvenation Pickup"), N_("Number of Rejuvenation potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) + , numFullRejuPotionPickup("Full Rejuvenation Potion Pickup", OptionEntryFlags::None, N_("Full Rejuvenation Potion Pickup"), N_("Number of Rejuvenation potions to pick up automatically."), 0, { 0, 1, 4, 8, 16 }) { grabInput.SetValueChangedCallback(OptionGrabInputChanged); experienceBar.SetValueChangedCallback(OptionExperienceBarChanged); @@ -831,6 +823,12 @@ std::vector GameplayOptions::GetEntries() &autoRefillBelt, &disableCripplingShrines, &quickCast, + &numHealPotionPickup, + &numFullHealPotionPickup, + &numManaPotionPickup, + &numFullManaPotionPickup, + &numRejuPotionPickup, + &numFullRejuPotionPickup, }; } diff --git a/Source/options.h b/Source/options.h index eb19f9771..99b89b717 100644 --- a/Source/options.h +++ b/Source/options.h @@ -463,17 +463,17 @@ struct GameplayOptions : OptionCategoryBase { /** @brief Spell hotkeys instantly cast the spell. */ OptionEntryBoolean quickCast; /** @brief Number of Healing potions to pick up automatically */ - int numHealPotionPickup; + OptionEntryInt numHealPotionPickup; /** @brief Number of Full Healing potions to pick up automatically */ - int numFullHealPotionPickup; + OptionEntryInt numFullHealPotionPickup; /** @brief Number of Mana potions to pick up automatically */ - int numManaPotionPickup; + OptionEntryInt numManaPotionPickup; /** @brief Number of Full Mana potions to pick up automatically */ - int numFullManaPotionPickup; + OptionEntryInt numFullManaPotionPickup; /** @brief Number of Rejuvenating potions to pick up automatically */ - int numRejuPotionPickup; + OptionEntryInt numRejuPotionPickup; /** @brief Number of Full Rejuvenating potions to pick up automatically */ - int numFullRejuPotionPickup; + OptionEntryInt numFullRejuPotionPickup; }; struct ControllerOptions : OptionCategoryBase { diff --git a/Source/qol/autopickup.cpp b/Source/qol/autopickup.cpp index 9752879fc..a96bd42ce 100644 --- a/Source/qol/autopickup.cpp +++ b/Source/qol/autopickup.cpp @@ -47,17 +47,17 @@ bool DoPickup(Item item) && (AutoPlaceItemInInventory(Players[MyPlayerId], item, false) || AutoPlaceItemInBelt(Players[MyPlayerId], item, false))) { switch (item._iMiscId) { case IMISC_HEAL: - return sgOptions.Gameplay.numHealPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numHealPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_FULLHEAL: - return sgOptions.Gameplay.numFullHealPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numFullHealPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_MANA: - return sgOptions.Gameplay.numManaPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numManaPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_FULLMANA: - return sgOptions.Gameplay.numFullManaPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numFullManaPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_REJUV: - return sgOptions.Gameplay.numRejuPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numRejuPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_FULLREJUV: - return sgOptions.Gameplay.numFullRejuPotionPickup > NumMiscItemsInInv(item._iMiscId); + return *sgOptions.Gameplay.numFullRejuPotionPickup > NumMiscItemsInInv(item._iMiscId); case IMISC_ELIXSTR: case IMISC_ELIXMAG: case IMISC_ELIXDEX: