… | |
… | |
35 | |
35 | |
36 | int |
36 | int |
37 | main (int argc, char *argv[]) |
37 | main (int argc, char *argv[]) |
38 | { |
38 | { |
39 | char InFileName[1024], OutFileName[1024]; |
39 | char InFileName[1024], OutFileName[1024]; |
40 | mapstruct *newMap; |
40 | maptile *newMap; |
41 | RMParms rp; |
41 | RMParms rp; |
42 | FILE *fp; |
42 | FILE *fp; |
43 | |
43 | |
44 | if (argc < 3) |
44 | if (argc < 3) |
45 | { |
45 | { |
… | |
… | |
71 | new_save_map (newMap, 1); |
71 | new_save_map (newMap, 1); |
72 | exit (0); |
72 | exit (0); |
73 | } |
73 | } |
74 | |
74 | |
75 | void |
75 | void |
76 | set_map_timeout (mapstruct *) |
76 | set_map_timeout (maptile *) |
77 | { |
77 | { |
78 | } /* doesn't need to do anything */ |
78 | } /* doesn't need to do anything */ |
79 | |
79 | |
80 | #include <global.h> |
80 | #include <global.h> |
81 | |
81 | |
… | |
… | |
89 | int i; |
89 | int i; |
90 | |
90 | |
91 | switch (op->type) |
91 | switch (op->type) |
92 | { |
92 | { |
93 | case SHOP_FLOOR: |
93 | case SHOP_FLOOR: |
94 | if (!HAS_RANDOM_ITEMS (op)) |
94 | if (!op->has_random_items ()) |
95 | return 0; |
95 | return 0; |
96 | do |
96 | do |
97 | { |
97 | { |
98 | i = 10; /* let's give it 10 tries */ |
98 | i = 10; /* let's give it 10 tries */ |
99 | while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i); |
99 | while ((tmp = generate_treasure (op->randomitems, op->stats.exp ? op->stats.exp : 5)) == NULL && --i); |
100 | if (tmp == NULL) |
100 | if (tmp == NULL) |
101 | return 0; |
101 | return 0; |
102 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
102 | if (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED)) |
103 | { |
103 | { |
104 | free_object (tmp); |
104 | tmp->destroy (); |
105 | tmp = NULL; |
105 | tmp = NULL; |
106 | } |
106 | } |
107 | } |
107 | } |
108 | while (!tmp); |
108 | while (!tmp); |
109 | |
109 | |
… | |
… | |
113 | CLEAR_FLAG (op, FLAG_AUTO_APPLY); |
113 | CLEAR_FLAG (op, FLAG_AUTO_APPLY); |
114 | identify (tmp); |
114 | identify (tmp); |
115 | break; |
115 | break; |
116 | |
116 | |
117 | case TREASURE: |
117 | case TREASURE: |
118 | if (HAS_RANDOM_ITEMS (op)) |
118 | if (op->has_random_items ()) |
119 | while ((op->stats.hp--) > 0) |
119 | while ((op->stats.hp--) > 0) |
120 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
120 | create_treasure (op->randomitems, op, GT_ENVIRONMENT, |
121 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
121 | op->stats.exp ? op->stats.exp : op->map == NULL ? 14 : op->map->difficulty, 0); |
122 | remove_ob (op); |
122 | op->remove (); |
123 | free_object (op); |
123 | op->destroy (); |
124 | break; |
124 | break; |
125 | } |
125 | } |
126 | |
126 | |
127 | return tmp ? 1 : 0; |
127 | return tmp ? 1 : 0; |
128 | } |
128 | } |
… | |
… | |
132 | * certain objects (most initialization of chests and creation of |
132 | * certain objects (most initialization of chests and creation of |
133 | * treasures and stuff). Calls auto_apply if appropriate. |
133 | * treasures and stuff). Calls auto_apply if appropriate. |
134 | */ |
134 | */ |
135 | |
135 | |
136 | void |
136 | void |
137 | fix_auto_apply (mapstruct *m) |
137 | fix_auto_apply (maptile *m) |
138 | { |
138 | { |
139 | object *tmp, *above = NULL; |
139 | object *tmp, *above = NULL; |
140 | int x, y; |
140 | int x, y; |
141 | |
141 | |
142 | for (x = 0; x < MAP_WIDTH (m); x++) |
142 | for (x = 0; x < MAP_WIDTH (m); x++) |
… | |
… | |
147 | |
147 | |
148 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
148 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
149 | auto_apply (tmp); |
149 | auto_apply (tmp); |
150 | else if (tmp->type == TREASURE) |
150 | else if (tmp->type == TREASURE) |
151 | { |
151 | { |
152 | if (HAS_RANDOM_ITEMS (tmp)) |
152 | if (tmp->has_random_items ()) |
153 | while ((tmp->stats.hp--) > 0) |
153 | while ((tmp->stats.hp--) > 0) |
154 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
154 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
155 | } |
155 | } |
156 | if (tmp && tmp->arch && tmp->type != PLAYER && tmp->type != TREASURE && tmp->randomitems) |
156 | if (tmp && tmp->arch && tmp->type != PLAYER && tmp->type != TREASURE && tmp->randomitems) |
157 | { |
157 | { |
158 | if (tmp->type == CONTAINER) |
158 | if (tmp->type == CONTAINER) |
159 | { |
159 | { |
160 | if (HAS_RANDOM_ITEMS (tmp)) |
160 | if (tmp->has_random_items ()) |
161 | while ((tmp->stats.hp--) > 0) |
161 | while ((tmp->stats.hp--) > 0) |
162 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
162 | create_treasure (tmp->randomitems, tmp, 0, m->difficulty, 0); |
163 | } |
163 | } |
164 | else if (HAS_RANDOM_ITEMS (tmp)) |
164 | else if (tmp->has_random_items ()) |
165 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
165 | create_treasure (tmp->randomitems, tmp, GT_APPLY, m->difficulty, 0); |
166 | } |
166 | } |
167 | } |
167 | } |
168 | for (x = 0; x < MAP_WIDTH (m); x++) |
168 | for (x = 0; x < MAP_WIDTH (m); x++) |
169 | for (y = 0; y < MAP_HEIGHT (m); y++) |
169 | for (y = 0; y < MAP_HEIGHT (m); y++) |
… | |
… | |
183 | { |
183 | { |
184 | fprintf (logfile, "%s\n", txt); |
184 | fprintf (logfile, "%s\n", txt); |
185 | } |
185 | } |
186 | |
186 | |
187 | void |
187 | void |
188 | new_info_map (int color, mapstruct *map, const char *str) |
188 | new_info_map (int color, maptile *map, const char *str) |
189 | { |
189 | { |
190 | fprintf (logfile, "new_info_map: %s\n", str); |
190 | fprintf (logfile, "new_info_map: %s\n", str); |
191 | } |
191 | } |
192 | |
192 | |
193 | void |
193 | void |
… | |
… | |
239 | weather_effect (const char *c) |
239 | weather_effect (const char *c) |
240 | { |
240 | { |
241 | } |
241 | } |
242 | |
242 | |
243 | void |
243 | void |
244 | set_darkness_map (mapstruct *m) |
244 | set_darkness_map (maptile *m) |
245 | { |
245 | { |
246 | } |
246 | } |
247 | |
247 | |
248 | void |
248 | void |
249 | move_apply (object *ob, object *obt, object *obx) |
249 | move_apply (object *ob, object *obt, object *obx) |