--- deliantra/server/random_maps/monster.C 2007/06/05 13:05:02 1.18 +++ deliantra/server/random_maps/monster.C 2008/05/04 14:12:37 1.24 @@ -1,67 +1,30 @@ /* - * CrossFire, A Multiplayer game - * - * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team - * Copyright (C) 2002 Mark Wedel & Crossfire Development Team - * Copyright (C) 1992 Frank Tore Johansen - * - * This program is free software; you can redistribute it and/or modify + * This file is part of Deliantra, the Roguelike Realtime MMORPG. + * + * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992,2007 Frank Tore Johansen + * + * Deliantra is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License - * 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 + * along with this program. If not, see . + * + * The authors can be reached via e-mail to */ #include #include #include -/* some monsters are multisquare, and these guys require special - handling. */ - -void -insert_multisquare_ob_in_map (object *new_obj, maptile *map) -{ - int x, y; - object *old_seg; - object *head; - - /* first insert the head */ - insert_ob_in_map (new_obj, map, new_obj, INS_NO_MERGE | INS_NO_WALK_ON); - - x = new_obj->x; - y = new_obj->y; - old_seg = new_obj; - head = new_obj; - - //TODO: use expand_tail + insert instead - for (archetype *at = (archetype *)new_obj->arch->more; at; at = (archetype *)at->more) - { - object *new_seg; - - new_seg = arch_to_object (at); - new_seg->x = x + at->x; - new_seg->y = y + at->y; - new_seg->map = old_seg->map; - insert_ob_in_map (new_seg, new_seg->map, new_seg, INS_NO_MERGE | INS_NO_WALK_ON); - new_seg->head = head; - old_seg->more = new_seg; - old_seg = new_seg; - } - - old_seg->more = 0; -} - /* place some monsters into the map. */ void place_monsters (maptile *map, char *monsterstyle, int difficulty, random_map_params *RP) @@ -85,25 +48,21 @@ exp_per_sq = 0; while (exp_per_sq <= level_exp (difficulty, 1.0) && failed_placements < 100 && number_monsters < (RP->Xsize * RP->Ysize) / 8) { - object *this_monster = style_map->pick_random_object (); + object *this_monster = style_map->pick_random_object (rmg_rndm); int x, y, freeindex; if (this_monster == NULL) return; /* no monster?? */ - x = rndm (RP->Xsize); - y = rndm (RP->Ysize); + x = rmg_rndm (RP->Xsize); + y = rmg_rndm (RP->Ysize); freeindex = find_first_free_spot (this_monster, map, x, y); if (freeindex != -1) { - object *new_monster = arch_to_object (this_monster->arch); - + object *new_monster = this_monster->deep_clone (); x += freearr_x[freeindex]; y += freearr_y[freeindex]; - copy_object_with_inv (this_monster, new_monster); - new_monster->x = x; - new_monster->y = y; - insert_multisquare_ob_in_map (new_monster, map); + map->insert (new_monster, x, y, 0, INS_NO_MERGE | INS_NO_WALK_ON); if (new_monster->is_alive ()) {