X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_items.pas;h=9693ad07f31270f0d4e691a33ebcd66de8cbe04d;hb=0b34f8195a84d9aecc7cd9f17fd1902b7723e3b8;hp=028f9d0a86024e5c6b8343c6f45e98429228467c;hpb=414af04a1d69b3bc575c1f6c9bc869973e5293d7;p=d2df-sdl.git diff --git a/src/game/g_items.pas b/src/game/g_items.pas index 028f9d0..9693ad0 100644 --- a/src/game/g_items.pas +++ b/src/game/g_items.pas @@ -2,8 +2,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -455,7 +454,6 @@ begin it.ItemType := ItemType; it.Respawnable := Respawnable; - if g_Game_IsServer and (ITEM_RESPAWNTIME = 0) then it.Respawnable := False; it.InitX := X; it.InitY := Y; it.RespawnTime := 0; @@ -517,6 +515,7 @@ begin for i := 0 to High(ggItems) do begin if (ggItems[i].ItemType = ITEM_NONE) then continue; + if not ggItems[i].slotIsUsed then continue; // just in case with ggItems[i] do begin @@ -577,7 +576,10 @@ begin // Íàäî óáðàòü ñ êàðòû, åñëè ýòî íå êëþ÷, êîòîðûì íóæíî ïîäåëèòüñÿ ñ äðóãèì èãðîêîì if r then begin - if not Respawnable then g_Items_Remove(i) else g_Items_Pick(i); + if not (Respawnable and (ITEM_RESPAWNTIME > 0)) then + g_Items_Remove(i) + else + g_Items_Pick(i); if g_Game_IsNet then MH_SEND_ItemDestroy(False, i); nxt := True; break; @@ -634,6 +636,7 @@ begin for i := 0 to High(ggItems) do begin it := @ggItems[i]; + if (not it.slotIsUsed) or (it.ItemType = ITEM_NONE) then continue; // just in case if not it.alive then continue; if (it.dropped <> dropflag) then continue; @@ -699,7 +702,12 @@ var it: PItem; trig: Integer; begin - if not g_Items_ValidId(ID) then raise Exception.Create('g_Items_Remove: invalid item id'); + if not g_Items_ValidId(ID) then + begin + //writeln('g_Items_Remove: invalid item id: ', ID); + raise Exception.Create('g_Items_Remove: invalid item id'); + //exit; + end; it := @ggItems[ID]; if (it.arrIdx <> Integer(ID)) then raise Exception.Create('g_Items_Remove: arrIdx desync'); @@ -719,7 +727,7 @@ var begin // Ñ÷èòàåì êîëè÷åñòâî ñóùåñòâóþùèõ ïðåäìåòîâ count := 0; - for i := 0 to High(ggItems) do if (ggItems[i].ItemType <> ITEM_NONE) then Inc(count); + for i := 0 to High(ggItems) do if (ggItems[i].ItemType <> ITEM_NONE) and (ggItems[i].slotIsUsed) then Inc(count); // Êîëè÷åñòâî ïðåäìåòîâ utils.writeInt(st, LongInt(count)); @@ -727,7 +735,7 @@ begin for i := 0 to High(ggItems) do begin - if (ggItems[i].ItemType <> ITEM_NONE) then + if (ggItems[i].ItemType <> ITEM_NONE) and (ggItems[i].slotIsUsed) then begin // Ñèãíàòóðà ïðåäìåòà utils.writeSign(st, 'ITEM'); @@ -807,7 +815,8 @@ begin for i := 0 to High(ggItems) do begin it := @ggItems[i]; - if it.Respawnable then + if not it.slotIsUsed then continue; + if it.Respawnable and (it.ItemType <> ITEM_NONE) then begin it.QuietRespawn := True; it.RespawnTime := 0; @@ -832,7 +841,7 @@ begin begin for idx := High(ggItems) downto 0 do begin - if ggItems[idx].alive then + if ggItems[idx].alive and ggItems[idx].slotIsUsed then begin result := cb(@ggItems[idx]); if result then exit; @@ -843,7 +852,7 @@ begin begin for idx := 0 to High(ggItems) do begin - if ggItems[idx].alive then + if ggItems[idx].alive and ggItems[idx].slotIsUsed then begin result := cb(@ggItems[idx]); if result then exit;