Changeset 860
- Timestamp:
- 04/28/08 23:20:43 (3 months ago)
- Files:
-
- trunk/lib/edit/shop_own.txt (modified) (2 diffs)
- trunk/src/init1.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/edit/shop_own.txt
r859 r860 11 11 12 12 # Format: 13 # N:store:owner idx:owner name 14 # I:purse 15 13 # N:store number 14 # S:purse:owner name 16 15 17 16 … … 21 20 22 21 # 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 22 N:0 23 S:5000:Bilbo the Friendly (Hobbit) 24 S:10000:Rincewind the Chicken (Human) 25 S:20000:Snafu the Midget (Gnome) 26 S:30000:Lyar-el the Comely (Elf) 31 27 32 28 # 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 29 N:1 30 S:5000:Kon-Dar the Ugly (Half-Orc) 31 S:10000:Darg-Low the Grim (Human) 32 S:25000:Decado the Handsome (Dundan) 33 S:30000:Mauglin the Grumpy (Dwarf) 41 34 42 35 # 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 36 N:2 37 S:5000:Ithyl-Mak the Beastly (Half-Troll) 38 S:10000:Arndal Beast-Slayer (Half-Elf) 39 S:25000:Tarl Beast-Master (Hobbit) 40 S:30000:Oglign Dragon-Slayer (Dwarf) 51 41 52 42 # 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 43 N:3 44 S:15000:Ludwig the Humble (Human) 45 S:20000:Gunnar the Paladin (Human) 46 S:25000:Delilah the Pure (Elf) 47 S:30000:Bosk the Wise (Dwarf) 61 48 62 49 # 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 50 N:4 51 S:10000:Mauser the Chemist (Half-Elf) 52 S:10000:Wizzle the Chaotic (Hobbit) 53 S:15000:Ga-nat the Greedy (Gnome) 54 S:15000:Vella the Slender (Human) 71 55 72 56 # 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 57 N:5 58 S:15000:Ariel the Sorceress (Half-Elf) 59 S:20000:Buggerby the Great (Gnome) 60 S:25000:Inglorian the Mage (Human) 61 S:30000:Luthien Starshine (High-Elf) 81 62 82 63 # 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 64 N:6 65 S:15000:Lo-Hak the Awful (Half-Troll) 66 S:20000:Histor the Goblin (Kobold) 67 S:25000:Durwin the Shifty (Half-Orc) 68 S:30000:Drago the Fair (Elf) 91 69 92 70 # 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 71 N:7 72 S:0:Your home 73 S:0:Your home 74 S:0:Your home 75 S:0:Your home trunk/src/init1.c
r859 r860 2902 2902 errr parse_b_info(char *buf, header *head) 2903 2903 { 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; 2911 2906 2912 2907 /* Process 'N' for "New/Number/Name" */ 2913 2908 if (buf[0] == 'N') 2914 2909 { 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 2916 2939 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; 2978 2948 } 2979 2949 else
