Changeset 63 for trunk/UGame.pas
- Timestamp:
- Nov 9, 2019, 1:38:36 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r56 r63 95 95 end; 96 96 97 TTileSkin = (tsLinear, tsPowerOfTwo, tsAlpha );97 TTileSkin = (tsLinear, tsPowerOfTwo, tsAlpha, tsRoman); 98 98 99 99 { TGame } … … 181 181 SSkinPowerOfTwo = 'Power of two'; 182 182 SSkinAlpha = 'Alpha'; 183 SSkinRoman = 'Roman numerals'; 183 184 STileShouldBeEmpty = 'Tile should be empty'; 184 185 … … 197 198 SkinText[tsPowerOfTwo] := SSkinPowerOfTwo; 198 199 SkinText[tsAlpha] := SSkinAlpha; 200 SkinText[tsRoman] := SSkinRoman; 199 201 end; 200 202 … … 1021 1023 end; 1022 1024 1025 function IntToStrRoman(Num: Integer): string; 1026 const 1027 Nvals = 13; 1028 Vals: array [1..Nvals] of Word = 1029 (1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000); 1030 Roms: array [1..Nvals] of string[2] = 1031 ('I', 'IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M'); 1032 var 1033 B: 1..Nvals; 1034 begin 1035 Result := ''; 1036 B := Nvals; 1037 while Num > 0 do 1038 begin 1039 while Vals[b] > Num do 1040 Dec(B); 1041 Dec(Num, Vals[B]); 1042 Result := Result + Roms[B]; 1043 end; 1044 end; 1045 1023 1046 function TGame.GetTileSkinValue(Value: Integer): string; 1024 1047 begin … … 1027 1050 tsPowerOfTwo: Result := IntToStr(1 shl Value); 1028 1051 tsAlpha: Result := Chr(Ord('A') + Value - 1); 1052 tsRoman: Result := IntToStrRoman(Value); 1029 1053 else Result := IntToStr(Value); 1030 1054 end;
Note:
See TracChangeset
for help on using the changeset viewer.