Refactor decimal separator to make Pas2C happy
authorWuzzy <Wuzzy2@mail.ru>
Tue, 30 Apr 2019 18:25:04 +0200
changeset 14866 acb0526bf458
parent 14865 259840ca77e3
child 14867 f40bfa7fac9c
Refactor decimal separator to make Pas2C happy
hedgewars/uGears.pas
hedgewars/uLocale.pas
hedgewars/uVariables.pas
--- a/hedgewars/uGears.pas	Tue Apr 30 17:00:23 2019 +0200
+++ b/hedgewars/uGears.pas	Tue Apr 30 18:25:04 2019 +0200
@@ -52,7 +52,7 @@
 function  IsClockRunning() : boolean;
 
 implementation
-uses SysUtils, uStore, uSound, uTeams, uRandom, uIO, uLandGraphics,
+uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics,
     {$IFDEF USE_TOUCH_INTERFACE}uTouch,{$ENDIF}
     uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables,
     uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions,
@@ -292,7 +292,7 @@
                             if j = 0 then
                                 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i)), $ff808080, fntSmall)
                             else
-                                curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i) + FormatSettings.DecimalSeparator + inttostr(j)), $ff808080, fntSmall);
+                                curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i) + lDecimalSeparator + inttostr(j)), $ff808080, fntSmall);
                             end
                     end
                 // Timer of other gears
--- a/hedgewars/uLocale.pas	Tue Apr 30 17:00:23 2019 +0200
+++ b/hedgewars/uLocale.pas	Tue Apr 30 18:25:04 2019 +0200
@@ -53,7 +53,7 @@
 {$ENDIF}
 
 implementation
-uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer;
+uses SysUtils, uRandom, uUtils, uVariables, uDebug, uPhysFSLayer;
 
 var trevt: array[TEventId] of array [0..Pred(MAX_EVENT_STRINGS)] of ansistring;
     trevt_n: array[TEventId] of integer;
@@ -65,6 +65,11 @@
     first: array[TEventId] of boolean;
     e: TEventId;
 begin
+{- TODO: Add support for localized decimal separator in Pas2C -}
+{$IFNDEF PAS2C}
+lDecimalSeparator:= FormatSettings.DecimalSeparator;
+{$ENDIF}
+
 for e:= Low(TEventId) to High(TEventId) do
     first[e]:= true;
 
--- a/hedgewars/uVariables.pas	Tue Apr 30 17:00:23 2019 +0200
+++ b/hedgewars/uVariables.pas	Tue Apr 30 18:25:04 2019 +0200
@@ -2593,6 +2593,8 @@
     aTexCoord: GLint;
     aColor: GLint;
 
+    lDecimalSeparator: Char;
+
 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
     trammod: array[TAmmoStrId] of ansistring;   // description of the weapon
@@ -2817,6 +2819,8 @@
     aTexCoord:= 1;
     aColor:= 2;
 
+    lDecimalSeparator       := '.';
+
 
     cMinMaxZoomLevelDelta:= cMaxZoomLevel - cMinZoomLevel;