X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_basic.pas;h=7024514be8898ce6796ea8dd5b9213f69e8c6893;hp=92a7955d505d74db05049759ad63e67b5e1bc4ad;hb=027ace8eccb0dc4c1d5ff8796b238d5b1fbbcfed;hpb=a03027407f9093e939012eb29fe12a574518268c diff --git a/src/game/g_basic.pas b/src/game/g_basic.pas index 92a7955..7024514 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_USER%} <> '' 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);