viewing paste Unknown #393 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
else if ( !strcmpi(subcmd, "set") ) // to record our restock settings
    {
        
        for (j=0; j < MAX_INVENTORY; ++j)
        {
            if (!sd->inventory_data[j])
                continue;
 
            switch (sd->inventory_data[j]->type)
            {
                case IT_HEALING:
                case IT_USABLE:
                case IT_ETC:
                case IT_DELAYCONSUME:
                case IT_THROWWEAPON:
                case IT_CASH:
                case IT_AMMO:
                {
                    if ( !itemdb_canstore(&sd->restock[idx].items[i], pc_isGM(sd)) )
                        continue;
                    if( sd->restock[idx].items[i].card[0] == CARD0_CREATE ) 
                    {
                        int char_id = MakeDWord(sd->restock[idx].items[i].card[2],sd->restock[idx].items[i].card[3]);
                        if( (BG_CHARID && char_id == BG_CHARID && BG_TRADE&32) || (WOE_CHARID && char_id == WOE_CHARID && WOE_TRADE&32) || (RAID_CHARID && char_id == RAID_CHARID && RAID_TRADE&32) )
                        {
                            continue;
                        }
                    }
 
                    memcpy(&sd->restock[idx].items[i], &sd->status.inventory[j], sizeof (struct item));
                    ++i;
                }
                default: 
                    continue;
            }
 
            if (i >= MAX_RESTOCK_ITEMS)
                break;
        }
 
        sd->restock[idx].size = i;
        if (sd->restock[idx].size > MAX_RESTOCK_ITEMS) // how would this happen? well, don't know don't care it shouldn't be this value!
            sd->restock[idx].size = MAX_RESTOCK_ITEMS;
 
        sd->state.restock_dirty |= (1<<idx);
        ShowDebug("Restock Slot %d marked for saving. (Dirty: %d)\n", idx, sd->state.restock_dirty);
 
        strcpy(subcmd, "check"); // so players will immediately view what they have set :)
    }
Viewed 834 times, submitted by Guest.