--- deliantra/server/random_maps/treasure.C 2006/09/14 21:16:12 1.5 +++ deliantra/server/random_maps/treasure.C 2006/12/30 18:45:28 1.11 @@ -1,9 +1,3 @@ - -/* - * static char *rcsid_treasure_c = - * "$Id: treasure.C,v 1.5 2006/09/14 21:16:12 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, random_map_params * 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. */ @@ -121,9 +115,9 @@ /* map_layout_style global, and is previously set */ switch (RP->map_layout_style) { - case ONION_LAYOUT: - case SPIRAL_LAYOUT: - case SQUARE_SPIRAL_LAYOUT: + case LAYOUT_ONION: + case LAYOUT_SPIRAL: + case LAYOUT_SQUARE_SPIRAL: { int i, j; @@ -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, random_map_params * 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 (); 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) @@ -273,7 +267,7 @@ object *new_trap; new_trap = arch_to_object (the_trap->arch); - copy_object (new_trap, the_trap); + new_trap->copy_to (the_trap); new_trap->x = x; new_trap->y = y; insert_ob_in_ob (new_trap, the_chest); @@ -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, random_map_params * RP) { int i; @@ -320,7 +314,7 @@ /* don't bother searching this square unless the map says life exists. */ if (GET_MAP_FLAGS (map, lx, ly) & P_IS_ALIVE) { - object *the_monster = get_map_ob (map, lx, ly); + object *the_monster = GET_MAP_OB (map, lx, ly); for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_MONSTER)); the_monster = the_monster->above); if (the_monster && QUERY_FLAG (the_monster, FLAG_MONSTER)) @@ -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, random_map_params * 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, random_map_params * RP) { int i, j; @@ -461,7 +455,7 @@ layout[x][y] = 1; if (GET_MAP_FLAGS (map, x, y) & P_IS_ALIVE) { - object *the_monster = get_map_ob (map, x, y); + object *the_monster = GET_MAP_OB (map, x, y); /* check off this point */ for (; the_monster != NULL && (!QUERY_FLAG (the_monster, FLAG_ALIVE)); the_monster = the_monster->above); @@ -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, random_map_params * RP) { char **layout2; int i, j; @@ -529,7 +523,7 @@ that datastructure. */ void -find_spot_in_room_recursive (char **layout, int x, int y, RMParms * RP) +find_spot_in_room_recursive (char **layout, int x, int y, random_map_params * RP) { 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, random_map_params * 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, random_map_params * RP) { int x, y; int i; @@ -677,18 +671,18 @@ void -remove_monsters (int x, int y, mapstruct *map) +remove_monsters (int x, int y, maptile *map) { object *tmp; - for (tmp = get_map_ob (map, x, y); tmp != NULL; tmp = tmp->above) + for (tmp = GET_MAP_OB (map, x, y); tmp != NULL; tmp = tmp->above) if (QUERY_FLAG (tmp, FLAG_ALIVE)) { if (tmp->head) tmp = tmp->head; - remove_ob (tmp); - free_object (tmp); - tmp = get_map_ob (map, x, y); + tmp->remove (); + tmp->destroy (); + 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,11 +737,11 @@ /* 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; - for (tmp = get_map_ob (map, x, y); tmp != NULL; tmp = tmp->above) + for (tmp = GET_MAP_OB (map, x, y); tmp != NULL; tmp = tmp->above) if (tmp->type == DOOR || tmp->type == LOCKED_DOOR) return tmp; return NULL; @@ -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, random_map_params * 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, random_map_params * 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, random_map_params * 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 (); 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 (); } } }