1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-12 04:45:25 +01:00

Default-initialize SColor

This commit is contained in:
sfan5
2025-11-02 10:02:01 +01:00
parent 329e210326
commit 8350fb734a
8 changed files with 14 additions and 45 deletions

View File

@@ -406,7 +406,7 @@ void Clouds::render()
const float cloud_full_radius = cloud_size * m_cloud_radius_i;
// Get fog parameters for setting them back later
video::SColor fog_color(0,0,0,0);
video::SColor fog_color;
video::E_FOG_TYPE fog_type = video::EFT_FOG_LINEAR;
f32 fog_start = 0;
f32 fog_end = 0;

View File

@@ -79,7 +79,7 @@ public:
auto *driver = services->getVideoDriver();
assert(driver);
video::SColor fog_color(0);
video::SColor fog_color;
video::E_FOG_TYPE fog_type = video::EFT_FOG_LINEAR;
f32 fog_start = 0;
f32 fog_end = 0;

View File

@@ -9,7 +9,7 @@ ShadowScreenQuad::ShadowScreenQuad()
{
Material.Wireframe = false;
video::SColor color(0x0);
video::SColor color;
Vertices[0] = video::S3DVertex(
-1.0f, -1.0f, 0.0f, 0, 0, 1, color, 0.0f, 1.0f);
Vertices[1] = video::S3DVertex(

View File

@@ -161,7 +161,7 @@ struct TileLayer
* The color of the tile, or if the tile does not own
* a color then the color of the node owning this tile.
*/
video::SColor color = video::SColor(0, 0, 0, 0);
video::SColor color;
//! If true, the tile has its own color.
bool has_color = false;

View File

@@ -69,5 +69,5 @@ private:
bool m_inf_rot = false;
bool m_initial_rotation = true;
video::SColor m_bgcolor = 0;
video::SColor m_bgcolor;
};

View File

@@ -282,7 +282,7 @@ video::SColor read_ARGB8(lua_State *L, int index)
// FIXME: maybe we should have strict type checks here. compare to is_color_table()
video::SColor color(0);
video::SColor color;
CHECK_TYPE(index, "ARGB color", LUA_TTABLE);
lua_getfield(L, index, "a");
color.setAlpha(lua_isnumber(L, -1) ? clamp_col(lua_tonumber(L, -1)) : 0xFF);

View File

@@ -579,7 +579,7 @@ int ModApiUtil::l_colorspec_to_colorstring(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
video::SColor color(0);
video::SColor color;
if (read_color(L, 1, &color)) {
char colorstring[10];
snprintf(colorstring, 10, "#%02X%02X%02X%02X",
@@ -596,7 +596,7 @@ int ModApiUtil::l_colorspec_to_bytes(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
video::SColor color(0);
video::SColor color;
if (read_color(L, 1, &color)) {
u8 colorbytes[4] = {
(u8) color.getRed(),
@@ -616,7 +616,7 @@ int ModApiUtil::l_colorspec_to_table(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
video::SColor color(0);
video::SColor color;
if (read_color(L, 1, &color)) {
push_ARGB8(L, color);
return 1;