Skip to content

Commit 3fb39da

Browse files
authored
Merge pull request #533 from openmultiplayer/amir/fix-formatting
Fix formatting so CI passes now
2 parents 3f78a69 + 890a69c commit 3fb39da

File tree

13 files changed

+72
-26
lines changed

13 files changed

+72
-26
lines changed

.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AlignConsecutiveAssignments: false
88
AlignConsecutiveBitFields: false
99
AlignConsecutiveDeclarations: false
1010
AlignEscapedNewlines: Right
11-
AlignOperands: DontAlign
11+
AlignOperands: DontAlign
1212
AlignTrailingComments: false
1313
AllowAllArgumentsOnNextLine: true
1414
AllowAllConstructorInitializersOnNextLine: true
@@ -17,7 +17,7 @@ AllowShortEnumsOnASingleLine: true
1717
AllowShortBlocksOnASingleLine: Empty
1818
AllowShortCaseLabelsOnASingleLine: false
1919
AllowShortFunctionsOnASingleLine: All
20-
AllowShortLambdasOnASingleLine: All
20+
AllowShortLambdasOnASingleLine: None
2121
AllowShortIfStatementsOnASingleLine: Never
2222
AllowShortLoopsOnASingleLine: false
2323
AlwaysBreakAfterDefinitionReturnType: None

SDK/include/Impl/events_impl.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ struct DefaultEventDispatcher final : public IEventDispatcher<EventHandlerType>,
152152
// `anyTrue` should still CALL them call, don't short-circuit.
153153
bool ret = false;
154154
std::for_each(handlers.begin(), handlers.end(), typename Storage::template Func<bool, Fn>([&fn, &ret]()
155-
{ ret = fn() || ret; }));
155+
{
156+
ret = fn() || ret;
157+
}));
156158
return ret;
157159
}
158160

@@ -167,7 +169,9 @@ struct DefaultEventDispatcher final : public IEventDispatcher<EventHandlerType>,
167169
{
168170
bool ret = true;
169171
std::for_each(handlers.begin(), handlers.end(), typename Storage::template Func<bool, Fn>([&fn, &ret]()
170-
{ ret = fn() && ret; }));
172+
{
173+
ret = fn() && ret;
174+
}));
171175
return ret;
172176
}
173177

SDK/include/anim.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,15 +2005,19 @@ inline bool animationNameValid(StringView lib, StringView name)
20052005
Impl::String fullName(lib);
20062006
fullName += ':' + Impl::String(name);
20072007
std::transform(fullName.begin(), fullName.end(), fullName.begin(), [](unsigned char c)
2008-
{ return std::toupper(c); });
2008+
{
2009+
return std::toupper(c);
2010+
});
20092011
return AnimationNamesLookup.valid.find(fullName) != AnimationNamesLookup.valid.end();
20102012
}
20112013

20122014
inline bool animationLibraryValid(StringView lib, bool v1_0 = true)
20132015
{
20142016
Impl::String fullName(lib);
20152017
std::transform(fullName.begin(), fullName.end(), fullName.begin(), [](unsigned char c)
2016-
{ return std::toupper(c); });
2018+
{
2019+
return std::toupper(c);
2020+
});
20172021
if (AnimationLibraryLookup.valid.find(fullName) != AnimationLibraryLookup.valid.end())
20182022
{
20192023
return true;

Server/Components/Console/commands.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ ADD_CONSOLE_CMD(rcon_password, [](const String& params, const ConsoleCommandSend
336336
});
337337

338338
ADD_CONSOLE_CMD(echo, [](const String& params, const ConsoleCommandSenderData& sender, ConsoleComponent& console, ICore* core)
339-
{ console.sendMessage(sender, params); });
339+
{
340+
console.sendMessage(sender, params);
341+
});
340342

