From ad0ca6090a77ee439d62c7e3db3da5c552a0b59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 10 Jul 2022 21:00:40 +0200 Subject: [PATCH 1/5] Fix modernize-use-bool-literals --- src/engine/client/backend_sdl.cpp | 4 ++-- src/test/teehistorian.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 8189daa37..361756e56 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -1416,7 +1416,7 @@ bool CGraphicsBackend_SDL_GL::ResizeWindow(int w, int h, int RefreshRate) { #ifdef CONF_FAMILY_WINDOWS // in windows make the window windowed mode first, this prevents strange window glitches (other games probably do something similar) - SetWindowParams(0, 1, true); + SetWindowParams(0, true, true); #endif SDL_DisplayMode SetMode = {}; SDL_DisplayMode ClosestMode = {}; @@ -1428,7 +1428,7 @@ bool CGraphicsBackend_SDL_GL::ResizeWindow(int w, int h, int RefreshRate) #ifdef CONF_FAMILY_WINDOWS // now change it back to fullscreen, this will restore the above set state, bcs SDL saves fullscreen modes appart from other video modes (as of SDL 2.0.16) // see implementation of SDL_SetWindowDisplayMode - SetWindowParams(1, 0, true); + SetWindowParams(1, false, true); #endif return true; } diff --git a/src/test/teehistorian.cpp b/src/test/teehistorian.cpp index b208de5ec..c58905285 100644 --- a/src/test/teehistorian.cpp +++ b/src/test/teehistorian.cpp @@ -690,13 +690,13 @@ TEST_F(TeeHistorian, TeamPractice) 0x40}; Tick(1); - m_TH.RecordTeamPractice(1, 0); - m_TH.RecordTeamPractice(16, 0); - m_TH.RecordTeamPractice(23, 1); + m_TH.RecordTeamPractice(1, false); + m_TH.RecordTeamPractice(16, false); + m_TH.RecordTeamPractice(23, true); Tick(2); - m_TH.RecordTeamPractice(1, 1); - m_TH.RecordTeamPractice(16, 0); - m_TH.RecordTeamPractice(23, 0); + m_TH.RecordTeamPractice(1, true); + m_TH.RecordTeamPractice(16, false); + m_TH.RecordTeamPractice(23, false); Finish(); Expect(EXPECTED, sizeof(EXPECTED)); } From 99d1fb726c8f7d4a81db16a8edfdb114f5f6c9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 10 Jul 2022 21:09:58 +0200 Subject: [PATCH 2/5] Fix modernize-loop-convert in tests --- src/test/bytes_be.cpp | 15 ++++++--------- src/test/compression.cpp | 12 ++++++------ src/test/prng.cpp | 4 ++-- src/test/score.cpp | 4 ++-- src/test/secure_random.cpp | 3 +-- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/test/bytes_be.cpp b/src/test/bytes_be.cpp index 56c64739e..0f9493971 100644 --- a/src/test/bytes_be.cpp +++ b/src/test/bytes_be.cpp @@ -5,27 +5,24 @@ #include static const int INT_DATA[] = {0, 1, -1, 32, 64, 256, -512, 12345, -123456, 1234567, 12345678, 123456789, 2147483647, (-2147483647 - 1)}; -static const int INT_NUM = std::size(INT_DATA); - static const unsigned UINT_DATA[] = {0u, 1u, 2u, 32u, 64u, 256u, 512u, 12345u, 123456u, 1234567u, 12345678u, 123456789u, 2147483647u, 2147483648u, 4294967295u}; -static const int UINT_NUM = std::size(INT_DATA); TEST(BytePacking, RoundtripInt) { - for(int i = 0; i < INT_NUM; i++) + for(auto i : INT_DATA) { unsigned char aPacked[4]; - int_to_bytes_be(aPacked, INT_DATA[i]); - EXPECT_EQ(bytes_be_to_int(aPacked), INT_DATA[i]); + int_to_bytes_be(aPacked, i); + EXPECT_EQ(bytes_be_to_int(aPacked), i); } } TEST(BytePacking, RoundtripUnsigned) { - for(int i = 0; i < UINT_NUM; i++) + for(auto u : UINT_DATA) { unsigned char aPacked[4]; - uint_to_bytes_be(aPacked, UINT_DATA[i]); - EXPECT_EQ(bytes_be_to_uint(aPacked), UINT_DATA[i]); + uint_to_bytes_be(aPacked, u); + EXPECT_EQ(bytes_be_to_uint(aPacked), u); } } diff --git a/src/test/compression.cpp b/src/test/compression.cpp index 968ee05b3..c3ad1e65d 100644 --- a/src/test/compression.cpp +++ b/src/test/compression.cpp @@ -21,8 +21,8 @@ TEST(CVariableInt, RoundtripPackUnpack) TEST(CVariableInt, UnpackInvalid) { unsigned char aPacked[CVariableInt::MAX_BYTES_PACKED]; - for(unsigned i = 0; i < sizeof(aPacked); i++) - aPacked[i] = 0xFF; + for(auto &Byte : aPacked) + Byte = 0xFF; int Result; EXPECT_EQ(int(CVariableInt::Unpack(aPacked, &Result, sizeof(aPacked)) - aPacked), int(CVariableInt::MAX_BYTES_PACKED)); @@ -43,8 +43,8 @@ TEST(CVariableInt, PackBufferTooSmall) TEST(CVariableInt, UnpackBufferTooSmall) { unsigned char aPacked[CVariableInt::MAX_BYTES_PACKED / 2]; - for(unsigned i = 0; i < sizeof(aPacked); i++) - aPacked[i] = 0xFF; // extended bits are set, but buffer ends too early + for(auto &Byte : aPacked) + Byte = 0xFF; // extended bits are set, but buffer ends too early int UnusedResult; EXPECT_EQ(CVariableInt::Unpack(aPacked, &UnusedResult, sizeof(aPacked)), (const unsigned char *)0x0); @@ -55,8 +55,8 @@ TEST(CVariableInt, RoundtripCompressDecompress) unsigned char aCompressed[NUM * CVariableInt::MAX_BYTES_PACKED]; int aDecompressed[NUM]; long ExpectedCompressedSize = 0; - for(int i = 0; i < NUM; i++) - ExpectedCompressedSize += SIZES[i]; + for(auto Size : SIZES) + ExpectedCompressedSize += Size; long CompressedSize = CVariableInt::Compress(DATA, sizeof(DATA), aCompressed, sizeof(aCompressed)); ASSERT_EQ(CompressedSize, ExpectedCompressedSize); diff --git a/src/test/prng.cpp b/src/test/prng.cpp index 3b270d301..d023d3809 100644 --- a/src/test/prng.cpp +++ b/src/test/prng.cpp @@ -56,9 +56,9 @@ TEST(Prng, EqualsPcg32GlobalDemo) CPrng Prng; Prng.Seed(aSeed); - for(unsigned i = 0; i < std::size(PCG32_GLOBAL_DEMO); i++) + for(auto Expected : PCG32_GLOBAL_DEMO) { - EXPECT_EQ(Prng.RandomBits(), PCG32_GLOBAL_DEMO[i]); + EXPECT_EQ(Prng.RandomBits(), Expected); } } diff --git a/src/test/score.cpp b/src/test/score.cpp index f069d8731..63cc728f6 100644 --- a/src/test/score.cpp +++ b/src/test/score.cpp @@ -183,9 +183,9 @@ TEST_P(SingleScore, LoadPlayerData) EXPECT_EQ(m_pPlayerResult->m_MessageKind, CScorePlayerResult::PLAYER_INFO); ASSERT_EQ(m_pPlayerResult->m_Data.m_Info.m_Time, 0.0); - for(int i = 0; i < NUM_CHECKPOINTS; i++) + for(auto &Time : m_pPlayerResult->m_Data.m_Info.m_aTimeCp) { - ASSERT_EQ(m_pPlayerResult->m_Data.m_Info.m_aTimeCp[i], 0); + ASSERT_EQ(Time, 0); } str_copy(m_PlayerRequest.m_aRequestingPlayer, "nameless tee", sizeof(m_PlayerRequest.m_aRequestingPlayer)); diff --git a/src/test/secure_random.cpp b/src/test/secure_random.cpp index e06660486..d5872c3c1 100644 --- a/src/test/secure_random.cpp +++ b/src/test/secure_random.cpp @@ -22,9 +22,8 @@ TEST(SecureRandom, Below1) TEST(SecureRandom, Below) { int BOUNDS[] = {2, 3, 4, 5, 10, 100, 127, 128, 129}; - for(unsigned i = 0; i < std::size(BOUNDS); i++) + for(auto Below : BOUNDS) { - int Below = BOUNDS[i]; for(int j = 0; j < 10; j++) { int Random = secure_rand_below(Below); From bf686342df77e30a08b9a0c7cf8c3277de325fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 10 Jul 2022 21:12:16 +0200 Subject: [PATCH 3/5] Fix performance-unnecessary-value-param --- src/test/score.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/score.cpp b/src/test/score.cpp index 63cc728f6..71e824d5f 100644 --- a/src/test/score.cpp +++ b/src/test/score.cpp @@ -106,7 +106,7 @@ struct Score : public testing::TestWithParam ASSERT_FALSE(CScoreWorker::SaveScore(m_pConn, &ScoreData, false, m_aError, sizeof(m_aError))) << m_aError; } - void ExpectLines(std::shared_ptr pPlayerResult, std::initializer_list Lines, bool All = false) + void ExpectLines(const std::shared_ptr &pPlayerResult, std::initializer_list Lines, bool All = false) { EXPECT_EQ(pPlayerResult->m_MessageKind, All ? CScorePlayerResult::ALL : CScorePlayerResult::DIRECT); From ec4175277e6e14a0215f0629634fc1aada74ebe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 10 Jul 2022 21:22:50 +0200 Subject: [PATCH 4/5] Fix readability-container-data-pointer --- src/engine/client/client.cpp | 2 +- src/engine/client/graphics_threaded.cpp | 10 +++++----- src/engine/client/input.cpp | 2 +- src/engine/client/text.cpp | 4 ++-- src/engine/gfx/image_loader.cpp | 2 +- src/game/client/components/maplayers.cpp | 14 +++++++------- src/game/editor/io.cpp | 12 ++++++------ src/game/editor/layer_quads.cpp | 4 ++-- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 4e486d8a1..9391c9fe1 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4775,7 +4775,7 @@ SWarning *CClient::GetCurWarning() } else { - return &m_vWarnings[0]; + return m_vWarnings.data(); } } diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index f1ebde97e..7147dd40d 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -354,9 +354,9 @@ IGraphics::CTextureHandle CGraphics_Threaded::LoadSpriteTextureImpl(CImageInfo & m_vSpriteHelper.resize((size_t)w * h * bpp); - CopyTextureFromTextureBufferSub(&m_vSpriteHelper[0], w, h, (uint8_t *)FromImageInfo.m_pData, FromImageInfo.m_Width, FromImageInfo.m_Height, bpp, x, y, w, h); + CopyTextureFromTextureBufferSub(m_vSpriteHelper.data(), w, h, (uint8_t *)FromImageInfo.m_pData, FromImageInfo.m_Width, FromImageInfo.m_Height, bpp, x, y, w, h); - IGraphics::CTextureHandle RetHandle = LoadTextureRaw(w, h, FromImageInfo.m_Format, &m_vSpriteHelper[0], FromImageInfo.m_Format, 0); + IGraphics::CTextureHandle RetHandle = LoadTextureRaw(w, h, FromImageInfo.m_Format, m_vSpriteHelper.data(), FromImageInfo.m_Format, 0); return RetHandle; } @@ -1413,12 +1413,12 @@ void CGraphics_Threaded::QuadContainerUpload(int ContainerIndex) if(Container.m_QuadBufferObjectIndex == -1) { size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad); - Container.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, &Container.m_vQuads[0], 0); + Container.m_QuadBufferObjectIndex = CreateBufferObject(UploadDataSize, Container.m_vQuads.data(), 0); } else { size_t UploadDataSize = Container.m_vQuads.size() * sizeof(SQuadContainer::SQuad); - RecreateBufferObject(Container.m_QuadBufferObjectIndex, UploadDataSize, &Container.m_vQuads[0], 0); + RecreateBufferObject(Container.m_QuadBufferObjectIndex, UploadDataSize, Container.m_vQuads.data(), 0); } if(Container.m_QuadBufferContainerIndex == -1) @@ -2808,7 +2808,7 @@ SWarning *CGraphics_Threaded::GetCurWarning() return NULL; else { - SWarning *pCurWarning = &m_vWarnings[0]; + SWarning *pCurWarning = m_vWarnings.data(); return pCurWarning; } } diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 3788d2260..b269901ba 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -137,7 +137,7 @@ void CInput::UpdateActiveJoystick() } // Fall back to first joystick if no match was found if(!m_pActiveJoystick) - m_pActiveJoystick = &m_vJoysticks[0]; + m_pActiveJoystick = &m_vJoysticks[0]; // NOLINT(readability-container-data-pointer) } void CInput::ConchainJoystickGuidChanged(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData) diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index 03dac9ac9..c3b9e02dd 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -1442,7 +1442,7 @@ public: if(Graphics()->IsTextBufferingEnabled()) { size_t DataSize = TextContainer.m_StringInfo.m_vCharacterQuads.size() * sizeof(STextCharQuad); - void *pUploadData = &TextContainer.m_StringInfo.m_vCharacterQuads[0]; + void *pUploadData = TextContainer.m_StringInfo.m_vCharacterQuads.data(); if(TextContainer.m_StringInfo.m_QuadBufferObjectIndex != -1 && (TextContainer.m_RenderFlags & TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD) == 0) { @@ -1503,7 +1503,7 @@ public: if(HasCursor) Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, aCursorQuads, 2); if(HasSelection) - Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, &vSelectionQuads[0], (int)vSelectionQuads.size()); + Graphics()->QuadContainerAddQuads(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex, vSelectionQuads.data(), (int)vSelectionQuads.size()); Graphics()->QuadContainerUpload(TextContainer.m_StringInfo.m_SelectionQuadContainerIndex); TextContainer.m_HasCursor = HasCursor; diff --git a/src/engine/gfx/image_loader.cpp b/src/engine/gfx/image_loader.cpp index 72f999b9b..784780c44 100644 --- a/src/engine/gfx/image_loader.cpp +++ b/src/engine/gfx/image_loader.cpp @@ -27,7 +27,7 @@ static void LibPNGWarning(png_structp png_ptr, png_const_charp warning_msg) static bool FileMatchesImageType(SImageByteBuffer &ByteLoader) { if(ByteLoader.m_pLoadedImageBytes->size() >= 8) - return png_sig_cmp((png_bytep) & (*ByteLoader.m_pLoadedImageBytes)[0], 0, 8) == 0; + return png_sig_cmp((png_bytep)ByteLoader.m_pLoadedImageBytes->data(), 0, 8) == 0; return false; } diff --git a/src/game/client/components/maplayers.cpp b/src/game/client/components/maplayers.cpp index 37e480550..e63f467be 100644 --- a/src/game/client/components/maplayers.cpp +++ b/src/game/client/components/maplayers.cpp @@ -833,8 +833,8 @@ void CMapLayers::OnMapLoad() vtmpTileTexCoords.insert(vtmpTileTexCoords.end(), vtmpBorderRightTilesTexCoords.begin(), vtmpBorderRightTilesTexCoords.end()); //setup params - float *pTmpTiles = (vtmpTiles.empty()) ? NULL : (float *)&vtmpTiles[0]; - unsigned char *pTmpTileTexCoords = (vtmpTileTexCoords.empty()) ? NULL : (unsigned char *)&vtmpTileTexCoords[0]; + float *pTmpTiles = vtmpTiles.empty() ? NULL : (float *)vtmpTiles.data(); + unsigned char *pTmpTileTexCoords = vtmpTileTexCoords.empty() ? NULL : (unsigned char *)vtmpTileTexCoords.data(); Visuals.m_BufferContainerIndex = -1; size_t UploadDataSize = vtmpTileTexCoords.size() * sizeof(SGraphicTileTexureCoords) + vtmpTiles.size() * sizeof(SGraphicTile); @@ -951,9 +951,9 @@ void CMapLayers::OnMapLoad() { void *pUploadData = NULL; if(Textured) - pUploadData = &vtmpQuadsTextured[0]; + pUploadData = vtmpQuadsTextured.data(); else - pUploadData = &vtmpQuads[0]; + pUploadData = vtmpQuads.data(); // create the buffer object int BufferObjectIndex = Graphics()->CreateBufferObject(UploadDataSize, pUploadData, 0); // then create the buffer container @@ -1087,7 +1087,7 @@ void CMapLayers::RenderTileLayer(int LayerIndex, ColorRGBA &Color, CMapItemLayer int DrawCount = s_vpIndexOffsets.size(); if(DrawCount != 0) { - Graphics()->RenderTileLayer(Visuals.m_BufferContainerIndex, Color, &s_vpIndexOffsets[0], &s_vDrawCounts[0], DrawCount); + Graphics()->RenderTileLayer(Visuals.m_BufferContainerIndex, Color, s_vpIndexOffsets.data(), s_vDrawCounts.data(), DrawCount); } } @@ -1416,7 +1416,7 @@ void CMapLayers::RenderQuadLayer(int LayerIndex, CMapItemLayerQuads *pQuadLayer, if(NeedsFlush) { // render quads of the current offset directly(cancel batching) - Graphics()->RenderQuadLayer(Visuals.m_BufferContainerIndex, &s_vQuadRenderInfo[0], QuadsRenderCount, CurQuadOffset); + Graphics()->RenderQuadLayer(Visuals.m_BufferContainerIndex, s_vQuadRenderInfo.data(), QuadsRenderCount, CurQuadOffset); QuadsRenderCount = 0; CurQuadOffset = i; if(Color.a == 0) @@ -1435,7 +1435,7 @@ void CMapLayers::RenderQuadLayer(int LayerIndex, CMapItemLayerQuads *pQuadLayer, QInfo.m_Rotation = Rot; } } - Graphics()->RenderQuadLayer(Visuals.m_BufferContainerIndex, &s_vQuadRenderInfo[0], QuadsRenderCount, CurQuadOffset); + Graphics()->RenderQuadLayer(Visuals.m_BufferContainerIndex, s_vQuadRenderInfo.data(), QuadsRenderCount, CurQuadOffset); } void CMapLayers::LayersOfGroupCount(CMapItemGroup *pGroup, int &TileLayerCount, int &QuadLayerCount, bool &PassedGameLayer) diff --git a/src/game/editor/io.cpp b/src/game/editor/io.cpp index c6f6cee7f..822eebb4a 100644 --- a/src/game/editor/io.cpp +++ b/src/game/editor/io.cpp @@ -290,7 +290,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) // add the data Item.m_NumQuads = pLayerQuads->m_vQuads.size(); - Item.m_Data = df.AddDataSwapped(pLayerQuads->m_vQuads.size() * sizeof(CQuad), &pLayerQuads->m_vQuads[0]); + Item.m_Data = df.AddDataSwapped(pLayerQuads->m_vQuads.size() * sizeof(CQuad), pLayerQuads->m_vQuads.data()); // save layer name StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), pLayerQuads->m_aName); @@ -319,7 +319,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) // add the data Item.m_NumSources = pLayerSounds->m_vSources.size(); - Item.m_Data = df.AddDataSwapped(pLayerSounds->m_vSources.size() * sizeof(CSoundSource), &pLayerSounds->m_vSources[0]); + Item.m_Data = df.AddDataSwapped(pLayerSounds->m_vSources.size() * sizeof(CSoundSource), pLayerSounds->m_vSources.data()); // save layer name StrToInts(Item.m_aName, sizeof(Item.m_aName) / sizeof(int), pLayerSounds->m_aName); @@ -358,7 +358,7 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName) for(const auto &pEnvelope : m_vpEnvelopes) { int Count = pEnvelope->m_vPoints.size(); - mem_copy(&pPoints[PointCount], &pEnvelope->m_vPoints[0], sizeof(CEnvPoint) * Count); + mem_copy(&pPoints[PointCount], pEnvelope->m_vPoints.data(), sizeof(CEnvPoint) * Count); PointCount += Count; } @@ -848,7 +848,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag void *pData = DataFile.GetDataSwapped(pQuadsItem->m_Data); pGroup->AddLayer(pQuads); pQuads->m_vQuads.resize(pQuadsItem->m_NumQuads); - mem_copy(&pQuads->m_vQuads[0], pData, sizeof(CQuad) * pQuadsItem->m_NumQuads); + mem_copy(pQuads->m_vQuads.data(), pData, sizeof(CQuad) * pQuadsItem->m_NumQuads); DataFile.UnloadData(pQuadsItem->m_Data); } else if(pLayerItem->m_Type == LAYERTYPE_SOUNDS) @@ -874,7 +874,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag void *pData = DataFile.GetDataSwapped(pSoundsItem->m_Data); pGroup->AddLayer(pSounds); pSounds->m_vSources.resize(pSoundsItem->m_NumSources); - mem_copy(&pSounds->m_vSources[0], pData, sizeof(CSoundSource) * pSoundsItem->m_NumSources); + mem_copy(pSounds->m_vSources.data(), pData, sizeof(CSoundSource) * pSoundsItem->m_NumSources); DataFile.UnloadData(pSoundsItem->m_Data); } else if(pLayerItem->m_Type == LAYERTYPE_SOUNDS_DEPRECATED) @@ -949,7 +949,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag CMapItemEnvelope *pItem = (CMapItemEnvelope *)DataFile.GetItem(Start + e, nullptr, nullptr); CEnvelope *pEnv = new CEnvelope(pItem->m_Channels); pEnv->m_vPoints.resize(pItem->m_NumPoints); - mem_copy(&pEnv->m_vPoints[0], &pPoints[pItem->m_StartPoint], sizeof(CEnvPoint) * pItem->m_NumPoints); + mem_copy(pEnv->m_vPoints.data(), &pPoints[pItem->m_StartPoint], sizeof(CEnvPoint) * pItem->m_NumPoints); if(pItem->m_aName[0] != -1) // compatibility with old maps IntsToStr(pItem->m_aName, sizeof(pItem->m_aName) / sizeof(int), pEnv->m_aName); m_vpEnvelopes.push_back(pEnv); diff --git a/src/game/editor/layer_quads.cpp b/src/game/editor/layer_quads.cpp index cde6c36d9..67774d21e 100644 --- a/src/game/editor/layer_quads.cpp +++ b/src/game/editor/layer_quads.cpp @@ -23,9 +23,9 @@ void CLayerQuads::Render(bool QuadPicker) Graphics()->TextureSet(m_pEditor->m_Map.m_vpImages[m_Image]->m_Texture); Graphics()->BlendNone(); - m_pEditor->RenderTools()->ForceRenderQuads(&m_vQuads[0], m_vQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor); + m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_OPAQUE, m_pEditor->EnvelopeEval, m_pEditor); Graphics()->BlendNormal(); - m_pEditor->RenderTools()->ForceRenderQuads(&m_vQuads[0], m_vQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor); + m_pEditor->RenderTools()->ForceRenderQuads(m_vQuads.data(), m_vQuads.size(), LAYERRENDERFLAG_TRANSPARENT, m_pEditor->EnvelopeEval, m_pEditor); } CQuad *CLayerQuads::NewQuad(int x, int y, int Width, int Height) From a971a16ed527984dbe147ee882a6f6974669ca2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 10 Jul 2022 21:23:27 +0200 Subject: [PATCH 5/5] Fix readability-duplicate-include --- src/engine/client/backend_sdl.cpp | 1 - src/engine/client/client.cpp | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 361756e56..832a4422e 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -6,7 +6,6 @@ #include -#include #include #include diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 9391c9fe1..021af169a 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -48,8 +48,6 @@ #include #include -#include - #include #include