Changeset 117

Show
Ignore:
Timestamp:
05/06/07 16:32:34 (1 year ago)
Author:
takkaria
Message:

Code cleanup. (Removed a needless option, too.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cmd3.c

    r59 r117  
    289289                msg_print("Oops! It feels deathly cold!"); 
    290290 
    291                 /* Remove special inscription, if any */ 
    292                 if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
    293  
    294                 /* Sense the object if allowed */ 
    295                 if (o_ptr->discount == 0) o_ptr->discount = INSCRIP_CURSED; 
     291                /* Sense the object */ 
     292                o_ptr->pseudo = INSCRIP_CURSED; 
    296293 
    297294                /* The object has been "sensed" */ 
     
    577574                        /* Already sensed objects always get improved feelings */ 
    578575                        if (cursed_p(o_ptr) || broken_p(o_ptr)) 
    579                                 o_ptr->discount = INSCRIP_TERRIBLE; 
     576                                o_ptr->pseudo = INSCRIP_TERRIBLE; 
    580577                        else 
    581                                 o_ptr->discount = INSCRIP_SPECIAL; 
     578                                o_ptr->pseudo = INSCRIP_SPECIAL; 
    582579                } 
    583580                else 
    584581                { 
    585582                        /* Mark the object as indestructible */ 
    586                         o_ptr->discount = INSCRIP_INDESTRUCTIBLE; 
     583                        o_ptr->pseudo = INSCRIP_INDESTRUCTIBLE; 
    587584                } 
    588585 
  • trunk/src/defines.h

    r112 r117  
    17141714 * The special inscriptions. 
    17151715 */ 
    1716 #define INSCRIP_NULL            10
    1717 #define INSCRIP_TERRIBLE        100+1 
    1718 #define INSCRIP_WORTHLESS       100+
    1719 #define INSCRIP_CURSED          100+
    1720 #define INSCRIP_BROKEN          100+
    1721 #define INSCRIP_AVERAGE         100+
    1722 #define INSCRIP_GOOD            100+
    1723 #define INSCRIP_EXCELLENT       100+
    1724 #define INSCRIP_SPECIAL         100+
    1725 #define INSCRIP_UNCURSED        100+
    1726 #define INSCRIP_INDESTRUCTIBLE  100+10 
     1716#define INSCRIP_NULL           
     1717#define INSCRIP_TERRIBLE        1 
     1718#define INSCRIP_WORTHLESS       
     1719#define INSCRIP_CURSED         
     1720#define INSCRIP_BROKEN         
     1721#define INSCRIP_AVERAGE         
     1722#define INSCRIP_GOOD           
     1723#define INSCRIP_EXCELLENT       
     1724#define INSCRIP_SPECIAL         
     1725#define INSCRIP_UNCURSED       
     1726#define INSCRIP_INDESTRUCTIBLE  10 
    17271727 
    17281728/* 
  • trunk/src/dungeon.c

    r116 r117  
    162162                if (!okay) continue; 
    163163 
    164                 /* It already has a discount or special inscription */ 
    165                 if ((o_ptr->discount > 0) && 
    166                     (o_ptr->discount != INSCRIP_INDESTRUCTIBLE)) continue; 
     164                /* It's already been pseudo-ID'd */ 
     165                if (o_ptr->pseudo && 
     166                    o_ptr->pseudo != INSCRIP_INDESTRUCTIBLE) continue; 
    167167 
    168168                /* It has already been sensed, do not sense it again */ 
     
    176176 
    177177                /* Indestructible objects are either excellent or terrible */ 
    178                 if (o_ptr->discount == INSCRIP_INDESTRUCTIBLE) 
     178                if (o_ptr->pseudo == INSCRIP_INDESTRUCTIBLE) 
    179179                        heavy = TRUE; 
    180180 
     
    217217 
    218218                /* Sense the object */ 
    219                 o_ptr->discount = feel; 
     219                o_ptr->pseudo = feel; 
    220220 
    221221                /* The object has been "sensed" */ 
  • trunk/src/load.c

    r72 r117  
    271271 
    272272 
    273         rd_byte(&o_ptr->discount); 
     273        rd_byte(&o_ptr->pseudo); 
     274 
     275        /* Fix the field */ 
     276        if (o_ptr->pseudo > 99) 
     277            o_ptr->pseudo -= 100; 
     278        else 
     279            o_ptr->pseudo = 0; 
    274280 
    275281        rd_byte(&o_ptr->number); 
  • trunk/src/object1.c

    r87 r117  
    14911491 
    14921492        /* Use special inscription, if any */ 
    1493         if (o_ptr->discount >= INSCRIP_NULL
    1494         { 
    1495                 v = inscrip_text[o_ptr->discount - INSCRIP_NULL]; 
     1493        if (o_ptr->pseudo
     1494        { 
     1495                v = inscrip_text[o_ptr->pseudo]; 
    14961496        } 
    14971497 
     
    15121512        { 
    15131513                v = "tried"; 
    1514         } 
    1515  
    1516         /* Use the discount, if any */ 
    1517         else if (o_ptr->discount > 0) 
    1518         { 
    1519                 char *q = discount_buf; 
    1520                 object_desc_num_macro(q, o_ptr->discount); 
    1521                 object_desc_str_macro(q, "% off"); 
    1522                 *q = '\0'; 
    1523                 v = discount_buf; 
    15241514        } 
    15251515 
  • trunk/src/object2.c

    r110 r117  
    765765{ 
    766766        /* Remove special inscription, if any */ 
    767         if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
     767        if (o_ptr->pseudo) o_ptr->pseudo = 0; 
    768768 
    769769        /* The object is not "sensed" */ 
     
    11431143 
    11441144 
    1145         /* Apply discount (if any) */ 
    1146         if (o_ptr->discount > 0 && o_ptr->discount < INSCRIP_NULL) 
    1147         { 
    1148                 value -= (value * o_ptr->discount / 100L); 
    1149         } 
    1150  
    1151  
    11521145        /* Return the final value */ 
    11531146        return (value); 
     
    13251318 
    13261319 
    1327         /* Hack -- Require compatible "discount" fields */ 
    1328         if (o_ptr->discount != j_ptr->discount) 
    1329         { 
    1330                 /* Both are (different) special inscriptions */ 
    1331                 if ((o_ptr->discount >= INSCRIP_NULL) && 
    1332                     (j_ptr->discount >= INSCRIP_NULL)) 
    1333                 { 
    1334                         /* Normally require matching inscriptions */ 
    1335                         return (0); 
    1336                 } 
    1337  
    1338                 /* One is a special inscription, one is a discount or nothing */ 
    1339                 else if ((o_ptr->discount >= INSCRIP_NULL) || 
    1340                          (j_ptr->discount >= INSCRIP_NULL)) 
    1341                 { 
    1342                         /* Normally require matching inscriptions */ 
    1343                         if (!stack_force_notes) return (0); 
    1344  
    1345                         /* Hack -- Never merge a special inscription with a discount */ 
    1346                         if ((o_ptr->discount > 0) && (j_ptr->discount > 0)) return (0); 
    1347                 } 
    1348  
    1349                 /* One is a discount, one is a (different) discount or nothing */ 
    1350                 else 
    1351                 { 
    1352                         /* Normally require matching discounts */ 
    1353                         if (!stack_force_costs) return (0); 
    1354                 } 
    1355         } 
     1320        /* Different pseudo-ID statuses preclude combination */ 
     1321        if (o_ptr->pseudo != j_ptr->pseudo) 
     1322                return (0); 
    13561323 
    13571324 
     
    14031370 
    14041371        /* Mega-Hack -- Blend "discounts" */ 
    1405         if (o_ptr->discount < j_ptr->discount) o_ptr->discount = j_ptr->discount
     1372        o_ptr->pseudo = j_ptr->pseudo
    14061373 
    14071374        /* 
  • trunk/src/save.c

    r48 r117  
    102102        wr_s16b(o_ptr->pval); 
    103103 
    104         wr_byte(o_ptr->discount); 
     104        wr_byte(o_ptr->pseudo); 
    105105 
    106106        wr_byte(o_ptr->number); 
  • trunk/src/spells2.c

    r24 r117  
    285285        o_ptr->ident &= ~(IDENT_CURSED); 
    286286 
    287         /* Remove special inscription, if any */ 
    288         if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
    289  
    290         /* Take note if allowed */ 
    291         if (o_ptr->discount == 0) o_ptr->discount = INSCRIP_UNCURSED; 
     287        /* Mark as uncursed */ 
     288        o_ptr->pseudo = INSCRIP_UNCURSED; 
    292289 
    293290        /* The object has been "sensed" */ 
     
    902899 
    903900                /* Remove special inscription, if any */ 
    904                 if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
     901                if (o_ptr->pseudo) o_ptr->pseudo = 0; 
    905902 
    906903                /* Hack -- Clear the "felt" flag */ 
  • trunk/src/store.c

    r110 r117  
    482482/* 
    483483 * Some cheap objects should be created in piles. 
    484  * 
    485  * Some objects can be sold at a "discount" (in smaller piles). 
    486  * Standard percentage discounts include 10, 25, 50, 75, and 90. 
    487484 */ 
    488485static void mass_produce(object_type *o_ptr) 
    489486{ 
    490487        int size = 1; 
    491  
    492         int discount = 0; 
    493  
    494488        s32b cost = object_value(o_ptr); 
    495  
    496489 
    497490        /* Analyze the type */ 
     
    563556 
    564557 
    565         /* Pick a discount */ 
    566         if (cost < 5) 
    567                 discount = 0; 
    568  
    569         else if (rand_int(25) == 0) 
    570                 discount = 10; 
    571  
    572         else if (rand_int(50) == 0) 
    573                 discount = 25; 
    574  
    575         else if (rand_int(150) == 0) 
    576                 discount = 50; 
    577  
    578         else if (rand_int(300) == 0) 
    579                 discount = 75; 
    580  
    581         else if (rand_int(500) == 0) 
    582                 discount = 90; 
    583  
    584  
    585         /* Save the discount */ 
    586         o_ptr->discount = discount; 
    587  
    588558        /* Save the total pile size */ 
    589         o_ptr->number = size - (size * discount / 100)
     559        o_ptr->number = size
    590560 
    591561        /* Hack -- rods need to increase PVAL if stacked */ 
     
    638608        if ((o_ptr->timeout || j_ptr->timeout) && o_ptr->tval != TV_LITE) 
    639609                return (0); 
     610 
    640611        /* Never stack items with different fuel */ 
    641612        else if ((o_ptr->timeout != j_ptr->timeout) && o_ptr->tval == TV_LITE) 
     
    649620        /* Hack -- Never stack chests */ 
    650621        if (o_ptr->tval == TV_CHEST) return (0); 
    651  
    652         /* Require matching "discount" fields */ 
    653         if (o_ptr->discount != j_ptr->discount) return (0); 
    654622 
    655623        /* They match, so they must be similar */ 
     
    857825        if (value <= 0) return (-1); 
    858826 
    859         /* Erase the inscription */ 
     827        /* Erase the inscription & pseudo-ID bit */ 
    860828        o_ptr->note = 0; 
    861  
    862         /* Remove special inscription, if any */ 
    863         if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
    864  
     829        o_ptr->pseudo = 0; 
    865830 
    866831        /* Check each existing object (try to combine) */ 
     
    15231488void store_shuffle(int which) 
    15241489{ 
    1525         int i, j
     1490        int i
    15261491 
    15271492        store_type *st_ptr = &store[which]; 
     
    15321497 
    15331498        /* Pick a new owner */ 
    1534         for (j = st_ptr->owner; j == st_ptr->owner; ) 
    1535         { 
    1536                 st_ptr->owner = (byte)rand_int(z_info->b_max); 
    1537         } 
    1538  
    1539  
    1540         /* Discount all the items */ 
    1541         for (i = 0; i < st_ptr->stock_num; i++) 
    1542         { 
    1543                 object_type *o_ptr; 
    1544  
    1545                 /* Get the object */ 
    1546                 o_ptr = &st_ptr->stock[i]; 
    1547  
    1548                 /* Discount non-discounted items by 40 percent */ 
    1549                 if (o_ptr->discount == 0) o_ptr->discount = 40; 
    1550         } 
     1499        i = st_ptr->owner; 
     1500 
     1501        while (i == st_ptr->owner) 
     1502            i = rand_int(z_info->b_max); 
     1503 
     1504        st_ptr->owner = i; 
    15511505} 
    15521506 
     
    19471901                /* Erase the inscription */ 
    19481902                i_ptr->note = 0; 
    1949  
    1950                 /* Remove special inscription, if any */ 
    1951                 if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
    19521903 
    19531904                /* Give it to the player */ 
     
    21582109                store_flags |= STORE_GOLD_CHANGE; 
    21592110 
    2160                 /* Erase the inscription */ 
    2161                 i_ptr->note = 0; 
    2162  
    2163                 /* Remove special inscription, if any */ 
    2164                 if (o_ptr->discount >= INSCRIP_NULL) o_ptr->discount = 0; 
    2165  
    21662111                /* Identify original object */ 
    21672112                object_aware(o_ptr); 
  • trunk/src/tables.c

    r111 r117  
    16701670        "Show dungeon level in feet",                           /* OPT_depth_in_feet */ 
    16711671        "Merge inscriptions when stacking",                     /* OPT_stack_force_notes */ 
    1672         "Merge discounts when stacking",                       /* OPT_stack_force_costs */ 
     1672        NULL,                                                                          /* xxx stack_force_costs */ 
    16731673        "Show labels in equipment listings",            /* OPT_show_labels */ 
    16741674        NULL,                                                                           /* xxx show_weights */ 
     
    19341934        FALSE,          /* OPT_depth_in_feet */ 
    19351935        FALSE,          /* OPT_stack_force_notes */ 
    1936         FALSE,          /* OPT_stack_force_costs */ 
     1936        FALSE,          /* xxx stack_force_costs */ 
    19371937        TRUE,           /* OPT_show_labels */ 
    19381938        FALSE,          /* xxx show_weights */ 
     
    22212221                OPT_always_pickup, 
    22222222                OPT_stack_force_notes, 
    2223                 OPT_stack_force_costs, 
    22242223                OPT_show_piles, 
    22252224                OPT_show_flavors, 
    22262225                OPT_verify_destroy, 
    22272226                OPT_verify_special, 
     2227                OPT_NONE, 
    22282228                OPT_NONE, 
    22292229                OPT_NONE, 
  • trunk/src/types.h

    r112 r117  
    476476        s16b pval;                      /* Item extra-parameter */ 
    477477 
    478         byte discount;         /* Discount (if any) */ 
     478        byte pseudo;           /* Pseudo-ID marker */ 
    479479 
    480480        byte number;            /* Number of items */