From: binarymaster Date: Wed, 9 Aug 2017 15:29:53 +0000 (+0300) Subject: Refactor: High value const for ammo X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=2f7fe10481b508addb4db1243d34c3aff4fb525e;p=d2df-sdl.git Refactor: High value const for ammo --- diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index e838a9b..9a226cf 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -1077,10 +1077,10 @@ begin for I := WP_FIRST to WP_LAST do e_Buffer_Write(@NetOut, Byte(FWeapon[I])); - for I := A_BULLETS to A_CELLS do + for I := A_BULLETS to A_HIGH do e_Buffer_Write(@NetOut, FAmmo[I]); - for I := A_BULLETS to A_CELLS do + for I := A_BULLETS to A_HIGH do e_Buffer_Write(@NetOut, FMaxAmmo[I]); for I := MR_SUIT to MR_MAX do @@ -2130,10 +2130,10 @@ begin for I := WP_FIRST to WP_LAST do FWeapon[I] := (e_Raw_Read_Byte(P) <> 0); - for I := A_BULLETS to A_CELLS do + for I := A_BULLETS to A_HIGH do FAmmo[I] := e_Raw_Read_Word(P); - for I := A_BULLETS to A_CELLS do + for I := A_BULLETS to A_HIGH do FMaxAmmo[I] := e_Raw_Read_Word(P); for I := MR_SUIT to MR_MAX do diff --git a/src/game/g_player.pas b/src/game/g_player.pas index 7dd22f8..1ec0ccd 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -50,6 +50,7 @@ const A_SHELLS = 1; A_ROCKETS = 2; A_CELLS = 3; + A_HIGH = 3; K_SIMPLEKILL = 0; K_HARDKILL = 1; @@ -114,8 +115,8 @@ type CurrWeap: Byte; NextWeap: WORD; NextWeapDelay: Byte; - Ammo: Array [A_BULLETS..A_CELLS] of Word; - MaxAmmo: Array [A_BULLETS..A_CELLS] of Word; + Ammo: Array [A_BULLETS..A_HIGH] of Word; + MaxAmmo: Array [A_BULLETS..A_HIGH] of Word; Weapon: Array [WP_FIRST..WP_LAST] of Boolean; Rulez: Set of R_ITEM_BACKPACK..R_BERSERK; WaitRecall: Boolean; @@ -216,8 +217,8 @@ type public FDamageBuffer: Integer; - FAmmo: Array [A_BULLETS..A_CELLS] of Word; - FMaxAmmo: Array [A_BULLETS..A_CELLS] of Word; + FAmmo: Array [A_BULLETS..A_HIGH] of Word; + FMaxAmmo: Array [A_BULLETS..A_HIGH] of Word; FWeapon: Array [WP_FIRST..WP_LAST] of Boolean; FRulez: Set of R_ITEM_BACKPACK..R_BERSERK; FBerserk: Integer; @@ -822,10 +823,10 @@ begin // Îáúåêò èãðîêà: Obj_LoadState(@gPlayers[a].FObj, Mem); // Òåêóùåå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.ReadWord(gPlayers[a].FAmmo[i]); // Ìàêñèìàëüíîå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.ReadWord(gPlayers[a].FMaxAmmo[i]); // Íàëè÷èå îðóæèÿ: for i := WP_FIRST to WP_LAST do @@ -4120,7 +4121,7 @@ begin FModel.SetWeapon(FCurrWeap); - for b := A_BULLETS to A_CELLS do + for b := A_BULLETS to A_HIGH do FAmmo[b] := 0; FAmmo[A_BULLETS] := 50; @@ -5392,10 +5393,10 @@ begin // Îáúåêò èãðîêà: Obj_SaveState(@FObj, Mem); // Òåêóùåå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.WriteWord(FAmmo[i]); // Ìàêñèìàëüíîå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.WriteWord(FMaxAmmo[i]); // Íàëè÷èå îðóæèÿ: for i := WP_FIRST to WP_LAST do @@ -5532,10 +5533,10 @@ begin // Îáúåêò èãðîêà: Obj_LoadState(@FObj, Mem); // Òåêóùåå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.ReadWord(FAmmo[i]); // Ìàêñèìàëüíîå êîëè÷åñòâî ïàòðîíîâ: - for i := A_BULLETS to A_CELLS do + for i := A_BULLETS to A_HIGH do Mem.ReadWord(FMaxAmmo[i]); // Íàëè÷èå îðóæèÿ: for i := WP_FIRST to WP_LAST do @@ -5605,7 +5606,7 @@ begin end; for a := WP_FIRST to WP_LAST do FWeapon[a] := True; - for a := A_BULLETS to A_CELLS do FAmmo[a] := 30000; + for a := A_BULLETS to A_HIGH do FAmmo[a] := 30000; FRulez := FRulez+[R_KEY_RED, R_KEY_GREEN, R_KEY_BLUE]; end;