Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old August 31, 2011, 05:08   #1
APWhite
Adept
 
APWhite's Avatar
 
Join Date: Jul 2007
Location: St George Utah, USA
Posts: 244
APWhite is on a distinguished road
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?
APWhite is offline   Reply With Quote
Old September 10, 2011, 21:39   #2
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,951
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by APWhite View Post
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-
takkaria is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
p_ptr->class vs. p_ptr->pclass APWhite Development 5 August 17, 2011 16:32
Ready for borg update? APWhite Development 8 April 21, 2009 19:22
Borg update APWhite Vanilla 75 April 11, 2009 12:14
309 Borg Update APWhite Vanilla 1 October 11, 2007 09:29
Borg 3.0.9 Progress Update APWhite Vanilla 3 August 10, 2007 02:15


All times are GMT +1. The time now is 12:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.