--- deliantra/server/random_maps/random_map.h 2006/12/30 18:45:28 1.6
+++ deliantra/server/random_maps/random_map.h 2008/04/11 21:09:53 1.17
@@ -1,29 +1,31 @@
/*
- * CrossFire, A Multiplayer game for X-windows
- *
- * Copyright (C) 2001 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 (©) 2001,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 crossfire@schmorp.de
+ * along with this program. If not, see .
+ *
+ * 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];
@@ -34,14 +36,14 @@
char layoutstyle[512];
char doorstyle[512];
char decorstyle[512];
- char origin_map[512];
- char final_map[512];
+ shstr origin_map;
+ shstr final_map;
char exitstyle[512];
- char this_map[512];
+ shstr this_map;
char exit_on_final_map[512];
+ char *custom;
- int Xsize;
- int Ysize;
+ int xsize, ysize;
int expand2x;
int layoutoptions1;
int layoutoptions2;
@@ -50,19 +52,25 @@
int difficulty;
int difficulty_given;
float difficulty_increase;
+
int dungeon_level;
int dungeon_depth;
+
int decoroptions;
int orientation;
int origin_y;
int origin_x;
- int random_seed;
+ uint32_t random_seed;
uint64_t total_map_hp;
int map_layout_style;
int treasureoptions;
int symmetry_used;
struct region *region;
+
+ // "private", adjusted sizes
+ int Xsize;
+ int Ysize;
};
enum {
@@ -113,11 +121,52 @@
SYMMETRY_XY,
};
-#define MIN_RANDOM_MAP_SIZE 10
+// 12 has been experimentally :( determined ot be a lot more stable
+// than 11 or 10, leading to the assumption that something inherently
+// needs a minimum size of at least 12
+#define MIN_RANDOM_MAP_SIZE 12
-/* a macro to get a strongly centered random distribution,
- from 0 to x, centered at x/2 */
-#define BC_RANDOM(x) ((int) ((RANDOM() % (x)+RANDOM()%(x)+RANDOM()%(x))/3.))
+struct MazeData : zero_initialised
+{
+ char **col;
+
+ MazeData (int xsize, int ysize);
+ ~MazeData ();
+
+ operator char **()
+ {
+ return col;
+ }
+};
+
+struct Maze
+{
+ MazeData *ptr;
+
+ Maze ()
+ {
+ }
+
+ Maze (int xsize, int ysize)
+ : ptr (new MazeData (xsize, ysize))
+ {
+ }
+
+ Maze (random_map_params *RP)
+ : ptr (new MazeData (RP->Xsize, RP->Ysize))
+ {
+ }
+
+ void free ()
+ {
+ delete ptr;
+ }
+
+ operator char **()
+ {
+ return *ptr;
+ }
+};
#endif