--- deliantra/server/random_maps/treasure.C 2006/09/10 16:06:37 1.4 +++ deliantra/server/random_maps/treasure.C 2006/12/12 20:53:03 1.8 @@ -1,9 +1,3 @@ - -/* - * static char *rcsid_treasure_c = - * "$Id: treasure.C,v 1.4 2006/09/10 16:06:37 root Exp $"; - */ - /* CrossFire, A Multiplayer game for X-windows @@ -24,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ /* placing treasure in maps, where appropriate. */ @@ -57,7 +51,7 @@ */ int -wall_blocked (mapstruct *m, int x, int y) +wall_blocked (maptile *m, int x, int y) { int r; @@ -75,11 +69,11 @@ */ void -place_treasure (mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms * RP) +place_treasure (maptile *map, char **layout, char *treasure_style, int treasureoptions, RMParms * RP) { char styledirname[256]; char stylefilepath[256]; - mapstruct *style_map = 0; + maptile *style_map = 0; int num_treasures; /* bail out if treasure isn't wanted. */ @@ -206,7 +200,7 @@ if the global variable "treasurestyle" is set to that treasure list's name */ object * -place_chest (int treasureoptions, int x, int y, mapstruct *map, mapstruct *style_map, int n_treasures, RMParms * RP) +place_chest (int treasureoptions, int x, int y, maptile *map, maptile *style_map, int n_treasures, RMParms * RP) { object *the_chest; int i, xl, yl; @@ -217,7 +211,7 @@ i = find_first_free_spot (the_chest, map, x, y); if (i == -1) { - free_object (the_chest); + the_chest->destroy (0); return NULL; } xl = x + freearr_x[i]; @@ -260,7 +254,7 @@ /* stick a trap in the chest if required */ if (treasureoptions & TRAPPED) { - mapstruct *trap_map = find_style ("/styles/trapstyles", "traps", -1); + maptile *trap_map = find_style ("/styles/trapstyles", "traps", -1); object *the_trap; if (trap_map) @@ -305,7 +299,7 @@ /* finds the closest monster and returns him, regardless of doors or walls */ object * -find_closest_monster (mapstruct *map, int x, int y, RMParms * RP) +find_closest_monster (maptile *map, int x, int y, RMParms * RP) { int i; @@ -344,7 +338,7 @@ */ int -keyplace (mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms * RP) +keyplace (maptile *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms * RP) { int i, j; int kx, ky; @@ -440,7 +434,7 @@ it does a check-off on the layout, converting 0's to 1's */ object * -find_monster_in_room_recursive (char **layout, mapstruct *map, int x, int y, RMParms * RP) +find_monster_in_room_recursive (char **layout, maptile *map, int x, int y, RMParms * RP) { int i, j; @@ -487,7 +481,7 @@ real work. */ object * -find_monster_in_room (mapstruct *map, int x, int y, RMParms * RP) +find_monster_in_room (maptile *map, int x, int y, RMParms * RP) { char **layout2; int i, j; @@ -558,7 +552,7 @@ /* find a random non-blocked spot in this room to drop a key. */ void -find_spot_in_room (mapstruct *map, int x, int y, int *kx, int *ky, RMParms * RP) +find_spot_in_room (maptile *map, int x, int y, int *kx, int *ky, RMParms * RP) { char **layout2; int i, j; @@ -605,7 +599,7 @@ it'll return 0 if no FREE spots are found.*/ void -find_enclosed_spot (mapstruct *map, int *cx, int *cy, RMParms * RP) +find_enclosed_spot (maptile *map, int *cx, int *cy, RMParms * RP) { int x, y; int i; @@ -664,7 +658,7 @@ } } /* give up and return the closest free spot. */ - i = find_first_free_spot (&find_archetype ("chest")->clone, map, x, y); + i = find_first_free_spot (&archetype::find ("chest")->clone, map, x, y); if (i != -1 && i <= SIZEOFFREE1) { *cx = x + freearr_x[i]; @@ -677,7 +671,7 @@ void -remove_monsters (int x, int y, mapstruct *map) +remove_monsters (int x, int y, maptile *map) { object *tmp; @@ -686,8 +680,8 @@ { if (tmp->head) tmp = tmp->head; - remove_ob (tmp); - free_object (tmp); + tmp->remove (); + tmp->destroy (0); tmp = get_map_ob (map, x, y); if (tmp == NULL) break; @@ -700,7 +694,7 @@ it'll remove any monsters it finds.*/ object ** -surround_by_doors (mapstruct *map, char **layout, int x, int y, int opts) +surround_by_doors (maptile *map, char **layout, int x, int y, int opts) { int i; char *doors[2]; @@ -743,7 +737,7 @@ /* returns the first door in this square, or NULL if there isn't a door. */ object * -door_in_square (mapstruct *map, int x, int y) +door_in_square (maptile *map, int x, int y) { object *tmp; @@ -756,7 +750,7 @@ /* the workhorse routine, which finds the doors in a room */ void -find_doors_in_room_recursive (char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms * RP) +find_doors_in_room_recursive (char **layout, maptile *map, int x, int y, object **doorlist, int *ndoors, RMParms * RP) { int i, j; object *door; @@ -798,7 +792,7 @@ /* find a random non-blocked spot in this room to drop a key. */ object ** -find_doors_in_room (mapstruct *map, int x, int y, RMParms * RP) +find_doors_in_room (maptile *map, int x, int y, RMParms * RP) { char **layout2; object **doorlist; @@ -838,7 +832,7 @@ opts doesn't say to lock/hide doors. */ void -lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms * RP) +lock_and_hide_doors (object **doorlist, maptile *map, int opts, RMParms * RP) { object *door; int i; @@ -856,8 +850,8 @@ new_door->face = door->face; new_door->x = door->x; new_door->y = door->y; - remove_ob (door); - free_object (door); + door->remove (); + door->destroy (0); doorlist[i] = new_door; insert_ob_in_map (new_door, map, NULL, 0); sprintf (keybuf, "%d", (int) RANDOM ()); @@ -883,8 +877,8 @@ retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); door->face = wallface->face; if (!QUERY_FLAG (wallface, FLAG_REMOVED)) - remove_ob (wallface); - free_object (wallface); + wallface->remove (); + wallface->destroy (0); } } }