Changeset 860

Show
Ignore:
Timestamp:
04/28/08 23:20:43 (3 months ago)
Author:
takkaria
Message:

Make shop_own.txt user a nicer format now there's only two things specified per shopkeeper.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/edit/shop_own.txt

    r859 r860  
    1111 
    1212# Format: 
    13 # N:store:owner idx:owner name 
    14 # I:purse 
    15  
     13# N:store number 
     14# S:purse:owner name 
    1615 
    1716 
     
    2120 
    2221# General Store 
    23 N:0:0:Bilbo the Friendly (Hobbit) 
    24 I:5000 
    25 N:0:1:Rincewind the Chicken (Human) 
    26 I:10000 
    27 N:0:2:Snafu the Midget (Gnome) 
    28 I:20000 
    29 N:0:3:Lyar-el the Comely (Elf) 
    30 I:30000 
     22N:0 
     23S:5000:Bilbo the Friendly (Hobbit) 
     24S:10000:Rincewind the Chicken (Human) 
     25S:20000:Snafu the Midget (Gnome) 
     26S:30000:Lyar-el the Comely (Elf) 
    3127 
    3228# Armoury 
    33 N:1:0:Kon-Dar the Ugly (Half-Orc) 
    34 I:5000 
    35 N:1:1:Darg-Low the Grim (Human) 
    36 I:10000 
    37 N:1:2:Decado the Handsome (Dundan) 
    38 I:25000 
    39 N:1:3:Mauglin the Grumpy (Dwarf) 
    40 I:30000 
     29N:1 
     30S:5000:Kon-Dar the Ugly (Half-Orc) 
     31S:10000:Darg-Low the Grim (Human) 
     32S:25000:Decado the Handsome (Dundan) 
     33S:30000:Mauglin the Grumpy (Dwarf) 
    4134 
    4235# Weapon Smith 
    43 N:2:0:Ithyl-Mak the Beastly (Half-Troll) 
    44 I:5000 
    45 N:2:1:Arndal Beast-Slayer (Half-Elf) 
    46 I:10000 
    47 N:2:2:Tarl Beast-Master (Hobbit) 
    48 I:25000 
    49 N:2:3:Oglign Dragon-Slayer (Dwarf) 
    50 I:30000 
     36N:2 
     37S:5000:Ithyl-Mak the Beastly (Half-Troll) 
     38S:10000:Arndal Beast-Slayer (Half-Elf) 
     39S:25000:Tarl Beast-Master (Hobbit) 
     40S:30000:Oglign Dragon-Slayer (Dwarf) 
    5141 
    5242# Temple 
    53 N:3:0:Ludwig the Humble (Human) 
    54 I:15000 
    55 N:3:1:Gunnar the Paladin (Human) 
    56 I:20000 
    57 N:3:2:Delilah the Pure (Elf) 
    58 I:25000 
    59 N:3:3:Bosk the Wise (Dwarf) 
    60 I:30000 
     43N:3 
     44S:15000:Ludwig the Humble (Human) 
     45S:20000:Gunnar the Paladin (Human) 
     46S:25000:Delilah the Pure (Elf) 
     47S:30000:Bosk the Wise (Dwarf) 
    6148 
    6249# Alchemist 
    63 N:4:0:Mauser the Chemist (Half-Elf) 
    64 I:10000 
    65 N:4:1:Wizzle the Chaotic (Hobbit) 
    66 I:10000 
    67 N:4:2:Ga-nat the Greedy (Gnome) 
    68 I:15000 
    69 N:4:3:Vella the Slender (Human) 
    70 I:15000 
     50N:4 
     51S:10000:Mauser the Chemist (Half-Elf) 
     52S:10000:Wizzle the Chaotic (Hobbit) 
     53S:15000:Ga-nat the Greedy (Gnome) 
     54S:15000:Vella the Slender (Human) 
    7155 
    7256# Magic Shop 
    73 N:5:0:Ariel the Sorceress (Half-Elf) 
    74 I:15000 
    75 N:5:1:Buggerby the Great (Gnome) 
    76 I:20000 
    77 N:5:2:Inglorian the Mage (Human) 
    78 I:25000 
    79 N:5:3:Luthien Starshine (High-Elf) 
    80 I:30000 
     57N:5 
     58S:15000:Ariel the Sorceress (Half-Elf) 
     59S:20000:Buggerby the Great (Gnome) 
     60S:25000:Inglorian the Mage (Human) 
     61S:30000:Luthien Starshine (High-Elf) 
    8162 
    8263# Black Market 
    83 N:6:0:Lo-Hak the Awful (Half-Troll) 
    84 I:15000 
    85 N:6:1:Histor the Goblin (Kobold) 
    86 I:20000 
    87 N:6:2:Durwin the Shifty (Half-Orc) 
    88 I:25000 
    89 N:6:3:Drago the Fair (Elf) 
    90 I:30000 
     64N:6 
     65S:15000:Lo-Hak the Awful (Half-Troll) 
     66S:20000:Histor the Goblin (Kobold) 
     67S:25000:Durwin the Shifty (Half-Orc) 
     68S:30000:Drago the Fair (Elf) 
    9169 
    9270# Home 
    93 N:7:0:Your home 
    94 I:0 
    95 N:7:1:Your home 
    96 I:0 
    97 N:7:2:Your home 
    98 I:0 
    99 N:7:3:Your home 
    100 I:0 
     71N:7 
     72S:0:Your home 
     73S:0:Your home 
     74S:0:Your home 
     75S:0:Your home 
  • trunk/src/init1.c

    r859 r860  
    29022902errr parse_b_info(char *buf, header *head) 
    29032903{ 
    2904         int i, j; 
    2905  
    2906         char *s, *t; 
    2907  
    2908         /* Current entry */ 
    2909         static owner_type *ot_ptr = NULL; 
    2910  
     2904        static int shop_idx = 0; 
     2905        static int owner_idx = 0; 
    29112906 
    29122907        /* Process 'N' for "New/Number/Name" */ 
    29132908        if (buf[0] == 'N') 
    29142909        { 
    2915                 /* Find the colon before the subindex */ 
     2910                /* Confirm the colon */ 
     2911                if (buf[1] != ':') return PARSE_ERROR_GENERIC; 
     2912 
     2913                /* Get the index */ 
     2914                shop_idx = atoi(buf+2); 
     2915                owner_idx = 0; 
     2916 
     2917                return 0; 
     2918        } 
     2919 
     2920        /* Process 'S' for "Owner" */ 
     2921        else if (buf[0] == 'S') 
     2922        { 
     2923                owner_type *ot_ptr; 
     2924                char *s; 
     2925                int purse; 
     2926 
     2927                if (owner_idx >= z_info->b_max) 
     2928                        return PARSE_ERROR_TOO_MANY_ENTRIES; 
     2929                if ((shop_idx * z_info->b_max) + owner_idx >= head->info_num) 
     2930                        return PARSE_ERROR_TOO_MANY_ENTRIES; 
     2931 
     2932                ot_ptr = (owner_type *)head->info_ptr + (shop_idx * z_info->b_max) + owner_idx; 
     2933                if (!ot_ptr) return PARSE_ERROR_GENERIC; 
     2934 
     2935                /* Extract the purse */ 
     2936                if (1 != sscanf(buf+2, "%d", &purse)) return PARSE_ERROR_GENERIC; 
     2937                ot_ptr->max_cost = purse; 
     2938 
    29162939                s = strchr(buf+2, ':'); 
    2917  
    2918                 /* Verify that colon */ 
    2919                 if (!s) return (PARSE_ERROR_GENERIC); 
    2920  
    2921                 /* Nuke the colon, advance to the subindex */ 
    2922                 *s++ = '\0'; 
    2923  
    2924                 /* Get the index */ 
    2925                 i = atoi(buf+2); 
    2926  
    2927                 /* Find the colon before the name */ 
    2928                 t = strchr(s, ':'); 
    2929  
    2930                 /* Verify that colon */ 
    2931                 if (!t) return (PARSE_ERROR_GENERIC); 
    2932  
    2933                 /* Nuke the colon, advance to the name */ 
    2934                 *t++ = '\0'; 
    2935  
    2936                 /* Paranoia -- require a name */ 
    2937                 if (!*t) return (PARSE_ERROR_GENERIC); 
    2938  
    2939                 /* Get the subindex */ 
    2940                 j = atoi(s); 
    2941  
    2942                 /* Verify information */ 
    2943                 if (j >= z_info->b_max) return (PARSE_ERROR_TOO_MANY_ENTRIES); 
    2944  
    2945                 /* Get the *real* index */ 
    2946                 i = (i * z_info->b_max) + j; 
    2947  
    2948                 /* Verify information */ 
    2949                 if (i <= error_idx) return (PARSE_ERROR_NON_SEQUENTIAL_RECORDS); 
    2950  
    2951                 /* Verify information */ 
    2952                 if (i >= head->info_num) return (PARSE_ERROR_TOO_MANY_ENTRIES); 
    2953  
    2954                 /* Save the index */ 
    2955                 error_idx = i; 
    2956  
    2957                 /* Point at the "info" */ 
    2958                 ot_ptr = (owner_type*)head->info_ptr + i; 
    2959  
    2960                 /* Store the name */ 
    2961                 if ((ot_ptr->owner_name = add_name(head, t)) == 0) 
    2962                         return (PARSE_ERROR_OUT_OF_MEMORY); 
    2963         } 
    2964  
    2965         /* Process 'I' for "Info" (one line only) */ 
    2966         else if (buf[0] == 'I') 
    2967         { 
    2968                 int purse; 
    2969  
    2970                 /* There better be a current ot_ptr */ 
    2971                 if (!ot_ptr) return (PARSE_ERROR_MISSING_RECORD_HEADER); 
    2972  
    2973                 /* Scan for the values */ 
    2974                 if (1 != sscanf(buf+2, "%d", &purse)) return (PARSE_ERROR_GENERIC); 
    2975  
    2976                 /* Save the values */ 
    2977                 ot_ptr->max_cost = purse; 
     2940                if (!s || s[1] == 0) return PARSE_ERROR_GENERIC; 
     2941 
     2942                ot_ptr->owner_name = add_name(head, s+1); 
     2943                if (!ot_ptr->owner_name) 
     2944                        return PARSE_ERROR_OUT_OF_MEMORY; 
     2945 
     2946                owner_idx++; 
     2947                return 0; 
    29782948        } 
    29792949        else