X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_basic.pas;h=7df493fe4f248a8fe57ac8fb11da55c9713227b4;hb=9b4492224e2e59560931496e925333bdbe6f2b0e;hp=92a7955d505d74db05049759ad63e67b5e1bc4ad;hpb=a03027407f9093e939012eb29fe12a574518268c;p=d2df-sdl.git diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas index 92a7955..7df493f 100644 --- a/src/game/g_basic.pas +++ b/src/game/g_basic.pas @@ -38,6 +38,9 @@ type DWArray = array of DWORD; String20 = String[20]; +function g_GetBuilderName (): AnsiString; +function g_GetBuildHash (full: Boolean = True): AnsiString; + function g_CreateUID(UIDType: Byte): Word; function g_GetUIDType(UID: Word): Byte; function g_Collide(X1, Y1: Integer; Width1, Height1: Word; @@ -100,6 +103,33 @@ uses Math, geom, e_log, g_map, g_gfx, g_player, SysUtils, MAPDEF, StrUtils, e_graphics, g_monsters, g_items, g_game; +{$PUSH} +{$WARN 2054 OFF} // unknwon env var +{$WARN 6018 OFF} // unreachable code +function g_GetBuilderName (): AnsiString; +begin + if {$I %D2DF_BUILD_USER%} <> '' then + result := {$I %D2DF_BUILD_USER%} // custom + else if {$I %USER%} <> '' then + result := {$I %USER%} // unix username + else if {$I %USERNAME%} <> '' then + result := {$I %USERNAME%} // windows username + else + result := 'unknown' +end; + +function g_GetBuildHash (full: Boolean = True): AnsiString; +begin + if {$I %D2DF_BUILD_HASH%} <> '' then + if full then + result := {$I %D2DF_BUILD_HASH%} + else + result := Copy({$I %D2DF_BUILD_HASH%}, 1, 7) + else + result := 'custom build' +end; +{$POP} + function g_PatchLength(X1, Y1, X2, Y2: Integer): Word; begin Result := Min(Round(Hypot(Abs(X2-X1), Abs(Y2-Y1))), 65535); @@ -646,7 +676,7 @@ function GetLines (Text: string; FontID: DWORD; MaxWidth: Word): SSArray; begin result := nil; lines := 0; j := 1; i := 1; len := Length(Text); - e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, Text]); + // e_LogWritefln('GetLines @%s len=%s [%s]', [MaxWidth, len, Text]); while j <= len do begin (* --- Get longest possible sequence --- *) @@ -659,7 +689,7 @@ begin (* --- Add line --- *) SetLength(result, lines + 1); result[lines] := GetLine(j, i); - e_LogWritefln(' -> (%s:%s::%s) [%s]', [j, i, GetWidth(j, i), result[lines]]); + // e_LogWritefln(' -> (%s:%s::%s) [%s]', [j, i, GetWidth(j, i), result[lines]]); Inc(lines); (* --- Skip spaces --- *) while (i <= len) and (text[i] = ' ') do Inc(i);