From fc07014b1c653524b7977ad11d807b00659c3ace Mon Sep 17 00:00:00 2001 From: morfidon <57798071+morfidon@users.noreply.github.com> Date: Tue, 10 Mar 2026 14:15:05 +0100 Subject: [PATCH] Revert "clang formatting fix" This reverts commit fd3d7f28ff80a4c029adf528989d418642d3621a. --- Source/items.cpp | 34 +++++++++++++++++----------------- Source/items.h | 4 ++-- Source/objects.cpp | 20 ++++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Source/items.cpp b/Source/items.cpp index b7b9ad4eb..7cacdbc06 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -442,7 +442,7 @@ bool ItemPlace(Point position) Point GetRandomAvailableItemPosition() { - Point position = { }; + Point position = {}; do { position = Point { GenerateRnd(80), GenerateRnd(80) } + Displacement { 16, 16 }; } while (!ItemPlace(position)); @@ -1950,7 +1950,7 @@ void SpawnOnePremium(Item &premiumItem, int plvl, const Player &player) const int maxCount = 150; const bool unlimited = !gbIsHellfire; // TODO: This could lead to an infinite loop if a suitable item can never be generated for (int count = 0; unlimited || count < maxCount; count++) { - premiumItem = { }; + premiumItem = {}; premiumItem._iSeed = AdvanceRndSeed(); SetRndSeed(premiumItem._iSeed); const _item_indexes itemType = RndPremiumItem(player, plvl / 4, plvl); @@ -2177,7 +2177,7 @@ void CreateMagicItem(Point position, int lvl, ItemType itemType, int imid, int i _item_indexes idx = RndTypeItems(itemType, imid, lvl); while (true) { - item = { }; + item = {}; SetupAllItems(*MyPlayer, item, idx, AdvanceRndSeed(), 2 * lvl, 1, true, delta); TryRandomUniqueItem(item, idx, 2 * lvl, 1, true, delta); SetupItem(item); @@ -2919,7 +2919,7 @@ void InitializeItem(Item &item, _item_indexes itemData) auto &pAllItem = AllItemsList[static_cast(itemData)]; // zero-initialize struct - item = { }; + item = {}; item._itype = pAllItem.itype; item._iCurs = pAllItem.iCurs; @@ -3080,7 +3080,7 @@ int AllocateItem() const int inum = ActiveItems[ActiveItemCount]; ActiveItemCount++; - Items[inum] = { }; + Items[inum] = {}; return inum; } @@ -3333,7 +3333,7 @@ void TryRandomUniqueItem(Item &item, _item_indexes idx, int8_t mLevel, int uper, // Force generate a non-unique item. DiabloGenerator itemGenerator(item._iSeed); do { - item = { }; // Reset item data + item = {}; // Reset item data item.position = itemPos; SetupAllItems(*MyPlayer, item, idx, itemGenerator.advanceRndSeed(), mLevel, uper, onlygood, pregen); } while (item._iMagical == ITEM_QUALITY_UNIQUE); @@ -3384,7 +3384,7 @@ void TryRandomUniqueItem(Item &item, _item_indexes idx, int8_t mLevel, int uper, // Force generate items until we find a uid match. DiabloGenerator itemGenerator(item._iSeed); do { - item = { }; // Reset item data + item = {}; // Reset item data item.position = itemPos; // Set onlygood = true, to always get the required item base level for the unique. SetupAllItems(*MyPlayer, item, idx, itemGenerator.advanceRndSeed(), targetLvl, uper, true, pregen); @@ -3392,7 +3392,7 @@ void TryRandomUniqueItem(Item &item, _item_indexes idx, int8_t mLevel, int uper, } else { // Recreate the item with new offset, this creates the desired unique item but is not reverse compatible. const int seed = item._iSeed; - item = { }; // Reset item data + item = {}; // Reset item data item.position = itemPos; SetupAllItems(*MyPlayer, item, idx, seed, mLevel, uper, onlygood, pregen, uidOffset); item.dwBuff |= (uidOffset << 1) & CF_UIDOFFSET; @@ -4034,13 +4034,13 @@ bool DoOil(Player &player, int cii) return _(/*xgettext:no-c-format*/ "hit steals 3% mana"); if (HasAnyOf(item._iFlags, ItemSpecialEffect::StealMana5)) return _(/*xgettext:no-c-format*/ "hit steals 5% mana"); - return { }; + return {}; case IPL_STEALLIFE: if (HasAnyOf(item._iFlags, ItemSpecialEffect::StealLife3)) return _(/*xgettext:no-c-format*/ "hit steals 3% life"); if (HasAnyOf(item._iFlags, ItemSpecialEffect::StealLife5)) return _(/*xgettext:no-c-format*/ "hit steals 5% life"); - return { }; + return {}; case IPL_TARGAC: return _("penetrates target's armor"); case IPL_FASTATTACK: @@ -4427,7 +4427,7 @@ void SpawnSmith(int lvl) while (SmithItems.size() < iCnt) { Item newItem; do { - newItem = { }; + newItem = {}; newItem._iSeed = AdvanceRndSeed(); SetRndSeed(newItem._iSeed); const _item_indexes itemData = RndSmithItem(*MyPlayer, lvl); @@ -4457,7 +4457,7 @@ void SpawnPremium(const Player &player) while (PremiumItems.size() < maxItems) { int plvl = PremiumItemLevel + (gbIsHellfire ? itemLevelAddHf[PremiumItems.size()] : itemLevelAdd[PremiumItems.size()]); - Item item = { }; + Item item = {}; SpawnOnePremium(item, plvl, player); PremiumItems.push_back(item); } @@ -4495,7 +4495,7 @@ void SpawnWitch(int lvl) WitchItems.clear(); for (int i = 0; i < itemCount; i++) { - Item item = { }; + Item item = {}; if (i < PinnedItemCount) { item._iSeed = AdvanceRndSeed(); @@ -4524,7 +4524,7 @@ void SpawnWitch(int lvl) } do { - item = { }; + item = {}; item._iSeed = AdvanceRndSeed(); SetRndSeed(item._iSeed); const _item_indexes itemData = RndWitchItem(*MyPlayer, lvl); @@ -4567,7 +4567,7 @@ void SpawnBoy(int lvl) return; do { keepgoing = false; - BoyItem = { }; + BoyItem = {}; BoyItem._iSeed = AdvanceRndSeed(); SetRndSeed(BoyItem._iSeed); const _item_indexes itype = RndBoyItem(*MyPlayer, lvl); @@ -4671,7 +4671,7 @@ void SpawnHealer(int lvl) HealerItems.clear(); for (size_t i = 0; i < itemCount; i++) { - Item item = { }; + Item item = {}; if (i < PinnedItemCount || (gbIsMultiplayer && i < NumHealerPinnedItemsMp)) { item._iSeed = AdvanceRndSeed(); @@ -4731,7 +4731,7 @@ void CreateSpellBook(Point position, SpellID ispell, bool sendmsg, bool delta) auto &item = Items[ii]; while (true) { - item = { }; + item = {}; SetupAllItems(*MyPlayer, item, idx, AdvanceRndSeed(), 2 * lvl, 1, true, delta); SetupItem(item); if (item._iMiscId == IMISC_BOOK && item._iSpell == ispell) diff --git a/Source/items.h b/Source/items.h index fb343f8b5..3695fe0c7 100644 --- a/Source/items.h +++ b/Source/items.h @@ -201,8 +201,8 @@ struct Item { bool _iPostDraw = false; bool _iIdentified = false; item_quality _iMagical = ITEM_QUALITY_NORMAL; - char _iName[ItemNameLength] = { }; - char _iIName[ItemNameLength] = { }; + char _iName[ItemNameLength] = {}; + char _iIName[ItemNameLength] = {}; item_equip_type _iLoc = ILOC_NONE; item_class _iClass = ICLASS_NONE; uint8_t _iCurs = 0; diff --git a/Source/objects.cpp b/Source/objects.cpp index b202a0a5c..54c7d342e 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -308,7 +308,7 @@ std::optional GetRandomObjectPosition(Displacement standoff) if (CanPlaceRandomObject(position, standoff)) return position; } - return { }; + return {}; } void InitRndLocObj5x5(int min, int max, _object_id objtype) @@ -325,7 +325,7 @@ void InitRndLocObj5x5(int min, int max, _object_id objtype) void ClrAllObjects() { for (Object &object : Objects) { - object = { }; + object = {}; } ActiveObjectCount = 0; for (int i = 0; i < MAXOBJECTS; i++) { @@ -556,7 +556,7 @@ void AddChestTraps() } } -void LoadMapObjects(const char *path, Point start, WorldTileRectangle mapRange = { }, int leveridx = 0) +void LoadMapObjects(const char *path, Point start, WorldTileRectangle mapRange = {}, int leveridx = 0) { LoadingMapObjects = true; @@ -1269,7 +1269,7 @@ void AddObjectLight(Object &object) return; } - DoLighting(object.position, radius, { }); + DoLighting(object.position, radius, {}); if (LoadingMapObjects) { DoUnLight(object.position, radius); UpdateLighting = true; @@ -1300,7 +1300,7 @@ void AddShrine(Object &shrine) shrine._oPreFlag = true; const int shrineCount = gbIsHellfire ? NumberOfShrineTypes : 26; - bool slist[NumberOfShrineTypes] = { }; + bool slist[NumberOfShrineTypes] = {}; for (int i = 0; i < shrineCount; i++) { bool isShrineAvailable = true; @@ -1846,7 +1846,7 @@ void OperateBook(Player &player, Object &book, bool sendmsg) } if (setlevel && setlvlnum == SL_VILEBETRAYER) { - Point target { }; + Point target {}; if (book.position == Point { 26, 45 }) { target = { 27, 29 }; } else if (book.position == Point { 45, 46 }) { @@ -3677,7 +3677,7 @@ bool IsItemBlockingObjectAtPosition(Point position) tl::expected LoadLevelObjects(uint16_t filesWidths[65]) { if (HeadlessMode) - return { }; + return {}; for (const ObjectData objectData : AllObjects) { if (leveltype == objectData.olvltype) { @@ -3696,12 +3696,12 @@ tl::expected LoadLevelObjects(uint16_t filesWidths[65]) ASSIGN_OR_RETURN(pObjCels[numobjfiles], LoadCelWithStatus(filestr, filesWidths[i])); numobjfiles++; } - return { }; + return {}; } tl::expected InitObjectGFX() { - uint16_t filesWidths[65] = { }; + uint16_t filesWidths[65] = {}; if (IsAnyOf(currlevel, 4, 8, 12)) { for (const auto id : { OBJ_STORYBOOK, OBJ_STORYCANDLE }) { @@ -3964,7 +3964,7 @@ void InitObjects() void SetMapObjects(const uint16_t *dunData, int startx, int starty) { - uint16_t filesWidths[65] = { }; + uint16_t filesWidths[65] = {}; ClrAllObjects();