… | |
… | |
856 | } |
856 | } |
857 | |
857 | |
858 | int |
858 | int |
859 | summon_object (object *op, object *caster, object *spell_ob, int dir, const char *stringarg) |
859 | summon_object (object *op, object *caster, object *spell_ob, int dir, const char *stringarg) |
860 | { |
860 | { |
861 | sint16 x, y, nrof = 1, i; |
861 | int nrof = 1; |
862 | archetype *summon_arch; |
862 | archetype *summon_arch; |
863 | int ndir; |
863 | int ndir; |
864 | |
864 | |
865 | if (spell_ob->other_arch) |
865 | if (spell_ob->other_arch) |
866 | summon_arch = spell_ob->other_arch; |
866 | summon_arch = spell_ob->other_arch; |
… | |
… | |
966 | { |
966 | { |
967 | new_draw_info (NDI_UNIQUE, 0, op, "There is no monsters available for summoning."); |
967 | new_draw_info (NDI_UNIQUE, 0, op, "There is no monsters available for summoning."); |
968 | return 0; |
968 | return 0; |
969 | } |
969 | } |
970 | |
970 | |
971 | for (i = 1; i <= nrof; i++) |
971 | for (int i = 1; i <= nrof; i++) |
972 | { |
972 | { |
973 | object *prev = NULL, *head = NULL, *tmp; |
973 | object *prev = NULL, *head = NULL, *tmp; |
974 | |
974 | |
975 | if (dir) |
975 | if (dir) |
976 | { |
976 | { |
… | |
… | |
978 | dir = absdir (dir + 1); |
978 | dir = absdir (dir + 1); |
979 | } |
979 | } |
980 | else |
980 | else |
981 | ndir = find_free_spot (summon_arch, op->map, op->x, op->y, 1, SIZEOFFREE); |
981 | ndir = find_free_spot (summon_arch, op->map, op->x, op->y, 1, SIZEOFFREE); |
982 | |
982 | |
983 | if (ndir > 0) |
|
|
984 | { |
|
|
985 | x = freearr_x[ndir]; |
983 | sint16 x = freearr_x [ndir]; |
986 | y = freearr_y[ndir]; |
984 | sint16 y = freearr_y [ndir]; |
987 | } |
|
|
988 | |
985 | |
989 | if (ndir < 0 || summon_arch->blocked (op->map, op->x + x, op->y + y)) |
986 | if (ndir < 0 || summon_arch->blocked (op->map, op->x + x, op->y + y)) |
990 | { |
987 | { |
991 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
988 | new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); |
992 | if (nrof > 1) |
989 | if (nrof > 1) |
993 | new_draw_info (NDI_UNIQUE, 0, op, "No more pets for this casting."); |
990 | new_draw_info (NDI_UNIQUE, 0, op, "No more pets for this casting."); |
994 | |
991 | |
995 | return nrof > 1; |
992 | return nrof > 1; |
996 | } |
993 | } |
997 | |
994 | |
998 | for (archetype *atmp = summon_arch; atmp != NULL; atmp = (archetype *)atmp->more) |
995 | for (archetype *atmp = summon_arch; atmp; atmp = (archetype *)atmp->more) |
999 | { |
996 | { |
1000 | tmp = arch_to_object (atmp); |
997 | tmp = arch_to_object (atmp); |
1001 | if (atmp == summon_arch) |
998 | if (atmp == summon_arch) |
1002 | { |
999 | { |
1003 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |
1000 | if (QUERY_FLAG (tmp, FLAG_MONSTER)) |