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

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.71 by root, Sun Jul 4 22:12:26 2010 UTC vs.
Revision 1.75 by root, Sun Aug 22 20:36:37 2010 UTC

23 */ 23 */
24 24
25#include <time.h> 25#include <time.h>
26#include <stdio.h> 26#include <stdio.h>
27#include <global.h> 27#include <global.h>
28#include <random_map.h> 28#include <rmg.h>
29#include <rproto.h> 29#include <rproto.h>
30#include <sproto.h> 30#include <sproto.h>
31 31
32#define CEDE coroapi::cede_to_tick () 32#define CEDE coroapi::cede_to_tick ()
33 33
60 60
61 assign (wall_name, get_str ("wall_name")); 61 assign (wall_name, get_str ("wall_name"));
62 62
63 xsize = get_iv ("xsize"); 63 xsize = get_iv ("xsize");
64 ysize = get_iv ("ysize"); 64 ysize = get_iv ("ysize");
65 expand2x = get_iv ("expand2x");
66 layoutoptions1 = get_iv ("layoutoptions1"); 65 layoutoptions1 = get_iv ("layoutoptions1");
67 layoutoptions2 = get_iv ("layoutoptions2"); 66 layoutoptions2 = get_iv ("layoutoptions2");
68 layoutoptions3 = get_iv ("layoutoptions3"); 67 layoutoptions3 = get_iv ("layoutoptions3");
69 difficulty = get_iv ("difficulty"); 68 difficulty = get_iv ("difficulty");
70 difficulty_given = get_iv ("difficulty_given"); 69 difficulty_given = get_iv ("difficulty_given");
71 difficulty_increase = get_nv ("difficulty_increase"); 70 difficulty_increase = get_nv ("difficulty_increase");
72 dungeon_level = get_iv ("dungeon_level"); 71 dungeon_level = get_iv ("dungeon_level");
73 dungeon_depth = get_iv ("dungeon_depth"); 72 dungeon_depth = get_iv ("dungeon_depth");
74 random_seed = get_uv ("random_seed");
75 total_map_hp = get_nv ("total_map_hp"); // actually val64, but I am too lazy 73 total_map_hp = get_nv ("total_map_hp"); // actually val64, but I am too lazy
76 symmetry_used = get_iv ("symmetry_used"); 74 symmetry_used = get_iv ("symmetry_used");
77} 75}
78 76
79random_map_params::~random_map_params () 77random_map_params::~random_map_params ()
88 set ("ysize" , ysize); 86 set ("ysize" , ysize);
89 set ("layoutoptions1" , layoutoptions1); 87 set ("layoutoptions1" , layoutoptions1);
90 set ("layoutoptions2" , layoutoptions2); 88 set ("layoutoptions2" , layoutoptions2);
91 set ("layoutoptions3" , layoutoptions3); 89 set ("layoutoptions3" , layoutoptions3);
92 set ("dungeon_depth" , dungeon_depth); 90 set ("dungeon_depth" , dungeon_depth);
93 set ("random_seed" , (UV)random_seed);
94 set ("difficulty" , difficulty && difficulty_given ? difficulty : 0); 91 set ("difficulty" , difficulty && difficulty_given ? difficulty : 0);
95 set ("difficulty_increase", difficulty_increase); 92 set ("difficulty_increase", difficulty_increase);
96 set ("dungeon_level" , dungeon_level); 93 set ("dungeon_level" , dungeon_level);
97 94
98 dynbuf_text buf; 95 dynbuf_text buf;
190 RP->Xsize = RP->xsize; 187 RP->Xsize = RP->xsize;
191 RP->Ysize = RP->ysize; 188 RP->Ysize = RP->ysize;
192 189
193 max_it (RP->dungeon_level, 1); 190 max_it (RP->dungeon_level, 1);
194 191
192 IV expand2x = RP->get_iv ("expand2x");
193 UV random_seed = RP->get_uv ("random_seed");
194
195 /* pick a random seed, or use the one from the input file */ 195 /* pick a random seed, or use the one from the input file */
196 RP->random_seed = RP->random_seed 196 random_seed = random_seed
197 ? RP->random_seed + RP->dungeon_level 197 ? random_seed + RP->dungeon_level
198 : pticks; 198 : pticks;
199 199
200 // we run "single-threaded" 200 // we run "single-threaded"
201 rmg_rndm.seed (RP->random_seed); 201 rmg_rndm.seed (random_seed);
202 rmg_rndm.seed (RP->random_seed + pticks);//D
203 202
204 shstr buf = RP->as_shstr (); 203 shstr buf = RP->as_shstr ();
205 204
206 if (RP->difficulty == 0) 205 if (RP->difficulty == 0)
207 { 206 {
236 RP->Ysize = RP->Ysize / 2 + 1; 235 RP->Ysize = RP->Ysize / 2 + 1;
237 236
238 if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY) 237 if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY)
239 RP->Xsize = RP->Xsize / 2 + 1; 238 RP->Xsize = RP->Xsize / 2 + 1;
240 239
241 if (RP->expand2x > 0) 240 if (expand2x)
242 { 241 {
243 RP->Xsize /= 2; 242 RP->Xsize /= 2;
244 RP->Ysize /= 2; 243 RP->Ysize /= 2;
245 } 244 }
246 245
273 if (RP->get_iv ("rotate", 1)) 272 if (RP->get_iv ("rotate", 1))
274 maze.rotate (rmg_rndm (4)); 273 maze.rotate (rmg_rndm (4));
275 274
276 maze.symmetrize (RP->symmetry_used); 275 maze.symmetrize (RP->symmetry_used);
277 276
278 if (RP->expand2x) 277 if (expand2x)
279 maze.expand2x (); 278 maze.expand2x ();
280 279
281#if 0 280#if 0
282 maze.print ();//D 281 maze.print ();//D
283#endif 282#endif
343 /* create treasure unless the treasurestyle is "none" */ 342 /* create treasure unless the treasurestyle is "none" */
344 place_treasure (this, maze, treasurestyle, RP->get_iv ("treasureoptions"), RP); 343 place_treasure (this, maze, treasurestyle, RP->get_iv ("treasureoptions"), RP);
345 344
346 CEDE; 345 CEDE;
347 346
348 const char *decorstyle = RP->get_str ("treasurestyle", ""); 347 const char *decorstyle = RP->get_str ("decorstyle", "");
349 348
350 /* create decor unless the decorstyle is "none" */ 349 /* create decor unless the decorstyle is "none" */
351 if (strcmp (decorstyle, "none")) 350 if (strcmp (decorstyle, "none"))
352 put_decor (this, maze, decorstyle, RP->get_iv ("decoroptions"), RP); 351 put_decor (this, maze, decorstyle, RP->get_iv ("decoroptions"), RP);
353 352

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines