1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2001 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
10 | * Free Software Foundation, either version 3 of the License, or (at your |
11 | * option) any later version. |
11 | * option) any later version. |
… | |
… | |
333 | } |
333 | } |
334 | |
334 | |
335 | /* put a chest into the map, near x and y, with the treasure style |
335 | /* put a chest into the map, near x and y, with the treasure style |
336 | determined (may be null, or may be a treasure list from lib/treasures, |
336 | determined (may be null, or may be a treasure list from lib/treasures, |
337 | if the global variable "treasurestyle" is set to that treasure list's name */ |
337 | if the global variable "treasurestyle" is set to that treasure list's name */ |
338 | object * |
338 | static object * |
339 | place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, random_map_params *RP) |
339 | place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, random_map_params *RP) |
340 | { |
340 | { |
341 | object *the_chest = archetype::get (shstr_chest); /* was "chest_2" */ |
341 | object *the_chest = archetype::get (shstr_chest); /* was "chest_2" */ |
342 | |
342 | |
343 | /* first, find a place to put the chest. */ |
343 | /* first, find a place to put the chest. */ |
… | |
… | |
366 | if (tlist != NULL) |
366 | if (tlist != NULL) |
367 | for (ti = 0; ti < n_treasures; ti++) |
367 | for (ti = 0; ti < n_treasures; ti++) |
368 | { /* use the treasure list */ |
368 | { /* use the treasure list */ |
369 | object *new_treasure = style_map->pick_random_object (rmg_rndm); |
369 | object *new_treasure = style_map->pick_random_object (rmg_rndm); |
370 | |
370 | |
371 | insert_ob_in_ob (arch_to_object (new_treasure->arch), the_chest); |
371 | insert_ob_in_ob (new_treasure->arch->instance (), the_chest); |
372 | } |
372 | } |
373 | else |
373 | else |
374 | { /* use the style map */ |
374 | { /* use the style map */ |
375 | the_chest->randomitems = tlist; |
375 | the_chest->randomitems = tlist; |
376 | the_chest->stats.hp = n_treasures; |
376 | the_chest->stats.hp = n_treasures; |
… | |
… | |
499 | return theMonsterToFind; |
499 | return theMonsterToFind; |
500 | } |
500 | } |
501 | |
501 | |
502 | /* sets up some data structures: the _recursive form does the |
502 | /* sets up some data structures: the _recursive form does the |
503 | real work. */ |
503 | real work. */ |
504 | object * |
504 | static object * |
505 | find_monster_in_room (maptile *map, int x, int y, random_map_params *RP) |
505 | find_monster_in_room (maptile *map, int x, int y, random_map_params *RP) |
506 | { |
506 | { |
507 | Layout layout2 (RP); |
507 | Layout layout2 (RP); |
508 | |
508 | |
509 | layout2->clear (); |
509 | layout2->clear (); |
… | |
… | |
674 | *cx = -1; |
674 | *cx = -1; |
675 | *cy = -1; |
675 | *cy = -1; |
676 | } |
676 | } |
677 | } |
677 | } |
678 | |
678 | |
679 | void |
679 | static void |
680 | remove_monsters (int x, int y, maptile *map) |
680 | remove_monsters (int x, int y, maptile *map) |
681 | { |
681 | { |
682 | for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) |
682 | for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) |
683 | { |
683 | { |
684 | object *next = tmp->above; |
684 | object *next = tmp->above; |