… | |
… | |
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 | maptile *newMap; |
40 | maptile *newMap; |
41 | RMParms rp; |
41 | random_map_params rp; |
42 | FILE *fp; |
42 | FILE *fp; |
43 | |
43 | |
44 | if (argc < 3) |
44 | if (argc < 3) |
45 | { |
45 | { |
46 | printf ("\nUsage: %s inputfile outputfile\n", argv[0]); |
46 | printf ("\nUsage: %s inputfile outputfile\n", argv[0]); |
… | |
… | |
55 | init_artifacts (); |
55 | init_artifacts (); |
56 | init_formulae (); |
56 | init_formulae (); |
57 | init_readable (); |
57 | init_readable (); |
58 | |
58 | |
59 | init_gods (); |
59 | init_gods (); |
60 | memset (&rp, 0, sizeof (RMParms)); |
60 | memset (&rp, 0, sizeof (random_map_params)); |
61 | rp.Xsize = -1; |
61 | rp.Xsize = -1; |
62 | rp.Ysize = -1; |
62 | rp.Ysize = -1; |
63 | if ((fp = fopen (InFileName, "r")) == NULL) |
63 | if ((fp = fopen (InFileName, "r")) == NULL) |
64 | { |
64 | { |
65 | fprintf (stderr, "\nError: can not open %s\n", InFileName); |
65 | fprintf (stderr, "\nError: can not open %s\n", InFileName); |
… | |
… | |
137 | fix_auto_apply (maptile *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 < m->width; x++) |
143 | for (y = 0; y < MAP_HEIGHT (m); y++) |
143 | for (y = 0; y < m->height; y++) |
144 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = above) |
144 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = above) |
145 | { |
145 | { |
146 | above = tmp->above; |
146 | above = tmp->above; |
147 | |
147 | |
148 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
148 | if (QUERY_FLAG (tmp, FLAG_AUTO_APPLY)) |
… | |
… | |
163 | } |
163 | } |
164 | else if (tmp->has_random_items ()) |
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 < m->width; x++) |
169 | for (y = 0; y < MAP_HEIGHT (m); y++) |
169 | for (y = 0; y < m->height; y++) |
170 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
170 | for (tmp = GET_MAP_OB (m, x, y); tmp != NULL; tmp = tmp->above) |
171 | if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) |
171 | if (tmp->above && (tmp->type == TRIGGER_BUTTON || tmp->type == TRIGGER_PEDESTAL)) |
172 | check_trigger (tmp, tmp->above); |
172 | check_trigger (tmp, tmp->above); |
173 | } |
173 | } |
174 | |
174 | |