Skip to content
Permalink
Browse files

Clang-format: fix some header files and remove them from whitelist

  • Loading branch information
nerzhul committed Apr 7, 2017
1 parent b751c59 commit f7088f69ab7406ea9fefa853fa7ce11f914e88cf
@@ -68,15 +68,9 @@ class RemotePlayer : public Player
*ratio = m_day_night_ratio;
}

void setHotbarImage(const std::string &name)
{
hud_hotbar_image = name;
}
void setHotbarImage(const std::string &name) { hud_hotbar_image = name; }

std::string getHotbarImage() const
{
return hud_hotbar_image;
}
std::string getHotbarImage() const { return hud_hotbar_image; }

void setHotbarSelectedImage(const std::string &name)
{
@@ -89,15 +83,15 @@ class RemotePlayer : public Player
}

void setSky(const video::SColor &bgcolor, const std::string &type,
const std::vector<std::string> &params)
const std::vector<std::string> &params)
{
m_sky_bgcolor = bgcolor;
m_sky_type = type;
m_sky_params = params;
}

void getSky(video::SColor *bgcolor, std::string *type,
std::vector<std::string> *params)
std::vector<std::string> *params)
{
*bgcolor = m_sky_bgcolor;
*type = m_sky_type;
@@ -130,6 +124,7 @@ class RemotePlayer : public Player
void setDirty(bool dirty) { m_dirty = true; }

u16 protocol_version;

private:
/*
serialize() writes a bunch of text that can contain
@@ -22,7 +22,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "lua_api/l_base.h"

class ModApiMapgen : public ModApiBase {
class ModApiMapgen : public ModApiBase
{
private:
// get_biome_id(biomename)
// returns the biome id used in biomemap
@@ -23,12 +23,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,

#include "lua_api/l_base.h"


class ModApiSound: public ModApiBase
class ModApiSound : public ModApiBase
{
private:
static int l_sound_play(lua_State *L);
static int l_sound_stop(lua_State *L);

public:
static void Initialize(lua_State *L, int top);
};
@@ -21,33 +21,34 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef __L_STORAGE_H__
#define __L_STORAGE_H__

#include "lua_api/l_base.h"
#include "l_metadata.h"
#include "lua_api/l_base.h"

class ModMetadata;

class ModApiStorage: public ModApiBase
class ModApiStorage : public ModApiBase
{
protected:
static int l_get_mod_storage(lua_State *L);

public:
static void Initialize(lua_State *L, int top);

};

class StorageRef: public MetaDataRef
class StorageRef : public MetaDataRef
{
private:
ModMetadata *m_object;

static const char className[];
static const luaL_reg methods[];

virtual Metadata* getmeta(bool auto_create);
virtual Metadata *getmeta(bool auto_create);
virtual void clearMeta();

// garbage collector
static int gc_object(lua_State *L);

public:
StorageRef(ModMetadata *object);
~StorageRef() {}
@@ -56,7 +57,7 @@ class StorageRef: public MetaDataRef
static void create(lua_State *L, ModMetadata *object);

static StorageRef *checkobject(lua_State *L, int narg);
static ModMetadata* getobject(StorageRef *ref);
static ModMetadata *getobject(StorageRef *ref);
};

#endif /* __L_STORAGE_H__ */
@@ -24,7 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,

class AsyncEngine;

class ModApiUtil : public ModApiBase {
class ModApiUtil : public ModApiBase
{
private:
/*
NOTE:
@@ -112,9 +113,7 @@ class ModApiUtil : public ModApiBase {

static void InitializeClient(lua_State *L, int top);

static void InitializeAsync(AsyncEngine& engine);

static void InitializeAsync(AsyncEngine &engine);
};

#endif /* L_UTIL_H_ */

@@ -20,9 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef L_VMANIP_H_
#define L_VMANIP_H_

#include "lua_api/l_base.h"
#include "irr_v3d.h"
#include <map>
#include "irr_v3d.h"
#include "lua_api/l_base.h"

class Map;
class MapBlock;
@@ -31,7 +31,8 @@ class MMVManip;
/*
VoxelManip
*/
class LuaVoxelManip : public ModApiBase {
class LuaVoxelManip : public ModApiBase
{
private:
std::map<v3s16, MapBlock *> modified_blocks;
bool is_mapgen_vm;
@@ -17,9 +17,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "irrlichttypes_extrabloated.h"
#include <ISceneNode.h>
#include "camera.h"
#include "irrlichttypes_extrabloated.h"

#ifndef SKY_HEADER
#define SKY_HEADER
@@ -34,30 +34,26 @@ class Sky : public scene::ISceneNode
{
public:
//! constructor
Sky(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id,
Sky(scene::ISceneNode *parent, scene::ISceneManager *mgr, s32 id,
ITextureSource *tsrc);

virtual void OnRegisterSceneNode();

//! renders the node.
virtual void render();

virtual const aabb3f &getBoundingBox() const
{ return m_box; }
virtual const aabb3f &getBoundingBox() const { return m_box; }

// Used by Irrlicht for optimizing rendering
virtual video::SMaterial& getMaterial(u32 i)
{ return m_materials[i]; }
virtual video::SMaterial &getMaterial(u32 i) { return m_materials[i]; }

// Used by Irrlicht for optimizing rendering
virtual u32 getMaterialCount() const
{ return SKY_MATERIAL_COUNT; }
virtual u32 getMaterialCount() const { return SKY_MATERIAL_COUNT; }

void update(float m_time_of_day, float time_brightness,
float direct_brightness, bool sunlight_seen, CameraMode cam_mode,
float yaw, float pitch);
void update(float m_time_of_day, float time_brightness, float direct_brightness,
bool sunlight_seen, CameraMode cam_mode, float yaw, float pitch);

float getBrightness(){ return m_brightness; }
float getBrightness() { return m_brightness; }

const video::SColor &getBgColor() const
{
@@ -72,8 +68,9 @@ class Sky : public scene::ISceneNode
bool getCloudsVisible() { return m_clouds_visible && m_visible; }
const video::SColorf &getCloudColor() { return m_cloudcolor_f; }

void setVisible(bool visible){ m_visible = visible; }
void setFallbackBgColor(const video::SColor &fallback_bg_color){
void setVisible(bool visible) { m_visible = visible; }
void setFallbackBgColor(const video::SColor &fallback_bg_color)
{
m_fallback_bg_color = fallback_bg_color;
}

@@ -86,7 +83,8 @@ class Sky : public scene::ISceneNode
{
if (!m_sunlight_seen)
return 0;
float x = m_time_of_day >= 0.5 ? (1 - m_time_of_day) * 2 : m_time_of_day * 2;
float x = m_time_of_day >= 0.5 ? (1 - m_time_of_day) * 2
: m_time_of_day * 2;

if (x <= 0.3)
return 0;
@@ -101,19 +99,19 @@ class Sky : public scene::ISceneNode
video::SColor m_mix_scolor(video::SColor col1, video::SColor col2, f32 factor)
{
video::SColor result = video::SColor(
col1.getAlpha() * (1 - factor) + col2.getAlpha() * factor,
col1.getRed() * (1 - factor) + col2.getRed() * factor,
col1.getGreen() * (1 - factor) + col2.getGreen() * factor,
col1.getBlue() * (1 - factor) + col2.getBlue() * factor);
col1.getAlpha() * (1 - factor) + col2.getAlpha() * factor,
col1.getRed() * (1 - factor) + col2.getRed() * factor,
col1.getGreen() * (1 - factor) + col2.getGreen() * factor,
col1.getBlue() * (1 - factor) + col2.getBlue() * factor);
return result;
}
video::SColorf m_mix_scolorf(video::SColorf col1, video::SColorf col2, f32 factor)
{
video::SColorf result = video::SColorf(
col1.r * (1 - factor) + col2.r * factor,
col1.g * (1 - factor) + col2.g * factor,
col1.b * (1 - factor) + col2.b * factor,
col1.a * (1 - factor) + col2.a * factor);
video::SColorf result =
video::SColorf(col1.r * (1 - factor) + col2.r * factor,
col1.g * (1 - factor) + col2.g * factor,
col1.b * (1 - factor) + col2.b * factor,
col1.a * (1 - factor) + col2.a * factor);
return result;
}

@@ -134,12 +132,11 @@ class Sky : public scene::ISceneNode
video::SColor m_skycolor;
video::SColorf m_cloudcolor_f;
v3f m_stars[SKY_STAR_COUNT];
video::S3DVertex m_star_vertices[SKY_STAR_COUNT*4];
video::ITexture* m_sun_texture;
video::ITexture* m_moon_texture;
video::ITexture* m_sun_tonemap;
video::ITexture* m_moon_tonemap;
video::S3DVertex m_star_vertices[SKY_STAR_COUNT * 4];
video::ITexture *m_sun_texture;
video::ITexture *m_moon_texture;
video::ITexture *m_sun_tonemap;
video::ITexture *m_moon_tonemap;
};

#endif

@@ -20,9 +20,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef SOUND_HEADER
#define SOUND_HEADER

#include "irrlichttypes_bloated.h"
#include <string>
#include <set>
#include <string>
#include "irrlichttypes_bloated.h"

class OnDemandSoundFetcher
{
@@ -36,66 +36,72 @@ struct SimpleSoundSpec
{
std::string name;
float gain;
SimpleSoundSpec(std::string name="", float gain=1.0):
name(name),
gain(gain)
{}
bool exists() {return name != "";}
SimpleSoundSpec(std::string name = "", float gain = 1.0) : name(name), gain(gain)
{
}
bool exists() { return name != ""; }
// Serialization intentionally left out
};

class ISoundManager
{
public:
virtual ~ISoundManager(){}
virtual ~ISoundManager() {}

// Multiple sounds can be loaded per name; when played, the sound
// should be chosen randomly from alternatives
// Return value determines success/failure
virtual bool loadSoundFile(const std::string &name,
const std::string &filepath) = 0;
virtual bool loadSoundData(const std::string &name,
const std::string &filedata) = 0;
virtual bool loadSoundFile(
const std::string &name, const std::string &filepath) = 0;
virtual bool loadSoundData(
const std::string &name, const std::string &filedata) = 0;

virtual void updateListener(v3f pos, v3f vel, v3f at, v3f up) = 0;
virtual void setListenerGain(float gain) = 0;

// playSound functions return -1 on failure, otherwise a handle to the
// sound. If name=="", call should be ignored without error.
virtual int playSound(const std::string &name, bool loop,
float volume) = 0;
virtual int playSoundAt(const std::string &name, bool loop,
float volume, v3f pos) = 0;
virtual int playSound(const std::string &name, bool loop, float volume) = 0;
virtual int playSoundAt(
const std::string &name, bool loop, float volume, v3f pos) = 0;
virtual void stopSound(int sound) = 0;
virtual bool soundExists(int sound) = 0;
virtual void updateSoundPosition(int sound, v3f pos) = 0;

int playSound(const SimpleSoundSpec &spec, bool loop)
{ return playSound(spec.name, loop, spec.gain); }
{
return playSound(spec.name, loop, spec.gain);
}
int playSoundAt(const SimpleSoundSpec &spec, bool loop, v3f pos)
{ return playSoundAt(spec.name, loop, spec.gain, pos); }
{
return playSoundAt(spec.name, loop, spec.gain, pos);
}
};

class DummySoundManager: public ISoundManager
class DummySoundManager : public ISoundManager
{
public:
virtual bool loadSoundFile(const std::string &name,
const std::string &filepath) {return true;}
virtual bool loadSoundData(const std::string &name,
const std::string &filedata) {return true;}
virtual bool loadSoundFile(const std::string &name, const std::string &filepath)
{
return true;
}
virtual bool loadSoundData(const std::string &name, const std::string &filedata)
{
return true;
}
void updateListener(v3f pos, v3f vel, v3f at, v3f up) {}
void setListenerGain(float gain) {}
int playSound(const std::string &name, bool loop,
float volume) {return 0;}
int playSoundAt(const std::string &name, bool loop,
float volume, v3f pos) {return 0;}
int playSound(const std::string &name, bool loop, float volume) { return 0; }
int playSoundAt(const std::string &name, bool loop, float volume, v3f pos)
{
return 0;
}
void stopSound(int sound) {}
bool soundExists(int sound) {return false;}
bool soundExists(int sound) { return false; }
void updateSoundPosition(int sound, v3f pos) {}
};

// Global DummySoundManager singleton
extern DummySoundManager dummySoundManager;

#endif

0 comments on commit f7088f6

Please sign in to comment.
You can’t perform that action at this time.