diff options
author | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-04 11:16:38 +0000 |
---|---|---|
committer | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2008-03-04 11:16:38 +0000 |
commit | 9a36ddf60248b9fabe61d21f7237c5cd187c4c7a (patch) | |
tree | 5cfc1e8e8bf148f69f3d226d035f10cc38e25fc1 /Game/Code | |
parent | 37cc5e26505c441d3de151fbe1a70f7d01f085e0 (diff) | |
download | usdx-9a36ddf60248b9fabe61d21f7237c5cd187c4c7a.tar.gz usdx-9a36ddf60248b9fabe61d21f7237c5cd187c4c7a.tar.xz usdx-9a36ddf60248b9fabe61d21f7237c5cd187c4c7a.zip |
removed overuse of DecimalSeperator
and re-implemented changes from changset#905
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@906 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Classes/UMain.pas | 2 | ||||
-rw-r--r-- | Game/Code/Classes/UPliki.pas | 7 | ||||
-rw-r--r-- | Game/Code/Classes/USong.pas | 33 | ||||
-rw-r--r-- | Game/Code/Classes/UThemes.pas | 30 |
4 files changed, 16 insertions, 56 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 66c8efe9..2d744a4f 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1143,7 +1143,7 @@ begin initialize_path( CoversPath , Platform.GetGameSharedPath + 'Covers' + PathDelim );
initialize_path( PlaylistPath , Platform.GetGameSharedPath + 'Playlists' + PathDelim );
- DecimalSeparator := ',';
+ DecimalSeparator := '.';
end;
end.
diff --git a/Game/Code/Classes/UPliki.pas b/Game/Code/Classes/UPliki.pas index f4e8ff97..81fdf5bf 100644 --- a/Game/Code/Classes/UPliki.pas +++ b/Game/Code/Classes/UPliki.pas @@ -37,6 +37,7 @@ var MultBPM: integer;
implementation
+
uses TextGL, UIni, UMain, math;
procedure InitializePaths;
@@ -49,12 +50,10 @@ begin ScreenshotsPath := GamePath + 'Screenshots\';
CoversPath := GamePath + 'Covers\';
LanguagesPath := GamePath + 'Languages\';
- //Modi Loader
- PluginPath := GamePath + 'Plugins\';
+ //Modi Loader
+ PluginPath := GamePath + 'Plugins\';
PlaylistPath := GamePath + 'Playlists\';
-
- DecimalSeparator := ',';
end;
function ReadHeader(var Song: TSong): boolean;
diff --git a/Game/Code/Classes/USong.pas b/Game/Code/Classes/USong.pas index cf75509a..6b4a2f09 100644 --- a/Game/Code/Classes/USong.pas +++ b/Game/Code/Classes/USong.pas @@ -334,26 +334,17 @@ end; function TSong.ReadTXTHeader(const aFileName : WideString): boolean;
- function Replace_Decimal_Separator( aValue : String ) : String;
+ function song_StrtoFloat( aValue : String ) : Extended;
var
- lReplaceChar : char;
- lDecSep : char;
+ lValue : String;
+ lOldDecimalSeparator : Char;
begin
- result := aValue;
-
- {$IFDEF FPC}
- lDecSep := DefaultFormatSettings.DecimalSeparator;
- {$ELSE}
- lDecSep := DecimalSeparator;
- {$ENDIF}
-
- if lDecSep = '.' then
- lReplaceChar := ','
- else
- lReplaceChar := '.';
+ lValue := aValue;
+
+ if (Pos(',', lValue) <> 0) then
+ lValue[Pos(',', lValue)] := '.';
- if (Pos(lReplaceChar, result) <> 0) then
- result[Pos(lReplaceChar, result)] := lDecSep;
+ Result := StrToFloatDef(lValue, 0);
end;
var
@@ -436,7 +427,7 @@ begin SetLength(self.BPM, 1);
self.BPM[0].StartBeat := 0;
- self.BPM[0].BPM := StrtoFloatDef(Replace_Decimal_Separator( Value ), 0) * Mult * MultBPM;
+ self.BPM[0].BPM := song_StrtoFloat( Value ) * Mult * MultBPM;
if self.BPM[0].BPM <> 0 then
begin
@@ -451,7 +442,7 @@ begin // Video Gap
else if (Identifier = 'GAP') then
- self.GAP := StrtoFloatDef ( Replace_Decimal_Separator( Value ), 0)
+ self.GAP := song_StrtoFloat( Value )
//Cover Picture
else if (Identifier = 'COVER') then
@@ -472,7 +463,7 @@ begin // Video Gap
else if (Identifier = 'VIDEOGAP') then
- self.VideoGAP := StrtoFloatDef ( Replace_Decimal_Separator( Value ), 0)
+ self.VideoGAP := song_StrtoFloat( Value )
//Genre Sorting
else if (Identifier = 'GENRE') then
@@ -492,7 +483,7 @@ begin // Song Start
else if (Identifier = 'START') then
- self.Start := StrtoFloatDef( Replace_Decimal_Separator( Value ), 0)
+ self.Start := song_StrtoFloat( Value )
// Song Ending
else if (Identifier = 'END') then
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index dc56020d..f47fbc0f 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -1448,8 +1448,6 @@ procedure TTheme.ThemeLoadText(var ThemeText: TThemeText; Name: string); var C: integer; begin - DecimalSeparator := '.'; - ThemeText.X := ThemeIni.ReadInteger(Name, 'X', 0); ThemeText.Y := ThemeIni.ReadInteger(Name, 'Y', 0); ThemeText.W := ThemeIni.ReadInteger(Name, 'W', 0); @@ -1471,8 +1469,6 @@ begin ThemeText.ColG := Color[C].RGB.G; ThemeText.ColB := Color[C].RGB.B; end; - - DecimalSeparator := ','; end; procedure TTheme.ThemeLoadTexts(var ThemeText: AThemeText; Name: string); @@ -1491,8 +1487,6 @@ procedure TTheme.ThemeLoadStatic(var ThemeStatic: TThemeStatic; Name: string); var C: integer; begin - DecimalSeparator := '.'; - ThemeStatic.Tex := ThemeIni.ReadString(Name, 'Tex', ''); ThemeStatic.X := ThemeIni.ReadInteger(Name, 'X', 0); @@ -1519,8 +1513,6 @@ begin //Reflection Mod ThemeStatic.Reflection := (ThemeIni.ReadInteger(Name, 'Reflection', 0) = 1); ThemeStatic.ReflectionSpacing := ThemeIni.ReadFloat(Name, 'ReflectionSpacing', 15); - - DecimalSeparator := ','; end; procedure TTheme.ThemeLoadStatics(var ThemeStatic: AThemeStatic; Name: string); @@ -1575,7 +1567,6 @@ begin ThemeButton.Visible := False; exit; end; - DecimalSeparator := '.'; ThemeButton.Tex := ThemeIni.ReadString(Name, 'Tex', ''); ThemeButton.X := ThemeIni.ReadInteger (Name, 'X', 0); ThemeButton.Y := ThemeIni.ReadInteger (Name, 'Y', 0); @@ -1653,16 +1644,12 @@ begin SetLength(ThemeButton.Text, TLen); for T := 1 to TLen do ThemeLoadText(ThemeButton.Text[T-1], Name + 'Text' + IntToStr(T)); - - DecimalSeparator := ','; end; procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); var C: integer; begin - DecimalSeparator := '.'; - //{$IFDEF TRANSLATE} ThemeSelect.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); //{$ELSE}{ @@ -1698,17 +1685,12 @@ begin ThemeSelect.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); LoadColor(ThemeSelect.STDColR, ThemeSelect.STDColG, ThemeSelect.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); ThemeSelect.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); - - - DecimalSeparator := ','; end; procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); var C: integer; begin - DecimalSeparator := '.'; - //{{$IFDEF TRANSLATE} ThemeSelectS.Text := Language.Translate(ThemeIni.ReadString(Name, 'Text', '')); //{{$ELSE}{ @@ -1750,9 +1732,6 @@ begin ThemeSelectS.STInt := ThemeIni.ReadFloat(Name, 'STInt', 1); LoadColor(ThemeSelectS.STDColR, ThemeSelectS.STDColG, ThemeSelectS.STDColB, ThemeIni.ReadString(Name, 'STDColor', '')); ThemeSelectS.STDInt := ThemeIni.ReadFloat(Name, 'STDInt', 1); - - - DecimalSeparator := ','; end; procedure TTheme.LoadColors; @@ -2119,7 +2098,6 @@ end; procedure TTheme.ThemeSaveStatic(ThemeStatic: TThemeStatic; Name: string); begin - DecimalSeparator := '.'; ThemeIni.WriteInteger(Name, 'X', ThemeStatic.X); ThemeIni.WriteInteger(Name, 'Y', ThemeStatic.Y); ThemeIni.WriteInteger(Name, 'W', ThemeStatic.W); @@ -2133,8 +2111,6 @@ begin ThemeIni.WriteFloat(Name, 'TexY1', ThemeStatic.TexY1); ThemeIni.WriteFloat(Name, 'TexX2', ThemeStatic.TexX2); ThemeIni.WriteFloat(Name, 'TexY2', ThemeStatic.TexY2); - - DecimalSeparator := ','; end; procedure TTheme.ThemeSaveStatics(ThemeStatic: AThemeStatic; Name: string); @@ -2149,7 +2125,6 @@ end; procedure TTheme.ThemeSaveText(ThemeText: TThemeText; Name: string); begin - DecimalSeparator := '.'; ThemeIni.WriteInteger(Name, 'X', ThemeText.X); ThemeIni.WriteInteger(Name, 'Y', ThemeText.Y); @@ -2159,8 +2134,6 @@ begin ThemeIni.WriteString(Name, 'Text', ThemeText.Text); ThemeIni.WriteString(Name, 'Color', ThemeText.Color); - - DecimalSeparator := ','; end; procedure TTheme.ThemeSaveTexts(ThemeText: AThemeText; Name: string); @@ -2177,7 +2150,6 @@ procedure TTheme.ThemeSaveButton(ThemeButton: TThemeButton; Name: string); var T: integer; begin - DecimalSeparator := '.'; ThemeIni.WriteString(Name, 'Tex', ThemeButton.Tex); ThemeIni.WriteInteger(Name, 'X', ThemeButton.X); ThemeIni.WriteInteger(Name, 'Y', ThemeButton.Y); @@ -2214,8 +2186,6 @@ begin for T := 0 to High(ThemeButton.Text) do ThemeSaveText(ThemeButton.Text[T], Name + 'Text' + IntToStr(T+1)); - - DecimalSeparator := ','; end; procedure TTheme.create_theme_objects(); |