input_common/input_mapping: Simplify UUID validity checks

Makes the checks a little more intuitive to read and doesn't construct
an extra UUID instance
This commit is contained in:
Lioncash 2022-01-24 11:48:59 -05:00
parent 0849be094e
commit 187c9d7e33

View File

@ -56,7 +56,7 @@ void MappingFactory::StopMapping() {
void MappingFactory::RegisterButton(const MappingData& data) { void MappingFactory::RegisterButton(const MappingData& data) {
Common::ParamPackage new_input; Common::ParamPackage new_input;
new_input.Set("engine", data.engine); new_input.Set("engine", data.engine);
if (data.pad.guid != Common::UUID{}) { if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format()); new_input.Set("guid", data.pad.guid.Format());
} }
new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("port", static_cast<int>(data.pad.port));
@ -92,7 +92,7 @@ void MappingFactory::RegisterButton(const MappingData& data) {
void MappingFactory::RegisterStick(const MappingData& data) { void MappingFactory::RegisterStick(const MappingData& data) {
Common::ParamPackage new_input; Common::ParamPackage new_input;
new_input.Set("engine", data.engine); new_input.Set("engine", data.engine);
if (data.pad.guid != Common::UUID{}) { if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format()); new_input.Set("guid", data.pad.guid.Format());
} }
new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("port", static_cast<int>(data.pad.port));
@ -137,7 +137,7 @@ void MappingFactory::RegisterStick(const MappingData& data) {
void MappingFactory::RegisterMotion(const MappingData& data) { void MappingFactory::RegisterMotion(const MappingData& data) {
Common::ParamPackage new_input; Common::ParamPackage new_input;
new_input.Set("engine", data.engine); new_input.Set("engine", data.engine);
if (data.pad.guid != Common::UUID{}) { if (data.pad.guid.IsValid()) {
new_input.Set("guid", data.pad.guid.Format()); new_input.Set("guid", data.pad.guid.Format());
} }
new_input.Set("port", static_cast<int>(data.pad.port)); new_input.Set("port", static_cast<int>(data.pad.port));