341343
ADD_CONSOLE_CMD(messageslimit, [](const String& params, const ConsoleCommandSenderData& sender, ConsoleComponent& console, ICore* core)
342344
{

Server/Components/CustomModels/models.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,9 @@ class CustomModelsComponent final : public ICustomModelsComponent, public Player
684684
bool getCustomModelPath(int32_t modelId, StringView& dffPath, StringView& txdPath) const override
685685
{
686686
auto model = std::find_if(storage.begin(), storage.end(), [&](const auto& model)
687-
{ return model->getId() == modelId; });
687+
{
688+
return model->getId() == modelId;
689+
});
688690

689691
if (model != storage.end())
690692
{

Server/Components/LegacyConfig/config_main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,9 @@ class LegacyConfigComponent final : public ILegacyConfigComponent, public Consol
216216
// Try all variants from most specific to least specific.
217217
Impl::String lower(right);
218218
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c)
219-
{ return std::tolower(c); });
219+
{
220+
return std::tolower(c);
221+
});
220222
if (lower == "true")
221223
{
222224
config.setBool(name, true);
@@ -334,7 +336,9 @@ class LegacyConfigComponent final : public ILegacyConfigComponent, public Consol
334336
{
335337
Impl::String lower(right);
336338
std::transform(lower.begin(), lower.end(), lower.begin(), [](unsigned char c)
337-
{ return std::tolower(c); });
339+
{
340+
return std::tolower(c);
341+
});
338342
if (lower == "true" || lower == "1")
339343
{
340344
config.setBool(dictIt->second, true);

Server/Components/Pawn/Manager/Manager.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ class PawnManager : public Singleton<PawnManager>
102102
DynamicArray<Pair<String, std::unique_ptr<PawnScript>>>::const_iterator const findScript(String const& name) const
103103
{
104104
return std::find_if(scripts_.begin(), scripts_.end(), [name](Pair<String, std::unique_ptr<PawnScript>> const& it)
105-
{ return it.first == name; });
105+
{
106+
return it.first == name;
107+
});
106108
}
107109

108110
public:

Server/Components/Pawn/Scripting/Types.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ class ParamCast<DynamicArray<T> const&>
853853
ParamCast(ParamCast<DynamicArray<T> const&> const&) = delete;
854854
ParamCast(ParamCast<DynamicArray<T> const&>&&) = delete;
855855

856-
operator DynamicArray<T> const &()
856+
operator DynamicArray<T> const&()
857857
{
858858
return value_;
859859
}

Server/Components/Pawn/Scripting/Vehicle/Natives.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,9 @@ SCRIPT_API(GetVehicleModelsUsed, int())
416416
auto& vehicle_models = PawnManager::Get()->vehicles->models();
417417

418418
return std::count_if(vehicle_models.begin(), vehicle_models.end(), [](uint8_t model_instances)
419-
{ return model_instances > 0; });
419+
{
420+
return model_instances > 0;
421+
});
420422
}
421423

422424
SCRIPT_API(GetVehiclePaintjob, int(IVehicle& vehicle))

Server/Components/Vehicles/vehicle.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ bool Vehicle::updateFromDriverSync(const VehicleDriverSyncPacket& vehicleSync, I
190190
sirenState = vehicleSync.Siren;
191191
params.siren = sirenState != 0;
192192
static_cast<DefaultEventDispatcher<VehicleEventHandler>&>(pool->getEventDispatcher()).stopAtFalse([&player, this](VehicleEventHandler* handler)
193-
{ return handler->onVehicleSirenStateChange(player, *this, sirenState); });
193+
{
194+
return handler->onVehicleSirenStateChange(player, *this, sirenState);
195+
});
194196
}
195197

196198
if (driver != &player)
@@ -254,7 +256,9 @@ bool Vehicle::updateFromUnoccupied(const VehicleUnoccupiedSyncPacket& unoccupied
254256

255257
UnoccupiedVehicleUpdate data = UnoccupiedVehicleUpdate { unoccupiedSync.SeatID, unoccupiedSync.Position, unoccupiedSync.Velocity };
256258
bool allowed = static_cast<DefaultEventDispatcher<VehicleEventHandler>&>(pool->getEventDispatcher()).stopAtFalse([&player, this, &data](VehicleEventHandler* handler)
257-
{ return handler->onUnoccupiedVehicleUpdate(*this, player, data); });
259+
{
260+
return handler->onUnoccupiedVehicleUpdate(*this, player, data);
261+
});
258262

259263
if (cab && !towing)
260264
{
@@ -325,7 +329,9 @@ bool Vehicle::updateFromTrailerSync(const VehicleTrailerSyncPacket& trailerSync,
325329
*/
326330

327331
bool allowed = static_cast<DefaultEventDispatcher<VehicleEventHandler>&>(pool->getEventDispatcher()).stopAtFalse([&player, this](VehicleEventHandler* handler)
328-
{ return handler->onTrailerUpdate(player, *this); });
332+
{
333+
return handler->onTrailerUpdate(player, *this);
334+
});
329335
return allowed;
330336
}
331337

Server/Components/Vehicles/vehicles_impl.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ class VehiclesComponent final : public IVehiclesComponent, public CoreEventHandl
231231
}
232232

233233
self.eventDispatcher.all([&peer, scmEvent](VehicleEventHandler* handler)
234-
{ handler->onEnterExitModShop(peer, scmEvent.Arg1, scmEvent.Arg2); });
234+
{
235+
handler->onEnterExitModShop(peer, scmEvent.Arg1, scmEvent.Arg2);
236+
});
235237

