? The code certainly looks similar.
It's been a while since I last actually tested my code - this seems to be working against the latest build:
Code:
diff --git a/src/act.movement.c b/src/act.movement.c
index a5a8e1d..1c242cf 100644
--- a/src/act.movement.c
+++ b/src/act.movement.c
@@ -676,12 +676,26 @@ ACMD(do_gen_door)
ACMD(do_enter)
{
char buf[MAX_INPUT_LENGTH];
+ char *tmp = buf;
int door;
+ struct obj_data *obj;
one_argument(argument, buf);
- if (*buf) { /* an argument was supplied, search for door
- * keyword */
+ if (*buf) {
+ int number = get_number(&tmp);
+ /* an argument was supplied, search for door keyword */
+ if ((obj = get_obj_in_list_vis(ch, buf, &number, world[IN_ROOM(ch)].contents))
+ && CAN_SEE_OBJ(ch, obj)
+ && GET_OBJ_VNUM(obj) == PORTAL_VNUM) {
+ room_rnum target_room_rnum = real_room(GET_OBJ_VAL(obj, 1));
+ if (target_room_rnum != NOWHERE) {
+ char_from_room(ch);
+ char_to_room(ch, target_room_rnum);
+ look_at_room(ch, 1);
+ return;
+ }
+ }
for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door))
if (EXIT(ch, door)->keyword)
diff --git a/src/limits.c b/src/limits.c
index a79f8cb..bc3fe43 100644
--- a/src/limits.c
+++ b/src/limits.c
@@ -448,6 +448,17 @@ void point_update(void)
extract_obj(j);
}
}
+
+ else if (GET_OBJ_VNUM(j) == PORTAL_VNUM) {
+ if (GET_OBJ_TIMER(j) > 0)
+ GET_OBJ_TIMER(j)--;
+ if (!GET_OBJ_TIMER(j)) {
+ act("A glowing portal fades from existance.",TRUE, world[j->in_room].people, j, 0, TO_ROOM);
+ act("A glowing portal fades from existance.", TRUE, world[j->in_room].people, j, 0, TO_CHAR);
+ extract_obj(j);
+ }
+ }
+
/* If the timer is set, count it down and at 0, try the trigger
* note to .rej hand-patchers: make this last in your point-update() */
else if (GET_OBJ_TIMER(j)>0) {
diff --git a/src/spell_parser.c b/src/spell_parser.c
index 30510d4..0aa4e0b 100644
--- a/src/spell_parser.c
+++ b/src/spell_parser.c
@@ -277,6 +277,7 @@ int call_magic(struct char_data *caster, struct char_data *cvict,
case SPELL_SUMMON: MANUAL_SPELL(spell_summon); break;
case SPELL_WORD_OF_RECALL: MANUAL_SPELL(spell_recall); break;
case SPELL_TELEPORT: MANUAL_SPELL(spell_teleport); break;
+ case SPELL_PORTAL: MANUAL_SPELL(spell_portal); break;
}
return (1);
@@ -881,6 +882,9 @@ void mag_assign_spells(void)
MAG_AFFECTS | MAG_ALTER_OBJS,
"You feel less sick.");
+ spello(SPELL_PORTAL, "portal", 150, 100, 5, POS_STANDING,
+ TAR_CHAR_WORLD | TAR_NOT_SELF, FALSE, MAG_MANUAL, NULL);
+
spello(SPELL_PROT_FROM_EVIL, "protection from evil", 40, 10, 3, POS_STANDING,
TAR_CHAR_ROOM | TAR_SELF_ONLY, FALSE, MAG_AFFECTS,
"You feel less protected.");
diff --git a/src/spells.c b/src/spells.c
index 1861408..c09b46a 100644
--- a/src/spells.c
+++ b/src/spells.c
@@ -448,3 +448,78 @@ ASPELL(spell_detect_poison)
}
}
}
+
+ASPELL(spell_portal) {
+ /* create a magic portal */
+ struct obj_data *portal_obj;
+ struct extra_descr_data *extra_desc;
+ char buf[512];
+
+ assert(ch);
+ assert((level >= 0) && (level <= LVL_IMPL));
+
+ /*
+ check target room for legality.
+ */
+
+ portal_obj = read_object(PORTAL_VNUM, VIRTUAL);
+ if (IN_ROOM(ch) == NOWHERE || !portal_obj) {
+ send_to_char(ch, "The magic fails\r\n");
+ extract_obj(portal_obj);
+ return;
+ }
+ if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_TUNNEL)) {
+ send_to_char(ch, "There is no room in here to summon!\r\n");
+ extract_obj(portal_obj);
+ return;
+ }
+
+ if (IN_ROOM(victim) == NOWHERE) {
+ log("%s not in any room", GET_NAME(victim));
+ send_to_char(ch, "The magic cannot locate the target\n");
+ extract_obj(portal_obj);
+ return;
+ }
+
+ if (ROOM_FLAGGED(IN_ROOM(victim), ROOM_NOMAGIC)) {
+ send_to_char(ch, "Your target is protected against your magic.\r\n");
+ extract_obj(portal_obj);
+ return;
+ }
+
+ sprintf(buf, "Through the mists of the portal, you can faintly see %s",
+ world[IN_ROOM(victim)].name);
+
+ CREATE(extra_desc, struct extra_descr_data, 1);
+ extra_desc->next = portal_obj->ex_description;
+ portal_obj->ex_description = extra_desc;
+ CREATE(extra_desc->keyword, char, strlen(portal_obj->name) + 1);
+ strcpy(extra_desc->keyword, portal_obj->name);
+ extra_desc->description = strdup(buf);
+
+ portal_obj->obj_flags.timer = 2;
+ portal_obj->obj_flags.value[1] = world[IN_ROOM(victim)].number;
+ obj_to_room(portal_obj, IN_ROOM(ch));
+
+ act("$p suddenly appears.", TRUE, ch, portal_obj, 0, TO_ROOM);
+ act("$p suddenly appears.", TRUE, ch, portal_obj, 0, TO_CHAR);
+
+ /* Portal at other side */
+ portal_obj = read_object(PORTAL_VNUM, VIRTUAL);
+ sprintf(buf, "Through the mists of the portal, you can faintly see %s",
+ world[IN_ROOM(ch)].name);
+
+ CREATE(extra_desc, struct extra_descr_data, 1);
+ extra_desc->next = portal_obj->ex_description;
+ portal_obj->ex_description = extra_desc;
+ CREATE(extra_desc->keyword, char, strlen(portal_obj->name) + 1);
+ strcpy(extra_desc->keyword, portal_obj->name);
+ extra_desc->description = strdup(buf);
+
+ portal_obj->obj_flags.timer = 2;
+ portal_obj->obj_flags.value[1] = world[IN_ROOM(ch)].number;
+ obj_to_room(portal_obj, IN_ROOM(victim));
+
+ act("$p suddenly appears.", TRUE, victim, portal_obj, 0, TO_ROOM);
+ act("$p suddenly appears.", TRUE, victim, portal_obj, 0, TO_CHAR);
+}
diff --git a/src/spells.h b/src/spells.h
index c88c554..c5c63b4 100644
--- a/src/spells.h
+++ b/src/spells.h
@@ -15,6 +15,8 @@
#define DEFAULT_STAFF_LVL 12
#define DEFAULT_WAND_LVL 12
+#define PORTAL_VNUM 20
+
#define CAST_UNDEFINED (-1)
#define CAST_SPELL 0
#define CAST_POTION 1
@@ -93,8 +95,9 @@
#define SPELL_IDENTIFY 52 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_FLY 53 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_DARKNESS 54
+#define SPELL_PORTAL 55
/** Total Number of defined spells */
-#define NUM_SPELLS 54
+#define NUM_SPELLS 55
/* Insert new spells here, up to MAX_SPELLS */
#define MAX_SPELLS 130
@@ -226,6 +229,7 @@ ASPELL(spell_information);
ASPELL(spell_identify);
ASPELL(spell_enchant_weapon);
ASPELL(spell_detect_poison);
+ASPELL(spell_portal);
/* basic magic calling functions */