1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-07-08 13:54:52 +02:00

all: fix 'warning: missing braces around initializer'

This commit is contained in:
Anonymous Maarten 2018-09-01 04:09:03 +02:00
parent 564f6efeb5
commit 0b8bc41fa7
14 changed files with 50 additions and 45 deletions

View File

@ -13,6 +13,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang
"-Wextra"
"-Wdouble-promotion"
"-Wpedantic"
"-Wmissing-braces"
"$<IF:$<COMPILE_LANGUAGE:CXX>,-Wold-style-cast,>"
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")

View File

@ -200,8 +200,8 @@ static const FontMap::gschar_unicode_map_t map_gta3_font_2_priv = {
const FontMap fontmap_gta3_font_common({map_gta3_font_common});
const std::array<FontMap, 3> fontmaps_gta3_font = {
FontMap({map_gta3_font_common, map_gta3_font_0_priv}),
FontMap({map_gta3_font_common, map_gta3_font_1_priv}),
FontMap({map_gta3_font_common, map_gta3_font_2_priv}),
};
const std::array<FontMap, 3> fontmaps_gta3_font = {{
FontMap{map_gta3_font_common, map_gta3_font_0_priv},
FontMap{map_gta3_font_common, map_gta3_font_1_priv},
FontMap{map_gta3_font_common, map_gta3_font_2_priv},
}};

View File

@ -142,8 +142,10 @@ std::vector<GameObject*> TrafficDirector::populateNearby(
peds.insert(peds.end(), group.cbegin(), group.cend());
// Vehicles for normal traffic @todo create correct vehicle list
static constexpr std::array<uint16_t, 32> cars = {90, 91, 92, 94, 95, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 116, 119, 128, 129, 130, 134, 135, 136, 138, 139, 144, 146};
static constexpr std::array<uint16_t, 32> cars = {{
90, 91, 92, 94, 95, 97, 98, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 116, 119, 128, 129, 130, 134, 135, 136, 138, 139, 144, 146
}};
auto availablePedsNodes = findAvailableNodes(AIGraphNode::Pedestrian, camera, radius);

View File

@ -234,7 +234,7 @@ public:
bool onPlayerTouch() override;
};
const static std::array<glm::vec3, 106> bigNVeinyPickupsLocations = {
const static std::array<glm::vec3, 106> bigNVeinyPickupsLocations = {{
glm::vec3(913.62219f, -155.13692f, 4.9699469f),
glm::vec3(913.92401f, -124.12943f, 4.9692569f),
glm::vec3(913.27899f, -93.524231f, 7.4325991f),
@ -340,7 +340,8 @@ const static std::array<glm::vec3, 106> bigNVeinyPickupsLocations = {
glm::vec3(1481.5685f, -701.30237f, 11.977908f),
glm::vec3(1511.4004f, -696.83295f, 11.972709f),
glm::vec3(1542.1796f, -695.61676f, 11.970441f),
glm::vec3(1570.3301f, -684.6239f, 11.969202f)};
glm::vec3(1570.3301f, -684.6239f, 11.969202f),
}};
/**
* @brief The BigNVeinyPickup class

View File

@ -68,7 +68,7 @@ void DebugDraw::flush(GameRenderer *renderer) {
dbuff->addGeometry(lineBuff.get());
Renderer::DrawParameters dp;
dp.textures = {texture};
dp.textures = {{texture}};
dp.ambient = 1.f;
dp.colour = glm::u8vec4(255, 255, 255, 255);
dp.start = 0;

View File

@ -421,7 +421,7 @@ void GameRenderer::renderSplash(GameWorld* world, GLuint splashTexName, glm::u16
wdp.depthMode = DepthMode::OFF;
wdp.blendMode = BlendMode::BLEND_ALPHA;
wdp.count = ssRectGeom.getCount();
wdp.textures = {splashTexName};
wdp.textures = {{splashTexName}};
renderer->drawArrays(glm::mat4(1.0f), &ssRectDraw, wdp);
}
@ -437,7 +437,7 @@ void GameRenderer::renderPostProcess() {
Renderer::DrawParameters wdp;
wdp.start = 0;
wdp.count = ssRectGeom.getCount();
wdp.textures = {fbTextures[0]};
wdp.textures = {{fbTextures[0]}};
wdp.depthMode = DepthMode::OFF;
renderer->drawArrays(glm::mat4(1.0f), &ssRectDraw, wdp);
@ -488,7 +488,7 @@ void GameRenderer::renderEffects(GameWorld* world) {
glm::vec3(particle->size,1.0f)) * glm::inverse(lookMat);
Renderer::DrawParameters dp;
dp.textures = {particle->texture->getName()};
dp.textures = {{particle->texture->getName()}};
dp.ambient = 1.f;
dp.colour = glm::u8vec4(particle->colour * 255.f);
dp.start = 0;
@ -529,7 +529,7 @@ void GameRenderer::drawRect(const glm::vec4& colour, TextureData* texture, glm::
wdp.depthMode = DepthMode::OFF;
wdp.blendMode = BlendMode::BLEND_ALPHA;
wdp.count = ssRectGeom.getCount();
wdp.textures = {texture ? texture->getName() : 0};
wdp.textures = {{texture ? texture->getName() : 0}};
renderer->drawArrays(glm::mat4(1.0f), &ssRectDraw, wdp);
}
@ -544,7 +544,7 @@ void GameRenderer::renderLetterbox() {
wdp.depthMode = DepthMode::OFF;
wdp.blendMode = BlendMode::BLEND_NONE;
wdp.count = ssRectGeom.getCount();
wdp.textures = {0};
wdp.textures = {{0}};
renderer->drawArrays(glm::mat4(1.0f), &ssRectDraw, wdp);
renderer->setUniform(ssRectProg.get(), "offset", glm::vec2{0.f, 1.f * (1.f - cinematicExperienceSize)});

View File

@ -125,7 +125,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
std::string num = (m < 10 ? "0" : "");
std::string name = "radar" + num + std::to_string(m);
auto texture = world->data->findSlotTexture(name, name);
dp.textures = {texture->getName()};
dp.textures = {{texture->getName()}};
dp.count = 4;
@ -152,7 +152,7 @@ void MapRenderer::draw(GameWorld* world, const MapInfo& mi) {
glBlendFuncSeparate(GL_DST_COLOR, GL_ZERO, GL_ONE, GL_ZERO);
TextureData::Handle radarDisc =
data->findSlotTexture("hud", "radardisc");
dp.textures = {radarDisc->getName()};
dp.textures = {{radarDisc->getName()}};
glm::mat4 model{1.0f};
model = glm::translate(model, glm::vec3(mi.screenPosition, 0.0f));

View File

@ -51,7 +51,7 @@ void ObjectRenderer::renderGeometry(Geometry* geom,
dp.colour = {255, 255, 255, 255};
dp.count = subgeom.numIndices;
dp.start = subgeom.start;
dp.textures = {0};
dp.textures = {{0}};
dp.visibility = 1.f;
if (object && object->type() == GameObject::Instance) {
@ -69,7 +69,7 @@ void ObjectRenderer::renderGeometry(Geometry* geom,
if (tex->isTransparent()) {
isTransparent = true;
}
dp.textures = {tex->getName()};
dp.textures = {{tex->getName()}};
}
}

View File

@ -70,7 +70,7 @@ void main()
constexpr size_t GLYPHS_NB = 193;
using FontWidthLut = std::array<std::uint8_t, GLYPHS_NB>;
constexpr std::array<std::uint8_t, 193> fontWidthsPager = {
constexpr std::array<std::uint8_t, 193> fontWidthsPager = {{
3, 3, 6, 8, 6, 10, 8, 3, 5, 5, 7, 0, 3, 7, 3, 0, // 1
6, 4, 6, 6, 7, 6, 6, 6, 6, 6, 3, 0, 0, 0, 0, 6, // 2
0, 6, 6, 6, 6, 6, 6, 6, 6, 3, 6, 6, 5, 8, 7, 6, // 3
@ -84,9 +84,9 @@ constexpr std::array<std::uint8_t, 193> fontWidthsPager = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 11
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // 12
8,
};
}};
constexpr std::array<std::uint8_t, 193> fontWidthsPriceDown = {
constexpr std::array<std::uint8_t, 193> fontWidthsPriceDown = {{
11, 13, 30, 27, 20, 24, 22, 12, 14, 14, 0, 26, 9, 14, 9, 26, // 1
20, 19, 20, 20, 22, 20, 20, 19, 20, 20, 13, 29, 24, 29, 24, 20, // 2
27, 20, 20, 20, 20, 20, 17, 20, 20, 10, 20, 20, 15, 30, 20, 20, // 3
@ -100,9 +100,9 @@ constexpr std::array<std::uint8_t, 193> fontWidthsPriceDown = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 11
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 12
16,
};
}};
constexpr std::array<std::uint8_t, 193> fontWidthsArial = {
constexpr std::array<std::uint8_t, 193> fontWidthsArial = {{
27, 25, 55, 43, 47, 65, 53, 19, 29, 31, 21, 45, 23, 35, 27, 29, // 1
47, 33, 45, 43, 49, 47, 47, 41, 47, 45, 25, 23, 53, 43, 53, 39, // 2
61, 53, 51, 47, 49, 45, 43, 49, 53, 23, 41, 53, 45, 59, 53, 51, // 3
@ -116,7 +116,7 @@ constexpr std::array<std::uint8_t, 193> fontWidthsArial = {
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 11, 19, 19, // 11
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, // 12
19,
};
}};
}
@ -350,7 +350,7 @@ void TextRenderer::renderText(const TextRenderer::TextInfo& ti,
dp.blendMode = BlendMode::BLEND_ALPHA;
dp.count = gb.getCount();
auto ftexture = renderer->getData()->findSlotTexture("fonts", fontMetaData.textureName);
dp.textures = {ftexture->getName()};
dp.textures = {{ftexture->getName()}};
dp.depthMode = DepthMode::OFF;
renderer->getRenderer()->drawArrays(glm::mat4(1.0f), &db, dp);

View File

@ -112,7 +112,7 @@ void WaterRenderer::render(GameRenderer* renderer, GameWorld* world) {
Renderer::DrawParameters wdp;
wdp.start = 0;
wdp.count = maskGeom.getCount();
wdp.textures = {0};
wdp.textures = {{0}};
glm::mat4 m(1.0);
glEnable(GL_STENCIL_TEST);
@ -147,7 +147,7 @@ void WaterRenderer::render(GameRenderer* renderer, GameWorld* world) {
r->setUniform(waterProg.get(), "inverseVP", ivp);
wdp.count = gridGeom.getCount();
wdp.textures = {waterTex->getName(), dataTexture};
wdp.textures = {{waterTex->getName(), dataTexture}};
r->drawArrays(m, &gridDraw, wdp);

View File

@ -211,18 +211,19 @@ void RWGame::handleCheatInput(char symbol) {
});
checkForCheat("GUNSGUNSGUNS", [&] {
constexpr std::array<int, 11> ammo = {1, //baseball bat
100,//pistol
100,//uzi
20, //shotgun
5, //grenade
5, //molotov
5, //rocket launcher
20, //flamethrower
200,//ak47
200,//m16
5 //sniper rifle
};
constexpr std::array<int, 11> ammo = {{
1, //baseball bat
100,//pistol
100,//uzi
20, //shotgun
5, //grenade
5, //molotov
5, //rocket launcher
20, //flamethrower
200,//ak47
200,//m16
5 //sniper rifle
}};
for (std::array<int, 11>::size_type i = 0; i < ammo.size(); i++)
player->addToInventory(static_cast<int>(i+1),ammo[i]);
state.showHelpMessage("CHEAT2"); // III / VC: Inputting weapon cheats.

View File

@ -214,7 +214,7 @@ std::shared_ptr<Menu> DebugState::createWeatherMenu() {
Menu::create({{"Back", [=] { this->enterMenu(createDebugMenu()); }}},
kDebugFont, kDebugEntryHeight);
const std::array<std::string, 4> w{"Sunny", "Cloudy", "Rainy", "Foggy"};
const std::array<std::string, 4> w{{"Sunny", "Cloudy", "Rainy", "Foggy"}};
for (std::size_t i = 0; i < w.size(); ++i) {
menu->lambda(w[i],
@ -230,7 +230,7 @@ std::shared_ptr<Menu> DebugState::createMissionsMenu() {
Menu::create({{"Back", [=] { this->enterMenu(createDebugMenu()); }}},
kDebugFont, kDebugEntryHeightMissions);
const std::array<std::string, 80> w{
const std::array<std::string, 80> w{{
"Intro Movie",
"Hospital Info Scene",
"Police Station Info Scene",
@ -311,7 +311,7 @@ std::shared_ptr<Menu> DebugState::createMissionsMenu() {
"Bullion Run",
"Rumble",
"The Exchange",
};
}};
for (std::size_t i = 0; i < w.size(); ++i) {
menu->lambda(w[i], [=] {

View File

@ -183,7 +183,7 @@ void ViewerWidget::drawFrameWidget(ModelFrame* f, const glm::mat4& m) {
dp.colour = {255, 255, 255, 255};
glLineWidth(1.f);
}
dp.textures = {whiteTex};
dp.textures = {{whiteTex}};
RW_CHECK(_renderer != nullptr, "GameRenderer is null");
if(_renderer != nullptr) {

View File

@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(objects_contains_modelID) {
BOOST_AUTO_TEST_CASE(instance_data_is_correct) {
loader.load(test_data_stream, {});
ASSERT_INSTANCE_IS<1>(*loader.objects[1100], "NAME", "TXD", {220.f}, 0);
ASSERT_INSTANCE_IS<1>(*loader.objects[1100], "NAME", "TXD", {{220.f}}, 0);
}
BOOST_AUTO_TEST_CASE(vehicle_data_is_correct) {