예제 #1
0
파일: MazeMap.c 프로젝트: maksverver/Amazes
void mm_look(MazeMap *mm, const char *line, RelDir rel_dir)
{
    Dir front = TURN(mm->dir, rel_dir),
        left  = TURN(front, LEFT),
        right = TURN(front, RIGHT),
        back  = TURN(front, BACK);

    int r = mm->loc.r,
        c = mm->loc.c;

    while (*line)
    {
        bool open_left = false, open_right = false;
        switch (*line++)
        {
        case 'B':  /* opening on both sides */
            open_left = open_right = true;
            break;
        case 'L':  /* opening on left side */
            open_left = true;
            break;
        case 'R':   /* opening on right side */
            open_right = true;
            break;
        case 'N':   /* no opening on either side */
            break;
        case 'W':  /* wall immediately ahead: */
            SET_WALL(mm, r, c, front, PRESENT);
            assert(*line == '\0');
            return;
        default:  /* invalid char */
            assert(0);
        }

        push_border(mm, r, c, front);
        r = RDR(r, front);
        c = CDC(c, front);

        SET_SQUARE(mm, r, c, PRESENT);
        SET_WALL(mm, r, c, back, ABSENT);
        SET_WALL(mm, r, c, left, open_left ? ABSENT : PRESENT);
        SET_WALL(mm, r, c, right, open_right ? ABSENT : PRESENT);

        if (open_left)
        {
            SET_SQUARE(mm, RDR(r, left), CDC(c, left), PRESENT);
            push_border(mm, r, c, left);
        }

        if (open_right)
        {
            SET_SQUARE(mm, RDR(r, right), CDC(c, right), PRESENT);
            push_border(mm, r, c, right);
        }
    }

    assert(0); /* shouldn't get here: every line must end with W */
    return;
}
예제 #2
0
void do_done(CHAR_DATA * ch, char * thedir)
{
CHAR_DATA *rch;
if(!ch->infight)
{
printf_to_char(ch,"You're not in a fight.");
return;
}

if(!TURN(ch))
{
printf_to_char(ch,"It's not your turn.");
return;
}
   
    check_winner(ch->in_room);
    
    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {  
         printf_to_char(rch,"%s ends %s turn.\n",fcn(ch), ch->sex ? "his" : "her");
         do_map(rch,"forced");
         rch->AT++;
    }
       ch->AT = 0;

advance_turn(ch); 
}
예제 #3
0
void sort_global_moves(Move_t tt_move, int tt_score, int depth) {
    
    Board_t *board = global_board();
    Move_t *moves = global_move_list();
    Move_t temp;
    int nMoves = global_move_count();
    int n_killers;
    
    Move_t *killers = get_killers(&n_killers, depth);
    
    if (nMoves <= 1)
        return;
    
    int *scores = sort_data.scores[depth];
    int *flags = sort_data.flags[depth];
    
    int i, j, fail;
    for (i = 0; i < nMoves; i++) {
        scores[i] = see(moves[i], board);
        flags[i] = NO_ORDER_FLAG;
        
        if (moves[i] == tt_move) {
            scores[i] = tt_score;
            flags[i] = TT_MOVE;
        } else {
            for (j = 0; j < n_killers; j++) {
                if (moves[i] == killers[j])
                    flags[i] = KILLER_MOVE;
            }
            
        }
        
        if (flags[i] == NO_ORDER_FLAG &&
            (temp = get_history_score(moves[i], TURN(board))) != -VALUE_INFINITE) {
            flags[i] = HISTORY_MOVE;
            scores[i] = temp;
        }
    }
    
    do {
        fail = 0;
        for (i = 0; i < nMoves - 1; i++) {
            if ((flags[i] < flags[i+1]) || (flags[i] == flags[i+1] && scores[i] < scores[i+1])) {
                temp = moves[i];
                moves[i] = moves[i+1];
                moves[i+1] = temp;
                temp = scores[i];
                scores[i] = scores[i+1];
                scores[i+1] = temp;
                temp = flags[i];
                flags[i] = flags[i+1];
                flags[i+1] = temp;
                fail = 1;
            }
        }
        
        
    } while (fail);
    
}
예제 #4
0
void leave_fight(CHAR_DATA *ch) 
{ 
ch->infight = FALSE; 

  if(TURN(ch))
  advance_turn(ch);
  ch->mposx = 0; ch->jump = 0; ch->base_move = 0; ch->in_room->map.closed = TRUE;
}
예제 #5
0
void check_winner(ROOM_INDEX_DATA *ro)
{
bool found=FALSE;
int redct = 0;
int bluect = 0;
int greenct = 0;
int nonect = 0;
int total = 0;
CHAR_DATA *rch;

    for (rch = ro->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch == NULL)
    continue;

    if(rch->infight)
    {
if(TURN(rch))
found=TRUE;    
    total++;
    if(rch->team == TEAM_BLUE) 
    bluect++;
    else if(rch->team == TEAM_RED) 
    redct++;
    else if(rch->team == TEAM_GREEN) 
    greenct++;
    else if(rch->team == TEAM_NONE) 
    nonect++;
    }
    }

