Oangband bug fix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bron
    Knight
    • May 2008
    • 515

    Oangband bug fix

    So I was playing in the recent Oangband Shadow Fairy Mage competition, and I was annoyed by a bug I kept hitting: if I was a full mana, and then saved the game (cntrl-X), when I restored it I had less than full mana. It annoyed me enough that I tracked it down: in update_stuff() in file xtra1.c, the call to calc_mana() comes *before* the call to calc_specialty(). This means that the very first time calc_mana() is called after a savefile reload, the value of p_ptr->specialties_allowed has not yet been updated and so is still zero. This in turn means that the bonus for having the "Clarity" special ability isn't being counted the first time that calc_mana() is called.

    The fix that I chose is simple: I just moved the block of code that checks for and calls calc_speciality to be the first such block in the update_stuff() routine.
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9634

    #2
    Cool, thanks - O110u isn't very well maintained, I'm afraid.
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • CJNyfalt
      Swordsman
      • May 2007
      • 289

      #3
      Thanks! Strangely doing this does not fix the same issue with Athletics and hitpoints.

      Comment

      • bron
        Knight
        • May 2008
        • 515

        #4
        Originally posted by CJNyfalt
        Thanks! Strangely doing this does not fix the same issue with Athletics and hitpoints.
        That is odd. I'm not surprised that similar issues would exist for other specialties; I'm surprised this doesn't fix them as well. Having just pawed through the code for my problem, I'd be happy to look at this case as well if you have a savefile that shows the problem (e.g. I load the character, rest to full HP <or whatever>, save, restore, and the attribute falls). No guarantees of course.

        Comment

        • bron
          Knight
          • May 2008
          • 515

          #5
          OK, so I just now created a Warrior character with the Athletics specialty. With the original code, I see the analogous problem. But for me, the fix I proposed does also fix the problem for Athletics. There are lots of possibilities here, but let's start with the simple one: if you load a savefile, and see that it has too few HP, and then save the character again, the savefile will now have the lower number of HP, and fixing the problem that caused it in the first place will not change the number of HP in the savefile. So please try: (1) apply the fix to update_stuff, moving the "if" block that includes calc_specialties to the top. (2) load the old save file, then rest to get up to full HP, (3) Now save, with the character at full HP, which will correct the number of HP in the savefile, and then (4) restore.

          If this still doesn't work, something more subtle is wrong.

          Comment

          • CJNyfalt
            Swordsman
            • May 2007
            • 289

            #6
            Yes, I did exactly like that, and it didn't work.

            Still, I got an idea on where the issue might be. First, I have a different version than 1.1.0u, at first I saw no reason how that should matter. However, one of the differences is that 1.1.0 has the menu to load savefiles from, and displays the character screen when loading a character. I noticed that the maximum hitpoints was too low on this screen. So, it looks to me that said screen is displayed before any call to update_stuff.

            It seems like I need to insert a call to update_stuff somewhere. The exact place is still unknown.

            Comment

            Working...
            😀
            😂
            🥰
            😘
            🤢
            😎
            😞
            😡
            👍
            👎