Rename "opaque_water" setting to "translucent_liquids" with inverted meaning (#14660)

The old setting will be migrated properly.

---------

Co-authored-by: grorp <gregor.parzefall@posteo.de>
This commit is contained in:
Xeno333 2024-05-22 09:46:05 -05:00 committed by GitHub
parent bd4572cfd1
commit a078cfee3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 25 additions and 8 deletions

@ -265,8 +265,8 @@ undersampling (Undersampling) int 1 1 8
[**Graphics Effects]
# Makes all liquids opaque
opaque_water (Opaque liquids) bool false
# Allows liquids to be translucent.
translucent_liquids (Translucent liquids) bool true
# Leaves style:
# - Fancy: all faces visible

@ -282,7 +282,7 @@ void set_default_settings()
settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("cloud_radius", "12");
settings->setDefault("menu_clouds", "true");
settings->setDefault("opaque_water", "false");
settings->setDefault("translucent_liquids", "true");
settings->setDefault("console_height", "0.6");
settings->setDefault("console_color", "(0,0,0)");
settings->setDefault("console_alpha", "200");

@ -28,6 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "version.h"
#include "defaultsettings.h"
#include "migratesettings.h"
#include "gettext.h"
#include "log.h"
#include "util/quicktune.h"
@ -687,6 +688,8 @@ static bool init_common(const Settings &cmd_args, int argc, char *argv[])
if (!read_config_file(cmd_args))
return false;
migrate_settings();
init_log_streams(cmd_args);
// Initialize random seed

14
src/migratesettings.h Normal file

@ -0,0 +1,14 @@
// Minetest
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "settings.h"
void migrate_settings()
{
// Converts opaque_water to translucent_liquids
if (g_settings->existsLocal("opaque_water")) {
g_settings->set("translucent_liquids",
g_settings->getBool("opaque_water") ? "false" : "true");
g_settings->remove("opaque_water");
}
}

@ -283,7 +283,7 @@ void TileDef::deSerialize(std::istream &is, NodeDrawType drawtype, u16 protocol_
void TextureSettings::readSettings()
{
connected_glass = g_settings->getBool("connected_glass");
opaque_water = g_settings->getBool("opaque_water");
translucent_liquids = g_settings->getBool("translucent_liquids");
bool smooth_lighting = g_settings->getBool("smooth_lighting");
enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
enable_minimap = g_settings->getBool("enable_minimap");
@ -683,7 +683,7 @@ void ContentFeatures::deSerialize(std::istream &is, u16 protocol_version)
if (is.eof())
throw SerializationError("");
post_effect_color_shaded = tmp;
} catch(SerializationError &e) {};
} catch (SerializationError &e) {};
}
#ifndef SERVER
@ -825,14 +825,14 @@ void ContentFeatures::updateTextures(ITextureSource *tsrc, IShaderSource *shdsrc
solidness = 0;
break;
case NDT_LIQUID:
if (tsettings.opaque_water)
if (!tsettings.translucent_liquids)
alpha = ALPHAMODE_OPAQUE;
solidness = 1;
is_liquid = true;
break;
case NDT_FLOWINGLIQUID:
solidness = 0;
if (tsettings.opaque_water)
if (!tsettings.translucent_liquids)
alpha = ALPHAMODE_OPAQUE;
is_liquid = true;
break;

@ -184,7 +184,7 @@ public:
WorldAlignMode world_aligned_mode;
AutoScale autoscale_mode;
int node_texture_size;
bool opaque_water;
bool translucent_liquids;
bool connected_glass;
bool enable_mesh_cache;
bool enable_minimap;