X-Git-Url: http://deadsoftware.ru/gitweb?p=d2df-sdl.git;a=blobdiff_plain;f=src%2Fgame%2Fg_player.pas;h=8ad8931e32ddaff68a1ac89b57e1431003da9464;hp=fbbd09af8b270a58deee364d75df247bf984a3bf;hb=a7ab3742313f79cefd688def25534d692dc7346c;hpb=4204edd3c7df01198a2289af4896be0575fff15c diff --git a/src/game/g_player.pas b/src/game/g_player.pas index fbbd09a..8ad8931 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -303,6 +303,7 @@ type procedure SetWeaponPrefs(Prefs: Array of Byte); procedure SetWeaponPref(Weapon, Pref: Byte); function GetWeaponPref(Weapon: Byte) : Byte; + function GetMorePrefered() : Byte; function Collide(X, Y: Integer; Width, Height: Word): Boolean; overload; function Collide(Panel: TPanel): Boolean; overload; function Collide(X, Y: Integer): Boolean; overload; @@ -2023,6 +2024,18 @@ begin result := FWeapPreferences[Weapon]; end; +function TPlayer.GetMorePrefered() : Byte; +var testedWeap, i: Byte; +begin + testedWeap := FCurrWeap; + for i := WP_FIRST to WP_LAST do + if FWeapon[i] and (FWeapPreferences[i] > FWeapPreferences[testedWeap]) then + testedWeap := i; + if (R_BERSERK in FRulez) and (FWeapPreferences[WP_LAST + 1] > FWeapPreferences[testedWeap]) then + testedWeap := WEAPON_KASTET; + result := testedWeap; +end; + procedure TPlayer.SwitchTeam; begin if g_Game_IsClient then