MrMister
Sailor Apprentice
By default, the potion hotkey uses the least powerful potion in the player's inventory, found with the function MaxHealthPotionForCharacter. This can be changed by redefining USEMAXPOTION_ONKEYPRESS to 1 instead of the default 0, which will instead choose the most powerful potion avaliable, as found by function MaxHealthPotionForCharacter.
I've just taken a quick look at MaxHealthPotionForCharacter, and I'm 99% sure it does still choose the most powerful potion even if a less powerful one would be enough to restore the player's health to full, which is a less efficient potion usage than using the least powerful potion able to completely heal the player.
My idea/suggestion:
Redefine MaxHealthPotionForCharacter so that it chooses the least powerful potion that would heal to full, and if none would do so, still chose the most powerful one. I think it is possible to do so without adding arguments, by using functions LAi_GetCharacterHP(PChar) and LAi_GetCharacterMaxHP(PChar) inside of it, but adding the difference between those two as a third argument is also possible, since it is only used once in the whole gamecode, in seadogs.c.
This would greatly increase the usefulness of the potion hotkey in combat, and if working well could be reason to default USEMAXPOTION_ONKEYPRESS to 1.
I miiiiiiight or might not look into changing the code myself, but I'm leaving this here as a reminder anyway.
I've just taken a quick look at MaxHealthPotionForCharacter, and I'm 99% sure it does still choose the most powerful potion even if a less powerful one would be enough to restore the player's health to full, which is a less efficient potion usage than using the least powerful potion able to completely heal the player.
My idea/suggestion:
Redefine MaxHealthPotionForCharacter so that it chooses the least powerful potion that would heal to full, and if none would do so, still chose the most powerful one. I think it is possible to do so without adding arguments, by using functions LAi_GetCharacterHP(PChar) and LAi_GetCharacterMaxHP(PChar) inside of it, but adding the difference between those two as a third argument is also possible, since it is only used once in the whole gamecode, in seadogs.c.
This would greatly increase the usefulness of the potion hotkey in combat, and if working well could be reason to default USEMAXPOTION_ONKEYPRESS to 1.
I miiiiiiight or might not look into changing the code myself, but I'm leaving this here as a reminder anyway.