ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/rmg.h
Revision: 1.2
Committed: Sun Aug 22 20:36:37 2010 UTC (13 years, 9 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.1: +0 -2 lines
Log Message:
µopt

File Contents

# Content
1 /*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 *
4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen
7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
21 *
22 * The authors can be reached via e-mail to <support@deliantra.net>
23 */
24
25 #ifndef RMG_H
26 #define RMG_H
27
28 #include "util.h"
29 #include "layout.h"
30
31 struct random_map_params : zero_initialised
32 {
33 char wall_name[512];
34
35 int xsize, ysize;
36 int layoutoptions1;
37 int layoutoptions2;
38 int layoutoptions3;
39 int difficulty;
40 int difficulty_given;
41 float difficulty_increase;
42
43 int dungeon_level;
44 int dungeon_depth;
45
46 uint64_t total_map_hp;
47
48 HV *hv;
49
50 shstr_tmp as_shstr () const;
51
52 // fetch something from the options hash
53 SV *get_sv (const char *option) const;
54 const_utf8_string get_str (const char *option, const_utf8_string fallback = "") const;
55 IV get_iv (const char *option, IV fallback = 0) const;
56 UV get_uv (const char *option, UV fallback = 0) const;
57 NV get_nv (const char *option, NV fallback = 0) const;
58
59 void set (const char *option, SV *value) const;
60 void set (const char *option, const_utf8_string value) const;
61 void set (const char *option, IV value) const;
62 void set (const char *option, UV value) const;
63 void set (const char *option, NV value) const;
64
65 void set (const char *option, int value) const { set (option, (IV)value); }
66
67 // "private", adjusted sizes
68 int Xsize;
69 int Ysize;
70
71 int map_layout_style;
72 int symmetry_used;
73
74 random_map_params ();
75 random_map_params (random_map_params *RP);
76 random_map_params (HV *hv);
77 ~random_map_params ();
78 };
79
80 enum {
81 LAYOUT_NONE,
82 LAYOUT_ONION,
83 LAYOUT_MAZE,
84 LAYOUT_SPIRAL,
85 LAYOUT_ROGUELIKE,
86 LAYOUT_SNAKE,
87 LAYOUT_SQUARE_SPIRAL,
88 LAYOUT_CAVE,
89 LAYOUT_CASTLE,
90 LAYOUT_MULTIPLE,
91 NROFLAYOUTS,
92 };
93
94 /*
95 * Move these defines out of room_gen_onion.c to here, as
96 * other files (like square_spiral) also uses them.
97
98 options:
99 0 Pick random options below
100 1 "centered"
101 2 linear doors (default is nonlinear)
102 4 bottom "centered"
103 8 bottom-right centered
104 16 irregularly/randomly spaced layers (default: regular)
105 32 outer wall off: i.e., no outer wall.
106
107 */
108
109 enum {
110 RMOPT_RANDOM = 0,
111 RMOPT_CENTERED = 1,
112 RMOPT_LINEAR = 2,
113 RMOPT_BOTTOM_C = 4,
114 RMOPT_BOTTOM_R = 8,
115 RMOPT_IRR_SPACE = 16,
116 RMOPT_WALL_OFF = 32,
117 RMOPT_WALLS_ONLY = 64,
118 RMOPT_NO_DOORS = 256, /* Place walls insead of doors. Produces broken map. */
119 };
120
121 /* symmetry definitions--used in this file AND in treasure.c:
122 the numerical values matter so don't change them. */
123 enum {
124 SYMMETRY_RANDOM,
125 SYMMETRY_NONE,
126 SYMMETRY_X,
127 SYMMETRY_Y,
128 SYMMETRY_XY,
129 };
130
131 // 12 has been experimentally :( determined ot be a lot more stable
132 // than 11 or 10, leading to the assumption that something inherently
133 // needs a minimum size of at least 12
134 #define MIN_RANDOM_MAP_SIZE 12
135
136 // we often use signed chars for coordinates (and U8 for distances)
137 #define MAX_RANDOM_MAP_SIZE 120
138
139 // utility functions, to use rmg_rndm instead of rndm.
140 static inline int
141 rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop)
142 {
143 swap (rmg_rndm, rndm);
144 int i = find_free_spot (ob, m, x, y, start, stop);
145 swap (rmg_rndm, rndm);
146 return i;
147 }
148
149 #endif
150