Post reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Subject:
Message icon:

shortcuts: hit alt+s to submit/post or alt+p to preview

Please read the rules before you post!


Topic Summary

Posted by: hephep
« on: September 29, 2020, 06:48:10 AM »

I don't know what the internals of Aurora look like, but all inputs should be sanitised anyway as best practice (or standard practice for web dev) - when devs don't do this you end up with security holes; less of a problem with a game, but still.         

You just need two core functions:

string number_format(dynamic in_num) - takes in any type and outputs it as a formatted string using the system preferences.          For bonus points parameters for number of decimals etc.         

float/int parse_number(string in_str) - takes in a string and tries to parse it into a float/int as appropriate.       

C# has a bunch of functions to help with this:
https://docs.      microsoft.      com/en-us/dotnet/api/system.      globalization?view=netcore-3.      1

All user-inputted numbers should use parse_number before being used internally, and everything that's a number should go through number_format before being printed.       I suspect its on these where Aurora currently fails.     

Throw in some unit tests for both functions and you've got some rock solid code that can handle number input/output, and a swath of bug reports just disappears. 
Posted by: SpikeTheHobbitMage
« on: May 12, 2020, 07:00:53 PM »

Aurora sees the number 100,00 as ten thousand, not 100. Simple as that.

Well, I think it is more that the comma throws off the SQL statements.
C# uses prepared statements so that shouldn't be a problem like it was in VB, since there are no text conversions involved any more.  At this point it should be restricted to reading and writing UI elements and that can safely be done using the user's locale.  It should now just be a matter of making certain that all code touching a given control agrees on what it is doing, which is admittedly a sizable chunk of code.
Posted by: Destragon
« on: May 12, 2020, 06:45:27 PM »

AuroraMod has a setting that lets you customise the number culture and date format, without having to change them in your system or having to create a new windows profile:

Edit: Fixed the link
http://aurora2.pentarch.org/index.php?topic=11382.0

Edit 2:
For Auora version 1.13 (and 2.0), the latest mod to change these settings is this one:
http://aurora2.pentarch.org/index.php?topic=12565.0
Posted by: Tree
« on: May 09, 2020, 03:08:29 AM »

If you are running Windows 10 and would like to keep your own regional settings for everything else other than Aurora, the following approach works:

1) Create a new local user (settings) be sure and give it a password
2) Log out and then Log in as the new local user, follow the instructions in the previous post above to change settings.
3) Log out of the new local user and Log back in as your normal user.

For then on, when you want to start Aurora, control+shift+right-click on the Aurora.exe file, select 'run as different user', enter the name and password for the new local user you created.  This runs Aurora with the regional settings it needs and leaves the rest of your programs (and desktop) as you like (had set previously).

You can also create a .bat file for it so you can skip the ctrl+shift+right click and just double click as normal. Put this line in notepad:
runas /profile /env /savecred /user:computername\username "C:\Games\Aurora\Aurora.exe"
You'll have to replace computername and username with what fits your computer and new Aurora user, the .exe's path, save as a .bat file and now you can run Aurora off the .bat file. It'll only ask for the password once, too.
Posted by: Second Foundationer
« on: May 02, 2020, 05:55:58 AM »

A pleasure if it is of any help.

Only to make sure, a general note for all comma-separated problems: Changing the keyboard layout does NOT in itself change your operating system's number format.  For that, please refer to the first post in this thread.
Posted by: smoelf
« on: May 02, 2020, 05:34:03 AM »

As for the numpad: I have myself a , for it printed on my current physical keyboard on the numpad, but I use an English (US) keyboard layout (and others at other times), so the numpad works fine.  If you do not need various keyboard layouts otherwise and don't want to switch the whole layout because other keys will then not do what they say on the label, it should be possible with very simple tools to create your own custom keyboard layout.  I myself use two adapted for special tasks with a bunch of additional signs stuffed in.  But for this, you can create one with just one or two keys changed from default, in this case just exchange comma with period, so that the numpad works for decimals.  You can then use that custom layout in Windows while running Aurora by selecting it in the language bar (I'm not sure if it's displayed by default these days, but it's easy to find) in the taskbar just like any standard keyboard layout or add a shortcut for switching.

If you want to try it and can't find on your own, I could look up which tool I used, and if it still exists, give you a link.  It may even be part of Windows, not sure.  It really takes only a minute.  Setup once, forget, use.  My main one must be more than a decade old and has already been ported across Windows versions.  It might only annoy you to have the language bar displayed permanently if you have no other use for it.  But as long as you don't forget to switch back when you need to: it should be possible to setup a shortcut without it, I think.

That's an excellent idea. Certainly a lot faster to change a saved keyboard layout than switching the area settings every time. Thanks :)
Posted by: Second Foundationer
« on: May 02, 2020, 05:30:30 AM »

Quote from: smoelf link=topic=11139. msg129896#msg129896 date=1588411139
Quote from: Father Tim link=topic=11139. msg129858#msg129858 date=1588396974
But yeah, given how difficult it has been trying to accomodate comma users it is likely that C# Aurora will go back to being period-only until C# itself (or Windows) changes.

Yeah, for me this is already the case.  I used to be able to use comma as a decimal separator in the mineral search window, but since 1. 9 I have had to use period in every window.  It's a bit of a shame, since everything is so much faster with numpad and comma as decimal separator, but considering the (possible?) time investment to make it work, I'd much rather that Steve spent his time on something else.  It's not that big of a deal to learn to use period instead.

As for the numpad: I have myself a , for it printed on my current physical keyboard on the numpad, but I use an English (US) keyboard layout (and others at other times), so the numpad works fine.  If you do not need various keyboard layouts otherwise and don't want to switch the whole layout because other keys will then not do what they say on the label, it should be possible with very simple tools to create your own custom keyboard layout.  I myself use two adapted for special tasks with a bunch of additional signs stuffed in.  But for this, you can create one with just one or two keys changed from default, in this case just exchange comma with period, so that the numpad works for decimals.  You can then use that custom layout in Windows while running Aurora by selecting it in the language bar (I'm not sure if it's displayed by default these days, but it's easy to find) in the taskbar just like any standard keyboard layout or add a shortcut for switching.

If you want to try it and can't find on your own, I could look up which tool I used, and if it still exists, give you a link.  It may even be part of Windows, not sure.  It really takes only a minute.  Setup once, forget, use.  My main one must be more than a decade old and has already been ported across Windows versions.  It might only annoy you to have the language bar displayed permanently if you have no other use for it.  But as long as you don't forget to switch back when you need to: it should be possible to setup a shortcut without it, I think.
Posted by: smoelf
« on: May 02, 2020, 04:18:59 AM »

But yeah, given how difficult it has been trying to accomodate comma users it is likely that C# Aurora will go back to being period-only until C# itself (or Windows) changes.

Yeah, for me this is already the case. I used to be able to use comma as a decimal separator in the mineral search window, but since 1.9 I have had to use period in every window. It's a bit of a shame, since everything is so much faster with numpad and comma as decimal separator, but considering the (possible?) time investment to make it work, I'd much rather that Steve spent his time on something else. It's not that big of a deal to learn to use period instead.
Posted by: Garfunkel
« on: May 02, 2020, 01:32:08 AM »

It''s also 20 years old and done by Steve alone, as a hobby. So literally anything is possible.
Posted by: Asanda Nima
« on: May 02, 2020, 01:30:24 AM »

Quote from: Tyrope link=topic=11139. msg129859#msg129859 date=1588399192
The fact that the way numbers display affects the way the back-end interprets the numbers at all makes me wonder what is happening.  .  .   I've done my fair share of programming and never have I ever bumped into an issue where front-end affects back-end.   Then again, I've never written something half as complex as Aurora.   :D

Yeah that surprised me too.  And I am 100% sure that there are some ways in C# to avoid that.  Else C# based programs would have to be done with comma and period version, nobody would use C# then. .
But as you said Aurora is one hell of complex program, and without knowing how exactly it works, we can only speculate. 

 
Posted by: Tyrope
« on: May 02, 2020, 12:59:52 AM »

The fact that the way numbers display affects the way the back-end interprets the numbers at all makes me wonder what is happening. . .  I've done my fair share of programming and never have I ever bumped into an issue where front-end affects back-end.  Then again, I've never written something half as complex as Aurora.  :D
Posted by: Father Tim
« on: May 02, 2020, 12:22:54 AM »

Thank you for your advise and also the tipp with the second user.

But I have a question, is this something that will be addressed in future? Because I do not remember having this issue with the VB version or Aurora 4X.
Or will this stay like this? In this case I think this should be added to the installation instruction, to make sure that the game works as it should.


It has been addressed several times already.  VB Aurora had the 'advantage' of failing catastrophically if you didn't use a period decimal separator, so there wasn't much of an opportunity to do it 'wrong'.  Steve tried to accomodate comma users in C# Aurora, and ran into the problem that 98% of it worked -- so people could get much deeper into the game before having a problem, and that most such problems aren't game-breaking.

But yeah, given how difficult it has been trying to accomodate comma users it is likely that C# Aurora will go back to being period-only until C# itself (or Windows) changes.
Posted by: Inglonias
« on: May 01, 2020, 07:12:32 AM »

From what I can tell, this was an issue with VB6 Aurora that was solved by running the game through the popular wrapper that existed for it.

As for making the issue more widely known, I believe that Steve is planning to add a popup window warning when the game starts up in the future.
Posted by: Asanda Nima
« on: May 01, 2020, 03:03:06 AM »

Thank you for your advise and also the tipp with the second user.

But I have a question, is this something that will be addressed in future? Because I do not remember having this issue with the VB version or Aurora 4X.
Or will this stay like this? In this case I think this should be added to the installation instruction, to make sure that the game works as it should.
Posted by: Erik L
« on: April 29, 2020, 10:17:12 PM »

Aurora sees the number 100,00 as ten thousand, not 100. Simple as that.

Well, I think it is more that the comma throws off the SQL statements.