]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapgen/dungeongen.h
Optimize random turns in dungeongen (#8129)
[minetest.git] / src / mapgen / dungeongen.h
index 6799db79ee9834ed536f26e04d826dff7d989598..7d04a6254b94c6fc9d79e400c57158ccb58f8b1c 100644 (file)
@@ -1,6 +1,7 @@
 /*
 Minetest
-Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2010-2018 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2015-2018 paramat
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -29,19 +30,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
                VMANIP_FLAG_DUNGEON_INSIDE|VMANIP_FLAG_DUNGEON_PRESERVE)
 
 class MMVManip;
-class INodeDefManager;
+class NodeDefManager;
 
 v3s16 rand_ortho_dir(PseudoRandom &random, bool diagonal_dirs);
 v3s16 turn_xz(v3s16 olddir, int t);
-v3s16 random_turn(PseudoRandom &random, v3s16 olddir);
+void random_turn(PseudoRandom &random, v3s16 &dir);
 int dir_to_facedir(v3s16 d);
 
 
 struct DungeonParams {
        s32 seed;
 
-       content_t c_water;
-       content_t c_river_water;
        content_t c_wall;
        content_t c_alt_wall;
        content_t c_stair;
@@ -57,8 +56,6 @@ struct DungeonParams {
        v3s16 room_size_large_max;
        u16 rooms_min;
        u16 rooms_max;
-       s16 y_min;
-       s16 y_max;
        GenNotifyType notifytype;
 
        NoiseParams np_density;
@@ -67,8 +64,8 @@ struct DungeonParams {
 
 class DungeonGen {
 public:
-       MMVManip *vm;
-       INodeDefManager *ndef;
+       MMVManip *vm = nullptr;
+       const NodeDefManager *ndef;
        GenerateNotifier *gennotify;
 
        u32 blockseed;
@@ -82,7 +79,7 @@ class DungeonGen {
        v3s16 m_pos;
        v3s16 m_dir;
 
-       DungeonGen(INodeDefManager *ndef,
+       DungeonGen(const NodeDefManager *ndef,
                GenerateNotifier *gennotify, DungeonParams *dparams);
 
        void generate(MMVManip *vm, u32 bseed,