LCOV - code coverage report
Current view: top level - src - mg_decoration.h (source / functions) Hit Total Coverage
Test: report Lines: 0 10 0.0 %
Date: 2015-07-11 18:23:49 Functions: 0 9 0.0 %

          Line data    Source code
       1             : /*
       2             : Minetest
       3             : Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
       4             : 
       5             : This program is free software; you can redistribute it and/or modify
       6             : it under the terms of the GNU Lesser General Public License as published by
       7             : the Free Software Foundation; either version 2.1 of the License, or
       8             : (at your option) any later version.
       9             : 
      10             : This program is distributed in the hope that it will be useful,
      11             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             : GNU Lesser General Public License for more details.
      14             : 
      15             : You should have received a copy of the GNU Lesser General Public License along
      16             : with this program; if not, write to the Free Software Foundation, Inc.,
      17             : 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             : */
      19             : 
      20             : #ifndef MG_DECORATION_HEADER
      21             : #define MG_DECORATION_HEADER
      22             : 
      23             : #include <set>
      24             : #include "objdef.h"
      25             : #include "noise.h"
      26             : #include "nodedef.h"
      27             : 
      28             : class Mapgen;
      29             : class MMVManip;
      30             : class PseudoRandom;
      31             : class Schematic;
      32             : 
      33             : enum DecorationType {
      34             :         DECO_SIMPLE,
      35             :         DECO_SCHEMATIC,
      36             :         DECO_LSYSTEM
      37             : };
      38             : 
      39             : #define DECO_PLACE_CENTER_X  0x01
      40             : #define DECO_PLACE_CENTER_Y  0x02
      41             : #define DECO_PLACE_CENTER_Z  0x04
      42             : #define DECO_USE_NOISE       0x08
      43             : #define DECO_FORCE_PLACEMENT 0x10
      44             : 
      45             : extern FlagDesc flagdesc_deco[];
      46             : 
      47             : 
      48             : #if 0
      49             : struct CutoffData {
      50             :         VoxelArea a;
      51             :         Decoration *deco;
      52             :         //v3s16 p;
      53             :         //v3s16 size;
      54             :         //s16 height;
      55             : 
      56             :         CutoffData(s16 x, s16 y, s16 z, s16 h) {
      57             :                 p = v3s16(x, y, z);
      58             :                 height = h;
      59             :         }
      60             : };
      61             : #endif
      62             : 
      63             : class Decoration : public ObjDef, public NodeResolver {
      64             : public:
      65             :         Decoration();
      66             :         virtual ~Decoration();
      67             : 
      68             :         virtual void resolveNodeNames();
      69             : 
      70             :         size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
      71             :         //size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
      72             : 
      73             :         virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p) = 0;
      74             :         virtual int getHeight() = 0;
      75             : 
      76             :         u32 flags;
      77             :         int mapseed;
      78             :         std::vector<content_t> c_place_on;
      79             :         s16 sidelen;
      80             :         s16 y_min;
      81             :         s16 y_max;
      82             :         float fill_ratio;
      83             :         NoiseParams np;
      84             : 
      85             :         std::set<u8> biomes;
      86             :         //std::list<CutoffData> cutoffs;
      87             :         //JMutex cutoff_mutex;
      88             : };
      89             : 
      90           0 : class DecoSimple : public Decoration {
      91             : public:
      92             :         virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p);
      93             :         bool canPlaceDecoration(MMVManip *vm, v3s16 p);
      94             :         virtual int getHeight();
      95             : 
      96             :         virtual void resolveNodeNames();
      97             : 
      98             :         std::vector<content_t> c_decos;
      99             :         std::vector<content_t> c_spawnby;
     100             :         s16 deco_height;
     101             :         s16 deco_height_max;
     102             :         s16 nspawnby;
     103             : };
     104             : 
     105           0 : class DecoSchematic : public Decoration {
     106             : public:
     107             :         DecoSchematic();
     108             : 
     109             :         virtual size_t generate(MMVManip *vm, PseudoRandom *pr, v3s16 p);
     110             :         virtual int getHeight();
     111             : 
     112             :         Rotation rotation;
     113             :         Schematic *schematic;
     114             : };
     115             : 
     116             : 
     117             : /*
     118             : class DecoLSystem : public Decoration {
     119             : public:
     120             :         virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
     121             : };
     122             : */
     123             : 
     124             : class DecorationManager : public ObjDefManager {
     125             : public:
     126             :         DecorationManager(IGameDef *gamedef);
     127           0 :         virtual ~DecorationManager() {}
     128             : 
     129           0 :         const char *getObjectTitle() const
     130             :         {
     131           0 :                 return "decoration";
     132             :         }
     133             : 
     134           0 :         static Decoration *create(DecorationType type)
     135             :         {
     136           0 :                 switch (type) {
     137             :                 case DECO_SIMPLE:
     138           0 :                         return new DecoSimple;
     139             :                 case DECO_SCHEMATIC:
     140           0 :                         return new DecoSchematic;
     141             :                 //case DECO_LSYSTEM:
     142             :                 //      return new DecoLSystem;
     143             :                 default:
     144           0 :                         return NULL;
     145             :                 }
     146             :         }
     147             : 
     148             :         size_t placeAllDecos(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
     149             : };
     150             : 
     151             : #endif

Generated by: LCOV version 1.11