summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-06-01 15:55:59 +0200
committerGitHub <noreply@github.com>2019-06-01 15:55:59 +0200
commit50a0952e62fe590bddd9eb0c3d65c913b938354d (patch)
tree927872bcac19b64c6d47c96e92536efb5f7c371a /src/map/clif.c
parentc8202e1cd9eb64d07fa921d117a13eef3938a4db (diff)
parent797464b89910c4a04d0381a831001f4a7591ad28 (diff)
downloadhercules-50a0952e62fe590bddd9eb0c3d65c913b938354d.tar.gz
hercules-50a0952e62fe590bddd9eb0c3d65c913b938354d.tar.bz2
hercules-50a0952e62fe590bddd9eb0c3d65c913b938354d.tar.xz
hercules-50a0952e62fe590bddd9eb0c3d65c913b938354d.zip
Merge pull request #2375 from AnnieRuru/58-negative_input
Allow *input script command to support negative input
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 721d2f5b5..b93274d3d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -12843,10 +12843,19 @@ static void clif_parse_NpcAmountInput(int fd, struct map_session_data *sd)
int npcid = RFIFOL(fd,2);
int amount = RFIFOL(fd,6);
- if (amount >= 0)
+ if (amount < sd->npc_amount_min) {
+ sd->npc_amount = sd->npc_amount_min;
+ sd->npc_input_capped_range = -1;
+ }
+ else if (amount > sd->npc_amount_max) {
+ sd->npc_amount = sd->npc_amount_max;
+ sd->npc_input_capped_range = 1;
+ }
+ else {
sd->npc_amount = amount;
- else
- sd->npc_amount = 0;
+ sd->npc_input_capped_range = 0;
+ }
+
npc->scriptcont(sd, npcid, false);
}