On Wed, 30 Aug 1995, Daniel W. Burke wrote:
> The code below is called every 5 seconds from comm.c
> no matter what changes I make, it either crashes when it get's
> called, or does nothing at all....
>
> ANY ideas or solutions would be wonderful... (or if you've
> already have teleport rooms working, I'd love to see your
> code, because as far as I can see, this code SHOULD work)
>
>
>
>
> struct teleport_type {
> int zstart;
> int zdest;
> };
>
>
> #define NUM_TELEPORT_ROOMS 4
>
> const struct teleport_type teleport_rooms[NUM_TELEPORT_ROOMS] = {
> {1211, 3001},
> {1210, 3001},
> {1201, 3001},
> {1204, 3002}
> };
>
>
> void do_teleports(void)
> {
> struct char_data *vict, *next_v;
> int i;
> for (i = 1; i < NUM_TELEPORT_ROOMS; i++)
Two things. Your exit condition and your i increment are
reversed (causing i to increase without bound). Also, the first element
of the array is 0, not 1. Try this.
for (i = 0; i++; i < NUM_TELEPORT_ROOMS)
> for (vict = world[teleport_rooms[i].zstart].people; vict; vict = next_v) {
> next_v = vict->next_in_room;
> char_from_room(vict);
> char_to_room(vict, teleport_rooms[i].zdest);
> }
> }
> }
>
>
This archive was generated by hypermail 2b30 : 12/07/00 PST