summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce76cc6)
raw | patch | inline | side by side (parent: ce76cc6)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 5 Feb 2018 01:13:07 +0000 (03:13 +0200) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 5 Feb 2018 01:13:28 +0000 (03:13 +0200) |
src/game/g_items.pas | patch | blob | history |
diff --git a/src/game/g_items.pas b/src/game/g_items.pas
index 64ffe3e62697d8ac162de5f236987561ca2068c5..a70bd54a61f9da0f9827996db6e1d654090da1df 100644 (file)
--- a/src/game/g_items.pas
+++ b/src/game/g_items.pas
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
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;
begin
if not g_Items_ValidId(ID) then
begin
- //raise Exception.Create('g_Items_Remove: invalid item id');
- writeln('g_Items_Remove: invalid item id: ', ID);
- exit;
+ //writeln('g_Items_Remove: invalid item id: ', ID);
+ raise Exception.Create('g_Items_Remove: invalid item id');
+ //exit;
end;
it := @ggItems[ID];
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));
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');
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;
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;
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;