From: Ketmar Dark Date: Wed, 30 Aug 2017 11:59:43 +0000 (+0300) Subject: more cosmetix X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=commitdiff_plain;h=1a10061a1cd706f5f06b923740e45a462d2bd885 more cosmetix --- diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index 475cb68..0679075 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -1656,16 +1656,6 @@ begin y := yptr^+miny; //prevx := x; //prevy := y; - {$IF DEFINED(D2F_DEBUG)} - if hopt then - begin - if (y <> ay0) then raise Exception.Create('htrace fatal internal error'); - end - else - begin - if (x <> ax0) then raise Exception.Create('vtrace fatal internal error'); - end; - {$ENDIF} while (wklen > 0) do begin {$IF DEFINED(D2F_DEBUG)} @@ -2254,16 +2244,6 @@ begin if dbgShowTraceLog then e_LogWritefln('optimized htrace; wklen=%d', [wklen]); {$ENDIF} ga := (yptr^ div tsize)*gw+(xptr^ div tsize); - {$IF DEFINED(D2F_DEBUG)} - if hopt then - begin - if (yptr^ <> ay0) then raise Exception.Create('htrace fatal internal error'); - end - else - begin - if (xptr^ <> ax0) then raise Exception.Create('vtrace fatal internal error'); - end; - {$ENDIF} while (wklen > 0) do begin {$IF DEFINED(D2F_DEBUG)} diff --git a/src/shared/hashtable.pas b/src/shared/hashtable.pas index 190d4e6..9f72e3a 100644 --- a/src/shared/hashtable.pas +++ b/src/shared/hashtable.pas @@ -59,7 +59,7 @@ type mEntries: TEntryArray; mFirstEntry, mLastEntry, cur: Integer; public - constructor Create (aents: TEntryArray; afirst, alast: Integer); + constructor Create (const aents: TEntryArray; afirst, alast: Integer); function MoveNext (): Boolean; inline; function getCurrent (): ValueT; inline; property Current: ValueT read getCurrent; @@ -70,7 +70,7 @@ type mEntries: TEntryArray; mFirstEntry, mLastEntry, cur: Integer; public - constructor Create (aents: TEntryArray; afirst, alast: Integer); + constructor Create (const aents: TEntryArray; afirst, alast: Integer); function MoveNext (): Boolean; inline; function getCurrent (): KeyT; inline; property Current: KeyT read getCurrent; @@ -81,7 +81,7 @@ type mEntries: TEntryArray; mFirstEntry, mLastEntry, cur: Integer; public - constructor Create (aents: TEntryArray; afirst, alast: Integer); + constructor Create (const aents: TEntryArray; afirst, alast: Integer); function MoveNext (): Boolean; inline; function getCurrent (): PEntry; inline; property Current: PEntry read getCurrent; @@ -945,7 +945,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // -constructor THashBase.TValEnumerator.Create (aents: TEntryArray; afirst, alast: Integer); +constructor THashBase.TValEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer); begin mEntries := aents; mFirstEntry := afirst; @@ -970,7 +970,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // -constructor THashBase.TKeyEnumerator.Create (aents: TEntryArray; afirst, alast: Integer); +constructor THashBase.TKeyEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer); begin mEntries := aents; mFirstEntry := afirst; @@ -995,7 +995,7 @@ end; // ////////////////////////////////////////////////////////////////////////// // -constructor THashBase.TKeyValEnumerator.Create (aents: TEntryArray; afirst, alast: Integer); +constructor THashBase.TKeyValEnumerator.Create (const aents: TEntryArray; afirst, alast: Integer); begin mEntries := aents; mFirstEntry := afirst; diff --git a/src/shared/utils.pas b/src/shared/utils.pas index 9e13649..fd57312 100644 --- a/src/shared/utils.pas +++ b/src/shared/utils.pas @@ -144,23 +144,24 @@ type generic TSimpleList = class private type PItemT = ^ItemT; + type TItemArr = array of ItemT; public type TEnumerator = record private - mItems: PItemT; + mItems: TItemArr; mCount: Integer; mCurrent: Integer; public - constructor Create (aitems: PItemT; acount: Integer); + constructor Create (const aitems: TItemArr; acount: Integer); function MoveNext: Boolean; function getCurrent (): ItemT; property Current: ItemT read getCurrent; end; private - mItems: array of ItemT; + mItems: TItemArr; mCount: Integer; // can be less than `mItems` size private @@ -193,11 +194,11 @@ implementation // ////////////////////////////////////////////////////////////////////////// // -constructor TSimpleList.TEnumerator.Create (aitems: PItemT; acount: Integer); +constructor TSimpleList.TEnumerator.Create (const aitems: TItemArr; acount: Integer); begin mItems := aitems; - mCount := acount; mCurrent := -1; + mCount := acount; end; function TSimpleList.TEnumerator.MoveNext: Boolean; @@ -243,7 +244,7 @@ end; function TSimpleList.GetEnumerator (): TEnumerator; begin - if (Length(mItems) > 0) then result := TEnumerator.Create(@mItems[0], mCount) + if (Length(mItems) > 0) then result := TEnumerator.Create(mItems, mCount) else result := TEnumerator.Create(nil, -1); end;