Changeset 357

Show
Ignore:
Timestamp:
07/19/07 09:54:22 (1 year ago)
Author:
ajps
Message:

diff xorg.conf xorg.conf~ stops squelch auto-dropping things, and kill -9 30201 marks an object not to be squelched. Tested reasonably well, but could do with checking over by someone else. Closes #245.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/angband-3.0.8/src/cmd3.c

    r291 r357  
    643643        o_ptr->note = 0; 
    644644 
    645         /* Combine the pack */ 
    646         p_ptr->notice |= (PN_COMBINE); 
     645        /* Combine the pack, check for squelchables */ 
     646        p_ptr->notice |= (PN_COMBINE | PN_SQUELCH); 
    647647 
    648648        /* Window stuff */ 
     
    707707                o_ptr->note = quark_add(tmp); 
    708708 
    709                 /* Combine the pack */ 
    710                 p_ptr->notice |= (PN_COMBINE); 
     709                /* Combine the pack, check for squelchables */ 
     710                p_ptr->notice |= (PN_COMBINE | PN_SQUELCH); 
    711711 
    712712                /* Window stuff */ 
  • branches/angband-3.0.8/src/externs.h

    r279 r357  
    635635extern errr quarks_init(void); 
    636636extern errr quarks_free(void); 
     637extern bool check_for_inscrip(const object_type *o_ptr, const char *inscrip); 
    637638extern s16b message_num(void); 
    638639extern cptr message_str(s16b age); 
  • branches/angband-3.0.8/src/squelch.c

    r351 r357  
    329329        if (artifact_p(o_ptr)) return FALSE; 
    330330 
     331        /* Don't squelch stuff inscribed not to be destroyed (!k) */ 
     332        if (check_for_inscrip(o_ptr, "!k") || check_for_inscrip(o_ptr, "!*")) 
     333        { 
     334                return FALSE; 
     335        } 
     336 
    331337        /* Auto-squelch dead chests */ 
    332338        if (o_ptr->tval == TV_CHEST && o_ptr->pval == 0) 
     
    523529                if (!squelch_item_ok(o_ptr)) continue; 
    524530 
    525                 /* Drop item */ 
    526                 inven_drop(n, o_ptr->number); 
     531                /* Check for !d (no drop) inscription */ 
     532                if (!check_for_inscrip(o_ptr, "!d") && !check_for_inscrip(o_ptr, "!*")) 
     533                { 
     534                        /* We're allowed to drop it. */ 
     535                        inven_drop(n, o_ptr->number); 
     536                } 
    527537        } 
    528538 
  • branches/angband-3.0.8/src/util.c

    r350 r357  
    14901490} 
    14911491 
     1492/* 
     1493 * Looks if "inscrip" is present on the given object. 
     1494 */ 
     1495bool check_for_inscrip(const object_type *o_ptr, const char *inscrip) 
     1496{ 
     1497        if (o_ptr->note) 
     1498        { 
     1499                const char *s = strstr(quark_str(o_ptr->note), inscrip); 
     1500                if (s) return TRUE; 
     1501        } 
     1502         
     1503        return FALSE; 
     1504} 
    14921505 
    14931506/* 
     
    34253438        for (i = INVEN_WIELD; i < INVEN_TOTAL; i++) 
    34263439        { 
    3427                 cptr s
     3440                char verify_inscrip[] = "^*"
    34283441 
    34293442                object_type *o_ptr = &inventory[i]; 
     
    34323445                if (!o_ptr->k_idx) continue; 
    34333446 
    3434                 /* No inscription */ 
    3435                 if (!o_ptr->note) continue; 
    3436  
    3437                 /* Find a '^' */ 
    3438                 s = strchr(quark_str(o_ptr->note), '^'); 
    3439  
    3440                 /* Process preventions */ 
    3441                 while (s) 
    3442                 { 
    3443                         /* Check the "restriction" character */ 
    3444                         if ((s[1] == p_ptr->command_cmd) || (s[1] == '*')) 
     3447                /* Set up string to look for, e.g. "^d" */ 
     3448                verify_inscrip[1] = p_ptr->command_cmd; 
     3449                 
     3450                if (check_for_inscrip(o_ptr, "^*") || check_for_inscrip(o_ptr, verify_inscrip)) 
     3451                { 
     3452                        /* Hack -- Verify command */ 
     3453                        if (!get_check("Are you sure? ")) 
    34453454                        { 
    3446                                 /* Hack -- Verify command */ 
    3447                                 if (!get_check("Are you sure? ")) 
    3448                                 { 
    3449                                         /* Hack -- Use "newline" */ 
    3450                                         p_ptr->command_cmd = '\n'; 
    3451                                 } 
     3455                                /* Hack -- Use "newline" */ 
     3456                                p_ptr->command_cmd = '\n'; 
    34523457                        } 
    3453  
    3454                         /* Find another '^' */ 
    3455                         s = strchr(s + 1, '^'); 
    34563458                } 
    34573459        }