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

Comparing deliantra/server/random_maps/treasure.C (file contents):
Revision 1.51 by root, Sun Mar 28 22:29:50 2010 UTC vs.
Revision 1.53 by root, Tue Apr 13 02:39:53 2010 UTC

109 freeindex = -1; 109 freeindex = -1;
110 for (tries = 0; tries < 15 && freeindex == -1; tries++) 110 for (tries = 0; tries < 15 && freeindex == -1; tries++)
111 { 111 {
112 kx = rmg_rndm (RP->Xsize - 2) + 1; 112 kx = rmg_rndm (RP->Xsize - 2) + 1;
113 ky = rmg_rndm (RP->Ysize - 2) + 1; 113 ky = rmg_rndm (RP->Ysize - 2) + 1;
114 freeindex = find_free_spot (the_key, map, kx, ky, 1, SIZEOFFREE1 + 1); 114 freeindex = rmg_find_free_spot (the_key, map, kx, ky, 1, SIZEOFFREE1 + 1);
115 } 115 }
116 116
117 // can freeindex ever be < 0? 117 // can freeindex ever be < 0?
118 if (freeindex >= 0) 118 if (freeindex >= 0)
119 { 119 {
225 225
226 if (num_treasures <= 0) 226 if (num_treasures <= 0)
227 return; 227 return;
228 228
229 /* get the style map */ 229 /* get the style map */
230 maptile *style_map = find_style ("/styles/treasurestyles", treasure_style, -1); 230 maptile *style_map = find_style ("/styles/treasurestyles", treasure_style, RP->difficulty);
231 231
232 if (!style_map) 232 if (!style_map)
233 { 233 {
234 LOG (llevError, "unable to load style map %s %s.\n", "/styles/treasurestyles", treasure_style); 234 LOG (llevError, "unable to load style map %s %s.\n", "/styles/treasurestyles", treasure_style);
235 return; 235 return;
379 } 379 }
380 380
381 /* stick a trap in the chest if required */ 381 /* stick a trap in the chest if required */
382 if (treasureoptions & TRAPPED) 382 if (treasureoptions & TRAPPED)
383 { 383 {
384 maptile *trap_map = find_style ("/styles/trapstyles", "traps", -1); 384 maptile *trap_map = find_style ("/styles/trapstyles", "traps", RP->difficulty);
385 385
386 if (trap_map) 386 if (trap_map)
387 { 387 {
388 object *the_trap = trap_map->pick_random_object (rmg_rndm); 388 object *the_trap = trap_map->pick_random_object (rmg_rndm);
389 389
434 /* don't bother searching this square unless the map says life exists. */ 434 /* don't bother searching this square unless the map says life exists. */
435 if (GET_MAP_FLAGS (map, lx, ly) & P_IS_ALIVE) 435 if (GET_MAP_FLAGS (map, lx, ly) & P_IS_ALIVE)
436 { 436 {
437 object *the_monster = GET_MAP_OB (map, lx, ly); 437 object *the_monster = GET_MAP_OB (map, lx, ly);
438 438
439 for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_MONSTER)); the_monster = the_monster->above); 439 for (; the_monster != NULL && (!the_monster->flag [FLAG_MONSTER]); the_monster = the_monster->above);
440 if (the_monster && QUERY_FLAG (the_monster, FLAG_MONSTER)) 440 if (the_monster && the_monster->flag [FLAG_MONSTER])
441 return the_monster; 441 return the_monster;
442 } 442 }
443 } 443 }
444 return NULL; 444 return NULL;
445} 445}
473 if (GET_MAP_FLAGS (map, x, y) & P_IS_ALIVE) 473 if (GET_MAP_FLAGS (map, x, y) & P_IS_ALIVE)
474 { 474 {
475 object *the_monster = GET_MAP_OB (map, x, y); 475 object *the_monster = GET_MAP_OB (map, x, y);
476 476
477 /* check off this point */ 477 /* check off this point */
478 for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_ALIVE)); the_monster = the_monster->above); 478 for (; the_monster != NULL && (!the_monster->flag [FLAG_ALIVE]); the_monster = the_monster->above);
479 if (the_monster && QUERY_FLAG (the_monster, FLAG_ALIVE)) 479 if (the_monster && the_monster->flag [FLAG_ALIVE])
480 { 480 {
481 theMonsterToFind = the_monster; 481 theMonsterToFind = the_monster;
482 return theMonsterToFind; 482 return theMonsterToFind;
483 } 483 }
484 } 484 }
654 *cy = ly; 654 *cy = ly;
655 return; 655 return;
656 } 656 }
657 } 657 }
658 /* give up and return the closest free spot. */ 658 /* give up and return the closest free spot. */
659 i = find_free_spot (archetype::find (shstr_chest), map, x, y, 1, SIZEOFFREE1 + 1); 659 i = rmg_find_free_spot (archetype::find (shstr_chest), map, x, y, 1, SIZEOFFREE1 + 1);
660 660
661 if (i != -1) 661 if (i != -1)
662 { 662 {
663 *cx = x + freearr_x[i]; 663 *cx = x + freearr_x[i];
664 *cy = y + freearr_y[i]; 664 *cy = y + freearr_y[i];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines