Jump to content

[Linux] floats not working?


Tommek
 Share

Recommended Posts

I am just starting with aggrors great Saturn-Tutorial and ran into a strange thing.

 

In Tutorial #3 you create a spawn timer and give it a float value. However the leadwerks editor first shows given number, but then round that number. So give it 0.4 after saving etc. its going to be 0.0 what creates a lot of instances in no time.

Giving this the value 1.5 gives you 1, 2.4 give 2 etc.

 

After I change the view the number shown in the editor is 0.0 or 1.0 or 2.0 etc.

 

 

Script.spawnObject = "" --entity "Spawn object"
Script.spawnTime = 0.5 --float "Spawn time"
local timer = 0
function Script:UpdateWorld()
timer = timer + (Time:GetSpeed()/100)
if(timer > self.spawnTime) then
 local newObject = self.spawnObject:Instance()
 newObject:SetPosition(self.entity:GetPosition())
 timer = 0
end
end

 

I've attached a screenshot.

post-12666-0-98565700-1409599525_thumb.jpg

Link to comment
Share on other sites

Also if I enter a "Mass" in "Physics" I can only use 1.0, 2.0 etc

 

If I enter 2.5 it gets 2.0, 1.4 -> 1.0, 7.5 -> 7.0 etc

 

So it seems to be a gerneral issue. Dio you need any logs from me?

 

edit: Yes it is in every value field I've entered data so far.

Link to comment
Share on other sites

Yes, I can reproduce this issue and (probably) already know what the problem is.

Tommek, am I right that you use a locale that uses comma for decimal separation?

 

If I remove "LC_ALL=C LANG=en_US.UTF-8 %command%" (LANG is optional here, just to make sure Leadwerks doesn't use a half arsed translation by pulling in German strings for default UI elements) from my Steam launch options for Leadwerks, I can reproduce your issue.

There already was a similar issue which was fixed once but it seems to have resurfaced.

Use these launch settings as a workaround until it is fixed.

 

@Josh: Please sanitize the system locale settings when using the editor (and probably the engine as well).

Link to comment
Share on other sites

The editor and engine make this call at startup on Linux:

SetLocale 0,"en-US"

 

What else can I do?

 

Not sure what 0 is

 

But I would suggest setting it for LC_NUMERIC and LC_MONETARY, use the defines as the numeric value is implementation dependent;

http://en.cppreference.com/w/cpp/locale/LC_categories

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

0 = LC_ALL

 

And that is properly the source of your error -

std::cout << "LC_ALL: "<< LC_ALL << std::endl;

yields

LC_ALL: 6

on my system

System:

Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k

Link to comment
Share on other sites

That explains it. I will try it with 6 and assume this fixes it. It's very hard for me to test this so you will have to let me know.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...