--- deliantra/server/random_maps/random_map.h 2007/05/28 21:15:57 1.14 +++ deliantra/server/random_maps/random_map.h 2010/03/28 22:29:50 1.24 @@ -1,30 +1,32 @@ /* - * This file is part of Crossfire TRT, the Multiplayer Online Role Playing Game. + * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team - * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team - * Copyright (©) 1992,2007 Frank Tore Johansen + * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2001 Mark Wedel & Crossfire Development Team + * Copyright (©) 1992 Frank Tore Johansen * - * Crossfire TRT 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. + * Deliantra is free software: you can redistribute it and/or modify it under + * the terms of the Affero GNU General Public License as published by 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 GNU General Public License - * for more details. + * 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 Crossfire TRT; if not, write to the Free Software Foundation, Inc. 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * You should have received a copy of the Affero GNU General Public License + * and the GNU General Public License along with this program. If not, see + * . * - * The authors can be reached via e-mail to + * The authors can be reached via e-mail to */ #ifndef RANDOM_MAP_H #define RANDOM_MAP_H +#include "util.h" + struct random_map_params { char wallstyle[512]; @@ -35,6 +37,7 @@ char layoutstyle[512]; char doorstyle[512]; char decorstyle[512]; + char miningstyle[512]; shstr origin_map; shstr final_map; char exitstyle[512]; @@ -125,5 +128,74 @@ // needs a minimum size of at least 12 #define MIN_RANDOM_MAP_SIZE 12 +// reference +// +// \0 floor only +// # wall +// D door +// < up +// > down +// C "center" (of onion layout) +// . ?? (rogue) +// + +struct LayoutData : zero_initialised +{ + char **col; + int w, h; + + LayoutData (int w, int h); + ~LayoutData (); + + operator char **() + { + return col; + } + + void clear (char fill = 0); + void border (char fill = '#'); +}; + +struct Layout +{ + LayoutData *ptr; + + Layout () + { + } + + Layout (int xsize, int ysize) + : ptr (new LayoutData (xsize, ysize)) + { + } + + Layout (random_map_params *RP) + : ptr (new LayoutData (RP->Xsize, RP->Ysize)) + { + } + + void free () + { + delete ptr; + } + + LayoutData *operator ->() const + { + return ptr; + } + + operator char **() const + { + return *ptr; + } + + void swap (const Layout &layout) const + { + ::swap (layout.ptr->col, ptr->col); + ::swap (layout.ptr->w , ptr->w ); + ::swap (layout.ptr->h , ptr->h ); + } +}; + #endif