Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarInput.cpp
diff options
context:
space:
mode:
authorKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 16:55:19 +0100
committerKai Blaschke <kai.blaschke@kb-dev.net>2024-02-19 16:55:19 +0100
commit431a9c00a56cf4c603be1cf5f773b193621d8150 (patch)
tree95843aeea9fb6dc18279ee05ff6961f40b19798f /source/game/StarInput.cpp
parent30e1871d3f44629e00a1f66d8164e3e62c7f889f (diff)
Fixed a huge amount of Clang warnings
On Linux and macOS, using Clang to compile OpenStarbound produces about 400 MB worth of warnings during the build, making the compiler output unreadable and slowing the build down considerably. 99% of the warnings were unqualified uses of std::move and std::forward, which are now all properly qualified. Fixed a few other minor warnings about non-virtual destructors and some uses of std::move preventing copy elision on temporary objects. Most remaining warnings are now unused parameters.
Diffstat (limited to 'source/game/StarInput.cpp')
-rw-r--r--source/game/StarInput.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/source/game/StarInput.cpp b/source/game/StarInput.cpp
index 57899bf..8dcf8e9 100644
--- a/source/game/StarInput.cpp
+++ b/source/game/StarInput.cpp
@@ -48,7 +48,7 @@ Json keyModsToJson(KeyMod mod) {
if (bool(mod & KeyMod::AltGr )) array.emplace_back("AltGr" );
if (bool(mod & KeyMod::Scroll)) array.emplace_back("Scroll");
- return array.empty() ? Json() : move(array);
+ return array.empty() ? Json() : std::move(array);
}
// Optional pointer argument to output calculated priority
@@ -146,19 +146,19 @@ Input::Bind Input::bindFromJson(Json const& json) {
KeyBind keyBind;
keyBind.key = KeyNames.getLeft(value.toString());
keyBind.mods = keyModsFromJson(json.getArray("mods", {}), &keyBind.priority);
- bind = move(keyBind);
+ bind = std::move(keyBind);
}
else if (type == "mouse") {
MouseBind mouseBind;
mouseBind.button = MouseButtonNames.getLeft(value.toString());
mouseBind.mods = keyModsFromJson(json.getArray("mods", {}), &mouseBind.priority);
- bind = move(mouseBind);
+ bind = std::move(mouseBind);
}
else if (type == "controller") {
ControllerBind controllerBind;
controllerBind.button = ControllerButtonNames.getLeft(value.toString());
controllerBind.controller = json.getUInt("controller", 0);
- bind = move(controllerBind);
+ bind = std::move(controllerBind);
}
return bind;
@@ -171,8 +171,8 @@ Json Input::bindToJson(Bind const& bind) {
{"value", KeyNames.getRight(keyBind->key)}
}; // don't want empty mods to exist as null entry
if (auto mods = keyModsToJson(keyBind->mods))
- obj.emplace("mods", move(mods));
- return move(obj);
+ obj.emplace("mods", std::move(mods));
+ return std::move(obj);
}
else if (auto mouseBind = bind.ptr<MouseBind>()) {
auto obj = JsonObject{
@@ -180,8 +180,8 @@ Json Input::bindToJson(Bind const& bind) {
{"value", MouseButtonNames.getRight(mouseBind->button)}
};
if (auto mods = keyModsToJson(mouseBind->mods))
- obj.emplace("mods", move(mods));
- return move(obj);
+ obj.emplace("mods", std::move(mods));
+ return std::move(obj);
}
else if (auto controllerBind = bind.ptr<ControllerBind>()) {
return JsonObject{
@@ -219,7 +219,7 @@ void Input::BindEntry::updated() {
String path = strf("{}.{}", InputBindingConfigRoot, category->id);
if (!config->getPath(path).isType(Json::Type::Object)) {
config->setPath(path, JsonObject{
- { id, move(array) }
+ { id, std::move(array) }
});
}
else {
@@ -577,7 +577,7 @@ Json Input::getDefaultBinds(String const& categoryId, String const& bindId) {
for (Bind const& bind : bindEntry(categoryId, bindId).defaultBinds)
array.emplace_back(bindToJson(bind));
- return move(array);
+ return std::move(array);
}
Json Input::getBinds(String const& categoryId, String const& bindId) {
@@ -585,7 +585,7 @@ Json Input::getBinds(String const& categoryId, String const& bindId) {
for (Bind const& bind : bindEntry(categoryId, bindId).customBinds)
array.emplace_back(bindToJson(bind));
- return move(array);
+ return std::move(array);
}
void Input::setBinds(String const& categoryId, String const& bindId, Json const& jBinds) {
@@ -595,7 +595,7 @@ void Input::setBinds(String const& categoryId, String const& bindId, Json const&
for (Json const& jBind : jBinds.toArray())
binds.emplace_back(bindFromJson(jBind));
- entry.customBinds = move(binds);
+ entry.customBinds = std::move(binds);
entry.updated();
}