summaryrefslogtreecommitdiff
path: root/npc/functions/inventoryplace.txt
blob: 76cdad21f512e3e7815fa38b5674d527c0276665 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Evol functions.
// Authors:
//    Qwerty Dragon
//    Reid
// Description:
//    Check if the player have enough place on his inventory to accept new items  with arguments:
//      getarg(even numbers)   item ID,
//      getarg(odd numbers)    number of items,

function	script	inventoryplace	{

    .@argc = getargcount();

    if (.@argc % 2 != 0)
    {
        Exception("inventoryplace: Wrong argument count.", RB_SPEECH|RB_ISFATAL|RB_PLEASEREPORT|RB_DEBUGMES);
    }

    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 S_FIRST_BLANK_LINE,
            l("It looks like you can't carry anything else for now."),
            l("You should come back when you have some free space.");

        close;
    }

    return true;
}