From ad049a15b43b7ddba3fe7d0a898652fc8022629d Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 22 Apr 2014 11:46:23 -0700 Subject: Use strict ID types Possibly some missing for the far side of the network. AccountId and BlockId are still terribly entangled. --- src/map/magic-expr.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/map/magic-expr.cpp') diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp index b6f3208..6a411b7 100644 --- a/src/map/magic-expr.cpp +++ b/src/map/magic-expr.cpp @@ -190,7 +190,7 @@ void stringify(val_t *v, int within_op) { dumb_ptr invocation_ = within_op ? v->v.v_invocation - : map_id2bl(v->v.v_int)->is_spell(); + : map_id2bl(wrap(static_cast(v->v.v_int)))->is_spell(); buf = invocation_->spell->name; } break; @@ -725,7 +725,7 @@ int fun_mob_id(dumb_ptr, val_t *result, Slice args) { if (ENTITY_TYPE(0) != BL::MOB) return 1; - RESULTINT = ARGMOB(0)->mob_class; + RESULTINT = unwrap(ARGMOB(0)->mob_class); return 0; } @@ -783,7 +783,7 @@ int fun_random_dir(dumb_ptr, val_t *result, Slice args) static int fun_hash_entity(dumb_ptr, val_t *result, Slice args) { - RESULTINT = ARGENTITY(0)->bl_id; + RESULTINT = unwrap(ARGENTITY(0)->bl_id); return 0; } @@ -794,7 +794,7 @@ magic_find_item(Slice args, int index, struct item *item_, int *stackable int must_add_sequentially; if (ARG_TYPE(index) == TYPE::INT) - item_data = itemdb_exists(ARGINT(index)); + item_data = itemdb_exists(wrap(static_cast(ARGINT(index)))); else if (ARG_TYPE(index) == TYPE::STRING) item_data = itemdb_searchname(ARGSTR(index)); else @@ -1559,13 +1559,13 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature, if (ty == TYPE::ENTITY) { /* Dereference entities in preparation for calling function */ - arg->v.v_entity = map_id2bl(arg->v.v_int); + arg->v.v_entity = map_id2bl(wrap(static_cast(arg->v.v_int))); if (!arg->v.v_entity) ty = arg->ty = TYPE::FAIL; } else if (ty == TYPE::INVOCATION) { - arg->v.v_invocation = map_id2bl(arg->v.v_int)->is_spell(); + arg->v.v_invocation = map_id2bl(wrap(static_cast(arg->v.v_int)))->is_spell(); if (!arg->v.v_entity) ty = arg->ty = TYPE::FAIL; } @@ -1674,7 +1674,7 @@ void magic_eval(dumb_ptr env, val_t *dest, dumb_ptr expr) if (dest->ty == TYPE::ENTITY) { if (dest->v.v_entity) - dest->v.v_int = dest->v.v_entity->bl_id; + dest->v.v_int = static_cast(unwrap(dest->v.v_entity->bl_id)); else dest->ty = TYPE::FAIL; } @@ -1700,7 +1700,7 @@ void magic_eval(dumb_ptr env, val_t *dest, dumb_ptr expr) if (v.ty == TYPE::INVOCATION) { - dumb_ptr t = map_id2bl(v.v.v_int)->is_spell(); + dumb_ptr t = map_id2bl(wrap(static_cast(v.v.v_int)))->is_spell(); if (!t) dest->ty = TYPE::UNDEF; -- cgit v1.2.3-60-g2f50