From 859141a0ce38fbd606d95ae7a2f0999acf2fbe84 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 12 Mar 2017 13:26:09 +0000 Subject: Cavegen/Mgv5/Mgv7: Add optional giant caverns Add to MapgenBasic for use by multiple mapgens. Add to mgv5 and mgv7, enabled by default. Similar to mgvalleys caverns but half the scale. Parameters for upper y limit, distance caverns taper to full size, and noise threshold (full cavern size). As with mgvalleys caverns are generated first and classic caves are disabled in any mapchunk containing a cavern, to avoid excessive spreading volumes of liquids. This also avoids floating blobs of liquid where a large classic cave has overgenerated out into a neighbouring previously-generated mapchunk. --- src/mapgen_v5.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/mapgen_v5.h') diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h index ddb090a9c..034d53560 100644 --- a/src/mapgen_v5.h +++ b/src/mapgen_v5.h @@ -25,6 +25,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MGV5_LARGE_CAVE_DEPTH -256 +///////// Mapgen V5 flags +#define MGV5_CAVERNS 0x01 + class BiomeManager; extern FlagDesc flagdesc_mapgen_v5[]; @@ -33,12 +36,17 @@ extern FlagDesc flagdesc_mapgen_v5[]; struct MapgenV5Params : public MapgenParams { u32 spflags; float cave_width; + s16 cavern_limit; + s16 cavern_taper; + float cavern_threshold; + NoiseParams np_filler_depth; NoiseParams np_factor; NoiseParams np_height; + NoiseParams np_ground; NoiseParams np_cave1; NoiseParams np_cave2; - NoiseParams np_ground; + NoiseParams np_cavern; MapgenV5Params(); ~MapgenV5Params() {} -- cgit v1.2.3 From 91a9382c25328075d1a27593b22b0a75863951e1 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sun, 23 Apr 2017 09:52:40 +0200 Subject: Pass clang-format on various cpp/header files (#5559) --- src/ban.h | 2 +- src/cavegen.h | 45 +++++++++++++++++----------------- src/constants.h | 8 +++--- src/content_abm.cpp | 4 +-- src/database-dummy.h | 1 - src/defaultsettings.h | 1 - src/environment.h | 6 ++--- src/guiKeyChangeMenu.h | 18 ++++++-------- src/guiPasswordChange.h | 16 +++++------- src/irrlichttypes_bloated.h | 1 - src/irrlichttypes_extrabloated.h | 1 - src/itemgroup.h | 6 ++--- src/keycode.h | 7 +++--- src/light.h | 31 ++++++++++++----------- src/localplayer.h | 36 ++++++++++++--------------- src/mapgen_flat.h | 7 +++--- src/mapgen_fractal.h | 7 +++--- src/mapgen_singlenode.h | 6 +++-- src/mapgen_v5.h | 8 +++--- src/metadata.cpp | 9 +++---- src/modifiedstate.h | 1 - src/nameidmapping.cpp | 12 ++++----- src/nameidmapping.h | 30 +++++++++++++---------- src/script/cpp_api/s_mainmenu.cpp | 8 +++--- src/unittest/test_mapnode.cpp | 3 ++- src/unittest/test_nodedef.cpp | 5 ++-- src/unittest/test_objdef.cpp | 4 +-- src/unittest/test_player.cpp | 3 ++- src/unittest/test_profiler.cpp | 3 ++- util/travis/clang-format-whitelist.txt | 32 ------------------------ 30 files changed, 138 insertions(+), 183 deletions(-) (limited to 'src/mapgen_v5.h') diff --git a/src/ban.h b/src/ban.h index d1a49cb15..e35bd0e10 100644 --- a/src/ban.h +++ b/src/ban.h @@ -41,12 +41,12 @@ public: void add(const std::string &ip, const std::string &name); void remove(const std::string &ip_or_name); bool isModified(); + private: Mutex m_mutex; std::string m_banfilepath; StringMap m_ips; bool m_modified; - }; #endif diff --git a/src/cavegen.h b/src/cavegen.h index e322c181c..a1140594e 100644 --- a/src/cavegen.h +++ b/src/cavegen.h @@ -37,11 +37,12 @@ class GenerateNotifier; TODO(hmmmm): Remove dependency on biomes TODO(hmmmm): Find alternative to overgeneration as solution for sunlight issue */ -class CavesNoiseIntersection { +class CavesNoiseIntersection +{ public: CavesNoiseIntersection(INodeDefManager *nodedef, BiomeManager *biomemgr, - v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2, - s32 seed, float cave_width); + v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2, + s32 seed, float cave_width); ~CavesNoiseIntersection(); void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, u8 *biomemap); @@ -65,10 +66,12 @@ private: /* CavernsNoise is a cave digging algorithm */ -class CavernsNoise { +class CavernsNoise +{ public: CavernsNoise(INodeDefManager *nodedef, v3s16 chunksize, NoiseParams *np_cavern, - s32 seed, float cavern_limit, float cavern_taper, float cavern_threshold); + s32 seed, float cavern_limit, float cavern_taper, + float cavern_threshold); ~CavernsNoise(); bool generateCaverns(MMVManip *vm, v3s16 nmin, v3s16 nmax); @@ -105,7 +108,8 @@ private: This algorithm is very fast, executing in less than 1ms on average for an 80x80x80 chunk of map on a modern processor. */ -class CavesRandomWalk { +class CavesRandomWalk +{ public: MMVManip *vm; INodeDefManager *ndef; @@ -150,18 +154,16 @@ public: // ndef is a mandatory parameter. // If gennotify is NULL, generation events are not logged. - CavesRandomWalk(INodeDefManager *ndef, - GenerateNotifier *gennotify = NULL, - s32 seed = 0, - int water_level = 1, - content_t water_source = CONTENT_IGNORE, - content_t lava_source = CONTENT_IGNORE); + CavesRandomWalk(INodeDefManager *ndef, GenerateNotifier *gennotify = NULL, + s32 seed = 0, int water_level = 1, + content_t water_source = CONTENT_IGNORE, + content_t lava_source = CONTENT_IGNORE); // vm and ps are mandatory parameters. // If heightmap is NULL, the surface level at all points is assumed to // be water_level. void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax, PseudoRandom *ps, - bool is_large_cave, int max_stone_height, s16 *heightmap); + bool is_large_cave, int max_stone_height, s16 *heightmap); private: void makeTunnel(bool dirswitch); @@ -183,7 +185,8 @@ private: tl;dr, *** DO NOT TOUCH THIS CLASS UNLESS YOU KNOW WHAT YOU ARE DOING *** */ -class CavesV6 { +class CavesV6 +{ public: MMVManip *vm; INodeDefManager *ndef; @@ -222,18 +225,16 @@ public: // ndef is a mandatory parameter. // If gennotify is NULL, generation events are not logged. - CavesV6(INodeDefManager *ndef, - GenerateNotifier *gennotify = NULL, - int water_level = 1, - content_t water_source = CONTENT_IGNORE, - content_t lava_source = CONTENT_IGNORE); + CavesV6(INodeDefManager *ndef, GenerateNotifier *gennotify = NULL, + int water_level = 1, content_t water_source = CONTENT_IGNORE, + content_t lava_source = CONTENT_IGNORE); // vm, ps, and ps2 are mandatory parameters. // If heightmap is NULL, the surface level at all points is assumed to // be water_level. - void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax, - PseudoRandom *ps, PseudoRandom *ps2, - bool is_large_cave, int max_stone_height, s16 *heightmap = NULL); + void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax, PseudoRandom *ps, + PseudoRandom *ps2, bool is_large_cave, int max_stone_height, + s16 *heightmap = NULL); private: void makeTunnel(bool dirswitch); diff --git a/src/constants.h b/src/constants.h index 55ae9daf3..fb9e97cb3 100644 --- a/src/constants.h +++ b/src/constants.h @@ -85,7 +85,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ // Size of player's main inventory -#define PLAYER_INVENTORY_SIZE (8*4) +#define PLAYER_INVENTORY_SIZE (8 * 4) // Maximum hit points of a player #define PLAYER_MAX_HP 20 @@ -110,10 +110,10 @@ with this program; if not, write to the Free Software Foundation, Inc., // TODO: implement dpi-based scaling for windows and remove this hack #if defined(_WIN32) - #define TTF_DEFAULT_FONT_SIZE (18) +#define TTF_DEFAULT_FONT_SIZE (18) #else - #define TTF_DEFAULT_FONT_SIZE (16) +#define TTF_DEFAULT_FONT_SIZE (16) #endif -#define DEFAULT_FONT_SIZE (10) +#define DEFAULT_FONT_SIZE (10) #endif diff --git a/src/content_abm.cpp b/src/content_abm.cpp index 2ab3a968c..1e175c64f 100644 --- a/src/content_abm.cpp +++ b/src/content_abm.cpp @@ -29,6 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "serverscripting.h" #include "log.h" -void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef) { - +void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef) +{ } diff --git a/src/database-dummy.h b/src/database-dummy.h index 72100edd0..9083850cb 100644 --- a/src/database-dummy.h +++ b/src/database-dummy.h @@ -38,4 +38,3 @@ private: }; #endif - diff --git a/src/defaultsettings.h b/src/defaultsettings.h index 20274a003..21c51396f 100644 --- a/src/defaultsettings.h +++ b/src/defaultsettings.h @@ -36,4 +36,3 @@ void set_default_settings(Settings *settings); void override_default_settings(Settings *settings, Settings *from); #endif - diff --git a/src/environment.h b/src/environment.h index 52f369817..1de13e9ed 100644 --- a/src/environment.h +++ b/src/environment.h @@ -58,7 +58,7 @@ public: */ virtual void step(f32 dtime) = 0; - virtual Map & getMap() = 0; + virtual Map &getMap() = 0; u32 getDayNightRatio(); @@ -78,7 +78,7 @@ public: // counter used internally when triggering ABMs u32 m_added_objects; - IGameDef* getGameDef() { return m_gamedef; } + IGameDef *getGameDef() { return m_gamedef; } protected: GenericAtomic m_time_of_day_speed; @@ -117,6 +117,7 @@ protected: float m_cache_nodetimer_interval; IGameDef *m_gamedef; + private: Mutex m_time_lock; @@ -124,4 +125,3 @@ private: }; #endif - diff --git a/src/guiKeyChangeMenu.h b/src/guiKeyChangeMenu.h index 19a07620d..1aa400632 100644 --- a/src/guiKeyChangeMenu.h +++ b/src/guiKeyChangeMenu.h @@ -30,7 +30,8 @@ #include #include -struct key_setting { +struct key_setting +{ int id; const wchar_t *button_name; KeyPress key; @@ -38,12 +39,11 @@ struct key_setting { gui::IGUIButton *button; }; - -class GUIKeyChangeMenu: public GUIModalMenu +class GUIKeyChangeMenu : public GUIModalMenu { public: - GUIKeyChangeMenu(gui::IGUIEnvironment* env, gui::IGUIElement* parent, - s32 id, IMenuManager *menumgr); + GUIKeyChangeMenu(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, + IMenuManager *menumgr); ~GUIKeyChangeMenu(); void removeChildren(); @@ -56,10 +56,9 @@ public: bool acceptInput(); - bool OnEvent(const SEvent& event); + bool OnEvent(const SEvent &event); private: - void init_keys(); bool resetMenu(); @@ -67,13 +66,12 @@ private: void add_key(int id, const wchar_t *button_name, const std::string &setting_name); bool shift_down; - + s32 activeKey; - + std::vector key_used; gui::IGUIStaticText *key_used_text; std::vector key_settings; }; #endif - diff --git a/src/guiPasswordChange.h b/src/guiPasswordChange.h index aecc7076f..cf81389eb 100644 --- a/src/guiPasswordChange.h +++ b/src/guiPasswordChange.h @@ -27,12 +27,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. class GUIPasswordChange : public GUIModalMenu { public: - GUIPasswordChange(gui::IGUIEnvironment* env, - gui::IGUIElement* parent, s32 id, - IMenuManager *menumgr, - Client* client); + GUIPasswordChange(gui::IGUIEnvironment *env, gui::IGUIElement *parent, s32 id, + IMenuManager *menumgr, Client *client); ~GUIPasswordChange(); - + void removeChildren(); /* Remove and re-add (or reposition) stuff @@ -43,12 +41,10 @@ public: bool acceptInput(); - bool OnEvent(const SEvent& event); - -private: - Client* m_client; + bool OnEvent(const SEvent &event); +private: + Client *m_client; }; #endif - diff --git a/src/irrlichttypes_bloated.h b/src/irrlichttypes_bloated.h index 77aba350c..2caca6fc4 100644 --- a/src/irrlichttypes_bloated.h +++ b/src/irrlichttypes_bloated.h @@ -29,4 +29,3 @@ with this program; if not, write to the Free Software Foundation, Inc., #include #endif - diff --git a/src/irrlichttypes_extrabloated.h b/src/irrlichttypes_extrabloated.h index cd6cb1d2c..464ee7904 100644 --- a/src/irrlichttypes_extrabloated.h +++ b/src/irrlichttypes_extrabloated.h @@ -36,4 +36,3 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #endif - diff --git a/src/itemgroup.h b/src/itemgroup.h index f91ccc221..2206857fd 100644 --- a/src/itemgroup.h +++ b/src/itemgroup.h @@ -25,14 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc., typedef UNORDERED_MAP ItemGroupList; -static inline int itemgroup_get(const ItemGroupList &groups, - const std::string &name) +static inline int itemgroup_get(const ItemGroupList &groups, const std::string &name) { ItemGroupList::const_iterator i = groups.find(name); - if(i == groups.end()) + if (i == groups.end()) return 0; return i->second; } #endif - diff --git a/src/keycode.h b/src/keycode.h index 4d66cf7b5..4cd0b707e 100644 --- a/src/keycode.h +++ b/src/keycode.h @@ -34,16 +34,16 @@ public: KeyPress(); KeyPress(const char *name); - KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character=false); + KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character = false); bool operator==(const KeyPress &o) const { - return (Char > 0 && Char == o.Char) || - (valid_kcode(Key) && Key == o.Key); + return (Char > 0 && Char == o.Char) || (valid_kcode(Key) && Key == o.Key); } const char *sym() const; const char *name() const; + protected: static bool valid_kcode(irr::EKEY_CODE k) { @@ -68,4 +68,3 @@ void clearKeyCache(); irr::EKEY_CODE keyname_to_keycode(const char *name); #endif - diff --git a/src/light.h b/src/light.h index 984e6d7c2..30a647581 100644 --- a/src/light.h +++ b/src/light.h @@ -38,30 +38,30 @@ with this program; if not, write to the Free Software Foundation, Inc., inline u8 diminish_light(u8 light) { - if(light == 0) + if (light == 0) return 0; - if(light >= LIGHT_MAX) + if (light >= LIGHT_MAX) return LIGHT_MAX - 1; - + return light - 1; } inline u8 diminish_light(u8 light, u8 distance) { - if(distance >= light) + if (distance >= light) return 0; - return light - distance; + return light - distance; } inline u8 undiminish_light(u8 light) { // We don't know if light should undiminish from this particular 0. // Thus, keep it at 0. - if(light == 0) + if (light == 0) return 0; - if(light == LIGHT_MAX) + if (light == LIGHT_MAX) return light; - + return light + 1; } @@ -85,9 +85,9 @@ extern const u8 *light_decode_table; // 0 <= return value <= 255 inline u8 decode_light(u8 light) { - if(light > LIGHT_MAX) + if (light > LIGHT_MAX) light = LIGHT_MAX; - + return light_decode_table[light]; } @@ -97,12 +97,12 @@ inline float decode_light_f(float light_f) { s32 i = (u32)(light_f * LIGHT_MAX + 0.5); - if(i <= 0) + if (i <= 0) return (float)light_decode_table[0] / 255.0; - if(i >= LIGHT_MAX) + if (i >= LIGHT_MAX) return (float)light_decode_table[LIGHT_MAX] / 255.0; - float v1 = (float)light_decode_table[i-1] / 255.0; + float v1 = (float)light_decode_table[i - 1] / 255.0; float v2 = (float)light_decode_table[i] / 255.0; float f0 = (float)i - 0.5; float f = light_f * LIGHT_MAX - f0; @@ -119,11 +119,10 @@ void set_light_table(float gamma); inline u8 blend_light(u32 daylight_factor, u8 lightday, u8 lightnight) { u32 c = 1000; - u32 l = ((daylight_factor * lightday + (c-daylight_factor) * lightnight))/c; - if(l > LIGHT_SUN) + u32 l = ((daylight_factor * lightday + (c - daylight_factor) * lightnight)) / c; + if (l > LIGHT_SUN) l = LIGHT_SUN; return l; } #endif - diff --git a/src/localplayer.h b/src/localplayer.h index 01e859bf0..d8d2f310b 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -30,7 +30,13 @@ class GenericCAO; class ClientActiveObject; class IGameDef; -enum LocalPlayerAnimations {NO_ANIM, WALK_ANIM, DIG_ANIM, WD_ANIM}; // no local animation, walking, digging, both +enum LocalPlayerAnimations +{ + NO_ANIM, + WALK_ANIM, + DIG_ANIM, + WD_ANIM +}; // no local animation, walking, digging, both class LocalPlayer : public Player { @@ -97,12 +103,11 @@ public: float hurt_tilt_timer; float hurt_tilt_strength; - GenericCAO* getCAO() const { - return m_cao; - } + GenericCAO *getCAO() const { return m_cao; } - void setCAO(GenericCAO* toset) { - assert( m_cao == NULL ); // Pre-condition + void setCAO(GenericCAO *toset) + { + assert(m_cao == NULL); // Pre-condition m_cao = toset; } @@ -113,28 +118,20 @@ public: v3s16 getLightPosition() const; - void setYaw(f32 yaw) - { - m_yaw = yaw; - } + void setYaw(f32 yaw) { m_yaw = yaw; } f32 getYaw() const { return m_yaw; } - void setPitch(f32 pitch) - { - m_pitch = pitch; - } + void setPitch(f32 pitch) { m_pitch = pitch; } f32 getPitch() const { return m_pitch; } - void setPosition(const v3f &position) - { - m_position = position; - } + void setPosition(const v3f &position) { m_position = position; } v3f getPosition() const { return m_position; } v3f getEyePosition() const { return m_position + getEyeOffset(); } v3f getEyeOffset() const; + private: void accelerateHorizontal(const v3f &target_speed, const f32 max_increase); void accelerateVertical(const v3f &target_speed, const f32 max_increase); @@ -169,9 +166,8 @@ private: bool camera_barely_in_ceiling; aabb3f m_collisionbox; - GenericCAO* m_cao; + GenericCAO *m_cao; Client *m_client; }; #endif - diff --git a/src/mapgen_flat.h b/src/mapgen_flat.h index 8b3de2bcf..7a6696329 100644 --- a/src/mapgen_flat.h +++ b/src/mapgen_flat.h @@ -31,8 +31,8 @@ class BiomeManager; extern FlagDesc flagdesc_mapgen_flat[]; - -struct MapgenFlatParams : public MapgenParams { +struct MapgenFlatParams : public MapgenParams +{ u32 spflags; s16 ground_level; s16 large_cave_depth; @@ -53,7 +53,8 @@ struct MapgenFlatParams : public MapgenParams { void writeParams(Settings *settings) const; }; -class MapgenFlat : public MapgenBasic { +class MapgenFlat : public MapgenBasic +{ public: MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge); ~MapgenFlat(); diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h index 3331848bc..d049724b4 100644 --- a/src/mapgen_fractal.h +++ b/src/mapgen_fractal.h @@ -32,8 +32,8 @@ class BiomeManager; extern FlagDesc flagdesc_mapgen_fractal[]; - -struct MapgenFractalParams : public MapgenParams { +struct MapgenFractalParams : public MapgenParams +{ u32 spflags; float cave_width; u16 fractal; @@ -57,7 +57,8 @@ struct MapgenFractalParams : public MapgenParams { void writeParams(Settings *settings) const; }; -class MapgenFractal : public MapgenBasic { +class MapgenFractal : public MapgenBasic +{ public: MapgenFractal(int mapgenid, MapgenFractalParams *params, EmergeManager *emerge); ~MapgenFractal(); diff --git a/src/mapgen_singlenode.h b/src/mapgen_singlenode.h index 07520134d..55a503374 100644 --- a/src/mapgen_singlenode.h +++ b/src/mapgen_singlenode.h @@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapgen.h" -struct MapgenSinglenodeParams : public MapgenParams { +struct MapgenSinglenodeParams : public MapgenParams +{ MapgenSinglenodeParams() {} ~MapgenSinglenodeParams() {} @@ -30,7 +31,8 @@ struct MapgenSinglenodeParams : public MapgenParams { void writeParams(Settings *settings) const {} }; -class MapgenSinglenode : public Mapgen { +class MapgenSinglenode : public Mapgen +{ public: u32 flags; content_t c_node; diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h index 034d53560..1cdb33683 100644 --- a/src/mapgen_v5.h +++ b/src/mapgen_v5.h @@ -32,8 +32,8 @@ class BiomeManager; extern FlagDesc flagdesc_mapgen_v5[]; - -struct MapgenV5Params : public MapgenParams { +struct MapgenV5Params : public MapgenParams +{ u32 spflags; float cave_width; s16 cavern_limit; @@ -55,8 +55,8 @@ struct MapgenV5Params : public MapgenParams { void writeParams(Settings *settings) const; }; - -class MapgenV5 : public MapgenBasic { +class MapgenV5 : public MapgenBasic +{ public: MapgenV5(int mapgenid, MapgenV5Params *params, EmergeManager *emerge); ~MapgenV5(); diff --git a/src/metadata.cpp b/src/metadata.cpp index 2ce9af5af..833735464 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -64,8 +64,7 @@ bool Metadata::operator==(const Metadata &other) const return true; } -const std::string &Metadata::getString(const std::string &name, - u16 recursion) const +const std::string &Metadata::getString(const std::string &name, u16 recursion) const { StringMap::const_iterator it = m_stringvars.find(name); if (it == m_stringvars.end()) { @@ -99,11 +98,9 @@ bool Metadata::setString(const std::string &name, const std::string &var) return true; } -const std::string &Metadata::resolveString(const std::string &str, - u16 recursion) const +const std::string &Metadata::resolveString(const std::string &str, u16 recursion) const { - if (recursion <= 1 && - str.substr(0, 2) == "${" && str[str.length() - 1] == '}') { + if (recursion <= 1 && str.substr(0, 2) == "${" && str[str.length() - 1] == '}') { return getString(str.substr(2, str.length() - 3), recursion + 1); } else { return str; diff --git a/src/modifiedstate.h b/src/modifiedstate.h index 75518f2f5..576c3c576 100644 --- a/src/modifiedstate.h +++ b/src/modifiedstate.h @@ -34,4 +34,3 @@ enum ModifiedState }; #endif - diff --git a/src/nameidmapping.cpp b/src/nameidmapping.cpp index 2af8befff..d031f0808 100644 --- a/src/nameidmapping.cpp +++ b/src/nameidmapping.cpp @@ -25,27 +25,25 @@ void NameIdMapping::serialize(std::ostream &os) const { writeU8(os, 0); // version writeU16(os, m_id_to_name.size()); - for(UNORDERED_MAP::const_iterator - i = m_id_to_name.begin(); - i != m_id_to_name.end(); ++i){ + for (UNORDERED_MAP::const_iterator i = m_id_to_name.begin(); + i != m_id_to_name.end(); ++i) { writeU16(os, i->first); - os<second); + os << serializeString(i->second); } } void NameIdMapping::deSerialize(std::istream &is) { int version = readU8(is); - if(version != 0) + if (version != 0) throw SerializationError("unsupported NameIdMapping version"); u32 count = readU16(is); m_id_to_name.clear(); m_name_to_id.clear(); - for(u32 i=0; i::const_iterator i; i = m_id_to_name.find(id); - if(i == m_id_to_name.end()) + if (i == m_id_to_name.end()) return false; result = i->second; return true; } - bool getId(const std::string &name, u16 &result) const{ + bool getId(const std::string &name, u16 &result) const + { UNORDERED_MAP::const_iterator i; i = m_name_to_id.find(name); - if(i == m_name_to_id.end()) + if (i == m_name_to_id.end()) return false; result = i->second; return true; } - u16 size() const{ - return m_id_to_name.size(); - } + u16 size() const { return m_id_to_name.size(); } private: UNORDERED_MAP m_id_to_name; UNORDERED_MAP m_name_to_id; }; #endif - diff --git a/src/script/cpp_api/s_mainmenu.cpp b/src/script/cpp_api/s_mainmenu.cpp index e9a7a13b9..1e9ba3a41 100644 --- a/src/script/cpp_api/s_mainmenu.cpp +++ b/src/script/cpp_api/s_mainmenu.cpp @@ -34,8 +34,7 @@ void ScriptApiMainMenu::setMainMenuData(MainMenuDataForScript *data) lua_pushnil(L); } lua_settable(L, gamedata_idx); - setboolfield(L, gamedata_idx, "reconnect_requested", - data->reconnect_requested); + setboolfield(L, gamedata_idx, "reconnect_requested", data->reconnect_requested); lua_pop(L, 1); } @@ -58,7 +57,7 @@ void ScriptApiMainMenu::handleMainMenuEvent(std::string text) // Call it lua_pushstring(L, text.c_str()); PCALL_RES(lua_pcall(L, 1, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } void ScriptApiMainMenu::handleMainMenuButtons(const StringMap &fields) @@ -90,6 +89,5 @@ void ScriptApiMainMenu::handleMainMenuButtons(const StringMap &fields) // Call it PCALL_RES(lua_pcall(L, 1, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } - diff --git a/src/unittest/test_mapnode.cpp b/src/unittest/test_mapnode.cpp index 9ecc2f82d..70e7d42cf 100644 --- a/src/unittest/test_mapnode.cpp +++ b/src/unittest/test_mapnode.cpp @@ -23,7 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "content_mapnode.h" -class TestMapNode : public TestBase { +class TestMapNode : public TestBase +{ public: TestMapNode() { TestManager::registerTestModule(this); } const char *getName() { return "TestMapNode"; } diff --git a/src/unittest/test_nodedef.cpp b/src/unittest/test_nodedef.cpp index 85093f52f..cb99ae854 100644 --- a/src/unittest/test_nodedef.cpp +++ b/src/unittest/test_nodedef.cpp @@ -25,7 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodedef.h" #include "network/networkprotocol.h" -class TestNodeDef : public TestBase { +class TestNodeDef : public TestBase +{ public: TestNodeDef() { TestManager::registerTestModule(this); } const char *getName() { return "TestNodeDef"; } @@ -55,7 +56,7 @@ void TestNodeDef::testContentFeaturesSerialization() std::ostringstream os(std::ios::binary); f.serialize(os, LATEST_PROTOCOL_VERSION); - //verbosestream<<"Test ContentFeatures size: "< Date: Thu, 25 May 2017 18:53:47 +0100 Subject: Mapgen files: Update and correct copyright credits --- src/mapgen.cpp | 3 ++- src/mapgen.h | 4 +++- src/mapgen_flat.cpp | 4 ++-- src/mapgen_flat.h | 4 ++-- src/mapgen_fractal.cpp | 4 ++-- src/mapgen_fractal.h | 4 ++-- src/mapgen_singlenode.cpp | 4 +++- src/mapgen_singlenode.h | 4 +++- src/mapgen_v5.cpp | 4 ++-- src/mapgen_v5.h | 4 ++-- src/mapgen_v6.cpp | 2 ++ src/mapgen_v6.h | 2 ++ src/mapgen_v7.cpp | 4 ++-- src/mapgen_v7.h | 4 ++-- src/mapgen_valleys.cpp | 5 ++--- src/mapgen_valleys.h | 5 ++--- src/mg_biome.cpp | 3 ++- src/mg_biome.h | 3 ++- src/mg_decoration.cpp | 3 ++- src/mg_decoration.h | 3 ++- src/mg_ore.cpp | 3 ++- src/mg_ore.h | 3 ++- src/mg_schematic.cpp | 3 ++- src/mg_schematic.h | 3 ++- 24 files changed, 51 insertions(+), 34 deletions(-) (limited to 'src/mapgen_v5.h') diff --git a/src/mapgen.cpp b/src/mapgen.cpp index bd0e94ac7..6fd2ac580 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -1,7 +1,8 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mapgen.h b/src/mapgen.h index 653b79ed8..1efd2bff7 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -1,6 +1,8 @@ /* Minetest -Copyright (C) 2010-2013 celeron55, Perttu Ahola +Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mapgen_flat.cpp b/src/mapgen_flat.cpp index 0a44f71a5..604c79dd0 100644 --- a/src/mapgen_flat.cpp +++ b/src/mapgen_flat.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2015-2017 paramat +Copyright (C) 2015-2016 kwolekr, Ryan Kwolek 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 diff --git a/src/mapgen_flat.h b/src/mapgen_flat.h index 7a6696329..18b84de76 100644 --- a/src/mapgen_flat.h +++ b/src/mapgen_flat.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2015-2017 paramat +Copyright (C) 2015-2016 kwolekr, Ryan Kwolek 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 diff --git a/src/mapgen_fractal.cpp b/src/mapgen_fractal.cpp index d48d38b65..faac9e1c1 100644 --- a/src/mapgen_fractal.cpp +++ b/src/mapgen_fractal.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2015-2017 paramat +Copyright (C) 2015-2016 kwolekr, Ryan Kwolek 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 diff --git a/src/mapgen_fractal.h b/src/mapgen_fractal.h index d049724b4..a5a09ccb9 100644 --- a/src/mapgen_fractal.h +++ b/src/mapgen_fractal.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2015-2017 paramat +Copyright (C) 2015-2016 kwolekr, Ryan Kwolek Fractal formulas from http://www.bugman123.com/Hypercomplex/index.html by Paul Nylander, and from http://www.fractalforums.com, thank you. diff --git a/src/mapgen_singlenode.cpp b/src/mapgen_singlenode.cpp index ff985dd34..f49059f7f 100644 --- a/src/mapgen_singlenode.cpp +++ b/src/mapgen_singlenode.cpp @@ -1,6 +1,8 @@ /* Minetest -Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mapgen_singlenode.h b/src/mapgen_singlenode.h index 55a503374..5171bfbca 100644 --- a/src/mapgen_singlenode.h +++ b/src/mapgen_singlenode.h @@ -1,6 +1,8 @@ /* Minetest -Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mapgen_v5.cpp b/src/mapgen_v5.cpp index 1c4d1fd70..932677e2a 100644 --- a/src/mapgen_v5.cpp +++ b/src/mapgen_v5.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2014-2017 paramat +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek 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 diff --git a/src/mapgen_v5.h b/src/mapgen_v5.h index 1cdb33683..b742638cd 100644 --- a/src/mapgen_v5.h +++ b/src/mapgen_v5.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2014-2017 paramat +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek 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 diff --git a/src/mapgen_v6.cpp b/src/mapgen_v6.cpp index ff0d93496..fe2b0b36f 100644 --- a/src/mapgen_v6.cpp +++ b/src/mapgen_v6.cpp @@ -1,6 +1,8 @@ /* Minetest Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mapgen_v6.h b/src/mapgen_v6.h index 44591e3dc..2b3b4444e 100644 --- a/src/mapgen_v6.h +++ b/src/mapgen_v6.h @@ -1,6 +1,8 @@ /* Minetest Copyright (C) 2010-2015 celeron55, Perttu Ahola +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp index dbf2b02ae..5e9bc4aa3 100644 --- a/src/mapgen_v7.cpp +++ b/src/mapgen_v7.cpp @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mapgen_v7.h b/src/mapgen_v7.h index 71a341afe..a69170057 100644 --- a/src/mapgen_v7.h +++ b/src/mapgen_v7.h @@ -1,7 +1,7 @@ /* Minetest -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory +Copyright (C) 2013-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mapgen_valleys.cpp b/src/mapgen_valleys.cpp index 32a32eb88..df318291c 100644 --- a/src/mapgen_valleys.cpp +++ b/src/mapgen_valleys.cpp @@ -1,8 +1,7 @@ /* Minetest Valleys C -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory -Copyright (C) 2016 Duane Robertson +Copyright (C) 2016-2017 Duane Robertson +Copyright (C) 2016-2017 paramat Based on Valleys Mapgen by Gael de Sailly (https://forum.minetest.net/viewtopic.php?f=9&t=11430) diff --git a/src/mapgen_valleys.h b/src/mapgen_valleys.h index 0c67c3232..8a32a5a82 100644 --- a/src/mapgen_valleys.h +++ b/src/mapgen_valleys.h @@ -1,8 +1,7 @@ /* Minetest Valleys C -Copyright (C) 2010-2015 kwolekr, Ryan Kwolek -Copyright (C) 2010-2015 paramat, Matt Gregory -Copyright (C) 2016 Duane Robertson +Copyright (C) 2016-2017 Duane Robertson +Copyright (C) 2016-2017 paramat Based on Valleys Mapgen by Gael de Sailly (https://forum.minetest.net/viewtopic.php?f=9&t=11430) diff --git a/src/mg_biome.cpp b/src/mg_biome.cpp index ef7e52685..2ef2ed16a 100644 --- a/src/mg_biome.cpp +++ b/src/mg_biome.cpp @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2013 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mg_biome.h b/src/mg_biome.h index 15088f7dd..2e07fd9cf 100644 --- a/src/mg_biome.h +++ b/src/mg_biome.h @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2013 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2014-2017 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 diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index ec31a9c01..b0566e830 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2014 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mg_decoration.h b/src/mg_decoration.h index 986328ec3..950800ec8 100644 --- a/src/mg_decoration.h +++ b/src/mg_decoration.h @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2013 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index c6c1c45a7..89319238e 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2014 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mg_ore.h b/src/mg_ore.h index e95fdd330..0503a6ca0 100644 --- a/src/mg_ore.h +++ b/src/mg_ore.h @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2013 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mg_schematic.cpp b/src/mg_schematic.cpp index 92e138df4..67931497f 100644 --- a/src/mg_schematic.cpp +++ b/src/mg_schematic.cpp @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2014 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 diff --git a/src/mg_schematic.h b/src/mg_schematic.h index 2f60c843b..db040343c 100644 --- a/src/mg_schematic.h +++ b/src/mg_schematic.h @@ -1,6 +1,7 @@ /* Minetest -Copyright (C) 2010-2013 kwolekr, Ryan Kwolek +Copyright (C) 2014-2016 kwolekr, Ryan Kwolek +Copyright (C) 2015-2017 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 -- cgit v1.2.3