--- deliantra/server/random_maps/door.C 2006/09/14 22:34:02 1.4 +++ deliantra/server/random_maps/door.C 2007/01/15 21:06:19 1.12 @@ -1,25 +1,26 @@ /* - CrossFire, A Multiplayer game for X-windows - - 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 - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 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 - 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 -*/ + * CrossFire, A Multiplayer game for X-windows + * + * 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 + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 + * 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 + */ #include #include @@ -47,16 +48,18 @@ } void -put_doors (mapstruct *the_map, char **maze, const char *doorstyle, RMParms * RP) +put_doors (maptile *the_map, char **maze, const char *doorstyle, random_map_params *RP) { int i, j; - mapstruct *vdoors; - mapstruct *hdoors; - char doorpath[128]; + maptile *vdoors; + maptile *hdoors; + char doorpath[1024]; if (!strcmp (doorstyle, "none")) return; + vdoors = find_style ("/styles/doorstyles", doorstyle, -1); + if (vdoors) hdoors = vdoors; else @@ -67,6 +70,7 @@ sprintf (doorpath, "/styles/doorstyles/hdoors%s", strrchr (vdoors->path, '/')); hdoors = find_style (doorpath, 0, -1); } + for (i = 0; i < RP->Xsize; i++) for (j = 0; j < RP->Ysize; j++) { @@ -80,8 +84,12 @@ this_door = pick_random_object (hdoors); else this_door = pick_random_object (vdoors); + + if (!this_door) + abort (); + new_door = arch_to_object (this_door->arch); - copy_object (this_door, new_door); + this_door->copy_to (new_door); new_door->x = i; new_door->y = j; insert_ob_in_map (new_door, the_map, NULL, 0);