• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fix in Progress buying better spyglass without one equiped, very minor inventory glitch

Tingyun

Corsair
Storm Modder
I bought a masterwork spyglass from Gregor Samsa. However, the interface didn’t show it moving over the my inventory (still 0/1 showing him as having it), until I switched screens to a different item type and back again, at that point it showed me as having it.

I checked and the error log was this:

RUNTIME ERROR - file: interface\itemstrade.c; line: 1305

invalid index -1 [size:2000]

RUNTIME ERROR - file: interface\itemstrade.c; line: 1305

invalid array index

RUNTIME ERROR - file: interface\itemstrade.c; line: 1305

function 'DoTradeOperation' stack error

RUNTIME ERROR - file: interface\itemstrade.c; line: 874

Unknown data type


I looked up the source of the error in itemstrade.c, and it was this code:


// TIH --> auto-equip better spyglass if bought another Jul15'06

if ( nTradeQuantity > 0 && CheckAttribute(itemref,"groupID") ) {

if ( itemref.groupID == SPYGLASS_ITEM_TYPE ) {

if( sti(itemref.quality) > sti(Items[GetItemIndex(GetCharacterEquipByGroup(refMyCh,SPYGLASS_ITEM_TYPE))].quality) ) {

RemoveCharacterEquip(refMyCh, SPYGLASS_ITEM_TYPE);// remove equip of old one

EquipCharacterByItem(refMyCh, itmName);// equip the new better one

}

}

}

// TIH <-- auto-equip better spyglass



I checked and I hadn’t had a spyglass equipped beforehand. I imagine this glitch occurs when you try to buy a spyglass without one currently equipped.

Very minor glitch, but thought I’d report it. ;)
 
One reason is if you sell your original spyglass before buying a new one, either because you know you won't need it any more and may as well get rid of it, or to raise a bit of money towards the price of the new spyglass.
 
Yep, Grey Roger is correct about the reason I didn't have one. This bug report is actually a bit old (it was on my list to track down the error report before posting, hence the delay). At the time, I didn't even know there was an autoequip function for spyglasses.
 
It is written with the specific intention that you buy the new one first and then sell the old one.

Maybe this line will help:
Code:
if(GetCharacterEquipByGroup(refMyCh,SPYGLASS_ITEM_TYPE) == "" || sti(itemref.quality) > sti(Items[GetItemIndex(GetCharacterEquipByGroup(refMyCh,SPYGLASS_ITEM_TYPE))].quality) ) {
That should catch you having no spyglass equipped and then default to equipping the new one.

Not tested.
 
Could anyone confirm if the above suggestion actually works?
 
Back
Top