summaryrefslogtreecommitdiff
path: root/npc/functions
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2016-12-06 14:23:19 -0500
committerReid <reidyaro@gmail.com>2016-12-07 17:05:02 +0100
commit135f7b4555e851fe00f24ba4157d3bb177c7b52e (patch)
tree801ae730d9900e5071d91f893cd9ca7b8d64e9ac /npc/functions
parent7ebc17f8b4ba8cb03a6251084bd896ac5a6fdc06 (diff)
downloadserverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.gz
serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.bz2
serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.tar.xz
serverdata-135f7b4555e851fe00f24ba4157d3bb177c7b52e.zip
simplify inventoryplace
Diffstat (limited to 'npc/functions')
-rw-r--r--npc/functions/inventoryplace.txt43
1 files changed, 15 insertions, 28 deletions
diff --git a/npc/functions/inventoryplace.txt b/npc/functions/inventoryplace.txt
index 02c28b1c..e92ec579 100644
--- a/npc/functions/inventoryplace.txt
+++ b/npc/functions/inventoryplace.txt
@@ -9,42 +9,29 @@
function script inventoryplace {
- function inventoryplace_warn {
- narrator
- l("It looks like you can't carry anything else for now."),
- l("You should come back when you have some free space.");
-
- bye;
- }
-
.@argc = getargcount();
- if (.@argc < 2)
+ if (.@argc % 2 != 0)
{
- debugmes "Wrong argument count.";
+ debugmes "inventoryplace: Wrong argument count.";
+ close;
}
- else if (.@argc == 2)
+
+ for (.@i = .@j = 0; .@i < .@argc; .@i += 2)
{
- if (!checkweight(getarg(0), getarg(1)))
- {
- inventoryplace_warn();
- }
+ setarray .@item[.@j], getarg(.@i);
+ setarray .@amount[.@j], getarg(.@i + 1);
+ ++.@j;
}
- else
- {
- for (.@i = .@j = 0; .@i < .@argc; .@i += 2)
- {
- setarray .@item[.@j], getarg(.@i);
- setarray .@amount[.@j], getarg(.@i + 1);
- .@j++;
- }
+ if (!checkweight2(.@item, .@amount))
+ {
+ narrator 1,
+ l("It looks like you can't carry anything else for now."),
+ l("You should come back when you have some free space.");
- if (!checkweight2(.@item, .@amount))
- {
- inventoryplace_warn();
- }
+ close;
}
- return;
+ return true;
}