236238
NetCode::RPC::SCMEvent enterExitRPC;
237239
enterExitRPC.PlayerID = peer.getID();

Server/Source/core_impl.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ struct adl_serializer<std::variant<Args...>>
134134
static void to_json(ordered_json& j, std::variant<Args...> const& v)
135135
{
136136
std::visit([&](auto&& value)
137-
{ j = std::forward<decltype(value)>(value); },
137+
{
138+
j = std::forward<decltype(value)>(value);
139+
},
138140
v);
139141
}
140142
};
@@ -468,7 +470,9 @@ class Config final : public IEarlyConfig
468470
void removeBan(const BanEntry& entry) override
469471
{
470472
auto ban_itr = std::find_if(bans.begin(), bans.end(), [&](const BanEntry& ban)
471-
{ return ban.address == entry.address; });
473+
{
474+
return ban.address == entry.address;
475+
});
472476

473477
if (ban_itr != bans.end())
474478
{
@@ -532,7 +536,9 @@ class Config final : public IEarlyConfig
532536
bool isBanned(const BanEntry& entry) const override
533537
{
534538
return std::any_of(bans.begin(), bans.end(), [&](const BanEntry& ban)
535-
{ return entry.address == ban.address; });
539+
{
540+
return entry.address == ban.address;
541+
});
536542
}
537543

538544
size_t getBansCount() const override

Server/Source/player_pool.hpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,9 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
584584
if (filteredMessage.size() > 1)
585585
{
586586
bool send = self.eventDispatcher.stopAtTrue([&peer, filteredMessage](PlayerEventHandler* handler)
587-
{ return handler->onPlayerCommandText(peer, filteredMessage); });
587+
{
588+
return handler->onPlayerCommandText(peer, filteredMessage);
589+
});
588590

589591
if (!send)
590592
{
@@ -707,7 +709,9 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
707709
const uint32_t oldKeys = player.keys_.keys;
708710
player.keys_.keys = newKeys;
709711
self.eventDispatcher.all([&peer, oldKeys, newKeys](PlayerEventHandler* handler)
710-
{ handler->onPlayerKeyStateChange(peer, newKeys, oldKeys); });
712+
{
713+
handler->onPlayerKeyStateChange(peer, newKeys, oldKeys);
714+
});
711715
}
712716

713717
player.setState(PlayerState_OnFoot);
@@ -778,13 +782,17 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
778782
const uint32_t oldKeys = player.keys_.keys;
779783
player.keys_.keys = newKeys;
780784
self.eventDispatcher.all([&peer, oldKeys, newKeys](PlayerEventHandler* handler)
781-
{ handler->onPlayerKeyStateChange(peer, newKeys, oldKeys); });
785+
{
786+
handler->onPlayerKeyStateChange(peer, newKeys, oldKeys);
787+
});
782788
}
783789
player.setState(PlayerState_Spectating);
784790

785791
TimePoint now = Time::now();
786792
if (self.playerUpdateDispatcher.stopAtFalse([&peer, now](PlayerUpdateEventHandler* handler)
787-
{ return handler->onUpdate(peer, now); }))
793+
{
794+
return handler->onUpdate(peer, now);
795+
}))
788796
{
789797
}
790798
return true;
@@ -1098,7 +1106,9 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
10981106
const uint32_t oldKeys = player.keys_.keys;
10991107
player.keys_.keys = newKeys;
11001108
self.eventDispatcher.all([&peer, oldKeys, newKeys](PlayerEventHandler* handler)
1101-
{ handler->onPlayerKeyStateChange(peer, newKeys, oldKeys); });
1109+
{
1110+
handler->onPlayerKeyStateChange(peer, newKeys, oldKeys);
1111+
});
11021112
}
11031113
player.setState(PlayerState_Driver);
11041114

@@ -1346,7 +1356,9 @@ struct PlayerPool final : public IPlayerPool, public NetworkEventHandler, public
13461356
const uint32_t oldKeys = player.keys_.keys;
13471357
player.keys_.keys = newKeys;
13481358
self.eventDispatcher.all([&peer, oldKeys, newKeys](PlayerEventHandler* handler)
1349-
{ handler->onPlayerKeyStateChange(peer, newKeys, oldKeys); });
1359+
{
1360+
handler->onPlayerKeyStateChange(peer, newKeys, oldKeys);
1361+
});
13501362
}
13511363
player.setState(PlayerState_Passenger);
13521364

0 commit comments

Comments
 (0)