if(total == 1
|| bluect == total || greenct == total || redct == total)
{
    for (rch = ro->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight)
    {
    printf_to_char(rch,"\n\r{Y* * * B A T T L E  C O M P L E T E * * *\n\r{x");
    printf_to_char(rch,"{B      Uh, you won... and stuff.         \n\r{x");
    rch->infight = FALSE;
    rch->mposy = 0;
    rch->team = 0;
    rch->in_room->turn=NULL;
    rch->mposx = 0;
    }
    }
}
}   
예제 #6
0
static void
generate_cesarovar(ModeInfo * mi, double pt1x, double pt1y,
		   double pt2x, double pt2y, int level, int sign)
{
	Display    *display = MI_DISPLAY(mi);
	Window      window = MI_WINDOW(mi);
	GC          gc = MI_GC(mi);
	turtlestruct *tp = &turtles[MI_SCREEN(mi)];
	complextype points[4];

	level--;

	tp->turtle.r = sqrt((double) ((pt2x - pt1x) * (pt2x - pt1x) +
				      (pt2y - pt1y) * (pt2y - pt1y))) / 2.0;
	points[0].x = pt1x;
	points[0].y = pt1y;
	points[2].x = pt2x;
	points[2].y = pt2y;
	tp->turtle.theta = POINT(pt1x, pt1y, pt2x, pt2y);
	tp->turtle.x = pt1x;
	tp->turtle.y = pt1y;
	STEP(tp->turtle.x, tp->turtle.y, tp->turtle.r, tp->turtle.theta);
	points[3].x = tp->turtle.x;
	points[3].y = tp->turtle.y;
	TURN(tp->turtle.theta, 90.0 * (double) sign);
	STEP(tp->turtle.x, tp->turtle.y, tp->turtle.r, tp->turtle.theta);
	points[1].x = tp->turtle.x;
	points[1].y = tp->turtle.y;
	sign = -1;
	if (level > 0) {
		int         j;

		for (j = 0; j < 2; j++) {
			pt1x = points[j].x;
			pt2x = points[j + 1].x;
			pt1y = points[j].y;
			pt2y = points[j + 1].y;
			generate_cesarovar(mi, pt1x, pt1y, pt2x, pt2y, level, sign);
		}
	} else {
		XDrawLine(display, window, gc,
			  (int) points[0].x + tp->start.x, (int) points[0].y + tp->start.y,
			  (int) points[2].x + tp->start.x, (int) points[2].y + tp->start.y);
		XDrawLine(display, window, gc,
			  (int) points[1].x + tp->start.x, (int) points[1].y + tp->start.y,
			  (int) points[3].x + tp->start.x, (int) points[3].y + tp->start.y);
	}
}
예제 #7
0
파일: MazeMap.c 프로젝트: maksverver/Amazes
void mm_move(MazeMap *mm, char move)
{
    RelDir rel_dir;
    switch (move)
    {
    case 'F': rel_dir = FRONT; break;
    case 'T': rel_dir = BACK;  break;
    case 'L': rel_dir = LEFT;  break;
    case 'R': rel_dir = RIGHT; break;
    default: assert(0);   /* invalid char */
    }
    mm->dir = TURN(mm->dir, rel_dir);
    push_border(mm, mm->loc.r, mm->loc.c, mm->dir);
    mm->loc.r = RDR(mm->loc.r, mm->dir);
    mm->loc.c = CDC(mm->loc.c, mm->dir);
    SET_SQUARE(mm, mm->loc.r, mm->loc.c, PRESENT);
}
예제 #8
0
/*
 * Mob autonomous action.
 * This function takes 25% to 35% of ALL Merc cpu time.
 * -- Furey
 */
