ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/special.C
(Generate patch)

Comparing deliantra/server/random_maps/special.C (file contents):
Revision 1.7 by root, Tue Dec 12 20:53:03 2006 UTC vs.
Revision 1.8 by root, Tue Dec 12 21:39:56 2006 UTC

56 if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR)) 56 if (!QUERY_FLAG (tmp, FLAG_IS_FLOOR))
57 { 57 {
58 if (tmp->head) 58 if (tmp->head)
59 tmp = tmp->head; 59 tmp = tmp->head;
60 tmp->remove (); 60 tmp->remove ();
61 tmp->destroy (0); 61 tmp->destroy ();
62 tmp = get_map_ob (map, i, j); 62 tmp = get_map_ob (map, i, j);
63 } 63 }
64 if (tmp == NULL) 64 if (tmp == NULL)
65 break; 65 break;
66 } 66 }
158place_fountain_with_specials (maptile *map) 158place_fountain_with_specials (maptile *map)
159{ 159{
160 int ix, iy, i = -1, tries = 0; 160 int ix, iy, i = -1, tries = 0;
161 maptile *fountain_style = find_style ("/styles/misc", "fountains", -1); 161 maptile *fountain_style = find_style ("/styles/misc", "fountains", -1);
162 object *fountain = get_archetype ("fountain"); 162 object *fountain = get_archetype ("fountain");
163 object *potion = get_object (); 163 object *potion = object::create ();
164 164
165 copy_object (pick_random_object (fountain_style), potion); 165 pick_random_object (fountain_style)->copy_to (potion);
166
166 while (i < 0 && tries < 10) 167 while (i < 0 && tries < 10)
167 { 168 {
168 ix = RANDOM () % (MAP_WIDTH (map) - 2) + 1; 169 ix = RANDOM () % (MAP_WIDTH (map) - 2) + 1;
169 iy = RANDOM () % (MAP_HEIGHT (map) - 2) + 1; 170 iy = RANDOM () % (MAP_HEIGHT (map) - 2) + 1;
170 i = find_first_free_spot (fountain, map, ix, iy); 171 i = find_first_free_spot (fountain, map, ix, iy);
171 tries++; 172 tries++;
172 }; 173 }
174
173 if (i == -1) 175 if (i == -1)
174 { /* can't place fountain */ 176 { /* can't place fountain */
175 fountain->destroy (0); 177 fountain->destroy ();
176 potion->destroy (0); 178 potion->destroy ();
177 return; 179 return;
178 } 180 }
181
179 ix += freearr_x[i]; 182 ix += freearr_x[i];
180 iy += freearr_y[i]; 183 iy += freearr_y[i];
181 potion->face = fountain->face; 184 potion->face = fountain->face;
182 SET_FLAG (potion, FLAG_NO_PICK); 185 SET_FLAG (potion, FLAG_NO_PICK);
183 SET_FLAG (potion, FLAG_IDENTIFIED); 186 SET_FLAG (potion, FLAG_IDENTIFIED);
198 int ix, iy, i = -1; 201 int ix, iy, i = -1;
199 char buf[HUGE_BUF], *style, *decor, *mon; 202 char buf[HUGE_BUF], *style, *decor, *mon;
200 maptile *exit_style = find_style ("/styles/misc", "obscure_exits", -1); 203 maptile *exit_style = find_style ("/styles/misc", "obscure_exits", -1);
201 int g_xsize, g_ysize; 204 int g_xsize, g_ysize;
202 205
203 object *the_exit = get_object (); 206 object *the_exit = object::create ();
204 207
205 if (!exit_style) 208 if (!exit_style)
206 return; 209 return;
207 210
208 copy_object (pick_random_object (exit_style), the_exit); 211 pick_random_object (exit_style)->copy_to (the_exit);
209 212
210 while (i < 0) 213 while (i < 0)
211 { 214 {
212 ix = RANDOM () % (MAP_WIDTH (map) - 2) + 1; 215 ix = RANDOM () % (MAP_WIDTH (map) - 2) + 1;
213 iy = RANDOM () % (MAP_HEIGHT (map) - 2) + 1; 216 iy = RANDOM () % (MAP_HEIGHT (map) - 2) + 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines