Skip to content

Commit

Permalink
Pass clang-format on various cpp/header files (#5559)
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzhul committed Apr 23, 2017
1 parent 0c34fe2 commit 91a9382
Show file tree
Hide file tree
Showing 30 changed files with 138 additions and 183 deletions.
2 changes: 1 addition & 1 deletion src/ban.h
Expand Up @@ -41,12 +41,12 @@ class BanManager
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
45 changes: 23 additions & 22 deletions src/cavegen.h
Expand Up @@ -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);
Expand All @@ -65,10 +66,12 @@ class CavesNoiseIntersection {
/*
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);
Expand Down Expand Up @@ -105,7 +108,8 @@ class CavernsNoise {
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;
Expand Down Expand Up @@ -150,18 +154,16 @@ class CavesRandomWalk {

// 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);
Expand All @@ -183,7 +185,8 @@ class CavesRandomWalk {
tl;dr,
*** DO NOT TOUCH THIS CLASS UNLESS YOU KNOW WHAT YOU ARE DOING ***
*/
class CavesV6 {
class CavesV6
{
public:
MMVManip *vm;
INodeDefManager *ndef;
Expand Down Expand Up @@ -222,18 +225,16 @@ class CavesV6 {

// 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);
Expand Down
8 changes: 4 additions & 4 deletions src/constants.h
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions src/content_abm.cpp
Expand Up @@ -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)
{
}
1 change: 0 additions & 1 deletion src/database-dummy.h
Expand Up @@ -38,4 +38,3 @@ class Database_Dummy : public Database
};

#endif

1 change: 0 additions & 1 deletion src/defaultsettings.h
Expand Up @@ -36,4 +36,3 @@ void set_default_settings(Settings *settings);
void override_default_settings(Settings *settings, Settings *from);

#endif

6 changes: 3 additions & 3 deletions src/environment.h
Expand Up @@ -58,7 +58,7 @@ class Environment
*/
virtual void step(f32 dtime) = 0;

virtual Map & getMap() = 0;
virtual Map &getMap() = 0;

u32 getDayNightRatio();

Expand All @@ -78,7 +78,7 @@ class Environment
// counter used internally when triggering ABMs
u32 m_added_objects;

IGameDef* getGameDef() { return m_gamedef; }
IGameDef *getGameDef() { return m_gamedef; }
protected:
GenericAtomic<float> m_time_of_day_speed;

Expand Down Expand Up @@ -117,11 +117,11 @@ class Environment
float m_cache_nodetimer_interval;

IGameDef *m_gamedef;

private:
Mutex m_time_lock;

DISABLE_CLASS_COPY(Environment);
};

#endif

18 changes: 8 additions & 10 deletions src/guiKeyChangeMenu.h
Expand Up @@ -30,20 +30,20 @@
#include <string>
#include <vector>

struct key_setting {
struct key_setting
{
int id;
const wchar_t *button_name;
KeyPress key;
std::string setting_name;
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();
Expand All @@ -56,24 +56,22 @@ class GUIKeyChangeMenu: public GUIModalMenu

bool acceptInput();

bool OnEvent(const SEvent& event);
bool OnEvent(const SEvent &event);

private:

void init_keys();

bool resetMenu();

void add_key(int id, const wchar_t *button_name, const std::string &setting_name);

bool shift_down;

s32 activeKey;

std::vector<KeyPress> key_used;
gui::IGUIStaticText *key_used_text;
std::vector<key_setting *> key_settings;
};

#endif

16 changes: 6 additions & 10 deletions src/guiPasswordChange.h
Expand Up @@ -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
Expand All @@ -43,12 +41,10 @@ class GUIPasswordChange : public GUIModalMenu

bool acceptInput();

bool OnEvent(const SEvent& event);

private:
Client* m_client;
bool OnEvent(const SEvent &event);

private:
Client *m_client;
};

#endif

1 change: 0 additions & 1 deletion src/irrlichttypes_bloated.h
Expand Up @@ -29,4 +29,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include <SColor.h>

#endif

1 change: 0 additions & 1 deletion src/irrlichttypes_extrabloated.h
Expand Up @@ -36,4 +36,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#endif

#endif

6 changes: 2 additions & 4 deletions src/itemgroup.h
Expand Up @@ -25,14 +25,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,

typedef UNORDERED_MAP<std::string, int> 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

7 changes: 3 additions & 4 deletions src/keycode.h
Expand Up @@ -34,16 +34,16 @@ class KeyPress
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)
{
Expand All @@ -68,4 +68,3 @@ void clearKeyCache();
irr::EKEY_CODE keyname_to_keycode(const char *name);

#endif

0 comments on commit 91a9382

Please sign in to comment.