ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.h
(Generate patch)

Comparing deliantra/server/random_maps/random_map.h (file contents):
Revision 1.16 by root, Thu Nov 8 19:43:25 2007 UTC vs.
Revision 1.18 by root, Mon Apr 14 22:41:17 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
21 * The authors can be reached via e-mail to <support@deliantra.net> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24#ifndef RANDOM_MAP_H 24#ifndef RANDOM_MAP_H
25#define RANDOM_MAP_H 25#define RANDOM_MAP_H
26
27#include "util.h"
26 28
27struct random_map_params 29struct random_map_params
28{ 30{
29 char wallstyle[512]; 31 char wallstyle[512];
30 char wall_name[512]; 32 char wall_name[512];
122// 12 has been experimentally :( determined ot be a lot more stable 124// 12 has been experimentally :( determined ot be a lot more stable
123// than 11 or 10, leading to the assumption that something inherently 125// than 11 or 10, leading to the assumption that something inherently
124// needs a minimum size of at least 12 126// needs a minimum size of at least 12
125#define MIN_RANDOM_MAP_SIZE 12 127#define MIN_RANDOM_MAP_SIZE 12
126 128
129struct MazeData : zero_initialised
130{
131 char **col;
132 int w, h;
133
134 MazeData (int w, int h);
135 ~MazeData ();
136
137 operator char **()
138 {
139 return col;
140 }
141
142 void clear (char fill = 0);
143 void border (char fill = '#');
144};
145
146struct Maze
147{
148 MazeData *ptr;
149
150 Maze ()
151 {
152 }
153
154 Maze (int xsize, int ysize)
155 : ptr (new MazeData (xsize, ysize))
156 {
157 }
158
159 Maze (random_map_params *RP)
160 : ptr (new MazeData (RP->Xsize, RP->Ysize))
161 {
162 }
163
164 void free ()
165 {
166 delete ptr;
167 }
168
169 MazeData *operator ->() const
170 {
171 return ptr;
172 }
173
174 operator char **() const
175 {
176 return *ptr;
177 }
178
179 void swap (Maze &maze)
180 {
181 MazeData *p = maze.ptr;
182 maze.ptr = ptr;
183 ptr = p;
184 }
185};
186
127#endif 187#endif
128 188

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines