From dc184a3dc52158992e31d87a63ba9866482ce282 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Mon, 14 Jan 2019 21:30:58 -0200 Subject: Sacrifice some performance to check cells where items will be burried. If it is not walkable, don't bury the item, failing silently. This will reduce random crap array size and thus, optimize memory. --- npc/items/shovel.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npc/items/shovel.txt b/npc/items/shovel.txt index 63d4f677c..fc30b9168 100644 --- a/npc/items/shovel.txt +++ b/npc/items/shovel.txt @@ -14,6 +14,11 @@ function script shovel_scriptItem { .@id=getarg(3); .@amount=getarg(4,1); + // Players can't walk on this cell, why bother? + if (!checkcell(.map$, .@x, .@y, cell_chkpass)) + return; + + // Bury the item, they're renewed daily at 00:00 .@wtc = getarraysize($@WBT_Random_id); $@WBT_Random_id[.@wtc] = .@id; $@WBT_Random_amount[.@wtc] = .@amount; -- cgit v1.2.3-60-g2f50