示例#1
0
static int fun_eq (env_t * env, int args_nr, val_t * result, val_t * args)
{
    if (TY (0) == TY_STRING || TY (1) == TY_STRING)
    {
        stringify (&args[0], 1);
        stringify (&args[1], 1);
        RESULTINT = strcmp (ARGSTR (0), ARGSTR (1)) == 0;
    }
    else if (TY (0) == TY_DIR && TY (1) == TY_DIR)
        RESULTINT = ARGDIR (0) == ARGDIR (1);
    else if (TY (0) == TY_ENTITY && TY (1) == TY_ENTITY)
        RESULTINT = ARGENTITY (0) == ARGENTITY (1);
    else if (TY (0) == TY_LOCATION && TY (1) == TY_LOCATION)
        RESULTINT = (ARGLOCATION (0).x == ARGLOCATION (1).x
                     && ARGLOCATION (0).y == ARGLOCATION (1).y
                     && ARGLOCATION (0).m == ARGLOCATION (1).m);
    else if (TY (0) == TY_AREA && TY (1) == TY_AREA)
        RESULTINT = ARGAREA (0) == ARGAREA (1); /* Probably not that great an idea... */
    else if (TY (0) == TY_SPELL && TY (1) == TY_SPELL)
        RESULTINT = ARGSPELL (0) == ARGSPELL (1);
    else if (TY (0) == TY_INVOCATION && TY (1) == TY_INVOCATION)
        RESULTINT = ARGINVOCATION (0) == ARGINVOCATION (1);
    else
    {
        intify (&args[0]);
        intify (&args[1]);
        RESULTINT = ARGINT (0) == ARGINT (1);
    }
    return 0;
}
示例#2
0
static
int fun_eq(dumb_ptr<env_t>, val_t *result, const_array<val_t> args)
{
    if (ARG_TYPE(0) == TYPE::STRING || ARG_TYPE(1) == TYPE::STRING)
    {
        stringify(&args[0], 1);
        stringify(&args[1], 1);
        RESULTINT = ARGSTR(0) == ARGSTR(1);
    }
    else if (ARG_TYPE(0) == TYPE::DIR && ARG_TYPE(1) == TYPE::DIR)
        RESULTINT = ARGDIR(0) == ARGDIR(1);
    else if (ARG_TYPE(0) == TYPE::ENTITY && ARG_TYPE(1) == TYPE::ENTITY)
        RESULTINT = ARGENTITY(0) == ARGENTITY(1);
    else if (ARG_TYPE(0) == TYPE::LOCATION && ARG_TYPE(1) == TYPE::LOCATION)
        RESULTINT = (ARGLOCATION(0).x == ARGLOCATION(1).x
                     && ARGLOCATION(0).y == ARGLOCATION(1).y
                     && ARGLOCATION(0).m == ARGLOCATION(1).m);
    else if (ARG_TYPE(0) == TYPE::AREA && ARG_TYPE(1) == TYPE::AREA)
        RESULTINT = ARGAREA(0) == ARGAREA(1); /* Probably not that great an idea... */
    else if (ARG_TYPE(0) == TYPE::SPELL && ARG_TYPE(1) == TYPE::SPELL)
        RESULTINT = ARGSPELL(0) == ARGSPELL(1);
    else if (ARG_TYPE(0) == TYPE::INVOCATION && ARG_TYPE(1) == TYPE::INVOCATION)
        RESULTINT = ARGINVOCATION(0) == ARGINVOCATION(1);
    else
    {
        intify(&args[0]);
        intify(&args[1]);
        RESULTINT = ARGINT(0) == ARGINT(1);
    }
    return 0;
}