Skip to content

Commit 1e1fe6d

Browse files
committed
clang format
1 parent 2bb7917 commit 1e1fe6d

26 files changed

+85
-99
lines changed

src/controller/controldevice/controller/Controller.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,7 @@ std::shared_ptr<ControllerButton> Controller::GetButtonByBitmask(CONTROLLERBUTTO
175175
return mButtons[bitmask];
176176
}
177177

178-
void Controller::MoveMappingsToDifferentController(std::shared_ptr<Controller> newController,
179-
ShipDeviceType lusIndex) {
178+
void Controller::MoveMappingsToDifferentController(std::shared_ptr<Controller> newController, ShipDeviceType lusIndex) {
180179
// todo: remove this entirely
181180
return;
182181
}

src/controller/controldevice/controller/ControllerButton.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ void ControllerButton::UpdatePad(CONTROLLERBUTTONS_T& padButtons) {
171171
}
172172

173173
bool ControllerButton::HasMappingsForShipDeviceType(ShipDeviceType shipDeviceType) {
174-
return std::any_of(mButtonMappings.begin(), mButtonMappings.end(),
175-
[shipDeviceType](const auto& mapping) { return mapping.second->GetShipDeviceType() == shipDeviceType; });
174+
return std::any_of(mButtonMappings.begin(), mButtonMappings.end(), [shipDeviceType](const auto& mapping) {
175+
return mapping.second->GetShipDeviceType() == shipDeviceType;
176+
});
176177
}
177178

178179
bool ControllerButton::AddOrEditButtonMappingFromRawPress(CONTROLLERBUTTONS_T bitmask, std::string id) {

src/controller/controldevice/controller/ControllerLED.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ bool ControllerLED::AddLEDMappingFromRawPress() {
131131
}
132132

133133
bool ControllerLED::HasMappingsForShipDeviceType(ShipDeviceType shipDeviceType) {
134-
return std::any_of(mLEDMappings.begin(), mLEDMappings.end(),
135-
[shipDeviceType](const auto& mapping) { return mapping.second->GetShipDeviceType() == shipDeviceType; });
134+
return std::any_of(mLEDMappings.begin(), mLEDMappings.end(), [shipDeviceType](const auto& mapping) {
135+
return mapping.second->GetShipDeviceType() == shipDeviceType;
136+
});
136137
}
137138
} // namespace Ship

src/controller/controldevice/controller/ControllerRumble.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ bool ControllerRumble::AddRumbleMappingFromRawPress() {
147147
}
148148

149149
bool ControllerRumble::HasMappingsForShipDeviceType(ShipDeviceType shipDeviceType) {
150-
return std::any_of(mRumbleMappings.begin(), mRumbleMappings.end(),
151-
[shipDeviceType](const auto& mapping) { return mapping.second->GetShipDeviceType() == shipDeviceType; });
150+
return std::any_of(mRumbleMappings.begin(), mRumbleMappings.end(), [shipDeviceType](const auto& mapping) {
151+
return mapping.second->GetShipDeviceType() == shipDeviceType;
152+
});
152153
}
153154
} // namespace Ship

src/controller/controldevice/controller/mapping/ControllerLEDMapping.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ namespace Ship {
1313

1414
class ControllerLEDMapping : public ControllerMapping {
1515
public:
16-
ControllerLEDMapping(ShipDeviceType shipDeviceType, uint8_t portIndex, uint8_t colorSource,
17-
Color_RGB8 savedColor);
16+
ControllerLEDMapping(ShipDeviceType shipDeviceType, uint8_t portIndex, uint8_t colorSource, Color_RGB8 savedColor);
1817
~ControllerLEDMapping();
1918

2019
void SetColorSource(uint8_t colorSource);

src/controller/controldevice/controller/mapping/factories/AxisDirectionMappingFactory.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig(uint8_t portIn
4040
}
4141

4242
return std::make_shared<SDLAxisDirectionToAxisDirectionMapping>(
43-
portIndex, stickIndex, static_cast<Direction>(direction),
44-
sdlControllerAxis, axisDirection);
43+
portIndex, stickIndex, static_cast<Direction>(direction), sdlControllerAxis, axisDirection);
4544
}
4645

