Changeset 286 for trunk/Packages/CevoComponents
- Timestamp:
- Feb 23, 2021, 10:47:47 AM (4 years ago)
- Location:
- trunk/Packages/CevoComponents
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r256 r286 263 263 264 264 function TurnToYear(Turn: Integer): Integer; 265 var266 I: Integer;267 265 begin 268 266 Result := -4000; 269 for I := 1 to Turn do 270 if Result < -1000 then Inc(Result, 50) // 0..60 271 else if Result < 0 then Inc(Result, 25) // 60..100 272 else if Result < 1500 then Inc(Result, 20) // 100..175 273 else if Result < 1750 then Inc(Result, 10) // 175..200 274 else if Result < 1850 then Inc(Result, 2) // 200..250 275 else Inc(Result); 267 if Turn <= 0 then Exit; 268 269 // Year -4000..-1000, Turn 0..60 270 Inc(Result, Min(60, Turn) * 50); 271 Dec(Turn, Min(60, Turn)); 272 if Turn = 0 then Exit; 273 274 // Year -1000..0, Turn 60..100 275 Inc(Result, Min(40, Turn) * 25); 276 Dec(Turn, Min(40, Turn)); 277 if Turn = 0 then Exit; 278 279 // Year 0..1500, Turn 100..175 280 Inc(Result, Min(75, Turn) * 20); 281 Dec(Turn, Min(75, Turn)); 282 if Turn = 0 then Exit; 283 284 // Year 1500..1750, Turn 175..200 285 Inc(Result, Min(25, Turn) * 10); 286 Dec(Turn, Min(25, Turn)); 287 if Turn = 0 then Exit; 288 289 // Year 1750..1850, Turn 200..250 290 Inc(Result, Min(50, Turn) * 2); 291 Dec(Turn, Min(50, Turn)); 292 if Turn = 0 then Exit; 293 294 // Year 1850.., Turn 250.. 295 Inc(Result, Turn); 276 296 end; 277 297 -
trunk/Packages/CevoComponents/StringTables.pas
r174 r286 19 19 function GetHandle(const Item: string): integer; 20 20 function LookupByHandle(Handle: integer; Index: integer = -1): string; 21 function Lookup(const Item: string; Index: integer = -1): string;21 function Lookup(const Item: string; Index: Integer = -1): string; 22 22 function Search(const Content: string; var Handle, Index: integer): boolean; 23 23 end; … … 99 99 end; 100 100 101 function TStringTable.Lookup(const Item: string; Index: integer): string;101 function TStringTable.Lookup(const Item: string; Index: Integer): string; 102 102 var 103 Handle: integer;103 Handle: Integer; 104 104 begin 105 105 Handle := GetHandle(Item); 106 106 if Handle >= 0 then 107 result := LookupByHandle(Handle, Index)107 Result := LookupByHandle(Handle, Index) 108 108 else 109 result := '';110 if result = '' then109 Result := ''; 110 if Result = '' then 111 111 if Index < 0 then 112 result := Format('[%s]', [Item])112 Result := Format('[%s]', [Item]) 113 113 else 114 result := Format('[%s %d]', [Item, Index])114 Result := Format('[%s %d]', [Item, Index]) 115 115 end; 116 116
Note:
See TracChangeset
for help on using the changeset viewer.