borg out of sync sometimes due to lag in update on p_ptr->inventory[]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • APWhite
    Adept
    • Jul 2007
    • 244

    borg out of sync sometimes due to lag in update on p_ptr->inventory[]

    I was reviewing some odd borg behavior that crept in during the change to Angband 320. One error seems to be the borg selling at item at the house, then immediately trying to sell the exact same item to a shop; as if he still had it in the inventory. Once he gets to the shop, he sells an item in the old items inventory slot. So the inventory is not being updated after he drops the item in the house.

    Same thing happens with ring swapping. During one round he will remove both rings, scan the inventory and re-wear the rings in the proper order (wearing the ring which had been on the left hand first, then wearing the ring which had been on the right hand).

    I have stepped through the code and found that the borg is correctly scanning the &p_ptr->inventory[], but the p_ptr->inventory is not being immediately updated after the borg's keypresses. So the borg is essentially scanning the old inventory and equipment state instead of the state following the keypresses. Vanilla 309 and previous versions immediately updated the p_ptr->inventory[] following any borg keypresses.

    Does anyone know if the update is being delayed? Maybe waiting for an event handler change or something? And if so, how do I fix it?
    St George Chiropractor
    Angband Borg Homepage
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #2
    Originally posted by APWhite
    I was reviewing some odd borg behavior that crept in during the change to Angband 320. One error seems to be the borg selling at item at the house, then immediately trying to sell the exact same item to a shop; as if he still had it in the inventory. Once he gets to the shop, he sells an item in the old items inventory slot. So the inventory is not being updated after he drops the item in the house.

    Same thing happens with ring swapping. During one round he will remove both rings, scan the inventory and re-wear the rings in the proper order (wearing the ring which had been on the left hand first, then wearing the ring which had been on the right hand).

    I have stepped through the code and found that the borg is correctly scanning the &p_ptr->inventory[], but the p_ptr->inventory is not being immediately updated after the borg's keypresses. So the borg is essentially scanning the old inventory and equipment state instead of the state following the keypresses. Vanilla 309 and previous versions immediately updated the p_ptr->inventory[] following any borg keypresses.

    Does anyone know if the update is being delayed? Maybe waiting for an event handler change or something? And if so, how do I fix it?
    I'm not quite sure why the borg isn't seeing the inventory update if it's using the same routines as the normal game for the stores, but my suspicion is that the command queue isn't being processed for some reason. For a non-borg game, when the player presses 's' and chooses what to sell, the UI layer puts a 'sell item X' command onto the command queue, and then tells the game layer to process commands. I suspect the borg is somehow stopping the latter from happening. The relevant command is in store_menu_handle():
    Code:
    process_command(CMD_STORE, TRUE);
    .

    Is that helpful at all?
    takkaria whispers something about options. -more-

    Comment

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