4746
if (mappingClass == "SDLButtonToAxisDirectionMapping") {
@@ -60,8 +59,7 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromConfig(uint8_t portIn
6059
}
6160

6261
return std::make_shared<SDLButtonToAxisDirectionMapping>(
63-
portIndex, stickIndex, static_cast<Direction>(direction),
64-
sdlControllerButton);
62+
portIndex, stickIndex, static_cast<Direction>(direction), sdlControllerButton);
6563
}
6664

6765
if (mappingClass == "KeyboardKeyToAxisDirectionMapping") {
@@ -182,8 +180,7 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromSDLInput(uint8_t port
182180
for (auto [lusIndex, controller] : sdlControllers) {
183181
for (int32_t button = SDL_CONTROLLER_BUTTON_A; button < SDL_CONTROLLER_BUTTON_MAX; button++) {
184182
if (SDL_GameControllerGetButton(controller, static_cast<SDL_GameControllerButton>(button))) {
185-
mapping = std::make_shared<SDLButtonToAxisDirectionMapping>(portIndex, stickIndex, direction,
186-
button);
183+
mapping = std::make_shared<SDLButtonToAxisDirectionMapping>(portIndex, stickIndex, direction, button);
187184
break;
188185
}
189186
}
@@ -206,8 +203,8 @@ AxisDirectionMappingFactory::CreateAxisDirectionMappingFromSDLInput(uint8_t port
206203
continue;
207204
}
208205

209-
mapping = std::make_shared<SDLAxisDirectionToAxisDirectionMapping>(portIndex, stickIndex,
210-
direction, axis, axisDirection);
206+
mapping = std::make_shared<SDLAxisDirectionToAxisDirectionMapping>(portIndex, stickIndex, direction, axis,
207+
axisDirection);
211208
break;
212209
}
213210
}

src/controller/controldevice/controller/mapping/factories/ButtonMappingFactory.cpp

+26-32
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ std::shared_ptr<ControllerButtonMapping> ButtonMappingFactory::CreateButtonMappi
4040
return nullptr;
4141
}
4242

43-
return std::make_shared<SDLButtonToButtonMapping>(portIndex,
44-
bitmask, sdlControllerButton);
43+
return std::make_shared<SDLButtonToButtonMapping>(portIndex, bitmask, sdlControllerButton);
4544
}
4645

4746
if (mappingClass == "SDLAxisDirectionToButtonMapping") {
@@ -59,8 +58,7 @@ std::shared_ptr<ControllerButtonMapping> ButtonMappingFactory::CreateButtonMappi
5958
return nullptr;
6059
}
6160

62-
return std::make_shared<SDLAxisDirectionToButtonMapping>(
63-
portIndex, bitmask, sdlControllerAxis, axisDirection);
61+
return std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, bitmask, sdlControllerAxis, axisDirection);
6462
}
6563