void mobile_update (void)
{
    CHAR_DATA *ch;
    CHAR_DATA *ch_next;
    CHAR_DATA *rch;

    /* Examine all mobs. */
    for (ch = char_list; ch != NULL; ch = ch_next)
    {
        ch_next = ch->next;

        if (!IS_NPC (ch) || ch->in_room == NULL) continue;

        if (ch->in_room->area->empty && !IS_SET (ch->act, ACT_UPDATE_ALWAYS))
            continue;

        if (ch->pIndexData->pShop != NULL)    /* give him some gold */
            if ((ch->gold * 100 + ch->silver) < ch->pIndexData->wealth)
            {
                ch->gold +=
                    ch->pIndexData->wealth * number_range (1, 20) / 5000000;
                ch->silver +=
                    ch->pIndexData->wealth * number_range (1, 20) / 50000;
            }


        /* That's all for sleeping / busy monster, and empty zones */
        if (ch->position != POS_STANDING)
            continue;
            
    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight && !ch->infight && IS_NPC(ch) && !ch->pIndexData->pShop)
    {
    do_autodisp(ch," ");
    do_join(ch,"none");
    }
    }

            if(IS_NPC(ch) && ch->infight && TURN(ch))
            ai_move(ch);
        
    }

    return;
}
int main() 
{
	printf("checklist");
	printf("hit black button when ready");
	while(black_button());
	printf("MAKE SURE CREATE IS ON!!!!!!!!");
	while(!black_button());
	printf("MAKE SURE ARM IS IN DOWN POSITION!!!!!!!!");
	while(!black_button());
	printf("MAKE SURE ARM AND CLAW WORK");
	while(!black_button());
	printf("CHECK POSITION OF CLAW AND ARM");
	while(!black_button());
	printf("MAKE SURE LIGHT SENSORT IS CALIBRATED");
	while(!black_button());
	// this starts the robot    SECTion 1
	wait_for_light(0);
	shut_down_in(120.0);
	//this shuts the robot down after 120.0 seconds
	while(create_connect());
	
		//connects create to cbc
	set_servo_position(3, 0);
	set_servo_position(0, 1800);
	enable_servos();
	msleep(500);
	create_full();
	//section 2
	create_drive_direct(SUPER_FAST, SUPER_FAST);
	msleep(1646);
	//leave beach
	create_stop();
	msleep(300);
	create_drive_direct(SUPER_FAST, -SUPER_FAST);
	msleep(435);
	//turn towards center
	create_stop();
	msleep(300);
	create_drive_direct(SUPER_FAST, SUPER_FAST);
	msleep(1600);
	//move towards botguy
	create_stop();
	msleep(500);
	//section 3
	set_servo_position(0, 1424);
	msleep(1800);
	set_servo_position(0, 1100);
	msleep(1800);
	set_servo_position(0, 924);
	msleep(1800);
	set_servo_position(0, 724);
	msleep(1800);
	set_servo_position(3, 1024);
	msleep(1800);
	set_servo_position(0, 924);
	msleep(1800);
	set_servo_position(0, 1100);
	msleep(1800);
	set_servo_position(0, 1200);
	msleep(2000);
	
	
	
	//retrieve botguy
	//section 4
	create_drive_direct(-FAST, FAST);
	msleep(445);
	create_stop();
	create_drive_direct(-FAST, -FAST);
	msleep(2000);
	create_stop();
	create_drive_direct(FAST, -FAST);
	msleep(445);
	create_stop();	
	create_drive_direct(-FAST, -FAST);
	msleep(900);
	create_stop();
	msleep(1600);
	create_stop();
	set_servo_position(3, 0);
	set_servo_position(0, 1800);
	msleep(1200);
	set_servo_position(0, 1200);
	msleep(1000);
	set_servo_position(0, 1800);
	msleep(1000);
	create_drive_direct(1000, 1000);
	msleep(800);
	create_drive_direct(-1000, -1000);
	msleep(800);
	DRIVE(SUPER_FAST);
	MSLEEP(800);
	TURN(-SUPER_FAST, SUPER_FAST);
	MSLEEP(460);
	DRIVE(SUPER_FAST);
	MSLEEP(1380);
	TURN(SUPER_FAST, -SUPER_FAST);
	MSLEEP(425);
	DRIVE(SUPER_FAST);
	SLEEP(1.5);
	while(get_create_lbump(0.01) == 0)
	{
		DRIVE(SUPER_FAST);
	}
	TURN(-SUPER_FAST, SUPER_FAST);
	MSLEEP(435);
	TURN(SUPER_FAST, 975);
	MSLEEP(500);
	while(get_create_rbump(0.01) == 0)
	{
		TURN(SUPER_FAST, 990);
	}
	
	
	
	create_stop();
	create_disconnect();
	
	
	
	
}
예제 #10
0
/* parses options and stores the main game loop */
int main(int argc, char **argv)
{
    /* init ncurses environment */
    initscr();
    cbreak();
    noecho();
    curs_set(FALSE);

    /* init variables */
    file = ".hs2048g";
    hs = 0;
    s  = 0;
    sl = 0;
    SZ = 4;
    MAXVAL = 4;
    CALLOC2D(g, SZ);

    load_score();
    int n_blocks = 1;
    
    /* parse options */
    int c;
    while ((c = getopt(argc, argv, "rchs:b:")) != -1) {
        switch (c) {
            // color support - assumes your terminal can display colours
            // should still work regardless
            case 'c':
                start_color();
                init_pair(1, 1, 0);
                init_pair(2, 2, 0);
                init_pair(3, 3, 0);
                init_pair(4, 4, 0);
                init_pair(5, 5, 0);
                init_pair(6, 6, 0);
                init_pair(7, 7, 0);
                break;
            // different board sizes
            case 's':
                FREE2D(g, SZ);
                int optint = atoi(optarg);
                SZ = optint > 4 ? optint : 4;
                CALLOC2D(g, SZ);
                break;
            // different block spawn rate
            case 'b':
                n_blocks = atoi(optarg);
                break;
            // reset hiscores
            case 'r':
                endwin();
                printf("Are you sure you want to reset your highscores? (Y)es or (N)o\n");
                int response;
                if ((response = getchar()) == 'y' || response == 'Y') {
                    FILE *fd = fopen(file, "w+");
                    fclose(fd);
                }
                exit(EXIT_SUCCESS);
            // help menu
            case 'h':
                endwin();
                printf("Controls:\n"
                       "    hjkl, wasd      Movement\n"
                       "    q               Quit\n"
                       "\n"
                       "Usage:\n"
                       "    2048 [options]\n"
                       "\n"
                       "Options:\n"
                       "    -s <size>       Set the grid border length\n"
                       "    -b <rate>       Set the block spawn rate\n"
                       "    -c              Enables color support\n");
                exit(EXIT_SUCCESS);
        }
    }
    
    int width  = SZ * (MAXVAL + 2) + 1;
    int height = SZ * (MAXVAL + 2) + 3;

    // might center in middle of screen
    WINDOW *gamewin = newwin(height, width, 1, 1);
    keypad(gamewin, TRUE);

    /* random seed */
    srand((unsigned int)time(NULL));
    ITER(2, rand_block());
    draw_grid(gamewin);

    int key, moved;
    while (1) {
        /* will goto this if we didn't get a valid keypress */
        retry:;
        moved = 0;
        key = wgetch(gamewin);
        sl = 0;

        /* should check if anything changed during merge and if not retry */
        switch (key) {
            case 'h':
            case 'a':
            case KEY_LEFT:
                moved = TURN(DL);
                break;
            case 'l':
            case 'd':
            case KEY_RIGHT:
                moved = TURN(DR);
                break;
            case 'j':
            case 's':
            case KEY_DOWN:
                moved = TURN(DD);
                break;
            case 'k':
            case 'w':
            case KEY_UP:
                moved = TURN(DU);
                break;
            case 'q':
                FREE2D(g, SZ);
                erase();
                refresh();
                endwin();
                save_score();
                exit(EXIT_SUCCESS);
            default:
                goto retry;
        }
        
        if (!moves_available()) {
            endwin();
            printf("\n"
                   "YOU LOSE! - Your score was %d\n", s);
            save_score();
            exit(EXIT_SUCCESS);
        }

        if (moved) {
            ITER(n_blocks, rand_block());
            draw_grid(gamewin);
        }
    }
}
예제 #11
0
void fmap (CHAR_DATA * ch, bool forced, bool range, char *argument)
{
char buf1[70];
char buf2[70];
char buf3[70];
int i,j;
int total = 0;
CHAR_DATA * fighters[16];
int fightcount = 0;
CHAR_DATA *rch;
int theturn = 0;

if(!ch->in_room->map.init)
{
ch->in_room->map.init = TRUE;
generate_random_terrain(ch->in_room);
}   

if (IS_SET (ch->comm, COMM_NOMAP) && forced == TRUE)
return;

    for (rch = ch->in_room->people; rch != NULL; rch = rch->next_in_room)
    {
    if(rch->infight)
        {
        if(TURN(rch))
        theturn = 1;
        fighters[fightcount] = rch;
        fightcount++;
        }
     }

printf_to_char(ch,"\n\r%s",echo_off_str);

printf_to_char(ch," {y 0123456789abcdefghijklmnop{x\n\r");
printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");
for(i=0;i<16;i++)
{
char buf2[MSL];
printf_to_char(ch,"{W%c|{x",gridname[i]);
for(j=0;j<26;j++)
{
total += parse_room(ch,i,j,range);
}
if(i < fightcount)
{

sprintf(buf2," %s{x{w{W - %s%-19s {C %3dAT %5dHP %5dMP{W",fighters[i]->fdisp,get_t_color(fighters[i]),fcn(fighters[i]),fighters[i]->AT,fighters[i]->hit,fighters[i]->mana);
}
else
sprintf(buf2,"{x%47s{x"," ");
printf_to_char(ch,"{W|%c |%s|\n\r",gridname[i],buf2);
}

if(ch->in_room->turn != NULL)
{
char buf7[40];
CHAR_DATA *rch = ch->in_room->turn;

if(rch->level > 99)
sprintf(buf7,"{gL{W**{c ---{bexp{W             | PA MA BR FA MV JM SP |");
else
sprintf(buf7,"{gL{R%2d{c %3d{bexp{W             | PA MA BR FA MV JM SP |",rch->level,((rch->level + 1) * 100) - rch->exp);
 
sprintf(buf1," %s%-23s{W|{r%4d{c/{r%4d{RHP {g%3d{c/{g%3d{GMP{W |",get_t_color(rch),fcn(rch),rch->hit,rch->max_hit,rch->mana,rch->max_mana);
sprintf(buf2," %s",buf7);
sprintf(buf3,"                        | %2d %2d %2d %2d %2d %2d %2d {W|",rch->PhysAttack,rch->MagAttack,
rch->Brave,rch->Faith,rch->MoveLeft,rch->jump,rch->speed);
printf_to_char(ch," {W----------------------------  |-----------------------------------------------|\n\r");
printf_to_char(ch," |{y0123456789abcdefghijklmnop{W|  |%-44s",buf1);
//parse_room(ch,(rch->mposy - 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy - 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy - 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W----------------------------  |%-44s",buf2);
//parse_room(ch,rch->mposy,(rch->mposx - 1),FALSE);
//parse_room(ch,rch->mposy,rch->mposx,FALSE);
//parse_room(ch,rch->mposy,(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
printf_to_char(ch," {W|%-26s|  |%-44s",ch->in_room->name,buf3);
//parse_room(ch,(rch->mposy + 1),(rch->mposx - 1),FALSE);
//parse_room(ch,(rch->mposy + 1),rch->mposx,FALSE);
//parse_room(ch,(rch->mposy + 1),(rch->mposx + 1),FALSE);
printf_to_char(ch,"{W\n\r");
}


printf_to_char(ch," ----------------------------  |-----------------------------------------------|\n\r");



check_winner(ch->in_room);
printf_to_char(ch,"%s", echo_on_str);

}
예제 #12
0
void do_attack (CHAR_DATA * ch, char *argument)
{
char arg[MSL];
CHAR_DATA *victim;
int dir;
if(!TURN(ch))
{
printf_to_char(ch,"It's not your turn.");
return;
}

if(ch->AttackLeft < 1)
{
printf_to_char(ch,"You've already attacked.");
return;
}

argument = one_argument (argument, arg);

if (!strcmp (arg, "north"))
{
dir = DIR_NORTH;
victim = find_char_map(ch,DIR_SOUTH);
}
else if (!strcmp (arg, "east"))
{
dir = DIR_EAST;
victim = find_char_map(ch,DIR_EAST);
}
else if (!strcmp (arg, "south"))
{
dir = DIR_SOUTH;
victim = find_char_map(ch,DIR_NORTH);
}
else if (!strcmp (arg, "west"))
{
dir = DIR_WEST;
victim = find_char_map(ch,DIR_WEST);
}
else
{

victim = get_char_room (ch, arg);

if(victim == NULL)
{
printf_to_char(ch,"Not here.\n");
return;
}

if(!can_hit_t(ch,victim->mposy,victim->mposx))
{
printf_to_char(ch,"Out of range.\n");
return;
}

}

if(victim == NULL)
{
printf_to_char(ch,"Nobody there.\n");
return;
}

if(victim->team == ch->team && IS_NPC(ch) && victim->team != TEAM_NONE)
return;


  if(UMAX(ch->in_room->map.index[ch->mposx][ch->mposy].height,ch->in_room->map.index[victim->mposx][victim->mposy].height) - UMIN(ch->in_room->map.index[ch->mposx][ch->mposy].height,ch->in_room->map.index[victim->mposx][victim->mposy].height) > 1)
  {
  send_to_char("Too high/low to attack.",ch);
  return;
  }

ch->AttackLeft--;

    if(skill_lookup("hamedo") == victim->reaction_num && number_range(1,100) < 31)
    f_multi_hit( victim, ch, TYPE_UNDEFINED );
    else 
    {
    f_multi_hit( ch, victim, TYPE_UNDEFINED );
    handle_reaction(ch,victim);
    }
}
예제 #13
0
void move_char (CHAR_DATA * ch, int door, bool follow)
{
    CHAR_DATA *fch;
    CHAR_DATA *fch_next;
    ROOM_INDEX_DATA *in_room;
    ROOM_INDEX_DATA *to_room;
    EXIT_DATA *pexit;

  
    if(ch->infight)
    {
    if(!TURN(ch))
    {
    printf_to_char(ch,"It's not your turn.\n");
    return;
    }

    refresh(ch->in_room);


    if(ch->MoveLeft == 0)
    {
    printf_to_char(ch,"You have no moves left.\n");
    return;
    }
    
    switch(door)
    {
    case DIR_EAST:
    if(find_char_xy(ch,ch->mposx+1,ch->mposy) == NULL)
    {
    if(hdif(ch,DIR_EAST) > ch->jump || hdif(ch,DIR_EAST) < -(ch->jump) || ch->mposx > 24) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    ch->mposx++;
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy][ch->mposx+1].occupied = TRUE;
    announce_move(ch,"east");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_WEST:
    if(find_char_xy(ch,ch->mposx-1,ch->mposy) == NULL)
    {
    if(hdif(ch,DIR_WEST) > (ch->jump) || hdif(ch,DIR_WEST) < -(ch->jump) || ch->mposx < 1) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy][ch->mposx-1].occupied = TRUE;
    ch->mposx--;
    announce_move(ch,"west");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_NORTH:
    if(hdif(ch,DIR_NORTH) > (ch->jump) || hdif(ch,DIR_NORTH) < -(ch->jump) || ch->mposy < 1) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    if(find_char_xy(ch,ch->mposx,ch->mposy-1) == NULL)
    {
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy-1][ch->mposx].occupied = TRUE;
    ch->mposy--;
    announce_move(ch,"north");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    case DIR_SOUTH:
    if(hdif(ch,DIR_SOUTH) > (ch->jump) || hdif(ch,DIR_SOUTH) < -(ch->jump) || ch->mposy > 14) 
    {
    printf_to_char(ch,"You can't jump that high.\n");
    return;
    }
    if(find_char_xy(ch,ch->mposx,ch->mposy+1) == NULL)
    {
    ch->in_room->map.index[ch->mposy][ch->mposx].occupied = FALSE;
    ch->in_room->map.index[ch->mposy+1][ch->mposx].occupied = TRUE;
    ch->mposy++;
    announce_move(ch,"south");
    }
    else
    printf_to_char(ch,"Somebody's in the way.\n");
    break;
    }

return;
}


    if (door < 0 || door > 5)
    {
        bug ("Do_move: bad door %d.", door);
        return;
    }

    /*
     * Exit trigger, if activated, bail out. Only PCs are triggered.
     */

    in_room = ch->in_room;
    if ((pexit = in_room->exit[door]) == NULL
        || (to_room = pexit->u1.to_room) == NULL
        || !can_see_room (ch, pexit->u1.to_room))
    {
        send_to_char ("Alas, you cannot go that way.\n\r", ch);
        return;
    }

    if (IS_SET (pexit->exit_info, EX_CLOSED)
            || IS_SET (pexit->exit_info, EX_NOPASS))
    {
        act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR);
        return;
    }

    if (!is_room_owner (ch, to_room) && room_is_private (to_room))
    {
        send_to_char ("That room is private right now.\n\r", ch);
        return;
    }

    if ( ch->invis_level < LEVEL_HERO)
        act ("$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM);


    char_from_room (ch);
    char_to_room (ch, to_room);


    if ( ch->invis_level < LEVEL_HERO)
        act ("$n has arrived.", ch, NULL, NULL, TO_ROOM);

    do_function (ch, &do_look, "auto");

    if (in_room == to_room)        /* no circular follows */
        return;

    for (fch = in_room->people; fch != NULL; fch = fch_next)
    {
        fch_next = fch->next_in_room;

        if (fch->master == ch && fch->position == POS_STANDING
            && can_see_room (fch, to_room))
        {

            if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
                && (IS_NPC (fch) && IS_SET (fch->act, ACT_AGGRESSIVE)))
            {
                act ("You can't bring $N into the city.",
                     ch, NULL, fch, TO_CHAR);
                act ("You aren't allowed in the city.",
                     fch, NULL, NULL, TO_CHAR);
                continue;
            }

            act ("You follow $N.", fch, NULL, ch, TO_CHAR);
            move_char (fch, door, TRUE);
        }
    }

    /* 
     * If someone is following the char, these triggers get activated
     * for the followers before the char, but it's safer this way...
     */
   // if(number_range(1,10) > 2)
 //   gen_random_battle(ch);

    return;
}