Browse Source

Optional feature to auto-refill belt from inventory (#983)

pull/3210/head
Joerg Wissen 4 years ago committed by GitHub
parent
commit
4e7d6b8f9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      Source/inv.cpp
  2. 2
      Source/options.cpp
  3. 2
      Source/options.h

12
Source/inv.cpp

@ -2010,8 +2010,19 @@ bool UseInvItem(int pnum, int cii)
if (talkflag)
return true;
c = cii - INVITEM_BELT_FIRST;
item = &player.SpdList[c];
speedlist = true;
//If selected speedlist item exists in InvList, use the InvList item.
for (int i = 0; i < player._pNumInv && sgOptions.Gameplay.bAutoRefillBelt; i++) {
if (player.InvList[i]._iMiscId == item->_iMiscId && player.InvList[i]._iSpell == item->_iSpell) {
c = i;
item = &player.InvList[c];
speedlist = false;
break;
}
}
}
constexpr int SpeechDelay = 10;
@ -2020,6 +2031,7 @@ bool UseInvItem(int pnum, int cii)
return true;
}
if (item->IDidx == IDI_FUNGALTM) {
PlaySFX(IS_IBOOK);
player.Say(HeroSpeech::ThatDidntDoAnything, SpeechDelay);
return true;

2
Source/options.cpp

@ -281,6 +281,7 @@ void LoadOptions()
sgOptions.Gameplay.bRandomizeQuests = GetIniBool("Game", "Randomize Quests", true);
sgOptions.Gameplay.bShowMonsterType = GetIniBool("Game", "Show Monster Type", false);
sgOptions.Gameplay.bDisableCripplingShrines = GetIniBool("Game", "Disable Crippling Shrines", false);
sgOptions.Gameplay.bAutoRefillBelt = GetIniBool("Game", "Auto Refill Belt", AUTO_PICKUP_DEFAULT(false));
GetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress, sizeof(sgOptions.Network.szBindAddress), "0.0.0.0");
sgOptions.Network.nPort = GetIniInt("Network", "Port", 6112);
@ -432,6 +433,7 @@ void SaveOptions()
SetIniValue("Game", "Randomize Quests", sgOptions.Gameplay.bRandomizeQuests);
SetIniValue("Game", "Show Monster Type", sgOptions.Gameplay.bShowMonsterType);
SetIniValue("Game", "Disable Crippling Shrines", sgOptions.Gameplay.bDisableCripplingShrines);
SetIniValue("Game", "Auto Refill Belt", sgOptions.Gameplay.bAutoRefillBelt);
SetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress);
SetIniValue("Network", "Port", sgOptions.Network.nPort);

2
Source/options.h

@ -134,6 +134,8 @@ struct GameplayOptions {
bool bRandomizeQuests;
/** @brief Indicates whether or not monster type (Animal, Demon, Undead) is shown along with other monster information. */
bool bShowMonsterType;
/** @brief Refill belt form inventory, or rather, use potions/scrolls from inventory first when belt item is consumed. */
bool bAutoRefillBelt;
/** @brief Locally disable clicking on shrines which permanently cripple character. */
bool bDisableCripplingShrines;
};

Loading…
Cancel
Save