diff --git a/src/builder/BSP.cc b/src/builder/BSP.cc index 5a38f8b9..763d29ac 100644 --- a/src/builder/BSP.cc +++ b/src/builder/BSP.cc @@ -242,10 +242,10 @@ void BSP::load() model.title = entityConfig["title"].get(""); static const EnumMap entityMap = { - { EntityClass::STATIC, "STATIC" }, - { EntityClass::MOVER, "MOVER" }, - { EntityClass::DOOR, "DOOR" }, - { EntityClass::PORTAL, "PORTAL" } + {EntityClass::STATIC, "STATIC"}, + {EntityClass::MOVER, "MOVER" }, + {EntityClass::DOOR, "DOOR" }, + {EntityClass::PORTAL, "PORTAL"} }; model.type = entityMap[entityConfig["type"].get("")]; diff --git a/src/builder/Compiler.cc b/src/builder/Compiler.cc index 7c5bf967..4fc592c1 100644 --- a/src/builder/Compiler.cc +++ b/src/builder/Compiler.cc @@ -454,7 +454,7 @@ void Compiler::end() case POLYGON: { OZ_ASSERT(vertNum >= 3); - int last[2] = { 0, 1 }; + int last[2] = {0, 1}; int top = vertNum - 1; int bottom = 2; @@ -657,21 +657,21 @@ void Compiler::positionKey(const Point& pos, float time) { OZ_ASSERT(environment == CHANNEL); - channel.positionKeys.add(Animation::PositionKey{ pos, time }); + channel.positionKeys.add(Animation::PositionKey{pos, time}); } void Compiler::rotationKey(const Quat& rot, float time) { OZ_ASSERT(environment == CHANNEL); - channel.rotationKeys.add(Animation::RotationKey{ rot, time }); + channel.rotationKeys.add(Animation::RotationKey{rot, time}); } void Compiler::scalingKey(const Vec3& scale, float time) { OZ_ASSERT(environment == CHANNEL); - channel.scalingKeys.add(Animation::ScalingKey{ scale, time }); + channel.scalingKeys.add(Animation::ScalingKey{scale, time}); } void Compiler::writeModel(Stream* os, bool globalTextures) diff --git a/src/builder/Terra.cc b/src/builder/Terra.cc index 803858a3..cf7cfdaf 100644 --- a/src/builder/Terra.cc +++ b/src/builder/Terra.cc @@ -38,8 +38,8 @@ void Terra::load() } EnumMap liquidMap = { - { Medium::WATER_BIT | Medium::SEA_BIT, "WATER" }, - { Medium::LAVA_BIT | Medium::SEA_BIT, "LAVA" } + {Medium::WATER_BIT | Medium::SEA_BIT, "WATER"}, + {Medium::LAVA_BIT | Medium::SEA_BIT, "LAVA" } }; detailTex = config["detailTexture"].get(""); @@ -103,8 +103,8 @@ void Terra::load() }; static const EnumMap controlMap = { - { TerraBuilder::COMBINER, "combiner" }, - { TerraBuilder::PLAINS, "plains" }, + {TerraBuilder::COMBINER, "combiner"}, + {TerraBuilder::PLAINS, "plains" }, }; for (int i = 0; i < Arrays::length(MODULE_NAMES); ++i) { diff --git a/src/client/Caelum.cc b/src/client/Caelum.cc index ccb73bf3..e8110b78 100644 --- a/src/client/Caelum.cc +++ b/src/client/Caelum.cc @@ -27,7 +27,7 @@ namespace oz namespace client { -const char* const Caelum::SKYBOX_FACES[] = { "+x", "-x", "+y", "-y", "+z", "-z" }; +const char* const Caelum::SKYBOX_FACES[] = {"+x", "-x", "+y", "-y", "+z", "-z"}; const Vec4 Caelum::GLOBAL_AMBIENT_COLOUR = Vec4(0.12f, 0.12f, 0.15f, 1.00f); const float Caelum::DAY_BIAS = 0.40f; diff --git a/src/client/Context.cc b/src/client/Context.cc index 66e7bd59..9b01399e 100644 --- a/src/client/Context.cc +++ b/src/client/Context.cc @@ -218,7 +218,7 @@ Context::ContSource* Context::addContSource(int sound, int key) alSourcei(srcId, AL_BUFFER, sounds[sound].handle); ++sounds[sound].nUsers; - return &contSources.add(key, ContSource{ srcId, sound, true }).value; + return &contSources.add(key, ContSource{srcId, sound, true}).value; } void Context::removeContSource(ContSource* contSource, int key) diff --git a/src/client/MD2.cc b/src/client/MD2.cc index e61ddbac..9b816872 100644 --- a/src/client/MD2.cc +++ b/src/client/MD2.cc @@ -27,26 +27,26 @@ namespace client const MD2::AnimInfo MD2::ANIM_LIST[] = { // first, last, frequency (FPS), nextAnim - { 0, 39, 9.0f, ANIM_STAND }, // STAND - { 40, 45, 10.0f, ANIM_RUN }, // RUN - { 46, 53, 16.0f, ANIM_ATTACK }, // ATTACK - { 54, 57, 7.0f, ANIM_STAND }, // PAIN_A - { 58, 61, 7.0f, ANIM_STAND }, // PAIN_B - { 62, 65, 7.0f, ANIM_STAND }, // PAIN_C - { 67, 67, 9.0f, ANIM_NONE }, // JUMP - { 72, 83, 7.0f, ANIM_STAND }, // FLIP - { 84, 94, 7.0f, ANIM_STAND }, // SALUTE - { 95, 111, 10.0f, ANIM_STAND }, // WAVE - { 112, 122, 7.0f, ANIM_STAND }, // FALLBACK - { 123, 134, 6.0f, ANIM_STAND }, // POINT - { 135, 153, 10.0f, ANIM_CROUCH_STAND }, // CROUCH_STAND - { 154, 159, 7.0f, ANIM_CROUCH_WALK }, // CROUCH_WALK - { 160, 168, 18.0f, ANIM_CROUCH_ATTACK }, // CROUCH_ATTACK - { 169, 172, 7.0f, ANIM_CROUCH_STAND }, // CROUCH_PAIN - { 173, 177, 5.0f, ANIM_NONE }, // CROUCH_DEATH - { 178, 183, 7.0f, ANIM_NONE }, // DEATH_FALLBACK - { 184, 189, 7.0f, ANIM_NONE }, // DEATH_FALLFORWARD - { 190, 197, 7.0f, ANIM_NONE } // DEATH_FALLBACKSLOW + { 0, 39, 9.0f, ANIM_STAND }, // STAND + { 40, 45, 10.0f, ANIM_RUN }, // RUN + { 46, 53, 16.0f, ANIM_ATTACK }, // ATTACK + { 54, 57, 7.0f, ANIM_STAND }, // PAIN_A + { 58, 61, 7.0f, ANIM_STAND }, // PAIN_B + { 62, 65, 7.0f, ANIM_STAND }, // PAIN_C + { 67, 67, 9.0f, ANIM_NONE }, // JUMP + { 72, 83, 7.0f, ANIM_STAND }, // FLIP + { 84, 94, 7.0f, ANIM_STAND }, // SALUTE + { 95, 111, 10.0f, ANIM_STAND }, // WAVE + {112, 122, 7.0f, ANIM_STAND }, // FALLBACK + {123, 134, 6.0f, ANIM_STAND }, // POINT + {135, 153, 10.0f, ANIM_CROUCH_STAND }, // CROUCH_STAND + {154, 159, 7.0f, ANIM_CROUCH_WALK }, // CROUCH_WALK + {160, 168, 18.0f, ANIM_CROUCH_ATTACK}, // CROUCH_ATTACK + {169, 172, 7.0f, ANIM_CROUCH_STAND }, // CROUCH_PAIN + {173, 177, 5.0f, ANIM_NONE }, // CROUCH_DEATH + {178, 183, 7.0f, ANIM_NONE }, // DEATH_FALLBACK + {184, 189, 7.0f, ANIM_NONE }, // DEATH_FALLFORWARD + {190, 197, 7.0f, ANIM_NONE } // DEATH_FALLBACKSLOW }; const float MD2::AnimState::MIN_SHOT_INTERVAL_SYNC = 0.2f; diff --git a/src/client/Model.cc b/src/client/Model.cc index 0c7d257b..4e8d149e 100644 --- a/src/client/Model.cc +++ b/src/client/Model.cc @@ -89,7 +89,7 @@ void Model::addSceneLights() transf = node->transf ^ transf; } - sceneLights.add(LightEntry{ &light, transf, 0.0f }); + sceneLights.add(LightEntry{&light, transf, 0.0f}); } } @@ -365,7 +365,7 @@ void Model::schedule(int mesh, QueueType queue) addSceneLights(); } - list.add(Instance{ this, tf.model, tf.colour, mesh, 0, 0, 0.0f }); + list.add(Instance{this, tf.model, tf.colour, mesh, 0, 0, 0.0f}); } void Model::scheduleFrame(int mesh, int frame, QueueType queue) @@ -376,7 +376,7 @@ void Model::scheduleFrame(int mesh, int frame, QueueType queue) addSceneLights(); } - list.add(Instance{ this, tf.model, tf.colour, mesh, frame, 0, 0.0f }); + list.add(Instance{this, tf.model, tf.colour, mesh, frame, 0, 0.0f}); } void Model::scheduleAnimated(int mesh, int firstFrame, int secondFrame, float interpolation, @@ -388,7 +388,7 @@ void Model::scheduleAnimated(int mesh, int firstFrame, int secondFrame, float in addSceneLights(); } - list.add(Instance{ this, tf.model, tf.colour, mesh, firstFrame, secondFrame, interpolation }); + list.add(Instance{this, tf.model, tf.colour, mesh, firstFrame, secondFrame, interpolation}); } const File* Model::preload() @@ -648,7 +648,7 @@ void Model::load() } } - loadedModels.include(Ref{ this }); + loadedModels.include(Ref{this}); delete preloadData; preloadData = nullptr; @@ -705,7 +705,7 @@ void Model::unload() ibo = 0; vbo = 0; - loadedModels.exclude(Ref{ this }); + loadedModels.exclude(Ref{this}); OZ_GL_CHECK_ERROR(); } diff --git a/src/client/Render.cc b/src/client/Render.cc index 4f89c929..e43ffaad 100644 --- a/src/client/Render.cc +++ b/src/client/Render.cc @@ -417,7 +417,7 @@ void Render::drawOrbis() glBindFramebuffer(GL_FRAMEBUFFER, mainFrame); #ifndef OZ_GL_ES - uint dbos[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; + uint dbos[] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1}; glDrawBuffers(2, dbos); #endif } @@ -769,13 +769,13 @@ void Render::init() shape.init(); EnumMap scaleFilterMap = { - { GL_LINEAR, "LINEAR" }, - { GL_NEAREST, "NEAREST" } + {GL_LINEAR, "LINEAR" }, + {GL_NEAREST, "NEAREST"} }; EnumMap collationMap = { - { Model::DEPTH_MAJOR, "DEPTH_MAJOR" }, - { Model::MODEL_MAJOR, "MODEL_MAJOR" } + {Model::DEPTH_MAJOR, "DEPTH_MAJOR"}, + {Model::MODEL_MAJOR, "MODEL_MAJOR"} }; Model::setCollation(collationMap[config.include("render.collation", "MODEL_MAJOR").get("")]); diff --git a/src/client/Shader.cc b/src/client/Shader.cc index ca3fdbc0..367ee65f 100644 --- a/src/client/Shader.cc +++ b/src/client/Shader.cc @@ -109,8 +109,8 @@ void Shader::compileShader(uint shaderId, const String& defines, const File& fil { Stream is = file.read(); - const char* strings[] = { defines.begin(), is.begin() }; - int lengths[] = { defines.length(), is.available() }; + const char* strings[] = {defines.begin(), is.begin()}; + int lengths[] = {defines.length(), is.available()}; int result; int logLength; @@ -316,7 +316,7 @@ void Shader::init() OZ_GL_CHECK_ERROR(); // Bind white texture to id 0 to emulate fixed functionality that has white texture on id 0. - ubyte whitePixel[] = { 0xff, 0xff, 0xff }; + ubyte whitePixel[] = {0xff, 0xff, 0xff}; glGenTextures(1, &defaultTexture); glBindTexture(GL_TEXTURE_2D, defaultTexture); @@ -325,7 +325,7 @@ void Shader::init() glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, whitePixel); // Default masks: specular 0.0, emission 0.0, environment 0.0. - ubyte masksPixel[] = { 0x00, 0x00, 0x00 }; + ubyte masksPixel[] = {0x00, 0x00, 0x00}; glGenTextures(1, &defaultMasks); glBindTexture(GL_TEXTURE_2D, defaultMasks); @@ -334,7 +334,7 @@ void Shader::init() glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, masksPixel); // Default normal for bumpmap: [0, 0, 1]. - ubyte normalsPixel[] = { 0x80, 0x80, 0xff, 0x80 }; + ubyte normalsPixel[] = {0x80, 0x80, 0xff, 0x80}; glGenTextures(1, &defaultNormals); glBindTexture(GL_TEXTURE_2D, defaultNormals); diff --git a/src/client/Shape.cc b/src/client/Shape.cc index 1b1470ed..1c8f0903 100644 --- a/src/client/Shape.cc +++ b/src/client/Shape.cc @@ -28,84 +28,84 @@ namespace client const Shape::Vertex Shape::VERTICES[] = { // filled rectangle (base index 0) - { { 0.0f, 0.0f, 0.0f }, { 0, 1 } }, - { { 1.0f, 0.0f, 0.0f }, { 1, 1 } }, - { { 0.0f, 1.0f, 0.0f }, { 0, 0 } }, - { { 1.0f, 1.0f, 0.0f }, { 1, 0 } }, + {{0.0f, 0.0f, 0.0f}, {0, 1}}, + {{1.0f, 0.0f, 0.0f}, {1, 1}}, + {{0.0f, 1.0f, 0.0f}, {0, 0}}, + {{1.0f, 1.0f, 0.0f}, {1, 0}}, // line loop rectangle (base index 4) - { { 0.0f, 0.0f, 0.0f }, {} }, - { { 1.0f, 0.0f, 0.0f }, {} }, - { { 1.0f, 1.0f, 0.0f }, {} }, - { { 0.0f, 1.0f, 0.0f }, {} }, + {{0.0f, 0.0f, 0.0f}, {}}, + {{1.0f, 0.0f, 0.0f}, {}}, + {{1.0f, 1.0f, 0.0f}, {}}, + {{0.0f, 1.0f, 0.0f}, {}}, // tag box (base index 8) - { { -1.5f, -1.5f, 0.0f }, {} }, - { { -1.5f, +3.5f, 0.0f }, {} }, - { { -0.5f, -1.5f, 0.0f }, {} }, - { { +3.5f, -1.5f, 0.0f }, {} }, - - { { +1.5f, -1.5f, 0.0f }, {} }, - { { -3.5f, -1.5f, 0.0f }, {} }, - { { +1.5f, -0.5f, 0.0f }, {} }, - { { +1.5f, +3.5f, 0.0f }, {} }, - - { { +1.5f, +1.5f, 0.0f }, {} }, - { { -3.5f, +1.5f, 0.0f }, {} }, - { { +1.5f, +0.5f, 0.0f }, {} }, - { { +1.5f, -3.5f, 0.0f }, {} }, - - { { -1.5f, +1.5f, 0.0f }, {} }, - { { +3.5f, +1.5f, 0.0f }, {} }, - { { -1.5f, +0.5f, 0.0f }, {} }, - { { -1.5f, -3.5f, 0.0f }, {} }, + {{-1.5f, -1.5f, 0.0f}, {}}, + {{-1.5f, +3.5f, 0.0f}, {}}, + {{-0.5f, -1.5f, 0.0f}, {}}, + {{+3.5f, -1.5f, 0.0f}, {}}, + + {{+1.5f, -1.5f, 0.0f}, {}}, + {{-3.5f, -1.5f, 0.0f}, {}}, + {{+1.5f, -0.5f, 0.0f}, {}}, + {{+1.5f, +3.5f, 0.0f}, {}}, + + {{+1.5f, +1.5f, 0.0f}, {}}, + {{-3.5f, +1.5f, 0.0f}, {}}, + {{+1.5f, +0.5f, 0.0f}, {}}, + {{+1.5f, -3.5f, 0.0f}, {}}, + + {{-1.5f, +1.5f, 0.0f}, {}}, + {{+3.5f, +1.5f, 0.0f}, {}}, + {{-1.5f, +0.5f, 0.0f}, {}}, + {{-1.5f, -3.5f, 0.0f}, {}}, // sprite (base index 24) - { { -1.0f, -1.0f, 0.0f }, { 0, 1 } }, - { { +1.0f, -1.0f, 0.0f }, { 1, 1 } }, - { { -1.0f, +1.0f, 0.0f }, { 0, 0 } }, - { { +1.0f, +1.0f, 0.0f }, { 1, 0 } }, + {{-1.0f, -1.0f, 0.0f}, {0, 1}}, + {{+1.0f, -1.0f, 0.0f}, {1, 1}}, + {{-1.0f, +1.0f, 0.0f}, {0, 0}}, + {{+1.0f, +1.0f, 0.0f}, {1, 0}}, // box (base index 28) - { { -1.0f, -1.0f, -1.0f }, {} }, - { { -1.0f, -1.0f, +1.0f }, {} }, - { { -1.0f, +1.0f, -1.0f }, {} }, - { { -1.0f, +1.0f, +1.0f }, {} }, - { { +1.0f, -1.0f, -1.0f }, {} }, - { { +1.0f, -1.0f, +1.0f }, {} }, - { { +1.0f, +1.0f, -1.0f }, {} }, - { { +1.0f, +1.0f, +1.0f }, {} }, + {{-1.0f, -1.0f, -1.0f}, {}}, + {{-1.0f, -1.0f, +1.0f}, {}}, + {{-1.0f, +1.0f, -1.0f}, {}}, + {{-1.0f, +1.0f, +1.0f}, {}}, + {{+1.0f, -1.0f, -1.0f}, {}}, + {{+1.0f, -1.0f, +1.0f}, {}}, + {{+1.0f, +1.0f, -1.0f}, {}}, + {{+1.0f, +1.0f, +1.0f}, {}}, // skybox (base index 36) - { { +1.0f, +1.0f, -1.0f }, { 0, 1 } }, - { { +1.0f, -1.0f, -1.0f }, { 1, 1 } }, - { { +1.0f, -1.0f, +1.0f }, { 1, 0 } }, - { { +1.0f, +1.0f, +1.0f }, { 0, 0 } }, - - { { -1.0f, -1.0f, -1.0f }, { 0, 1 } }, - { { -1.0f, +1.0f, -1.0f }, { 1, 1 } }, - { { -1.0f, +1.0f, +1.0f }, { 1, 0 } }, - { { -1.0f, -1.0f, +1.0f }, { 0, 0 } }, - - { { -1.0f, +1.0f, -1.0f }, { 0, 1 } }, - { { +1.0f, +1.0f, -1.0f }, { 1, 1 } }, - { { +1.0f, +1.0f, +1.0f }, { 1, 0 } }, - { { -1.0f, +1.0f, +1.0f }, { 0, 0 } }, - - { { +1.0f, -1.0f, -1.0f }, { 0, 1 } }, - { { -1.0f, -1.0f, -1.0f }, { 1, 1 } }, - { { -1.0f, -1.0f, +1.0f }, { 1, 0 } }, - { { +1.0f, -1.0f, +1.0f }, { 0, 0 } }, - - { { -1.0f, +1.0f, +1.0f }, { 0, 1 } }, - { { +1.0f, +1.0f, +1.0f }, { 1, 1 } }, - { { +1.0f, -1.0f, +1.0f }, { 1, 0 } }, - { { -1.0f, -1.0f, +1.0f }, { 0, 0 } }, - - { { -1.0f, -1.0f, -1.0f }, { 0, 1 } }, - { { +1.0f, -1.0f, -1.0f }, { 1, 1 } }, - { { +1.0f, +1.0f, -1.0f }, { 1, 0 } }, - { { -1.0f, +1.0f, -1.0f }, { 0, 0 } } + {{+1.0f, +1.0f, -1.0f}, {0, 1}}, + {{+1.0f, -1.0f, -1.0f}, {1, 1}}, + {{+1.0f, -1.0f, +1.0f}, {1, 0}}, + {{+1.0f, +1.0f, +1.0f}, {0, 0}}, + + {{-1.0f, -1.0f, -1.0f}, {0, 1}}, + {{-1.0f, +1.0f, -1.0f}, {1, 1}}, + {{-1.0f, +1.0f, +1.0f}, {1, 0}}, + {{-1.0f, -1.0f, +1.0f}, {0, 0}}, + + {{-1.0f, +1.0f, -1.0f}, {0, 1}}, + {{+1.0f, +1.0f, -1.0f}, {1, 1}}, + {{+1.0f, +1.0f, +1.0f}, {1, 0}}, + {{-1.0f, +1.0f, +1.0f}, {0, 0}}, + + {{+1.0f, -1.0f, -1.0f}, {0, 1}}, + {{-1.0f, -1.0f, -1.0f}, {1, 1}}, + {{-1.0f, -1.0f, +1.0f}, {1, 0}}, + {{+1.0f, -1.0f, +1.0f}, {0, 0}}, + + {{-1.0f, +1.0f, +1.0f}, {0, 1}}, + {{+1.0f, +1.0f, +1.0f}, {1, 1}}, + {{+1.0f, -1.0f, +1.0f}, {1, 0}}, + {{-1.0f, -1.0f, +1.0f}, {0, 0}}, + + {{-1.0f, -1.0f, -1.0f}, {0, 1}}, + {{+1.0f, -1.0f, -1.0f}, {1, 1}}, + {{+1.0f, +1.0f, -1.0f}, {1, 0}}, + {{-1.0f, +1.0f, -1.0f}, {0, 0}} }; const ushort Shape::INDICES[] = { diff --git a/src/client/Sound.cc b/src/client/Sound.cc index 509bbbe6..b92290bb 100644 --- a/src/client/Sound.cc +++ b/src/client/Sound.cc @@ -53,7 +53,7 @@ static OZ_DL_DEFINE(NeAACDecClose); static OZ_DL_DEFINE(NeAACDecDecode); static size_t vorbisRead(void* buffer, size_t size, size_t n, void* handle); -static ov_callbacks VORBIS_CALLBACKS = { vorbisRead, nullptr, nullptr, nullptr }; +static ov_callbacks VORBIS_CALLBACKS = {vorbisRead, nullptr, nullptr, nullptr}; static size_t vorbisRead(void* buffer, size_t size, size_t n, void* handle) { diff --git a/src/client/UnitProxy.cc b/src/client/UnitProxy.cc index 19b2e06d..78afc4e9 100644 --- a/src/client/UnitProxy.cc +++ b/src/client/UnitProxy.cc @@ -566,7 +566,7 @@ void UnitProxy::update() camera.setTaggedObj(orbis.obj(bot->cargo)); } else { - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(bot->h, &hvsc[0], &hvsc[1]); diff --git a/src/client/common.cc b/src/client/common.cc index 6fef4df1..d809dd3c 100644 --- a/src/client/common.cc +++ b/src/client/common.cc @@ -26,7 +26,7 @@ namespace client const TexCoord TexCoord::ZERO = TexCoord(0.0f, 0.0f); -const Json::Format CONFIG_FORMAT = { 2, 32, "%.4g", "\n" }; +const Json::Format CONFIG_FORMAT = {2, 32, "%.4g", "\n"}; Collider collider; Json config; diff --git a/src/client/ui/BuildFrame.cc b/src/client/ui/BuildFrame.cc index 08dd9709..2ba5bddf 100644 --- a/src/client/ui/BuildFrame.cc +++ b/src/client/ui/BuildFrame.cc @@ -83,10 +83,10 @@ void BuildFrame::overlayCallback(Area* area, const Vec3& ray) if (!overlaps) { // Check if ground is plain enough. float corners[][2] = { - { bounds.mins.x, bounds.mins.y }, - { bounds.maxs.x, bounds.mins.y }, - { bounds.mins.x, bounds.maxs.y }, - { bounds.maxs.x, bounds.maxs.y } + {bounds.mins.x, bounds.mins.y}, + {bounds.maxs.x, bounds.mins.y}, + {bounds.mins.x, bounds.maxs.y}, + {bounds.maxs.x, bounds.maxs.y} }; for (int i = 0; i < 4; ++i) { diff --git a/src/client/ui/MissionMenu.cc b/src/client/ui/MissionMenu.cc index b3ed74f7..821ee318 100644 --- a/src/client/ui/MissionMenu.cc +++ b/src/client/ui/MissionMenu.cc @@ -211,7 +211,7 @@ MissionMenu::MissionMenu() : GL::textureDataFromFile(missionDir / "description.dds"); }; - missions.add(MissionInfo{ missionName, missionTitle, missionDescription, missionImageId }); + missions.add(MissionInfo{missionName, missionTitle, missionDescription, missionImageId}); lingua.clear(); } diff --git a/src/matrix/Bot.cc b/src/matrix/Bot.cc index b15a6abc..48eab6d7 100644 --- a/src/matrix/Bot.cc +++ b/src/matrix/Bot.cc @@ -570,7 +570,7 @@ void Bot::onUpdate() * MOVE */ - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(h, &hvsc[0], &hvsc[1]); @@ -1002,7 +1002,7 @@ void Bot::onUpdate() if (cargoObj != nullptr && stamina >= clazz->staminaThrowDrain) { OZ_ASSERT(cargoObj->flags & DYNAMIC_BIT); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(h, &hvsc[0], &hvsc[1]); @@ -1046,7 +1046,7 @@ void Bot::onUpdate() if (item != nullptr && cargo < 0 && items.contains(instrument)) { OZ_ASSERT((item->flags & DYNAMIC_BIT) && (item->flags & ITEM_BIT)); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(h, &hvsc[0], &hvsc[1]); diff --git a/src/matrix/Liber.cc b/src/matrix/Liber.cc index ce46eb59..19800953 100644 --- a/src/matrix/Liber.cc +++ b/src/matrix/Liber.cc @@ -256,7 +256,7 @@ void Liber::initShaders() Log::println("%s", name.c()); shaderIndices.add(name, shaders.length()); - shaders.add(Resource{ name, file }); + shaders.add(Resource{name, file}); } shaderIndices.trim(); @@ -288,7 +288,7 @@ void Liber::initTextures() Log::println("%s", name.c()); textureIndices.add(name, textures.length()); - textures.add(Resource{ name, "@tex/" + name }); + textures.add(Resource{name, "@tex/" + name}); } } @@ -325,7 +325,7 @@ void Liber::initSounds() } soundIndices.add(name, sounds.length()); - sounds.add(Resource{ name, file }); + sounds.add(Resource{name, file}); } } @@ -353,7 +353,7 @@ void Liber::initCaela() Log::println("%s", name.c()); caelumIndices.add(name, caela.length()); - caela.add(Resource{ name, subDir }); + caela.add(Resource{name, subDir}); } caelumIndices.trim(); @@ -380,7 +380,7 @@ void Liber::initTerrae() Log::println("%s", name.c()); terraIndices.add(name, terrae.length()); - terrae.add(Resource{ name, file }); + terrae.add(Resource{name, file}); } terraIndices.trim(); @@ -407,7 +407,7 @@ void Liber::initParticles() Log::println("%s", name.c()); partIndices.add(name, parts.length()); - parts.add(Resource{ name, file }); + parts.add(Resource{name, file}); } partIndices.trim(); @@ -443,7 +443,7 @@ void Liber::initModels() } modelIndices.add(name, models.length()); - models.add(Resource{ name, file }); + models.add(Resource{name, file}); } modelIndices.trim(); @@ -667,7 +667,7 @@ void Liber::initMusicRecurse(const File& dir) { Log::println("%s", file.c()); - musicTracks.add(Resource{ file.baseName(), file }); + musicTracks.add(Resource{file.baseName(), file}); } } } diff --git a/src/matrix/Struct.cc b/src/matrix/Struct.cc index d54d43e6..a9d9d394 100644 --- a/src/matrix/Struct.cc +++ b/src/matrix/Struct.cc @@ -50,8 +50,8 @@ static const Mat4 ROTATIONS[] = 0.0f, 0.0f, 0.0f, 1.0f), }; -static const Entity::State OPPOSITE_STATES[] = { Entity::CLOSING, Entity::OPENING }; -static const Entity::State END_STATES[] = { Entity::OPEN, Entity::CLOSED }; +//static const Entity::State OPPOSITE_STATES[] = {Entity::CLOSING, Entity::OPENING}; +//static const Entity::State END_STATES[] = {Entity::OPEN, Entity::CLOSED}; const Vec3 Struct::DESTRUCT_FRAG_VELOCITY = Vec3(0.0f, 0.0f, 2.0f); const float Struct::DEMOLISH_SPEED = 8.0f; @@ -125,38 +125,38 @@ void Entity::moverHandler() { time += Timer::TICK_TIME; - float timeout[] { clazz->openTimeout, clazz->closeTimeout }; - - switch (state) { - case CLOSED: - case OPEN: { - bool isClosed = state == CLOSED; - - if (timeout[isClosed] != 0.0f && time > timeout[isClosed]) { - if (time > clazz->openTimeout) { - state = OPPOSITE_STATES[isClosed]; - time = 0.0f; - } - } - break; - } - case OPENING: - case CLOSING: { - Vec3 move = destination - offset; - - if (move.sqN() <= EPSILON) { - bool isClosing = state == CLOSING; - - state = END_STATES[isClosing]; - time = 0.0f; - velocity = Vec3::ZERO; - } - else { - physics.updateEnt(this, move); - } - break; - } - } +// float timeout[] {clazz->openTimeout, clazz->closeTimeout}; + +// switch (state) { +// case CLOSED: +// case OPEN: { +// bool isClosed = state == CLOSED; + +// if (timeout[isClosed] != 0.0f && time > timeout[isClosed]) { +// if (time > clazz->openTimeout) { +// state = OPPOSITE_STATES[isClosed]; +// time = 0.0f; +// } +// } +// break; +// } +// case OPENING: +// case CLOSING: { +// Vec3 move = destination - offset; + +// if (move.sqN() <= EPSILON) { +// bool isClosing = state == CLOSING; + +// state = END_STATES[isClosing]; +// time = 0.0f; +// velocity = Vec3::ZERO; +// } +// else { +// physics.updateEnt(this, move); +// } +// break; +// } +// } } void Entity::doorHandler() diff --git a/src/matrix/Terra.hh b/src/matrix/Terra.hh index e3122fb1..776e0450 100644 --- a/src/matrix/Terra.hh +++ b/src/matrix/Terra.hh @@ -83,7 +83,7 @@ public: int ix = int((x + DIM) / Quad::SIZE); int iy = int((y + DIM) / Quad::SIZE); - return { clamp(ix, 0, QUADS - 1), clamp(iy, 0, QUADS - 1) }; + return {clamp(ix, 0, QUADS - 1), clamp(iy, 0, QUADS - 1)}; } float getHeight(float x, float y) const diff --git a/src/matrix/Vehicle.cc b/src/matrix/Vehicle.cc index 968553e5..2aa1545f 100644 --- a/src/matrix/Vehicle.cc +++ b/src/matrix/Vehicle.cc @@ -122,7 +122,7 @@ void Vehicle::mechHandler() stairRate *= clazz->mech.stairRateSupp; - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(h, &hvsc[0], &hvsc[1]); @@ -225,7 +225,7 @@ void Vehicle::hoverHandler() { const VehicleClass* clazz = static_cast(this->clazz); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(h, &hvsc[0], &hvsc[1]); diff --git a/src/matrix/luaapi.hh b/src/matrix/luaapi.hh index 2b962f85..80f1108b 100644 --- a/src/matrix/luaapi.hh +++ b/src/matrix/luaapi.hh @@ -2046,7 +2046,7 @@ static int ozBotGetDir(lua_State* l) OBJ(); OBJ_BOT(); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(bot->h, &hvsc[0], &hvsc[1]); @@ -2351,7 +2351,7 @@ static int ozVehicleGetDir(lua_State* l) OBJ(); OBJ_VEHICLE(); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(veh->h, &hvsc[0], &hvsc[1]); diff --git a/src/nirvana/QuestList.cc b/src/nirvana/QuestList.cc index fe0746f1..9c925e09 100644 --- a/src/nirvana/QuestList.cc +++ b/src/nirvana/QuestList.cc @@ -33,7 +33,7 @@ void QuestList::add(const char* title, const char* description, const Point& pla activeQuest = 0; } - Quest quest = { title, description, place, state }; + Quest quest = {title, description, place, state}; quests.add(static_cast(quest)); } diff --git a/src/nirvana/luaapi.hh b/src/nirvana/luaapi.hh index 49a3f5cf..977ad554 100644 --- a/src/nirvana/luaapi.hh +++ b/src/nirvana/luaapi.hh @@ -302,7 +302,7 @@ static int ozSelfGetDir(lua_State* l) { ARG(0); - // { hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine } + // {hsine, hcosine, vsine, vcosine, vsine * hsine, vsine * hcosine} float hvsc[6]; Math::sincos(ns.self->h, &hvsc[0], &hvsc[1]); diff --git a/src/ozCore/Alloc.cc b/src/ozCore/Alloc.cc index 82769fec..42d7cdea 100644 --- a/src/ozCore/Alloc.cc +++ b/src/ozCore/Alloc.cc @@ -37,7 +37,7 @@ enum AllocMode ARRAY }; -static const char* const ALLOC_MODE_NAMES[2] = { "object", "array" }; +static const char* const ALLOC_MODE_NAMES[2] = {"object", "array"}; static Chain chunkInfos[2]; static SpinLock allocInfoLock; @@ -67,7 +67,7 @@ static void* allocate(AllocMode mode, size_t size) #ifdef OZ_ALLOCATOR - Alloc::ChunkInfo* ci = new(ptr) Alloc::ChunkInfo{ {}, size, StackTrace::current(2) }; + Alloc::ChunkInfo* ci = new(ptr) Alloc::ChunkInfo{{}, size, StackTrace::current(2)}; allocInfoLock.lock(); diff --git a/src/ozCore/EnumMap.hh b/src/ozCore/EnumMap.hh index 1c925220..b153fbfd 100644 --- a/src/ozCore/EnumMap.hh +++ b/src/ozCore/EnumMap.hh @@ -116,8 +116,8 @@ public: * }; * * EnumMap myEnumMap = { - * { FOO, "FOO" }, - * { BAR, "BAR" } + * {FOO, "FOO"}, + * {BAR, "BAR"} * }; * Log() << map[FOO]; // "FOO" * Log() << map["BAR"]; // 42 diff --git a/src/ozCore/Gettext.cc b/src/ozCore/Gettext.cc index 93e60dd7..9d464c1a 100644 --- a/src/ozCore/Gettext.cc +++ b/src/ozCore/Gettext.cc @@ -40,7 +40,7 @@ struct Gettext::Message const char* Gettext::systemLanguage(const char* fallback) { - for (const char* envVar : { "LC_ALL", "LC_MESSAGES", "LANG" }) { + for (const char* envVar : {"LC_ALL", "LC_MESSAGES", "LANG"}) { const char* lang = getenv(envVar); if (lang != nullptr && !String::isEmpty(lang)) { diff --git a/src/ozCore/HashMap.hh b/src/ozCore/HashMap.hh index fd0a3ae9..15ce10a1 100644 --- a/src/ozCore/HashMap.hh +++ b/src/ozCore/HashMap.hh @@ -91,7 +91,7 @@ private: } data[index] = new(pool) Entry { - data[index], h, { static_cast(key), static_cast(value) } + data[index], h, {static_cast(key), static_cast(value)} }; return data[index]->elem; } diff --git a/src/ozCore/HashSet.hh b/src/ozCore/HashSet.hh index be7a5c91..8e60f29f 100644 --- a/src/ozCore/HashSet.hh +++ b/src/ozCore/HashSet.hh @@ -266,7 +266,7 @@ protected: entry = entry->next; } - data[index] = new(pool) Entry{ data[index], h, static_cast(elem) }; + data[index] = new(pool) Entry{data[index], h, static_cast(elem)}; return *data[index]; } diff --git a/src/ozCore/Java.cc b/src/ozCore/Java.cc index b9e3c430..d89bdeb4 100644 --- a/src/ozCore/Java.cc +++ b/src/ozCore/Java.cc @@ -47,7 +47,7 @@ void Java::application(JNIEnv* env, jclass clazz) env->GetJavaVM(&javaVM); char argv0[] = ""; - char* argv[] = { argv0, nullptr }; + char* argv[] = {argv0, nullptr}; javaMain(1, argv); } diff --git a/src/ozCore/Java.hh b/src/ozCore/Java.hh index 8382bdb6..4944ee8c 100644 --- a/src/ozCore/Java.hh +++ b/src/ozCore/Java.hh @@ -54,7 +54,7 @@ * * For a Java JNI application, you must implement this function and put `OZ_JAVA_ENTRY_POINT()` * macro in a `.cc` file (out of any namespace). An empty string is passed as the zero argument - * (i.e. `argc = 1` and `argv = { "" }`). + * (i.e. `argc = 1` and `argv = {""}`). */ int javaMain(int argc, char** argv); diff --git a/src/ozCore/Json.cc b/src/ozCore/Json.cc index efd23d0a..f4b942ba 100644 --- a/src/ozCore/Json.cc +++ b/src/ozCore/Json.cc @@ -593,11 +593,11 @@ struct Json::Formatter } }; -const Json::Format Json::DEFAULT_FORMAT = { 2, 32, "%.9g", "\n" }; +const Json::Format Json::DEFAULT_FORMAT = {2, 32, "%.9g", "\n"}; OZ_INTERNAL Json::Json(const float* vector, int count) : - data(new ArrayData{ List(count) }), valueType(ARRAY) + data(new ArrayData{List(count)}), valueType(ARRAY) { List& list = static_cast(data)->list; @@ -667,11 +667,11 @@ Json::Json(double value) : {} Json::Json(const String& value) : - data(new StringData{ value }), valueType(STRING) + data(new StringData{value}), valueType(STRING) {} Json::Json(const char* value) : - data(new StringData{ value }), valueType(STRING) + data(new StringData{value}), valueType(STRING) {} Json::Json(const Vec3& v) : @@ -1289,7 +1289,7 @@ String Json::toString() const String Json::toFormattedString(const Format& format) const { Stream os(0); - Formatter formatter = { &os, &format, String::length(format.lineEnd), 0 }; + Formatter formatter = {&os, &format, String::length(format.lineEnd), 0}; formatter.writeValue(*this); os.write(format.lineEnd, formatter.lineEndLength); @@ -1311,7 +1311,7 @@ bool Json::load(const File& file) bool Json::save(const File& file, const Format& format) const { Stream os(0); - Formatter formatter = { &os, &format, String::length(format.lineEnd), 0 }; + Formatter formatter = {&os, &format, String::length(format.lineEnd), 0}; formatter.writeValue(*this); os.write(format.lineEnd, formatter.lineEndLength); diff --git a/src/ozCore/Json.hh b/src/ozCore/Json.hh index 98c95627..3caee689 100644 --- a/src/ozCore/Json.hh +++ b/src/ozCore/Json.hh @@ -217,7 +217,7 @@ public: * This constructor might be ambiguous when elements appear in pairs. Adding `Json` before the * first array element solves the issue: * @code - * Json array = { Json { 0, 1 }, { 1, 2 }, { 2, 0 } }; + * Json array = {Json {0, 1}, {1, 2}, {2, 0}}; * @endcode */ Json(InitialiserList l); @@ -227,7 +227,7 @@ public: * * For disambiguation from array initialiser one should add `Json::Pair` before the first element: * @code - * Json object = { Json::Pair { "key1", 1 }, { "key2", 2 }, { "key3", 3 } }; + * Json object = {Json::Pair {"key1", 1}, {"key2", 2}, {"key3", 3}}; * @endcode */ Json(InitialiserList l); diff --git a/src/ozCore/Math.hh b/src/ozCore/Math.hh index 421314d7..d27d5e88 100644 --- a/src/ozCore/Math.hh +++ b/src/ozCore/Math.hh @@ -404,7 +404,7 @@ public: OZ_ALWAYS_INLINE static uint toBits(float x) { - return FloatToBits{ x }.bits; + return FloatToBits{x}.bits; } /** @@ -413,7 +413,7 @@ public: OZ_ALWAYS_INLINE static float fromBits(uint b) { - return BitsToFloat{ b }.value; + return BitsToFloat{b}.value; } /** @@ -424,7 +424,7 @@ public: { OZ_ASSERT(x >= 0.0f); - FloatToBits fb = { x }; + FloatToBits fb = {x}; fb.bits = 0x5f375a86 - (fb.bits >> 1); return x * fb.value * (1.5f - 0.5f * x * fb.value*fb.value); @@ -438,7 +438,7 @@ public: { OZ_ASSERT(x > 0.0f); - FloatToBits fb = { x }; + FloatToBits fb = {x}; fb.bits = 0x5f375a86 - (fb.bits >> 1); return fb.value * (1.5f - 0.5f * x * fb.value*fb.value); diff --git a/src/ozCore/Pepper.hh b/src/ozCore/Pepper.hh index bde51a1a..370a0326 100644 --- a/src/ozCore/Pepper.hh +++ b/src/ozCore/Pepper.hh @@ -173,7 +173,7 @@ public: cw->semaphore->post(); } }; - CallbackWrapper cw = { function, localSemaphore }; + CallbackWrapper cw = {function, localSemaphore}; Pepper::mainCall(CallbackWrapper::callback, &cw); localSemaphore->wait(); @@ -211,7 +211,7 @@ public: cw->function(); } }; - CallbackWrapper cw = { function }; + CallbackWrapper cw = {function}; Pepper::mainCall(CallbackWrapper::callback, &cw); diff --git a/src/ozCore/Quat.hh b/src/ozCore/Quat.hh index 0169b94c..ea973e7e 100644 --- a/src/ozCore/Quat.hh +++ b/src/ozCore/Quat.hh @@ -82,7 +82,7 @@ public: Quat operator * () const { #ifdef OZ_SIMD - return Quat(float4(uint4(f4) ^ uint4{ 0x80000000u, 0x80000000u, 0x80000000u, 0u })); + return Quat(float4(uint4(f4) ^ uint4{0x80000000u, 0x80000000u, 0x80000000u, 0u})); #else return Quat(-x, -y, -z, w); #endif @@ -260,7 +260,7 @@ public: float4 k = vFill(s); k /= vDot(q.f4, q.f4); - k *= float4{ -1.0f, -1.0f, -1.0f, +1.0f }; + k *= float4{-1.0f, -1.0f, -1.0f, +1.0f}; return Quat(q.f4 * k); #else diff --git a/src/ozCore/StackTrace.cc b/src/ozCore/StackTrace.cc index cce371b3..3be96ea6 100644 --- a/src/ozCore/StackTrace.cc +++ b/src/ozCore/StackTrace.cc @@ -39,7 +39,7 @@ StackTrace StackTrace::current(int nSkippedFrames) { OZ_ASSERT(nSkippedFrames >= 0); - StackTrace st = { {}, 0, {} }; + StackTrace st = {{}, 0, {}}; memccpy(st.thread, Thread::name(), '\0', Thread::NAME_LENGTH); #ifdef __GLIBC__ diff --git a/src/ozCore/Stream.cc b/src/ozCore/Stream.cc index b729ddc4..405f79fe 100644 --- a/src/ozCore/Stream.cc +++ b/src/ozCore/Stream.cc @@ -35,14 +35,14 @@ void Stream::readFloats(float* values, int count) if (order == Endian::NATIVE) { for (int i = 0; i < count; ++i, data += 4, ++values) { - Endian::ToValue value = { { data[0], data[1], data[2], data[3] } }; + Endian::ToValue value = {{data[0], data[1], data[2], data[3]}}; *values = value.value; } } else { for (int i = 0; i < count; ++i, data += 4, ++values) { - Endian::ToValue value = { { data[3], data[2], data[1], data[0] } }; + Endian::ToValue value = {{data[3], data[2], data[1], data[0]}}; *values = value.value; } @@ -56,7 +56,7 @@ void Stream::writeFloats(const float* values, int count) if (order == Endian::NATIVE) { for (int i = 0; i < count; ++i, data += 4, ++values) { - Endian::ToBytes value = { *values }; + Endian::ToBytes value = {*values}; data[0] = value.data[0]; data[1] = value.data[1]; @@ -66,7 +66,7 @@ void Stream::writeFloats(const float* values, int count) } else { for (int i = 0; i < count; ++i, data += 4, ++values) { - Endian::ToBytes value = { *values }; + Endian::ToBytes value = {*values}; data[0] = value.data[3]; data[1] = value.data[2]; @@ -282,7 +282,7 @@ short Stream::readShort() void Stream::writeShort(short s) { - Endian::ToBytes value = { order == Endian::NATIVE ? s : Endian::bswap(s) }; + Endian::ToBytes value = {order == Endian::NATIVE ? s : Endian::bswap(s)}; write(value.data, sizeof(value.data)); } @@ -297,7 +297,7 @@ ushort Stream::readUShort() void Stream::writeUShort(ushort s) { - Endian::ToBytes value = { order == Endian::NATIVE ? s : Endian::bswap(s) }; + Endian::ToBytes value = {order == Endian::NATIVE ? s : Endian::bswap(s)}; write(value.data, sizeof(value.data)); } @@ -312,7 +312,7 @@ int Stream::readInt() void Stream::writeInt(int i) { - Endian::ToBytes value = { order == Endian::NATIVE ? i : Endian::bswap(i) }; + Endian::ToBytes value = {order == Endian::NATIVE ? i : Endian::bswap(i)}; write(value.data, sizeof(value.data)); } @@ -327,7 +327,7 @@ uint Stream::readUInt() void Stream::writeUInt(uint i) { - Endian::ToBytes value = { order == Endian::NATIVE ? i : Endian::bswap(i) }; + Endian::ToBytes value = {order == Endian::NATIVE ? i : Endian::bswap(i)}; write(value.data, sizeof(value.data)); } @@ -342,7 +342,7 @@ long64 Stream::readLong64() void Stream::writeLong64(long64 l) { - Endian::ToBytes value = { order == Endian::NATIVE ? l : Endian::bswap(l) }; + Endian::ToBytes value = {order == Endian::NATIVE ? l : Endian::bswap(l)}; write(value.data, sizeof(value.data)); } @@ -357,7 +357,7 @@ ulong64 Stream::readULong64() void Stream::writeULong64(ulong64 l) { - Endian::ToBytes value = { order == Endian::NATIVE ? l : Endian::bswap(l) }; + Endian::ToBytes value = {order == Endian::NATIVE ? l : Endian::bswap(l)}; write(value.data, sizeof(value.data)); } @@ -367,12 +367,12 @@ float Stream::readFloat() const char* data = readSkip(sizeof(float)); if (order == Endian::NATIVE) { - Endian::ToValue value = { { data[0], data[1], data[2], data[3] } }; + Endian::ToValue value = {{data[0], data[1], data[2], data[3]}}; return value.value; } else { - Endian::ToValue value = { { data[3], data[2], data[1], data[0] } }; + Endian::ToValue value = {{data[3], data[2], data[1], data[0]}}; return value.value; } @@ -382,7 +382,7 @@ void Stream::writeFloat(float f) { char* data = writeSkip(sizeof(float)); - Endian::ToBytes value = { f }; + Endian::ToBytes value = {f}; if (order == Endian::NATIVE) { data[0] = value.data[0]; @@ -404,14 +404,14 @@ double Stream::readDouble() if (order == Endian::NATIVE) { Endian::ToValue value = { - { data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7] } + {data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]} }; return value.value; } else { Endian::ToValue value = { - { data[7], data[6], data[5], data[4], data[3], data[2], data[1], data[0] } + {data[7], data[6], data[5], data[4], data[3], data[2], data[1], data[0]} }; return value.value; @@ -422,7 +422,7 @@ void Stream::writeDouble(double d) { char* data = writeSkip(sizeof(double)); - Endian::ToBytes value = { d }; + Endian::ToBytes value = {d}; if (order == Endian::NATIVE) { data[0] = value.data[0]; diff --git a/src/ozCore/System.cc b/src/ozCore/System.cc index a5a5cb3d..916d6025 100644 --- a/src/ozCore/System.cc +++ b/src/ozCore/System.cc @@ -191,7 +191,7 @@ static void* bellMain(void*) static_cast(genBellSamples); SLObjectItf engine; - SLEngineOption engineOptions[] = { SL_ENGINEOPTION_THREADSAFE, true }; + SLEngineOption engineOptions[] = {SL_ENGINEOPTION_THREADSAFE, true}; slCreateEngine(&engine, 1, engineOptions, 0, nullptr, nullptr); (*engine)->Realize(engine, false); @@ -203,15 +203,15 @@ static void* bellMain(void*) (*outputMix)->Realize(outputMix, false); SLObjectItf player; - SLDataFormat_PCM pcmFormat = { SL_DATAFORMAT_PCM, 2, SL_SAMPLINGRATE_48, - SL_PCMSAMPLEFORMAT_FIXED_16, 16, - SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, - SL_BYTEORDER_LITTLEENDIAN + SLDataFormat_PCM pcmFormat = {SL_DATAFORMAT_PCM, 2, SL_SAMPLINGRATE_48, + SL_PCMSAMPLEFORMAT_FIXED_16, 16, + SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, + SL_BYTEORDER_LITTLEENDIAN }; - SLDataLocator_BufferQueue bufferQueueLocator = { SL_DATALOCATOR_BUFFERQUEUE, 1 }; - SLDataLocator_OutputMix outputMixLocator = { SL_DATALOCATOR_OUTPUTMIX, outputMix }; - SLDataSource audioSource = { &bufferQueueLocator, &pcmFormat }; - SLDataSink audioSink = { &outputMixLocator, nullptr }; + SLDataLocator_BufferQueue bufferQueueLocator = {SL_DATALOCATOR_BUFFERQUEUE, 1}; + SLDataLocator_OutputMix outputMixLocator = {SL_DATALOCATOR_OUTPUTMIX, outputMix}; + SLDataSource audioSource = {&bufferQueueLocator, &pcmFormat}; + SLDataSink audioSink = {&outputMixLocator, nullptr}; (*iEngine)->CreateAudioPlayer(iEngine, &player, &audioSource, &audioSink, 0, nullptr, nullptr); (*player)->Realize(player, false); @@ -278,7 +278,7 @@ static void* bellMain(void*) int nFrameSamples = pp::AudioConfig::RecommendSampleFrameCount(ppInstance, rate, 4096); int nSamples = min(int(BELL_TIME * float(rate)), 2 * BELL_SAMPLES); - SampleInfo info = { rate, nFrameSamples, nSamples, 0, false }; + SampleInfo info = {rate, nFrameSamples, nSamples, 0, false}; pp::AudioConfig config(ppInstance, rate, nFrameSamples); pp::Audio audio(ppInstance, config, bellCallback, &info); diff --git a/src/ozCore/simd.hh b/src/ozCore/simd.hh index 002793c0..88185550 100644 --- a/src/ozCore/simd.hh +++ b/src/ozCore/simd.hh @@ -67,7 +67,7 @@ typedef uint __attribute__((vector_size(16))) uint4; OZ_ALWAYS_INLINE inline float4 vFill(float x) { - return float4{ x, x, x, x }; + return float4{x, x, x, x}; } /** @@ -76,7 +76,7 @@ inline float4 vFill(float x) OZ_ALWAYS_INLINE inline uint4 vFill(uint x) { - return uint4{ x, x, x, x }; + return uint4{x, x, x, x}; } /** @@ -86,7 +86,7 @@ inline uint4 vFill(uint x) #ifdef OZ_CLANG # define vShuffle(a, i, j, k, l) __builtin_shufflevector(a, a, i, j, k, l) #else -# define vShuffle(a, i, j, k, l) __builtin_shuffle(a, uint4 { i, j, k, l }) +# define vShuffle(a, i, j, k, l) __builtin_shuffle(a, uint4{i, j, k, l}) #endif /** @@ -195,7 +195,7 @@ public: #ifdef OZ_SIMD __extension__ union { - float4 f4 = { 0.0f, 0.0f, 0.0f, 0.0f }; + float4 f4 = {0.0f, 0.0f, 0.0f, 0.0f}; __extension__ struct { float x; @@ -224,7 +224,7 @@ protected: OZ_ALWAYS_INLINE #ifdef OZ_SIMD explicit VectorBase3(float x_, float y_, float z_, float w_) : - f4{ x_, y_, z_, w_ } + f4{x_, y_, z_, w_} #else explicit VectorBase3(float x_, float y_, float z_, float) : x(x_), y(y_), z(z_) diff --git a/src/ozEngine/AL.cc b/src/ozEngine/AL.cc index ce6626cd..e6224d79 100644 --- a/src/ozEngine/AL.cc +++ b/src/ozEngine/AL.cc @@ -63,7 +63,7 @@ static long vorbisTell(void* handle) return is->tell(); } -static ov_callbacks VORBIS_CALLBACKS = { vorbisRead, vorbisSeek, nullptr, vorbisTell }; +static ov_callbacks VORBIS_CALLBACKS = {vorbisRead, vorbisSeek, nullptr, vorbisTell}; /* * Vorbis decoder helper function. diff --git a/src/ozEngine/Font.cc b/src/ozEngine/Font.cc index 971ddb4a..570701fe 100644 --- a/src/ozEngine/Font.cc +++ b/src/ozEngine/Font.cc @@ -29,7 +29,7 @@ namespace oz { -static const SDL_Color WHITE_COLOUR = { 0xff, 0xff, 0xff, 0xff }; +static const SDL_Color WHITE_COLOUR = {0xff, 0xff, 0xff, 0xff}; Font::Font(const File& file, int height) : fontHeight(height), fileBuffer(file.read()) diff --git a/src/ozEngine/Input.cc b/src/ozEngine/Input.cc index 3ea8e859..754f8f26 100644 --- a/src/ozEngine/Input.cc +++ b/src/ozEngine/Input.cc @@ -200,7 +200,7 @@ bool Input::saveConfig(const File& file) { Json keyboard = Json::OBJECT; Json mouse = Json::OBJECT; - Json root = { keyboard, mouse }; + Json root = {keyboard, mouse}; keyboard.add("sensitivity", config.keyboard.sensitivity); keyboard.add("leftKey", config.keyboard.leftKey); diff --git a/src/ozEngine/Lua.cc b/src/ozEngine/Lua.cc index 627ded0a..a6b20410 100644 --- a/src/ozEngine/Lua.cc +++ b/src/ozEngine/Lua.cc @@ -22,6 +22,7 @@ #include "Lua.hh" +#include #include #if LUA_VERSION_NUM < 502 @@ -101,14 +102,13 @@ Lua::Field::Field(lua_State* l, const Field* parent, int index) : OZ_ASSERT(parent != nullptr); } -int Lua::Field::push() const +void Lua::Field::push() const { if (parent == nullptr) { lua_getglobal(l, name); - return 1; } else { - int nValues = parent->push(); + parent->push(); if (name == nullptr) { lua_rawgeti(l, -1, index); @@ -117,7 +117,7 @@ int Lua::Field::push() const lua_getfield(l, -1, name); } - return nValues + 1; + lua_remove(l, -2); } } @@ -146,32 +146,47 @@ void Lua::Field::pushValue(const char* value) const lua_pushstring(l, value); } -Lua::Field::Field(Field&& s) : - l(s.l) +void Lua::Field::assign(void* data) const { - s.l = nullptr; -} + if (parent == nullptr) { + lua_pushlightuserdata(l, data); + lua_setglobal(l, name); + } + else { + parent->push(); + lua_pushlightuserdata(l, data); -Lua::Field& Lua::Field::operator = (Lua::Field&& s) -{ - if (&s != this) { - l = s.l; + if (name == nullptr) { + lua_rawseti(l, -2, index); + } + else { + lua_setfield(l, -2, name); + } - s.l = nullptr; + lua_pop(l, 1); } - return *this; } -Lua::Field& Lua::Field::operator = (bool value) +void Lua::Field::assign(const void* data, size_t size, const char* metatable) const { if (parent == nullptr) { - lua_pushboolean(l, value); + memcpy(lua_newuserdata(l, size), data, size); + + if (metatable != nullptr) { + lua_getglobal(l, metatable); + lua_setmetatable(l, -1); + } + lua_setglobal(l, name); } else { - int nValues = parent->push(); + parent->push(); + memcpy(lua_newuserdata(l, size), data, size); - lua_pushboolean(l, value); + if (metatable != nullptr) { + lua_getglobal(l, metatable); + lua_setmetatable(l, -1); + } if (name == nullptr) { lua_rawseti(l, -2, index); @@ -180,21 +195,27 @@ Lua::Field& Lua::Field::operator = (bool value) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } - return *this; } -Lua::Field& Lua::Field::operator = (int value) +Lua::Result Lua::Field::call(int nArgs) const +{ + if (lua_pcall(l, nArgs, LUA_MULTRET, 0)) { + OZ_ERROR("oz::Lua: %s", lua_tostring(l, -1)); + } + return Result(l); +} + +Lua::Field& Lua::Field::operator = (const Lua::Field& s) { if (parent == nullptr) { - lua_pushinteger(l, value); + s.push(); lua_setglobal(l, name); } else { - int nValues = parent->push(); - - lua_pushinteger(l, value); + parent->push(); + s.push(); if (name == nullptr) { lua_rawseti(l, -2, index); @@ -203,21 +224,20 @@ Lua::Field& Lua::Field::operator = (int value) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } -Lua::Field& Lua::Field::operator = (float value) +Lua::Field& Lua::Field::operator = (const Lua::Result&) { if (parent == nullptr) { - lua_pushnumber(l, value); + lua_pushvalue(l, 1); lua_setglobal(l, name); } else { - int nValues = parent->push(); - - lua_pushnumber(l, value); + parent->push(); + lua_pushvalue(l, 1); if (name == nullptr) { lua_rawseti(l, -2, index); @@ -226,22 +246,54 @@ Lua::Field& Lua::Field::operator = (float value) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } -Lua::Field& Lua::Field::operator = (const char* value) +Lua::Field& Lua::Field::operator = (Lua::Type type) { + if (parent != nullptr) { + parent->push(); + } + + switch (type) { + case NIL: { + lua_pushnil(l); + break; + } + case BOOLEAN: { + lua_pushboolean(l, false); + break; + } + case LIGHTUSERDATA: { + lua_pushlightuserdata(l, nullptr); + break; + } + case NUMBER: { + lua_pushinteger(l, 0); + break; + } + case STRING: { + lua_pushstring(l, ""); + break; + } + case TABLE: { + lua_newtable(l); + break; + } + case FUNCTION: + case USERDATA: + case THREAD: { + OZ_ERROR("oz::Lua: Assignment of an uninitialised function, user data or thread is not " + "supported."); + } + } + if (parent == nullptr) { - lua_pushstring(l, value); lua_setglobal(l, name); } else { - int nValues = parent->push(); - - lua_pushstring(l, value); - if (name == nullptr) { lua_rawseti(l, -2, index); } @@ -249,21 +301,20 @@ Lua::Field& Lua::Field::operator = (const char* value) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } -Lua::Field& Lua::Field::operator = (Lua::Function* value) +Lua::Field& Lua::Field::operator = (bool value) { if (parent == nullptr) { - lua_pushcfunction(l, value); + lua_pushboolean(l, value); lua_setglobal(l, name); } else { - int nValues = parent->push(); - - lua_pushcfunction(l, value); + parent->push(); + lua_pushboolean(l, value); if (name == nullptr) { lua_rawseti(l, -2, index); @@ -272,21 +323,20 @@ Lua::Field& Lua::Field::operator = (Lua::Function* value) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } -Lua::Field& Lua::Field::operator = (void* data) +Lua::Field& Lua::Field::operator = (int value) { if (parent == nullptr) { - lua_pushlightuserdata(l, data); + lua_pushinteger(l, value); lua_setglobal(l, name); } else { - int nValues = parent->push(); - - lua_pushlightuserdata(l, data); + parent->push(); + lua_pushinteger(l, value); if (name == nullptr) { lua_rawseti(l, -2, index); @@ -295,56 +345,65 @@ Lua::Field& Lua::Field::operator = (void* data) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } -Lua::Field& Lua::Field::operator = (Lua::Type type) +Lua::Field& Lua::Field::operator = (float value) { - int nValues = 0; - - if (parent != nullptr) { - nValues = parent->push(); + if (parent == nullptr) { + lua_pushnumber(l, value); + lua_setglobal(l, name); } + else { + parent->push(); + lua_pushnumber(l, value); - switch (type) { - case NIL: { - lua_pushnil(l); - break; - } - case BOOLEAN: { - lua_pushboolean(l, false); - break; - } - case LIGHTUSERDATA: { - lua_pushlightuserdata(l, nullptr); - break; - } - case NUMBER: { - lua_pushinteger(l, 0); - break; + if (name == nullptr) { + lua_rawseti(l, -2, index); } - case STRING: { - lua_pushstring(l, ""); - break; + else { + lua_setfield(l, -2, name); } - case TABLE: { - lua_newtable(l); - break; + + lua_pop(l, 1); + } + return *this; +} + +Lua::Field& Lua::Field::operator = (const char* value) +{ + if (parent == nullptr) { + lua_pushstring(l, value); + lua_setglobal(l, name); + } + else { + parent->push(); + lua_pushstring(l, value); + + if (name == nullptr) { + lua_rawseti(l, -2, index); } - case FUNCTION: - case USERDATA: - case THREAD: { - OZ_ERROR("oz::Lua: Assignment of an uninitialised function, user data or thread is not " - "supported."); + else { + lua_setfield(l, -2, name); } + + lua_pop(l, 1); } + return *this; +} +Lua::Field& Lua::Field::operator = (Lua::Function* value) +{ if (parent == nullptr) { + lua_pushcfunction(l, value); lua_setglobal(l, name); } else { + parent->push(); + lua_pushcfunction(l, value); + if (name == nullptr) { lua_rawseti(l, -2, index); } @@ -352,7 +411,7 @@ Lua::Field& Lua::Field::operator = (Lua::Type type) lua_setfield(l, -2, name); } - lua_pop(l, nValues); + lua_pop(l, 1); } return *this; } @@ -367,83 +426,90 @@ Lua::Field Lua::Field::operator [] (int index) const return Field(l, this, index); } -Lua::Result Lua::Field::call(int nArgs) const +Lua::Type Lua::Field::type() const { - if (lua_pcall(l, nArgs, LUA_MULTRET, 0)) { - OZ_ERROR("oz::Lua: Error in executed code"); - } - return Result(l); + push(); + + Lua::Type t = Lua::Type(lua_type(l, -1)); + + lua_pop(l, 1); + return t; } bool Lua::Field::toBool() const { - int nValues = push(); + push(); bool value = lua_toboolean(l, -1); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } int Lua::Field::toInt() const { - int nValues = push(); + push(); int value = int(lua_tointeger(l, -1)); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } float Lua::Field::toFloat() const { - int nValues = push(); + push(); float value = float(lua_tonumber(l, -1)); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } String Lua::Field::toString() const { - int nValues = push(); + push(); const char* s = lua_tostring(l, -1); String value = s == nullptr ? String() : String(s); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } Lua::Function* Lua::Field::toFunction() const { - int nValues = push(); + push(); Function* value = lua_tocfunction(l, -1); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } void* Lua::Field::toPointer() const { - int nValues = push(); + push(); void* value = lua_touserdata(l, -1); - lua_pop(l, nValues); + lua_pop(l, 1); return value; } -Lua::Type Lua::Field::type() const +void Lua::Field::setMetatable(const char* name) { - int nValues = push(); + push(); - Lua::Type t = Lua::Type(lua_type(l, -1)); + if (name == nullptr) { + lua_pushnil(l); + } + else { + lua_getglobal(l, name); + } + lua_setmetatable(l, -2); - lua_pop(l, nValues); - return t; + lua_pop(l, 1); } int Lua::randomSeed = 0; @@ -476,7 +542,9 @@ Lua& Lua::operator = (Lua&& s) Lua::Result Lua::operator () (const char* code) const { - luaL_dostring(l, code); + if (luaL_dostring(l, code) != 0) { + OZ_ERROR("oz::Lua: %s", lua_tostring(l, -1)); + } return Result(l); } @@ -740,9 +808,7 @@ void Lua::loadDir(const File& dir) const if (luaL_loadbufferx(l, is.begin(), is.available(), file, "t") != 0 || lua_pcall(l, 0, LUA_MULTRET, 0) != 0) { - const char* errorMessage = lua_tostring(l, -1); - - OZ_ERROR("oz::Lua: %s", errorMessage); + OZ_ERROR("oz::Lua: %s", lua_tostring(l, -1)); } } } diff --git a/src/ozEngine/Lua.hh b/src/ozEngine/Lua.hh index a0de6f3a..ef0e2fda 100644 --- a/src/ozEngine/Lua.hh +++ b/src/ozEngine/Lua.hh @@ -292,10 +292,8 @@ public: /** * Recursively push all parent field values and finally this field value onto the stack. - * - * @return Number of values pushed onto the stack. */ - int push() const; + void push() const; /** * NOOP for `pushValue()` variadic template. @@ -338,6 +336,16 @@ public: pushValue(static_cast(tail)...); } + /** + * Helper for assigning light user data. + */ + void assign(void* data) const; + + /** + * Helper for assigning full user data. + */ + void assign(const void* data, size_t size, const char* metatable = nullptr) const; + /** * Call a function with given number of arguments. * @@ -348,14 +356,24 @@ public: public: /** - * Move constructor. + * Copy constructor copies field accessor. */ - Field(Field&& s); + Field(const Field& s) = default; /** - * Move operator. + * Copy operator assigns value of the target field. + */ + Field& operator = (const Field& s); + + /** + * Assign first value of a function's result. */ - Field& operator = (Field&& s); + Field& operator = (const Result& s); + + /** + * Assing an empty value of a given type to the field. + */ + Field& operator = (Type type); /** * Assign boolean value to the field. @@ -385,12 +403,22 @@ public: /** * Assign light user data pointer to the field. */ - Field& operator = (void* data); + template + Field& operator = (Data* data) + { + assign(data); + return *this; + } /** - * Assing an empty value of a given type to the field. + * Assign user data to the field. */ - Field& operator = (Type type); + template + Field& operator = (const Data& data) + { + assign(&data, sizeof(Data)); + return *this; + } /** * Access a field of the current field (should be a table). @@ -462,6 +490,11 @@ public: return static_cast(toPointer()); } + /** + * Determine type of the current field. + */ + Type type() const; + /** * Get value of the current field as a boolean. */ @@ -493,13 +526,13 @@ public: void* toPointer() const; /** - * Determine type of the current field. + * Set metatable or remove it if null. */ - Type type() const; + void setMetatable(const char* name); }; -protected: +public: lua_State* l = nullptr; ///< %Lua state escriptor. diff --git a/src/ozEngine/Window.cc b/src/ozEngine/Window.cc index da9083a8..9e89ba9c 100644 --- a/src/ozEngine/Window.cc +++ b/src/ozEngine/Window.cc @@ -169,7 +169,7 @@ void Window::screenshot(const File& file, int quality) int pitch = ((windowWidth * 3 + 3) / 4) * 4; char* pixels = new char[windowHeight * pitch]; - ScreenshotInfo* info = new ScreenshotInfo{ file, quality, windowWidth, windowHeight, pixels }; + ScreenshotInfo* info = new ScreenshotInfo{file, quality, windowWidth, windowHeight, pixels}; glReadPixels(0, 0, windowWidth, windowHeight, GL_RGB, GL_UNSIGNED_BYTE, info->pixels); screenshotThread = Thread("screenshot", screenshotMain, info); diff --git a/src/ozFactory/ModelBuilder.cc b/src/ozFactory/ModelBuilder.cc index a25c25ca..62dafe42 100644 --- a/src/ozFactory/ModelBuilder.cc +++ b/src/ozFactory/ModelBuilder.cc @@ -260,14 +260,14 @@ bool ModelBuilder::buildModel(const File& file, OutputStream* os) Vec3 centre = (a + b + c) / 3.0f; for (int k = 0; k < 8; ++k) { - triangles[k].add({ centre* DIRS[k], j }); + triangles[k].add({centre* DIRS[k], j}); } } int nIndices = indices.length() - firstIndex; int material = mesh->mMaterialIndex; - meshes.add({ firstIndex, nIndices, 0, 0, material }); + meshes.add({firstIndex, nIndices, 0, 0, material}); } for (uint i = 0; i < scene->mNumMaterials; ++i) { @@ -281,7 +281,7 @@ bool ModelBuilder::buildModel(const File& file, OutputStream* os) float alpha = 1.0f; material->Get(AI_MATKEY_OPACITY, alpha); - materials.add({ String::fileBaseName(path.C_Str()), alpha }); + materials.add({String::fileBaseName(path.C_Str()), alpha}); Log() << i << " texure: " << path.C_Str(); } @@ -304,8 +304,8 @@ bool ModelBuilder::buildModel(const File& file, OutputStream* os) lights.add(Light { Point(light->mPosition.x, light->mPosition.y, light->mPosition.z), Vec3(light->mDirection.x, light->mDirection.y, light->mDirection.z), - { Math::tan(light->mAngleInnerCone / 2.0f), Math::tan(light->mAngleOuterCone / 2.0f) }, - { light->mAttenuationConstant, light->mAttenuationLinear, light->mAttenuationQuadratic }, + {Math::tan(light->mAngleInnerCone / 2.0f), Math::tan(light->mAngleOuterCone / 2.0f)}, + {light->mAttenuationConstant, light->mAttenuationLinear, light->mAttenuationQuadratic}, Vec3(light->mColorDiffuse.r, light->mColorDiffuse.g, light->mColorDiffuse.b), Light::Type(light->mType - 1) }); diff --git a/src/ozFactory/TerraBuilder.hh b/src/ozFactory/TerraBuilder.hh index ed716ed6..728daddb 100644 --- a/src/ozFactory/TerraBuilder.hh +++ b/src/ozFactory/TerraBuilder.hh @@ -165,7 +165,7 @@ public: /** * Generate grey noise on cube map. * - * Returns an array of 6 pointers to RGB images { +x, -x, +y, -y, +z, -z } for OpenGL cube map + * Returns an array of 6 pointers to RGB images {+x, -x, +y, -y, +z, -z} for OpenGL cube map * texture. -1.0 maps to black and +1.0 maps to white, so make sure NOISE module has bounds close * to [-1.0, +1.0]. * diff --git a/src/tools/ozGettext.cc b/src/tools/ozGettext.cc index 08266609..8809ca65 100644 --- a/src/tools/ozGettext.cc +++ b/src/tools/ozGettext.cc @@ -50,7 +50,7 @@ static void readLuaChunk(const char* begin, int size, const char* path) LuaSyntaxState state = NORMAL; int lineNum = 1; int gettextLineNum = 1; - char last[4] = { '\0', '\0', '\0', '\0' }; + char last[4] = {'\0', '\0', '\0', '\0'}; List lastString; bool restartString = true; bool inGettext = false; diff --git a/src/unittest/Arrays.cc b/src/unittest/Arrays.cc index ab439eb9..228044be 100644 --- a/src/unittest/Arrays.cc +++ b/src/unittest/Arrays.cc @@ -31,7 +31,7 @@ void test_arrays() Arrays::CIterator ici; Arrays::Iterator ii; - Foo a[4] = { 1, 2, 3, 2 }; + Foo a[4] = {1, 2, 3, 2}; Foo b[4]; Arrays::move(a, 4, b); diff --git a/src/unittest/unittest.hh b/src/unittest/unittest.hh index e0dda592..ac8916b4 100644 --- a/src/unittest/unittest.hh +++ b/src/unittest/unittest.hh @@ -31,7 +31,7 @@ { \ auto i = citerator(container); \ typedef decltype(i) CIterator; \ - CIterator::ElemType array[] = { __VA_ARGS__ }; \ + CIterator::ElemType array[] = {__VA_ARGS__}; \ OZ_CHECK(iEquals(i, citerator(array))); \ }