6664
if (mappingClass == "KeyboardKeyToButtonMapping") {
@@ -154,66 +152,63 @@ ButtonMappingFactory::CreateDefaultKeyboardButtonMappings(uint8_t portIndex, CON
154152
}
155153

156154
std::vector<std::shared_ptr<ControllerButtonMapping>>
157-
ButtonMappingFactory::CreateDefaultSDLButtonMappings(uint8_t portIndex,
158-
CONTROLLERBUTTONS_T bitmask) {
155+
ButtonMappingFactory::CreateDefaultSDLButtonMappings(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask) {
159156
std::vector<std::shared_ptr<ControllerButtonMapping>> mappings;
160157

161158
switch (bitmask) {
162159
case BTN_A:
163-
mappings.push_back(
164-
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_A, SDL_CONTROLLER_BUTTON_A));
160+
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_A, SDL_CONTROLLER_BUTTON_A));
165161
break;
166162
case BTN_B:
167-
mappings.push_back(
168-
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_B, SDL_CONTROLLER_BUTTON_B));
163+
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_B, SDL_CONTROLLER_BUTTON_B));
169164
break;
170165
case BTN_L:
171-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_L,
172-
SDL_CONTROLLER_BUTTON_LEFTSHOULDER));
166+
mappings.push_back(
167+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_L, SDL_CONTROLLER_BUTTON_LEFTSHOULDER));
173168
break;
174169
case BTN_R:
175-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_R,
170+
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_R,
176171
SDL_CONTROLLER_AXIS_TRIGGERRIGHT, 1));
177172
break;
178173
case BTN_Z:
179-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_Z,
174+
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_Z,
180175
SDL_CONTROLLER_AXIS_TRIGGERLEFT, 1));
181176
break;
182177
case BTN_START:
183-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_START,
184-
SDL_CONTROLLER_BUTTON_START));
178+
mappings.push_back(
179+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_START, SDL_CONTROLLER_BUTTON_START));
185180
break;
186181
case BTN_CUP:
187-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_CUP,
188-
SDL_CONTROLLER_AXIS_RIGHTY, -1));
182+
mappings.push_back(
183+
std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_CUP, SDL_CONTROLLER_AXIS_RIGHTY, -1));
189184
break;
190185
case BTN_CDOWN:
191-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_CDOWN,
192-
SDL_CONTROLLER_AXIS_RIGHTY, 1));
186+
mappings.push_back(
187+
std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_CDOWN, SDL_CONTROLLER_AXIS_RIGHTY, 1));
193188
break;
194189
case BTN_CLEFT:
195-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_CLEFT,
190+
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_CLEFT,
196191
SDL_CONTROLLER_AXIS_RIGHTX, -1));
197192
break;
198193
case BTN_CRIGHT:
199-
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>( portIndex, BTN_CRIGHT,
194+
mappings.push_back(std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, BTN_CRIGHT,
200195
SDL_CONTROLLER_AXIS_RIGHTX, 1));
201196
break;
202197
case BTN_DUP:
203-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_DUP,
204-
SDL_CONTROLLER_BUTTON_DPAD_UP));
198+
mappings.push_back(
199+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_DUP, SDL_CONTROLLER_BUTTON_DPAD_UP));
205200
break;
206201
case BTN_DDOWN:
207-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_DDOWN,
208-
SDL_CONTROLLER_BUTTON_DPAD_DOWN));
202+
mappings.push_back(
203+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_DDOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN));
209204
break;
210205
case BTN_DLEFT:
211-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_DLEFT,
212-
SDL_CONTROLLER_BUTTON_DPAD_LEFT));
206+
mappings.push_back(
207+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_DLEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT));
213208
break;
214209
case BTN_DRIGHT:
215-
mappings.push_back(std::make_shared<SDLButtonToButtonMapping>( portIndex, BTN_DRIGHT,
216-
SDL_CONTROLLER_BUTTON_DPAD_RIGHT));
210+
mappings.push_back(
211+
std::make_shared<SDLButtonToButtonMapping>(portIndex, BTN_DRIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT));
217212
break;
218213
}
219214

@@ -269,8 +264,7 @@ ButtonMappingFactory::CreateButtonMappingFromSDLInput(uint8_t portIndex, CONTROL
269264
continue;
270265
}
271266

272-
mapping =
273-
std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, bitmask, axis, axisDirection);
267+
mapping = std::make_shared<SDLAxisDirectionToButtonMapping>(portIndex, bitmask, axis, axisDirection);
274268
break;
275269
}
276270
}

src/controller/controldevice/controller/mapping/factories/GyroMappingFactory.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ std::shared_ptr<ControllerGyroMapping> GyroMappingFactory::CreateGyroMappingFrom
3737
float neutralYaw = CVarGetFloat(StringHelper::Sprintf("%s.NeutralYaw", mappingCvarKey.c_str()).c_str(), 0.0f);
3838
float neutralRoll = CVarGetFloat(StringHelper::Sprintf("%s.NeutralRoll", mappingCvarKey.c_str()).c_str(), 0.0f);
3939

