summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-format4
-rw-r--r--core/config/boolean.cc6
-rw-r--r--core/io/cmdline.cc3
-rw-r--r--core/io/config_map.cc9
-rw-r--r--core/math/constexpr.hh33
-rw-r--r--core/resource/binfile.cc3
-rw-r--r--core/resource/image.cc9
-rw-r--r--core/utils/string.cc9
-rw-r--r--game/client/config/keybind.cc6
-rw-r--r--game/client/entity/player_look.cc3
-rw-r--r--game/client/entity/player_move.cc15
-rw-r--r--game/client/game.cc6
-rw-r--r--game/client/gui/chat.cc3
-rw-r--r--game/client/gui/direct_connection.cc6
-rw-r--r--game/client/gui/language.cc6
-rw-r--r--game/client/gui/main_menu.cc12
-rw-r--r--game/client/gui/play_menu.cc27
-rw-r--r--game/client/gui/settings.cc9
-rw-r--r--game/client/gui/splash.cc3
-rw-r--r--game/client/gui/window_title.cc3
-rw-r--r--game/client/main.cc21
-rw-r--r--game/client/program.cc3
-rw-r--r--game/client/resource/sound_effect.cc6
-rw-r--r--game/client/resource/texture_gui.cc15
-rw-r--r--game/client/session.cc3
-rw-r--r--game/client/sound/sound.cc12
-rw-r--r--game/client/toggles.cc15
-rw-r--r--game/client/world/chunk_mesher.cc33
-rw-r--r--game/client/world/chunk_renderer.cc3
-rw-r--r--game/client/world/player_target.cc3
-rw-r--r--game/client/world/voxel_atlas.cc3
-rw-r--r--game/server/chat.cc3
-rw-r--r--game/server/receive.cc3
-rw-r--r--game/server/sessions.cc15
-rw-r--r--game/server/whitelist.cc3
-rw-r--r--game/server/world/overworld.cc6
-rw-r--r--game/shared/entity/collision.cc12
-rw-r--r--game/shared/entity/stasis.cc3
-rw-r--r--game/shared/game.cc6
-rw-r--r--game/shared/splash.cc3
-rw-r--r--game/shared/threading.cc6
-rw-r--r--game/shared/world/chunk.cc3
-rw-r--r--game/shared/world/dimension.cc9
-rw-r--r--game/shared/world/item_registry.cc9
-rw-r--r--game/shared/world/ray_dda.cc18
-rw-r--r--game/shared/world/voxel_registry.cc12
46 files changed, 268 insertions, 135 deletions
diff --git a/.clang-format b/.clang-format
index e6d043d..499fbac 100644
--- a/.clang-format
+++ b/.clang-format
@@ -63,8 +63,8 @@ BraceWrapping:
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
- BeforeCatch: false
- BeforeElse: false
+ BeforeCatch: true
+ BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
diff --git a/core/config/boolean.cc b/core/config/boolean.cc
index a8d670c..6363271 100644
--- a/core/config/boolean.cc
+++ b/core/config/boolean.cc
@@ -31,7 +31,8 @@ const char* config::Boolean::to_string(bool value)
{
if(value) {
return "true";
- } else {
+ }
+ else {
return "false";
}
}
@@ -40,7 +41,8 @@ bool config::Boolean::from_string(const char* value)
{
if(std::strcmp(value, "false") && !std::strcmp(value, "true")) {
return true;
- } else {
+ }
+ else {
return false;
}
}
diff --git a/core/io/cmdline.cc b/core/io/cmdline.cc
index c43727d..963f67c 100644
--- a/core/io/cmdline.cc
+++ b/core/io/cmdline.cc
@@ -61,7 +61,8 @@ void io::cmdline::insert(const char* option, const char* argument)
{
if(argument == nullptr) {
options.insert_or_assign(option, std::string());
- } else {
+ }
+ else {
options.insert_or_assign(option, argument);
}
}
diff --git a/core/io/config_map.cc b/core/io/config_map.cc
index 7bce1a6..2afd2a8 100644
--- a/core/io/config_map.cc
+++ b/core/io/config_map.cc
@@ -32,7 +32,8 @@ bool io::ConfigMap::load_file(const char* path)
if(comment == std::string::npos) {
kv_string = utils::trim_whitespace(line);
- } else {
+ }
+ else {
kv_string = utils::trim_whitespace(line.substr(0, comment));
}
@@ -109,7 +110,8 @@ const char* io::ConfigMap::get_value(const char* name) const
auto kv_pair = m_values.find(name);
if(kv_pair != m_values.cend()) {
return kv_pair->second->get();
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -125,7 +127,8 @@ const config::IValue* io::ConfigMap::find(const char* name) const
if(kv_pair != m_values.cend()) {
return kv_pair->second;
- } else {
+ }
+ else {
return nullptr;
}
}
diff --git a/core/math/constexpr.hh b/core/math/constexpr.hh
index 3e4fcfa..263a6e8 100644
--- a/core/math/constexpr.hh
+++ b/core/math/constexpr.hh
@@ -46,7 +46,8 @@ constexpr static inline const T math::abs(const T x)
{
if(x < static_cast<T>(0)) {
return -x;
- } else {
+ }
+ else {
return x;
}
}
@@ -64,7 +65,8 @@ constexpr static inline const T math::ceil(const F x)
if(ival < x) {
return ival + static_cast<T>(1);
- } else {
+ }
+ else {
return ival;
}
}
@@ -82,7 +84,8 @@ constexpr static inline const T math::floor(const F x)
if(ival > x) {
return ival - static_cast<T>(1);
- } else {
+ }
+ else {
return ival;
}
}
@@ -92,9 +95,11 @@ constexpr static inline const T math::clamp(const T x, const T min, const T max)
{
if(x < min) {
return min;
- } else if(x > max) {
+ }
+ else if(x > max) {
return max;
- } else {
+ }
+ else {
return x;
}
}
@@ -110,7 +115,8 @@ constexpr static inline const T math::log2(const T x)
{
if(x < 2) {
return 0;
- } else {
+ }
+ else {
return math::log2<T>((x + 1) >> 1) + 1;
}
}
@@ -120,7 +126,8 @@ constexpr static inline const T math::max(const T x, const T y)
{
if(x < y) {
return y;
- } else {
+ }
+ else {
return x;
}
}
@@ -130,7 +137,8 @@ constexpr static inline const T math::min(const T x, const T y)
{
if(x > y) {
return y;
- } else {
+ }
+ else {
return x;
}
}
@@ -143,7 +151,8 @@ constexpr static inline const T math::mod_signed(const T x, const T m)
if(result < T(0)) {
return result + m;
- } else {
+ }
+ else {
return result;
}
}
@@ -174,9 +183,11 @@ constexpr static inline const T math::sign(const F x)
{
if(x < F(0)) {
return T(-1);
- } else if(x > F(0)) {
+ }
+ else if(x > F(0)) {
return T(+1);
- } else {
+ }
+ else {
return T(0);
}
}
diff --git a/core/resource/binfile.cc b/core/resource/binfile.cc
index e17db50..b8e3db8 100644
--- a/core/resource/binfile.cc
+++ b/core/resource/binfile.cc
@@ -39,7 +39,8 @@ void resource::hard_cleanup<BinFile>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [BinFile] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [BinFile] {}", it.first);
}
diff --git a/core/resource/image.cc b/core/resource/image.cc
index 1601703..9ff0206 100644
--- a/core/resource/image.cc
+++ b/core/resource/image.cc
@@ -41,7 +41,8 @@ resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
if(flags & IMAGE_LOAD_FLIP) {
stbi_set_flip_vertically_on_load(true);
- } else {
+ }
+ else {
stbi_set_flip_vertically_on_load(false);
}
@@ -54,7 +55,8 @@ resource_ptr<Image> resource::load<Image>(const char* name, unsigned int flags)
if(flags & IMAGE_LOAD_GRAY) {
new_resource->pixels = stbi_load_from_callbacks(&callbacks, file, &new_resource->size.x, &new_resource->size.y, nullptr, STBI_grey);
- } else {
+ }
+ else {
new_resource->pixels = stbi_load_from_callbacks(
&callbacks, file, &new_resource->size.x, &new_resource->size.y, nullptr, STBI_rgb_alpha);
}
@@ -81,7 +83,8 @@ void resource::hard_cleanup<Image>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [Image] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [Image] {}", it.first);
}
diff --git a/core/utils/string.cc b/core/utils/string.cc
index 5497cec..dd3d567 100644
--- a/core/utils/string.cc
+++ b/core/utils/string.cc
@@ -8,9 +8,11 @@ bool utils::is_whitespace(const std::string& string)
{
if(string.find_first_not_of(WHITESPACE_CHARS) == std::string::npos) {
return true;
- } else if((string.size() == 1) && string[0] == 0x00) {
+ }
+ else if((string.size() == 1) && string[0] == 0x00) {
return true;
- } else {
+ }
+ else {
return string.empty();
}
}
@@ -48,7 +50,8 @@ std::string utils::trim_whitespace(const std::string& string)
if(su == std::string::npos) {
return std::string();
- } else {
+ }
+ else {
return string.substr(su, sv - su + 1);
}
}
diff --git a/game/client/config/keybind.cc b/game/client/config/keybind.cc
index 1cf896c..6bd8ef0 100644
--- a/game/client/config/keybind.cc
+++ b/game/client/config/keybind.cc
@@ -153,7 +153,8 @@ config::KeyBind::KeyBind(int default_value)
if(default_value == DEBUG_KEY) {
m_glfw_keycode = GLFW_KEY_UNKNOWN;
m_name = UNKNOWN_KEY_NAME;
- } else {
+ }
+ else {
m_glfw_keycode = default_value;
m_name = get_key_name(default_value);
}
@@ -183,7 +184,8 @@ void config::KeyBind::set_key(int keycode)
if(keycode == DEBUG_KEY) {
m_glfw_keycode = GLFW_KEY_UNKNOWN;
m_name = UNKNOWN_KEY_NAME;
- } else {
+ }
+ else {
m_glfw_keycode = keycode;
m_name = get_key_name(keycode);
}
diff --git a/game/client/entity/player_look.cc b/game/client/entity/player_look.cc
index 9326af2..c633922 100644
--- a/game/client/entity/player_look.cc
+++ b/game/client/entity/player_look.cc
@@ -142,7 +142,8 @@ void entity::player_look::update_late(void)
if(!globals::gui_screen && session::is_ingame()) {
glfwSetInputMode(globals::window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwSetInputMode(globals::window, GLFW_RAW_MOUSE_MOTION, mouse_raw_input.get_value());
- } else {
+ }
+ else {
glfwSetInputMode(globals::window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
glfwSetInputMode(globals::window, GLFW_RAW_MOUSE_MOTION, false);
}
diff --git a/game/client/entity/player_move.cc b/game/client/entity/player_move.cc
index 65e8669..4b40efb 100644
--- a/game/client/entity/player_move.cc
+++ b/game/client/entity/player_move.cc
@@ -180,7 +180,8 @@ void entity::player_move::fixed_update(void)
if(new_speed > 0.01f) {
footsteps_distance += globals::fixed_frametime * new_speed;
- } else {
+ }
+ else {
footsteps_distance = 0.0f;
}
@@ -191,7 +192,8 @@ void entity::player_move::fixed_update(void)
footsteps_distance = 0.0f;
}
- } else {
+ }
+ else {
auto new_velocity = pm_air_move(wishdir, velocity_horizontal);
velocity.value.x = new_velocity.x;
velocity.value.z = new_velocity.z;
@@ -220,11 +222,13 @@ void entity::player_move::fixed_update(void)
// No considerable speed increase within
// the precision we use to draw the speedometer
gui::status_lines::set(gui::STATUS_DEBUG, new_speed_text, ImVec4(0.7f, 0.7f, 0.7f, 1.0f), 1.0f);
- } else if(speed_change < 0.0f) {
+ }
+ else if(speed_change < 0.0f) {
// Speed change is negative, we are actively
// slowing down; use the red color for the status line
gui::status_lines::set(gui::STATUS_DEBUG, new_speed_text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f), 1.0f);
- } else {
+ }
+ else {
// Speed change is positive, we are actively
// speeding up; use the green color for the status line
gui::status_lines::set(gui::STATUS_DEBUG, new_speed_text, ImVec4(0.0f, 1.0f, 0.0f, 1.0f), 1.0f);
@@ -258,7 +262,8 @@ void entity::player_move::update_late(void)
movement_direction.x += axis_move_sideways.get_value(io::gamepad::state, io::gamepad::deadzone.get_value());
movement_direction.z -= axis_move_forward.get_value(io::gamepad::state, io::gamepad::deadzone.get_value());
- } else {
+ }
+ else {
if(GLFW_PRESS == glfwGetKey(globals::window, key_move_forward.get_key())) {
movement_direction += DIR_FORWARD<float>;
}
diff --git a/game/client/game.cc b/game/client/game.cc
index 0418236..d5820f4 100644
--- a/game/client/game.cc
+++ b/game/client/game.cc
@@ -512,7 +512,8 @@ void client_game::update(void)
if(session::is_ingame()) {
if(toggles::get(TOGGLE_PM_FLIGHT)) {
globals::dimension->entities.remove<entity::Gravity>(globals::player);
- } else {
+ }
+ else {
globals::dimension->entities.emplace_or_replace<entity::Gravity>(globals::player);
}
}
@@ -574,7 +575,8 @@ void client_game::update_late(void)
if(client_game::vertical_sync.get_value()) {
glfwSwapInterval(1);
- } else {
+ }
+ else {
glfwSwapInterval(0);
}
}
diff --git a/game/client/gui/chat.cc b/game/client/gui/chat.cc
index 3cf0958..8c4ac26 100644
--- a/game/client/gui/chat.cc
+++ b/game/client/gui/chat.cc
@@ -215,7 +215,8 @@ void gui::client_chat::layout(void)
if(globals::gui_screen == GUI_CHAT) {
rect_alpha = 0.75f;
text_alpha = 1.00f;
- } else {
+ }
+ else {
rect_alpha = 0.50f * fadeout;
text_alpha = 1.00f * fadeout;
}
diff --git a/game/client/gui/direct_connection.cc b/game/client/gui/direct_connection.cc
index 8a09e48..0290bd3 100644
--- a/game/client/gui/direct_connection.cc
+++ b/game/client/gui/direct_connection.cc
@@ -55,13 +55,15 @@ static void connect_to_server(void)
if(!parts[0].empty()) {
parsed_hostname = parts[0];
- } else {
+ }
+ else {
parsed_hostname = std::string("localhost");
}
if(parts.size() >= 2) {
parsed_port = math::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
- } else {
+ }
+ else {
parsed_port = protocol::PORT;
}
diff --git a/game/client/gui/language.cc b/game/client/gui/language.cc
index 04906b4..b5bdc7d 100644
--- a/game/client/gui/language.cc
+++ b/game/client/gui/language.cc
@@ -164,7 +164,8 @@ gui::LanguageIterator gui::language::find(const char* ietf)
const auto it = ietf_map.find(ietf);
if(it != ietf_map.cend()) {
return it->second;
- } else {
+ }
+ else {
return manifest.cend();
}
}
@@ -184,7 +185,8 @@ const char* gui::language::resolve(const char* key)
const auto it = language_map.find(key);
if(it != language_map.cend()) {
return it->second.c_str();
- } else {
+ }
+ else {
return key;
}
}
diff --git a/game/client/gui/main_menu.cc b/game/client/gui/main_menu.cc
index 7af1f10..37ee398 100644
--- a/game/client/gui/main_menu.cc
+++ b/game/client/gui/main_menu.cc
@@ -62,7 +62,8 @@ void gui::main_menu::init(void)
if(title->size.x > title->size.y) {
title_aspect = static_cast<float>(title->size.x) / static_cast<float>(title->size.y);
- } else {
+ }
+ else {
title_aspect = static_cast<float>(title->size.y) / static_cast<float>(title->size.x);
}
@@ -89,7 +90,8 @@ void gui::main_menu::layout(void)
if(session::is_ingame()) {
ImGui::Dummy(ImVec2(0.0f, 32.0f * globals::gui_scale));
- } else {
+ }
+ else {
auto reference_height = 0.225f * window_size.y;
auto image_width = math::min(window_size.x, reference_height * title_aspect);
auto image_height = image_width / title_aspect;
@@ -110,7 +112,8 @@ void gui::main_menu::layout(void)
}
ImGui::Spacing();
- } else {
+ }
+ else {
ImGui::SetCursorPosX(button_xpos);
if(ImGui::Button(str_play.c_str(), ImVec2(button_width, 0.0f))) {
@@ -138,7 +141,8 @@ void gui::main_menu::layout(void)
}
ImGui::Spacing();
- } else {
+ }
+ else {
ImGui::SetCursorPosX(button_xpos);
if(ImGui::Button(str_quit.c_str(), ImVec2(button_width, 0.0f))) {
diff --git a/game/client/gui/play_menu.cc b/game/client/gui/play_menu.cc
index 922dd4e..f2a8887 100644
--- a/game/client/gui/play_menu.cc
+++ b/game/client/gui/play_menu.cc
@@ -85,13 +85,15 @@ static void parse_hostname(ServerStatusItem* item, const std::string& hostname)
if(!parts[0].empty()) {
item->hostname = parts[0];
- } else {
+ }
+ else {
item->hostname = std::string("localhost");
}
if(parts.size() >= 2) {
item->port = math::clamp<std::uint16_t>(strtoul(parts[1].c_str(), nullptr, 10), 1024, UINT16_MAX);
- } else {
+ }
+ else {
item->port = protocol::PORT;
}
}
@@ -125,7 +127,8 @@ static void edit_selected_server(void)
if(selected_server->port != protocol::PORT) {
input_hostname = std::format("{}:{}", selected_server->hostname, selected_server->port);
- } else {
+ }
+ else {
input_hostname = selected_server->hostname;
}
@@ -163,7 +166,8 @@ static void on_glfw_key(const io::GlfwKeyEvent& event)
if(editing_server) {
if(adding_server) {
remove_selected_server();
- } else {
+ }
+ else {
input_itemname.clear();
input_hostname.clear();
input_password.clear();
@@ -209,7 +213,8 @@ static void on_bother_response(const gui::BotherResponseEvent& event)
item->max_players = UINT16_MAX;
item->motd = str_status_fail;
item->status = item_status::FAILURE;
- } else {
+ }
+ else {
item->protocol_version = event.protocol_version;
item->num_players = event.num_players;
item->max_players = event.max_players;
@@ -270,7 +275,8 @@ static void layout_server_item(ServerStatusItem* item)
if(item->protocol_version < protocol::VERSION) {
ImGui::TextUnformatted(str_outdated_server.c_str(), str_outdated_server.c_str() + str_outdated_server.size());
- } else {
+ }
+ else {
ImGui::TextUnformatted(str_outdated_client.c_str(), str_outdated_client.c_str() + str_outdated_client.size());
}
@@ -359,7 +365,8 @@ static void layout_servers(void)
for(ServerStatusItem* item : servers_deque) {
if(editing_server && item == selected_server) {
layout_server_edit(item);
- } else {
+ }
+ else {
layout_server_item(item);
}
}
@@ -460,13 +467,15 @@ void gui::play_menu::init(void)
if(parts.size() >= 2) {
item->password = parts[1];
- } else {
+ }
+ else {
item->password = std::string();
}
if(parts.size() >= 3) {
item->name = parts[2].substr(0, MAX_SERVER_ITEM_NAME);
- } else {
+ }
+ else {
item->name = DEFAULT_SERVER_NAME;
}
diff --git a/game/client/gui/settings.cc b/game/client/gui/settings.cc
index 5c6b5eb..034db4c 100644
--- a/game/client/gui/settings.cc
+++ b/game/client/gui/settings.cc
@@ -315,7 +315,8 @@ void SettingValue_InputString::layout(void) const
if(allow_whitespace) {
flags = ImGuiInputTextFlags_AllowTabInput;
- } else {
+ }
+ else {
flags = 0;
}
@@ -379,7 +380,8 @@ void SettingValue_StepperInt::layout(void) const
if(current_value > max_value) {
value->set_value(min_value);
- } else {
+ }
+ else {
value->set_value(current_value);
}
@@ -409,7 +411,8 @@ void SettingValue_StepperUnsigned::layout(void) const
if(current_value > max_value) {
value->set_value(min_value);
- } else {
+ }
+ else {
value->set_value(current_value);
}
diff --git a/game/client/gui/splash.cc b/game/client/gui/splash.cc
index d6615ec..a144f97 100644
--- a/game/client/gui/splash.cc
+++ b/game/client/gui/splash.cc
@@ -61,7 +61,8 @@ void gui::client_splash::init(void)
if(texture) {
if(texture->size.x > texture->size.y) {
texture_aspect = static_cast<float>(texture->size.x) / static_cast<float>(texture->size.y);
- } else {
+ }
+ else {
texture_aspect = static_cast<float>(texture->size.y) / static_cast<float>(texture->size.x);
}
diff --git a/game/client/gui/window_title.cc b/game/client/gui/window_title.cc
index 5a5aca2..91e308f 100644
--- a/game/client/gui/window_title.cc
+++ b/game/client/gui/window_title.cc
@@ -14,7 +14,8 @@ void gui::window_title::update(void)
if(globals::sound_ctx && globals::sound_dev) {
title = std::format("Voxelius {}: {}", project_version_string, splash::get());
- } else {
+ }
+ else {
title = std::format("Voxelius {}: {} [NOSOUND]", project_version_string, splash::get());
}
diff --git a/game/client/main.cc b/game/client/main.cc
index 04ee832..cb3e209 100644
--- a/game/client/main.cc
+++ b/game/client/main.cc
@@ -207,11 +207,13 @@ int main(int argc, char** argv)
// information about buffer usage into the debug callback
static const std::uint32_t ignore_nvidia_131185 = 131185;
glDebugMessageControl(GL_DEBUG_SOURCE_API, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 1, &ignore_nvidia_131185, GL_FALSE);
- } else {
+ }
+ else {
spdlog::warn("glad: nodebug command line parameter found");
spdlog::warn("glad: OpenGL errors will not be logged");
}
- } else {
+ }
+ else {
spdlog::warn("glad: KHR_debug extension not supported");
spdlog::warn("glad: OpenGL errors will not be logged");
}
@@ -256,18 +258,21 @@ int main(int argc, char** argv)
spdlog::warn("client: sound disabled [per command line]");
globals::sound_dev = nullptr;
globals::sound_ctx = nullptr;
- } else {
+ }
+ else {
if(!saladLoadALdefault()) {
spdlog::warn("client: sound disabled [openal loading failed]");
globals::sound_dev = nullptr;
globals::sound_ctx = nullptr;
- } else {
+ }
+ else {
globals::sound_dev = alcOpenDevice(nullptr);
if(globals::sound_dev == nullptr) {
spdlog::warn("client: sound disabled [no device]");
globals::sound_ctx = nullptr;
- } else {
+ }
+ else {
spdlog::info("sound: {}", reinterpret_cast<const char*>(alcGetString(globals::sound_dev, ALC_DEVICE_SPECIFIER)));
globals::sound_ctx = alcCreateContext(globals::sound_dev, nullptr);
@@ -276,7 +281,8 @@ int main(int argc, char** argv)
spdlog::warn("client: sound disabled [context creation failed]");
alcCloseDevice(globals::sound_dev);
globals::sound_dev = nullptr;
- } else {
+ }
+ else {
alcMakeContextCurrent(globals::sound_ctx);
}
}
@@ -340,7 +346,8 @@ int main(int argc, char** argv)
if(globals::fixed_frametime_us == UINT64_MAX) {
globals::fixed_framecount = 0;
globals::fixed_accumulator = 0;
- } else {
+ }
+ else {
globals::fixed_accumulator += globals::window_frametime_us;
globals::fixed_framecount = globals::fixed_accumulator / globals::fixed_frametime_us;
globals::fixed_accumulator %= globals::fixed_frametime_us;
diff --git a/game/client/program.cc b/game/client/program.cc
index 7b908af..17441e6 100644
--- a/game/client/program.cc
+++ b/game/client/program.cc
@@ -30,7 +30,8 @@ static void parse_source(const char* source, std::vector<std::string>& out_lines
out_lines.push_back(std::string());
line_number += 1UL;
- } else {
+ }
+ else {
out_lines.push_back(line);
line_number += 1UL;
}
diff --git a/game/client/resource/sound_effect.cc b/game/client/resource/sound_effect.cc
index e3a0a6a..0d987a5 100644
--- a/game/client/resource/sound_effect.cc
+++ b/game/client/resource/sound_effect.cc
@@ -17,7 +17,8 @@ static drwav_bool32 drwav_seek_physfs(void* file, int offset, drwav_seek_origin
{
if(origin == drwav_seek_origin_current) {
return PHYSFS_seek(reinterpret_cast<PHYSFS_File*>(file), PHYSFS_tell(reinterpret_cast<PHYSFS_File*>(file)) + offset);
- } else {
+ }
+ else {
return PHYSFS_seek(reinterpret_cast<PHYSFS_File*>(file), offset);
}
}
@@ -84,7 +85,8 @@ void resource::hard_cleanup<SoundEffect>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [SoundEffect] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [SoundEffect] {}", it.first);
}
diff --git a/game/client/resource/texture_gui.cc b/game/client/resource/texture_gui.cc
index a931352..971e201 100644
--- a/game/client/resource/texture_gui.cc
+++ b/game/client/resource/texture_gui.cc
@@ -36,25 +36,29 @@ resource_ptr<TextureGUI> resource::load<TextureGUI>(const char* name, unsigned i
if(flags & TEXTURE_GUI_LOAD_CLAMP_S) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- } else {
+ }
+ else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
}
if(flags & TEXTURE_GUI_LOAD_CLAMP_T) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- } else {
+ }
+ else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
if(flags & TEXTURE_GUI_LOAD_LINEAR_MAG) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- } else {
+ }
+ else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
if(flags & TEXTURE_GUI_LOAD_LINEAR_MIN) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- } else {
+ }
+ else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
@@ -75,7 +79,8 @@ void resource::hard_cleanup<TextureGUI>(void)
for(const auto& it : resource_map) {
if(it.second.use_count() > 1L) {
spdlog::warn("resource: zombie resource [TextureGUI] {} [use_count={}]", it.first, it.second.use_count());
- } else {
+ }
+ else {
spdlog::debug("resource: releasing [TextureGUI] {}", it.first);
}
diff --git a/game/client/session.cc b/game/client/session.cc
index d3f4859..521e0c2 100644
--- a/game/client/session.cc
+++ b/game/client/session.cc
@@ -296,7 +296,8 @@ bool session::is_ingame(void)
{
if(globals::dimension) {
return globals::dimension->entities.valid(globals::player);
- } else {
+ }
+ else {
return false;
}
}
diff --git a/game/client/sound/sound.cc b/game/client/sound/sound.cc
index fa3cd19..f3bd5e2 100644
--- a/game/client/sound/sound.cc
+++ b/game/client/sound/sound.cc
@@ -99,7 +99,8 @@ void sound::play_generic(const char* sound, bool looping, float pitch)
{
if(sound) {
sound::play_generic(resource::load<SoundEffect>(sound), looping, pitch);
- } else {
+ }
+ else {
sound::play_generic(static_cast<const char*>(nullptr), looping, pitch);
}
}
@@ -108,7 +109,8 @@ void sound::play_entity(entt::entity entity, const char* sound, bool looping, fl
{
if(sound) {
sound::play_entity(entity, resource::load<SoundEffect>(sound), looping, pitch);
- } else {
+ }
+ else {
sound::play_entity(entity, static_cast<const char*>(nullptr), looping, pitch);
}
}
@@ -117,7 +119,8 @@ void sound::play_player(const char* sound, bool looping, float pitch)
{
if(sound) {
sound::play_player(resource::load<SoundEffect>(sound), looping, pitch);
- } else {
+ }
+ else {
sound::play_player(static_cast<const char*>(nullptr), looping, pitch);
}
}
@@ -126,7 +129,8 @@ void sound::play_ui(const char* sound, bool looping, float pitch)
{
if(sound) {
sound::play_ui(resource::load<SoundEffect>(sound), looping, pitch);
- } else {
+ }
+ else {
sound::play_ui(static_cast<const char*>(nullptr), looping, pitch);
}
}
diff --git a/game/client/toggles.cc b/game/client/toggles.cc
index f5d9561..96c4ae4 100644
--- a/game/client/toggles.cc
+++ b/game/client/toggles.cc
@@ -27,7 +27,8 @@ static void print_toggle_state(const ToggleInfo& info)
if(info.description) {
if(info.is_enabled) {
gui::client_chat::print(std::format("[toggles] {} ON", info.description));
- } else {
+ }
+ else {
gui::client_chat::print(std::format("[toggles] {} OFF", info.description));
}
}
@@ -38,7 +39,8 @@ static void toggle_value(ToggleInfo& info, toggle_type type)
if(info.is_enabled) {
info.is_enabled = false;
globals::dispatcher.trigger(ToggleDisabledEvent { type });
- } else {
+ }
+ else {
info.is_enabled = true;
globals::dispatcher.trigger(ToggleEnabledEvent { type });
}
@@ -124,7 +126,8 @@ void toggles::init_late(void)
for(toggle_type i = 0; i < TOGGLE_COUNT; ++i) {
if(toggle_infos[i].is_enabled) {
globals::dispatcher.trigger(ToggleEnabledEvent { i });
- } else {
+ }
+ else {
globals::dispatcher.trigger(ToggleDisabledEvent { i });
}
}
@@ -134,7 +137,8 @@ bool toggles::get(toggle_type type)
{
if(type < TOGGLE_COUNT) {
return toggle_infos[type].is_enabled;
- } else {
+ }
+ else {
return false;
}
}
@@ -145,7 +149,8 @@ void toggles::set(toggle_type type, bool value)
if(value) {
toggle_infos[type].is_enabled = true;
globals::dispatcher.trigger(ToggleEnabledEvent { type });
- } else {
+ }
+ else {
toggle_infos[type].is_enabled = false;
globals::dispatcher.trigger(ToggleDisabledEvent { type });
}
diff --git a/game/client/world/chunk_mesher.cc b/game/client/world/chunk_mesher.cc
index 5e70626..9f5ce6c 100644
--- a/game/client/world/chunk_mesher.cc
+++ b/game/client/world/chunk_mesher.cc
@@ -43,9 +43,11 @@ static const CachedChunkCoord get_cached_cpos(const chunk_pos& pivot, const chun
if(delta[0]) {
return nx[delta[0] + 1];
- } else if(delta[1]) {
+ }
+ else if(delta[1]) {
return ny[delta[1] + 1];
- } else {
+ }
+ else {
return nz[delta[2] + 1];
}
}
@@ -210,7 +212,8 @@ void GL_MeshingTask::finalize(void)
buffer.handle = 0;
buffer.size = 0;
}
- } else {
+ }
+ else {
if(!buffer.handle) {
glGenBuffers(1, &buffer.handle);
}
@@ -232,7 +235,8 @@ void GL_MeshingTask::finalize(void)
buffer.handle = 0;
buffer.size = 0;
}
- } else {
+ }
+ else {
if(!buffer.handle) {
glGenBuffers(1, &buffer.handle);
}
@@ -264,18 +268,22 @@ bool GL_MeshingTask::vis_test(voxel_id voxel, const world::VoxelInfo* info, cons
if(neighbour == NULL_VOXEL_ID) {
result = true;
- } else if(neighbour == voxel) {
+ }
+ else if(neighbour == voxel) {
result = false;
- } else if(auto neighbour_info = world::voxel_registry::find(neighbour)) {
+ }
+ else if(auto neighbour_info = world::voxel_registry::find(neighbour)) {
if(neighbour_info->blending != info->blending) {
// Voxel types that use blending are semi-transparent;
// this means they're rendered using a different setup
// and they must have visible faces with opaque voxels
result = neighbour_info->blending;
- } else {
+ }
+ else {
result = false;
}
- } else {
+ }
+ else {
result = false;
}
@@ -289,7 +297,8 @@ void GL_MeshingTask::push_quad_a(const world::VoxelInfo* info, const glm::fvec3&
if(info->blending) {
m_quads_b[vtex.cached_plane].push_back(make_chunk_quad(pos, size, facing, vtex.cached_offset, vtex.paths.size()));
- } else {
+ }
+ else {
m_quads_s[vtex.cached_plane].push_back(make_chunk_quad(pos, size, facing, vtex.cached_offset, vtex.paths.size()));
}
}
@@ -303,7 +312,8 @@ void GL_MeshingTask::push_quad_v(
if(info->blending) {
m_quads_b[vtex.cached_plane].push_back(make_chunk_quad(pos, size, facing, vtex.cached_offset + entropy_mod, 0));
- } else {
+ }
+ else {
m_quads_s[vtex.cached_plane].push_back(make_chunk_quad(pos, size, facing, vtex.cached_offset + entropy_mod, 0));
}
}
@@ -338,7 +348,8 @@ void GL_MeshingTask::make_cube(
if(vis & world::VIS_DOWN) {
push_quad_a(info, fpos, fsize, world::voxel_face::CUBE_BOTTOM);
}
- } else {
+ }
+ else {
if(vis & world::VIS_NORTH) {
push_quad_v(info, fpos, fsize, world::voxel_face::CUBE_NORTH, entropy);
}
diff --git a/game/client/world/chunk_renderer.cc b/game/client/world/chunk_renderer.cc
index 0962010..fe3a42e 100644
--- a/game/client/world/chunk_renderer.cc
+++ b/game/client/world/chunk_renderer.cc
@@ -94,7 +94,8 @@ void world::chunk_renderer::render(void)
if(toggles::get(TOGGLE_WIREFRAME)) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- } else {
+ }
+ else {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
diff --git a/game/client/world/player_target.cc b/game/client/world/player_target.cc
index 6da8129..a398eed 100644
--- a/game/client/world/player_target.cc
+++ b/game/client/world/player_target.cc
@@ -48,7 +48,8 @@ void world::player_target::update(void)
world::player_target::normal = voxel_pos();
world::player_target::info = nullptr;
} while(ray.distance < MAX_REACH);
- } else {
+ }
+ else {
world::player_target::voxel = NULL_VOXEL_ID;
world::player_target::coord = voxel_pos();
world::player_target::normal = voxel_pos();
diff --git a/game/client/world/voxel_atlas.cc b/game/client/world/voxel_atlas.cc
index c327deb..1018747 100644
--- a/game/client/world/voxel_atlas.cc
+++ b/game/client/world/voxel_atlas.cc
@@ -131,7 +131,8 @@ GLuint world::voxel_atlas::plane_texture(std::size_t plane_id)
{
if(plane_id < planes.size()) {
return planes[plane_id].gl_texture;
- } else {
+ }
+ else {
return 0;
}
}
diff --git a/game/server/chat.cc b/game/server/chat.cc
index 1634c59..b7826b0 100644
--- a/game/server/chat.cc
+++ b/game/server/chat.cc
@@ -11,7 +11,8 @@ static void on_chat_message_packet(const protocol::ChatMessage& packet)
if(packet.type == protocol::ChatMessage::TEXT_MESSAGE) {
if(auto session = sessions::find(packet.peer)) {
server_chat::broadcast(packet.message.c_str(), session->client_username.c_str());
- } else {
+ }
+ else {
server_chat::broadcast(packet.message.c_str(), packet.sender.c_str());
}
}
diff --git a/game/server/receive.cc b/game/server/receive.cc
index 1945243..296d664 100644
--- a/game/server/receive.cc
+++ b/game/server/receive.cc
@@ -135,7 +135,8 @@ static void on_request_chunk_packet(const protocol::RequestChunk& packet)
response.chunk = packet.cpos;
response.voxels = chunk->get_voxels();
protocol::send(packet.peer, protocol::encode(response));
- } else {
+ }
+ else {
world::worldgen::request_chunk(session, packet.cpos);
}
}
diff --git a/game/server/sessions.cc b/game/server/sessions.cc
index df98c75..7ca0d7c 100644
--- a/game/server/sessions.cc
+++ b/game/server/sessions.cc
@@ -99,7 +99,8 @@ static void on_login_request_packet(const protocol::LoginRequest& packet)
protocol::send(packet.peer, protocol::encode(response));
return;
}
- } else if(packet.password_hash != server_game::password_hash) {
+ }
+ else if(packet.password_hash != server_game::password_hash) {
protocol::Disconnect response;
response.reason = "protocol.password_incorrect";
protocol::send(packet.peer, protocol::encode(response));
@@ -327,7 +328,8 @@ Session* sessions::find(const char* client_username)
const auto it = username_map.find(client_username);
if(it != username_map.cend()) {
return it->second;
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -337,7 +339,8 @@ Session* sessions::find(std::uint16_t client_index)
if(client_index < sessions_vector.size()) {
if(!sessions_vector[client_index].peer) {
return nullptr;
- } else {
+ }
+ else {
return &sessions_vector[client_index];
}
}
@@ -351,7 +354,8 @@ Session* sessions::find(std::uint64_t client_identity)
if(it != identity_map.cend()) {
return it->second;
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -360,7 +364,8 @@ Session* sessions::find(ENetPeer* peer)
{
if(peer != nullptr) {
return reinterpret_cast<Session*>(peer->data);
- } else {
+ }
+ else {
return nullptr;
}
}
diff --git a/game/server/whitelist.cc b/game/server/whitelist.cc
index 2da1bf4..8a858c6 100644
--- a/game/server/whitelist.cc
+++ b/game/server/whitelist.cc
@@ -64,7 +64,8 @@ void whitelist::init_late(void)
// to the global server password; this allows easier adding
// of guest accounts which can later be edited to use a better password
whitelist_map[line] = server_game::password_hash;
- } else {
+ }
+ else {
const auto username = line.substr(0, location);
const auto password = line.substr(location + 1);
whitelist_map[username] = math::crc64(password);
diff --git a/game/server/world/overworld.cc b/game/server/world/overworld.cc
index 3949b77..ff0b6f7 100644
--- a/game/server/world/overworld.cc
+++ b/game/server/world/overworld.cc
@@ -296,7 +296,8 @@ void world::Overworld::generate_surface(const chunk_pos& cpos, VoxelStorage& vox
}
depth += 1U;
- } else {
+ }
+ else {
if(voxels[d_index] == NULL_VOXEL_ID) {
break;
}
@@ -308,7 +309,8 @@ void world::Overworld::generate_surface(const chunk_pos& cpos, VoxelStorage& vox
if(depth < 5U) {
if(depth == 0U) {
voxels[i] = game_voxels::grass;
- } else {
+ }
+ else {
voxels[i] = game_voxels::dirt;
}
}
diff --git a/game/shared/entity/collision.cc b/game/shared/entity/collision.cc
index 190f6e7..454e96a 100644
--- a/game/shared/entity/collision.cc
+++ b/game/shared/entity/collision.cc
@@ -49,7 +49,8 @@ static int vgrid_collide(const world::Dimension* dimension, int d, entity::Colli
ddir = local_pos::value_type(+1);
dmin = lpos_min[d];
dmax = lpos_max[d];
- } else {
+ }
+ else {
ddir = local_pos::value_type(-1);
dmin = lpos_max[d];
dmax = lpos_min[d];
@@ -115,7 +116,8 @@ static int vgrid_collide(const world::Dimension* dimension, int d, entity::Colli
if(move_distance > threshold) {
velocity.value[d] *= -latch_values[d];
- } else {
+ }
+ else {
velocity.value[d] = 0.0f;
}
@@ -154,10 +156,12 @@ void entity::Collision::fixed_update(world::Dimension* dimension)
if(dimension->entities.any_of<entity::Gravity>(entity)) {
if(vertical_move == math::sign<int>(dimension->get_gravity())) {
dimension->entities.emplace_or_replace<entity::Grounded>(entity, entity::Grounded { surface });
- } else {
+ }
+ else {
dimension->entities.remove<entity::Grounded>(entity);
}
- } else {
+ }
+ else {
// The entity cannot be grounded because the component
// setup of said entity should not let it comprehend the
// concept of resting on the ground (it flies around)
diff --git a/game/shared/entity/stasis.cc b/game/shared/entity/stasis.cc
index 10e2e0c..68d8e9d 100644
--- a/game/shared/entity/stasis.cc
+++ b/game/shared/entity/stasis.cc
@@ -12,7 +12,8 @@ void entity::Stasis::fixed_update(world::Dimension* dimension)
for(auto [entity, transform] : view.each()) {
if(dimension->find_chunk(transform.chunk)) {
dimension->entities.remove<entity::Stasis>(entity);
- } else {
+ }
+ else {
dimension->entities.emplace_or_replace<entity::Stasis>(entity);
}
}
diff --git a/game/shared/game.cc b/game/shared/game.cc
index f383397..62eaf13 100644
--- a/game/shared/game.cc
+++ b/game/shared/game.cc
@@ -65,9 +65,11 @@ void shared_game::init(int argc, char** argv)
if(io::cmdline::contains("quiet")) {
logger->set_level(spdlog::level::warn);
- } else if(io::cmdline::contains("verbose")) {
+ }
+ else if(io::cmdline::contains("verbose")) {
logger->set_level(spdlog::level::trace);
- } else {
+ }
+ else {
logger->set_level(default_loglevel);
}
diff --git a/game/shared/splash.cc b/game/shared/splash.cc
index 0cd5f50..1ff3e8f 100644
--- a/game/shared/splash.cc
+++ b/game/shared/splash.cc
@@ -35,7 +35,8 @@ static void splash_init_filename(const char* filename)
while(std::getline(stream, line))
splash_lines.push_back(sanitize_line(line));
splash_random.seed(std::random_device()());
- } else {
+ }
+ else {
splash_lines.push_back(std::format("{}: {}", filename, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())));
splash_random.seed(std::random_device()());
}
diff --git a/game/shared/threading.cc b/game/shared/threading.cc
index 82bcad7..ae3b3ea 100644
--- a/game/shared/threading.cc
+++ b/game/shared/threading.cc
@@ -42,10 +42,12 @@ void threading::init(void)
// Use the maximum available number of concurrent
// hardware threads provided by the implementation
thread_pool_size = num_concurrent_threads;
- } else {
+ }
+ else {
if(num_concurrent_threads) {
thread_pool_size = math::clamp<unsigned int>(std::strtoul(argument, nullptr, 10), 1U, num_concurrent_threads);
- } else {
+ }
+ else {
thread_pool_size = math::max<unsigned int>(std::strtoul(argument, nullptr, 10), 1U);
}
}
diff --git a/game/shared/world/chunk.cc b/game/shared/world/chunk.cc
index 24a8d06..f689fc1 100644
--- a/game/shared/world/chunk.cc
+++ b/game/shared/world/chunk.cc
@@ -21,7 +21,8 @@ voxel_id world::Chunk::get_voxel(const std::size_t index) const
{
if(index >= CHUNK_VOLUME) {
return NULL_VOXEL_ID;
- } else {
+ }
+ else {
return m_voxels[index];
}
}
diff --git a/game/shared/world/dimension.cc b/game/shared/world/dimension.cc
index b5cedad..3389917 100644
--- a/game/shared/world/dimension.cc
+++ b/game/shared/world/dimension.cc
@@ -61,7 +61,8 @@ world::Chunk* world::Dimension::find_chunk(entt::entity entity) const
{
if(chunks.valid(entity)) {
return chunks.get<ChunkComponent>(entity).chunk;
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -72,7 +73,8 @@ world::Chunk* world::Dimension::find_chunk(const chunk_pos& cpos) const
if(it != m_chunkmap.cend()) {
return it->second;
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -112,7 +114,8 @@ voxel_id world::Dimension::get_voxel(const voxel_pos& vpos) const
if(auto chunk = find_chunk(cpos)) {
return chunk->get_voxel(lpos);
- } else {
+ }
+ else {
return NULL_VOXEL_ID;
}
}
diff --git a/game/shared/world/item_registry.cc b/game/shared/world/item_registry.cc
index 3ec3b88..378f0f1 100644
--- a/game/shared/world/item_registry.cc
+++ b/game/shared/world/item_registry.cc
@@ -58,7 +58,8 @@ world::ItemInfoBuilder& world::item_registry::construct(const char* name)
if(it != world::item_registry::builders.cend()) {
return it->second;
- } else {
+ }
+ else {
return world::item_registry::builders.emplace(name, ItemInfoBuilder(name)).first->second;
}
}
@@ -69,7 +70,8 @@ world::ItemInfo* world::item_registry::find(const char* name)
if(it != world::item_registry::names.cend()) {
return world::item_registry::find(it->second);
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -78,7 +80,8 @@ world::ItemInfo* world::item_registry::find(const item_id item)
{
if((item != NULL_ITEM_ID) && (item <= world::item_registry::items.size())) {
return world::item_registry::items[item - 1].get();
- } else {
+ }
+ else {
return nullptr;
}
}
diff --git a/game/shared/world/ray_dda.cc b/game/shared/world/ray_dda.cc
index b12fa48..9f85e6b 100644
--- a/game/shared/world/ray_dda.cc
+++ b/game/shared/world/ray_dda.cc
@@ -40,7 +40,8 @@ void world::RayDDA::reset(
if(direction.x < 0.0f) {
this->side_dist.x = this->delta_dist.x * (start_fpos.x - lpos.x);
this->vstep.x = voxel_pos::value_type(-1);
- } else {
+ }
+ else {
this->side_dist.x = this->delta_dist.x * (lpos.x + 1.0f - start_fpos.x);
this->vstep.x = voxel_pos::value_type(+1);
}
@@ -48,7 +49,8 @@ void world::RayDDA::reset(
if(direction.y < 0.0f) {
this->side_dist.y = this->delta_dist.y * (start_fpos.y - lpos.y);
this->vstep.y = voxel_pos::value_type(-1);
- } else {
+ }
+ else {
this->side_dist.y = this->delta_dist.y * (lpos.y + 1.0f - start_fpos.y);
this->vstep.y = voxel_pos::value_type(+1);
}
@@ -56,7 +58,8 @@ void world::RayDDA::reset(
if(direction.z < 0.0f) {
this->side_dist.z = this->delta_dist.z * (start_fpos.z - lpos.z);
this->vstep.z = voxel_pos::value_type(-1);
- } else {
+ }
+ else {
this->side_dist.z = this->delta_dist.z * (lpos.z + 1.0f - start_fpos.z);
this->vstep.z = voxel_pos::value_type(+1);
}
@@ -76,19 +79,22 @@ voxel_id world::RayDDA::step(void)
distance = side_dist.x;
side_dist.x += delta_dist.x;
vpos.x += vstep.x;
- } else {
+ }
+ else {
vnormal = voxel_pos(0, -vstep.y, 0);
distance = side_dist.y;
side_dist.y += delta_dist.y;
vpos.y += vstep.y;
}
- } else {
+ }
+ else {
if(side_dist.z < side_dist.y) {
vnormal = voxel_pos(0, 0, -vstep.z);
distance = side_dist.z;
side_dist.z += delta_dist.z;
vpos.z += vstep.z;
- } else {
+ }
+ else {
vnormal = voxel_pos(0, -vstep.y, 0);
distance = side_dist.y;
side_dist.y += delta_dist.y;
diff --git a/game/shared/world/voxel_registry.cc b/game/shared/world/voxel_registry.cc
index 2a82445..8deab30 100644
--- a/game/shared/world/voxel_registry.cc
+++ b/game/shared/world/voxel_registry.cc
@@ -114,7 +114,8 @@ voxel_id world::VoxelInfoBuilder::build(void) const
new_info->textures[i].paths = default_texture.paths;
new_info->textures[i].cached_offset = SIZE_MAX;
new_info->textures[i].cached_plane = SIZE_MAX;
- } else {
+ }
+ else {
new_info->textures[i].paths = prototype.textures[i].paths;
new_info->textures[i].cached_offset = SIZE_MAX;
new_info->textures[i].cached_plane = SIZE_MAX;
@@ -145,7 +146,8 @@ world::VoxelInfoBuilder& world::voxel_registry::construct(const char* name, voxe
if(it != world::voxel_registry::builders.cend()) {
return it->second;
- } else {
+ }
+ else {
return world::voxel_registry::builders.emplace(name, VoxelInfoBuilder(name, type, animated, blending)).first->second;
}
}
@@ -156,7 +158,8 @@ world::VoxelInfo* world::voxel_registry::find(const char* name)
if(it != world::voxel_registry::names.cend()) {
return world::voxel_registry::find(it->second);
- } else {
+ }
+ else {
return nullptr;
}
}
@@ -165,7 +168,8 @@ world::VoxelInfo* world::voxel_registry::find(const voxel_id voxel)
{
if((voxel != NULL_VOXEL_ID) && (voxel <= world::voxel_registry::voxels.size())) {
return world::voxel_registry::voxels[voxel - 1].get();
- } else {
+ }
+ else {
return nullptr;
}
}