Invisible/1-pixel-tall health and experience bars

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:
User avatar
josteph
Developer
Posts: 448
Joined: August 19th, 2017, 6:58 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by josteph » October 23rd, 2018, 5:52 pm

What's your system locale? Does it display decimal fractions with a decimal point or a comma? Does the problem persist if you change locale to English (USA)? Can you point to the exact file and line where you changed decimal point to comma?

levstk
Posts: 5
Joined: February 16th, 2015, 4:47 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by levstk » October 23rd, 2018, 5:59 pm

I addressed that in my second edit. My system setting is for a decimal comma. I changed the system setting to decimal point and now the game works absolutely fine. So the issue is that the game respects that system setting, which it really shouldn't do.

User avatar
josteph
Developer
Posts: 448
Joined: August 19th, 2017, 6:58 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by josteph » October 23rd, 2018, 10:55 pm

Agreed, it shouldn't use the system decimal separator settings for game data files. Can you answer my last question? Where in the config files did you change a period to a comma in your initial attempt? It'll be a lot easier to fix the bug if we knew that.

levstk
Posts: 5
Joined: February 16th, 2015, 4:47 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by levstk » October 24th, 2018, 8:51 am

/wesnoth/data/game_config.cfg

hp_bar_scaling
xp_bar_scaling

Those are the only relevant lines (that I could quickly find) where commas aren't used as separators and the most instantly obvious thing when you load the game.

User avatar
josteph
Developer
Posts: 448
Joined: August 19th, 2017, 6:58 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by josteph » October 24th, 2018, 4:34 pm

It might be this line: https://github.com/wesnoth/wesnoth/blob ... e.cpp#L193 but I can't reproduce the bug even when I change my locale. I hope a windows based developer will be able to reproduce this.

User avatar
josteph
Developer
Posts: 448
Joined: August 19th, 2017, 6:58 pm

Re: Invisible/1-pixel-tall health and experience bars

Post by josteph » February 26th, 2019, 8:09 pm

levtsk, could you try this patch?

Code: Select all

diff --git a/data/game_config.cfg b/data/game_config.cfg
index b22668b95b0..20740317fc1 100644
--- a/data/game_config.cfg
+++ b/data/game_config.cfg
@@ -30,8 +30,8 @@
 
     lobby_refresh=1000
 
-    hp_bar_scaling=0.6
-    xp_bar_scaling=0.5
+    hp_bar_scaling=0.6060606
+    xp_bar_scaling=0.5060606
     zoom_levels = 0.25, 0.33333333333333333, 0.5, 0.75, 1.0, 1.25, 1.5, 2.0, 3.0, 4.0
 
     #temporary disable hex brightening
diff --git a/src/lexical_cast.hpp b/src/lexical_cast.hpp
index 181d3768eef..621047d8494 100644
--- a/src/lexical_cast.hpp
+++ b/src/lexical_cast.hpp
@@ -21,6 +21,7 @@
  * real job. This is done for the unit tests but should normally not be done.
  */
 
+#include <iostream>
 #ifdef LEXICAL_CAST_DEBUG
 #undef LEXICAL_CAST_HPP_INCLUDED
 #endif
@@ -351,6 +352,7 @@ struct lexical_caster<
 		}
 
 		try {
+			std::cerr << "lexical_caster<string to floating point> converting " << value << " to " << std::stold(value) << "\n";
 			long double res = std::stold(value);
 			if((static_cast<long double>(std::numeric_limits<To>::lowest()) <= res) && (static_cast<long double>(std::numeric_limits<To>::max()) >= res)) {
 				return static_cast<To>(res);
Apply it and start ./wesnoth 2>stderr.log and show us the relevant lines from that file (the ones that have the values of hp_bar_scaling on the left hand side). Right now I'm just trying to confirm that that stold call is what's introducing the error, this will not fix the issue.

I suppose the right-hand side will print the value using your locale point/comma separators too.

Post Reply