Skip to content

Commit

Permalink
Fix integer-string conversion for shaders
Browse files Browse the repository at this point in the history
closes #10605
  • Loading branch information
sfan5 committed Nov 5, 2020
1 parent 3356da0 commit 627c22c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/shader.cpp
Expand Up @@ -734,7 +734,7 @@ ShaderInfo generate_shader(const std::string &name, u8 material_type, u8 drawtyp
shaders_header += "#define ";
shaders_header += drawTypes[i];
shaders_header += " ";
shaders_header += std::to_string(i);
shaders_header += itos(i);
shaders_header += "\n";
}

Expand All @@ -757,15 +757,15 @@ ShaderInfo generate_shader(const std::string &name, u8 material_type, u8 drawtyp
shaders_header += "#define ";
shaders_header += materialTypes[i];
shaders_header += " ";
shaders_header += std::to_string(i);
shaders_header += itos(i);
shaders_header += "\n";
}

shaders_header += "#define MATERIAL_TYPE ";
shaders_header += std::to_string(material_type);
shaders_header += itos(material_type);
shaders_header += "\n";
shaders_header += "#define DRAW_TYPE ";
shaders_header += std::to_string(drawtype);
shaders_header += itos(drawtype);
shaders_header += "\n";

if (g_settings->getBool("enable_waving_water")){
Expand Down

3 comments on commit 627c22c

@numberZero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfan5 What was the problem here? is material_type a enum instead of integer?

@numberZero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, read that again... MSVC seems to think u8 is the same as char...

@numberZero
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so why not to simply change argument types to int, for example?

Please sign in to comment.