40-
return std::make_shared<SDLGyroMapping>(portIndex, sensitivity,
41-
neutralPitch, neutralYaw, neutralRoll);
40+
return std::make_shared<SDLGyroMapping>(portIndex, sensitivity, neutralPitch, neutralYaw, neutralRoll);
4241
}
4342

4443
return nullptr;

src/controller/controldevice/controller/mapping/factories/LEDMappingFactory.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ std::shared_ptr<ControllerLEDMapping> LEDMappingFactory::CreateLEDMappingFromCon
3535
return nullptr;
3636
}
3737

38-
return std::make_shared<SDLLEDMapping>(portIndex, colorSource,
39-
savedColor);
38+
return std::make_shared<SDLLEDMapping>(portIndex, colorSource, savedColor);
4039
}
4140

4241
return nullptr;

src/controller/controldevice/controller/mapping/factories/RumbleMappingFactory.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ std::shared_ptr<ControllerRumbleMapping> RumbleMappingFactory::CreateRumbleMappi
3737
return nullptr;
3838
}
3939

40-
return std::make_shared<SDLRumbleMapping>(portIndex,
41-
lowFrequencyIntensityPercentage, highFrequencyIntensityPercentage);
40+
return std::make_shared<SDLRumbleMapping>(portIndex, lowFrequencyIntensityPercentage,
41+
highFrequencyIntensityPercentage);
4242
}
4343

4444
return nullptr;
@@ -56,8 +56,7 @@ RumbleMappingFactory::CreateDefaultSDLRumbleMappings(ShipDeviceType shipDeviceTy
5656
}
5757

5858
std::vector<std::shared_ptr<ControllerRumbleMapping>> mappings = { std::make_shared<SDLRumbleMapping>(
59-
portIndex, DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE,
60-
DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE) };
59+
portIndex, DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE, DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE) };
6160

