From 5cc06e4748a82acb36310fee89e72f30b2b35a36 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sat, 11 Apr 2020 19:59:43 +0200 Subject: Reduce ServerEnvironment propagation (#9642) ServerEnvironment is a huge class with many accessors. In various places it's not needed Remove it to reduce the ServerEnvironment view. Idea here is to reduce size of some of our objects to transport lightweight managers and permit easier testing Pathfinder is now tied to a generic map, not a ServerMap, it can be ported to client --- src/mapgen/treegen.cpp | 4 +--- src/mapgen/treegen.h | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/mapgen') diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp index 89bdef73b..d538e15b4 100644 --- a/src/mapgen/treegen.cpp +++ b/src/mapgen/treegen.cpp @@ -25,7 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "map.h" #include "mapblock.h" -#include "serverenvironment.h" #include "nodedef.h" #include "treegen.h" #include "voxelalgorithms.h" @@ -120,10 +119,9 @@ void make_tree(MMVManip &vmanip, v3s16 p0, bool is_apple_tree, // L-System tree LUA spawner -treegen::error spawn_ltree(ServerEnvironment *env, v3s16 p0, +treegen::error spawn_ltree(ServerMap *map, v3s16 p0, const NodeDefManager *ndef, const TreeDef &tree_definition) { - ServerMap *map = &env->getServerMap(); std::map modified_blocks; MMVManip vmanip(map); v3s16 tree_blockp = getNodeBlockPos(p0); diff --git a/src/mapgen/treegen.h b/src/mapgen/treegen.h index 5ab79f428..447baabb3 100644 --- a/src/mapgen/treegen.h +++ b/src/mapgen/treegen.h @@ -26,8 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc., class MMVManip; class NodeDefManager; -class ServerEnvironment; - +class ServerMap; namespace treegen { @@ -73,7 +72,7 @@ namespace treegen { treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, const NodeDefManager *ndef, TreeDef tree_definition); // Spawn L-systems tree from LUA - treegen::error spawn_ltree (ServerEnvironment *env, v3s16 p0, + treegen::error spawn_ltree (ServerMap *map, v3s16 p0, const NodeDefManager *ndef, const TreeDef &tree_definition); // L-System tree gen helper functions -- cgit v1.2.3