6261
return mappings;
6362
}
@@ -94,9 +93,8 @@ std::shared_ptr<ControllerRumbleMapping> RumbleMappingFactory::CreateRumbleMappi
9493
for (auto [lusIndex, controller] : sdlControllersWithRumble) {
9594
for (int32_t button = SDL_CONTROLLER_BUTTON_A; button < SDL_CONTROLLER_BUTTON_MAX; button++) {
9695
if (SDL_GameControllerGetButton(controller, static_cast<SDL_GameControllerButton>(button))) {
97-
mapping =
98-
std::make_shared<SDLRumbleMapping>(portIndex, DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE,
99-
DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE);
96+
mapping = std::make_shared<SDLRumbleMapping>(portIndex, DEFAULT_LOW_FREQUENCY_RUMBLE_PERCENTAGE,
97+
DEFAULT_HIGH_FREQUENCY_RUMBLE_PERCENTAGE);
10098
break;
10199
}
102100
}

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAnyMapping.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
#include "window/gui/IconsFontAwesome4.h"
55

66
namespace Ship {
7-
SDLAxisDirectionToAnyMapping::SDLAxisDirectionToAnyMapping(int32_t sdlControllerAxis,
8-
int32_t axisDirection)
7+
SDLAxisDirectionToAnyMapping::SDLAxisDirectionToAnyMapping(int32_t sdlControllerAxis, int32_t axisDirection)
98
: ControllerInputMapping(ShipDeviceType::SDLGamepad), SDLMapping() {
109
mControllerAxis = static_cast<SDL_GameControllerAxis>(sdlControllerAxis);
1110
mAxisDirection = static_cast<AxisDirection>(axisDirection);

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToAxisDirectionMapping.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ namespace Ship {
55
class SDLAxisDirectionToAxisDirectionMapping final : public ControllerAxisDirectionMapping,
66
public SDLAxisDirectionToAnyMapping {
77
public:
8-
SDLAxisDirectionToAxisDirectionMapping(uint8_t portIndex, StickIndex stickIndex,
9-
Direction direction, int32_t sdlControllerAxis, int32_t axisDirection);
8+
SDLAxisDirectionToAxisDirectionMapping(uint8_t portIndex, StickIndex stickIndex, Direction direction,
9+
int32_t sdlControllerAxis, int32_t axisDirection);
1010
float GetNormalizedAxisDirectionValue() override;
1111
std::string GetAxisDirectionMappingId() override;
1212
int8_t GetMappingType() override;

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include "Context.h"
77

88
namespace Ship {
9-
SDLAxisDirectionToButtonMapping::SDLAxisDirectionToButtonMapping(uint8_t portIndex,
10-
CONTROLLERBUTTONS_T bitmask, int32_t sdlControllerAxis,
11-
int32_t axisDirection)
12-
: ControllerInputMapping(ShipDeviceType::SDLGamepad), ControllerButtonMapping(ShipDeviceType::SDLGamepad, portIndex, bitmask),
9+
SDLAxisDirectionToButtonMapping::SDLAxisDirectionToButtonMapping(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask,
10+
int32_t sdlControllerAxis, int32_t axisDirection)
11+
: ControllerInputMapping(ShipDeviceType::SDLGamepad),
12+
ControllerButtonMapping(ShipDeviceType::SDLGamepad, portIndex, bitmask),
1313
SDLAxisDirectionToAnyMapping(sdlControllerAxis, axisDirection) {
1414
}
1515

src/controller/controldevice/controller/mapping/sdl/SDLAxisDirectionToButtonMapping.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace Ship {
55
class SDLAxisDirectionToButtonMapping final : public ControllerButtonMapping, public SDLAxisDirectionToAnyMapping {
66
public:
7-
SDLAxisDirectionToButtonMapping(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask,
8-
int32_t sdlControllerAxis, int32_t axisDirection);
7+
SDLAxisDirectionToButtonMapping(uint8_t portIndex, CONTROLLERBUTTONS_T bitmask, int32_t sdlControllerAxis,
8+
int32_t axisDirection);
99
void UpdatePad(CONTROLLERBUTTONS_T& padButtons) override;
1010
int8_t GetMappingType() override;
1111
std::string GetButtonMappingId() override;

src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
#define MAX_SDL_RANGE (float)INT16_MAX
99

1010
namespace Ship {
11-
SDLButtonToAxisDirectionMapping::SDLButtonToAxisDirectionMapping(uint8_t portIndex,
12-
StickIndex stickIndex, Direction direction,
13-
int32_t sdlControllerButton)
11+
SDLButtonToAxisDirectionMapping::SDLButtonToAxisDirectionMapping(uint8_t portIndex, StickIndex stickIndex,
12+
Direction direction, int32_t sdlControllerButton)
1413
: ControllerInputMapping(ShipDeviceType::SDLGamepad),
1514
ControllerAxisDirectionMapping(ShipDeviceType::SDLGamepad, portIndex, stickIndex, direction),
1615
SDLButtonToAnyMapping(sdlControllerButton) {

src/controller/controldevice/controller/mapping/sdl/SDLButtonToAxisDirectionMapping.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace Ship {
55
class SDLButtonToAxisDirectionMapping final : public ControllerAxisDirectionMapping, public SDLButtonToAnyMapping {
66
public:
7-
SDLButtonToAxisDirectionMapping(uint8_t portIndex, StickIndex stickIndex,
8-
Direction direction, int32_t sdlControllerButton);
7+
SDLButtonToAxisDirectionMapping(uint8_t portIndex, StickIndex stickIndex, Direction direction,
8+
int32_t sdlControllerButton);
99
float GetNormalizedAxisDirectionValue() override;
1010
std::string GetAxisDirectionMappingId() override;
1111
int8_t GetMappingType() override;

0 commit comments

Comments
 (0)