void
fire_area (int xx, int yy)
{
    /* this happens when a rocket crashes or on random_fire. */
    int x = xx;
    int y = yy;
    int size;
    if (MP_GROUP(x,y) == GROUP_WATER || MP_GROUP(x,y) == GROUP_FIRE)
        return;
    if (MP_TYPE(x,y) == CST_USED) {
        x = MP_INFO(xx,yy).int_1;
        y = MP_INFO(xx,yy).int_2;
    }
    size = MP_SIZE(x,y);

    /* Destroy the content of the building to prevent special management
     * when bulldozed.
     */

    /* Kill 'only' half of the people (bulldoze item put them in people_pool)
     * lincity NG 1.1 and previous killed all the people!
     */
    if ((MP_INFO(x,y).flags & FLAG_FIRE_COVER) !=0)
        MP_INFO(x,y).population = MP_INFO(x,y).population / 2;
    else
        MP_INFO(x,y).population = 0;
    MP_INFO(x,y).flags = 0;
    MP_INFO(x,y).int_1 = 0;
    MP_INFO(x,y).int_2 = 0;
    MP_INFO(x,y).int_3 = 0;
    MP_INFO(x,y).int_4 = 0;
    MP_INFO(x,y).int_5 = 0;
    MP_INFO(x,y).int_6 = 0;
    MP_INFO(x,y).int_7 = 0;

    /* Correctly remove buildings (substations...) and adjust count,
     * but don't count bulldoze cost
     * */
    adjust_money(+main_groups[MP_GROUP(x,y)].bul_cost);
    bulldoze_item(x, y);

    /* put fire */
    for (int i = 0; i < size; i++)
        for (int j = 0; j < size; j++) {
            bulldoze_mappoint (CST_FIRE_1, x + i, y + j);
            MP_GROUP(x + i, y + j) = GROUP_FIRE;
        }


    /* AL1: is it necessary ? It is the only place in lincity/. with such a call
     *  all other are in lincity-ng/.
     */
    refresh_main_screen ();

  /* 
    // update transport or we get stuff put in
    // the area from connected tracks etc.
    // FIXME: AL1: NG 1.1: do the right thing and/or remove this comment
  */
}
/* Adjust the main window origin, and refresh if necessary */
void
adjust_main_origin (int new_origin_x, int new_origin_y, int refresh)
{
    Rect* mw = &scr.main_win;

    if (new_origin_x < 1) {
	new_origin_x = 1;
    } else if (new_origin_x > WORLD_SIDE_LEN - mw->w / 16 - 1) {
	new_origin_x = WORLD_SIDE_LEN - mw->w / 16 - 1;
    }
    if (new_origin_y < 1) {
	new_origin_y = 1;
    } else if (new_origin_y > WORLD_SIDE_LEN - mw->h / 16 - 1) {
	new_origin_y = WORLD_SIDE_LEN - mw->h / 16 - 1;
    }

    if (new_origin_x == main_screen_originx
	&& new_origin_y == main_screen_originy)
    {
	return;
    }

    main_screen_originx = new_origin_x;
    main_screen_originy = new_origin_y;

    if (refresh) {
	request_main_screen ();
	hide_mouse ();
	refresh_main_screen ();
	redraw_mouse ();
    }
}
Example #3
0
void 
handle_msg_map_zoom (void)
{
  MsgBuf* msg = &recvbuf;
  Int32* msgp = (Int32*) MSG_BODY(msg);

  printf ("Client received MSG_MAP_ZOOM.\n");
  main_screen_originx = ntohl(*msgp++);
  main_screen_originy = ntohl(*msgp++);

  network_request_main_screen ();
  refresh_main_screen ();
}
Example #4
0
void 
handle_msg_item_placed (void)
{
  int x, y;
  unsigned short selected_item;
  MsgBuf* msg = &recvbuf;
  Int32* msgp = (Int32*) MSG_BODY(msg);

  printf ("Client received MSG_ITEM_PLACED.\n");
  x = ntohl(*msgp++);
  y = ntohl(*msgp++);
  selected_item = (unsigned short) ntohl(*msgp++);

  set_mappoint (x, y, selected_item);
  refresh_main_screen ();
}
Example #5
0
void
do_help_mouse (int x, int y, int mbutton)
{
    Rect* mw = &scr.main_win;
    if (mouse_in_rect(mw, x, y)) {
	do_help_buttons (x, y);
	return;
    }
    if (block_help_exit)
	return;

    help_flag = 0;
#ifdef USE_EXPANDED_FONT
    Fgl_setwritemode (WRITEMODE_OVERWRITE | FONT_EXPANDED);
#else
    Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
#endif
    refresh_main_screen ();
}
Example #6
0
void
draw_help_page (char *helppage)
{
    Rect* mw = &scr.main_win;
    char *helppage_full, *helppage_short;
    int i, y;
    FILE *inf;
    char help_line[MAX_HELP_LINE];

    /* Return pages have arguments.  It is always true that "-2" means "Out" 
       and "-1" means "Back".  Semantics for other arguments depend upon
       the name of the source page (e.g. load game or choose residence). 
       Most of the times (except "Back"), this will exit the help system. */
    if (strncmp (helppage, "return", 6) == 0) {
	sscanf (&(helppage[6]), "%d", &help_return_val);

	/* If "Back" was clicked */
	if (help_return_val == -1 && help_history_count > 1) {
	    strcpy (helppage, help_button_history[help_history_count - 2]);
	    help_history_count -= 2;
	    goto continue_with_help;
	}

	/* XXX: WCK: residential selection is really ugly */
	if (help_history_count > 0 &&
	    strcmp (help_button_history[help_history_count - 1],
		    "res.tmp") == 0)
	{
	    switch (help_return_val) {
	    case (-2):
	    case (-1):
	    case (0):
	    case (1):
		selected_type = CST_RESIDENCE_LL;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_LL);
		break;
	    case (2):
		selected_type = CST_RESIDENCE_ML;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_ML);
		break;
	    case (3):
		selected_type = CST_RESIDENCE_HL;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_HL);
		break;
	    case (4):
		selected_type = CST_RESIDENCE_LH;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_LH);
		break;
	    case (5):
		selected_type = CST_RESIDENCE_MH;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_MH);
		break;
	    case (6):
		selected_type = CST_RESIDENCE_HH;
		selected_type_cost = get_group_cost (GROUP_RESIDENCE_HH);
		break;
	    }
	}
	else if (help_history_count > 0 &&
		 strcmp (help_button_history[help_history_count - 1],
			 "menu.hlp") == 0)
	{
	    switch (help_return_val) {
	    case 1:
		save_flag = 1;
		break;
	    case 2:
		prefs_flag = 1;
		break;
	    case 3:
		quit_flag = 1;
		break;
	    }
	}
	else if (help_history_count > 0 && 
		 strcmp (help_button_history[help_history_count - 1],
			 "opening.hlp") == 0)
	{
	    switch (help_return_val)
	    {
	    case (-2):
	    case (-1):
	    case (0):
		/* Random villiage */
		new_city (&main_screen_originx, &main_screen_originy, 1);
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (1):
		/* Bare board */
		new_city (&main_screen_originx, &main_screen_originy, 0);
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (2):
		/* Network start */
		network_flag = 1;
		break;
	    }
	}
	else if (help_history_count > 0 && 
		 strcmp (help_button_history[help_history_count - 1],
			 "newgame.hlp") == 0)
	{
	    switch (help_return_val)
	    {
	    case (0):
		/* Random villiage */
		new_city (&main_screen_originx, &main_screen_originy, 1);
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (1):
		/* Bare board */
		new_city (&main_screen_originx, &main_screen_originy, 0);
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (2):
		/* Network start */
		network_flag = 1;
		break;
	    }
	}
	else if (help_history_count > 0 &&
		 strcmp (help_button_history[help_history_count - 1],
			 "openload.hlp") == 0)
	{
	    switch (help_return_val)
	    {
	    case (-2):
	    case (-1):
	    case (0):
		new_city (&main_screen_originx, &main_screen_originy, 1);
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (1):
		redraw_mouse ();
		load_opening_city ("good_times.scn");
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		hide_mouse ();
		break;
	    case (2):
		load_opening_city ("bad_times.scn");
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (9):
		load_flag = 1;
		break;
	    }
	}
	else if (help_history_count > 0 &&
		 strcmp (help_button_history[help_history_count - 1],
			 "loadgame.hlp") == 0)
	{
	    switch (help_return_val)
	    {
	    case (1):
		redraw_mouse ();
		load_opening_city ("good_times.scn");
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		hide_mouse ();
		break;
	    case (2):
		load_opening_city ("bad_times.scn");
		adjust_main_origin (main_screen_originx,main_screen_originy,0);
		break;
	    case (9):
		load_flag = 1;
		break;
	    }
	}
	else if (help_history_count > 0 &&
		 strcmp (help_button_history[help_history_count - 1],
			 "ask-dir.hlp") == 0)
	{
	    if (help_return_val == 1 || help_return_val == -2)
		do_error ("User exited");
	}

	block_help_exit = 0;
	help_flag = 0;
	/* Fix origin */
#ifdef USE_EXPANDED_FONT
	Fgl_setwritemode (WRITEMODE_OVERWRITE | FONT_EXPANDED);
#else
	Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
#endif
	request_main_screen ();
	refresh_main_screen ();
	return;
    }

 continue_with_help:
    /* This buffer is just a copy of helppage.  Sometimes helppage is an 
       entry within help_button_s[], which gets overwritten when the page 
       is parsed. */
    if ((helppage_short = (char*) malloc (strlen(helppage) + 1)) == 0) {
	malloc_failure ();
    }
    strcpy (helppage_short, helppage);

    /* Right click on mini-screen */
    if (strncmp (helppage, "mini-screen.hlp", 15) == 0) {
	draw_big_mini_screen ();
    } else if (strncmp (helppage, "mini-in-main.hlp", 17) == 0) {
	/* do nothing */
    } else {
	/* This buffer is for the full path of the help file.
	   The file might be either in the help directory (most cases),
	   or in the temp directory (dynamically created pages). */
	if ((helppage_full = (char *) malloc (lc_save_dir_len 
					      + strlen (help_path) 
					      + strlen(helppage) + 2)) == 0) {
	    malloc_failure ();
	}

	/* Open the file */
	sprintf (helppage_full, "%s%s", help_path, helppage);
	if ((inf = fopen (helppage_full, "r")) == 0) {
	    sprintf (helppage_full, "%s%c%s", lc_save_dir, 
		     PATH_SLASH, helppage);
	    if ((inf = fopen (helppage_full, "r")) == 0) {
		sprintf (helppage_full, "%s%s", help_path, HELPERRORPAGE);
		if ((inf = fopen (helppage_full, "r")) == 0)
		    do_error ("Help error");
	    }
	}

	/* Parse and render help file */
	numof_help_buttons = 0;
	Fgl_fillbox (mw->x, mw->y, mw->w, mw->h, HELPBACKGROUNDCOLOUR);
	while (feof (inf) == 0) {
	    if (fgets (help_line, MAX_HELP_LINE, inf) == 0)
		break;
	    parse_helpline (help_line);
	}
	fclose (inf);

	/* For ask-dir, we add path info */
	if (strncmp (helppage_short, "ask-dir.hlp", 11) == 0) {
	    parse_helpline ("tcolour 0 255");
	    y = 100;
	    for (i = 0; i < askdir_lines; i++) {
		sprintf (help_line, "text -1 %d %s", y, askdir_path[i]);
		parse_helpline (help_line);
		y += 14;
	    }
	}
	free (helppage_full);
    }

    /* At this point, most of the page has been rendered.  Now we have 
       to draw in the "BACK" and "OUT" buttons.  */
    if (help_history_count > 0) {
	parse_helpline ("tcolour 122 153");
	parse_helpline (_("tbutton 4 387 return-1 BACK"));
    }
    parse_helpline ("tcolour 188 153");
    parse_helpline (_("tbutton 370 387 return-2 OUT"));
    parse_helpline ("tcolour -1 -1");
#if defined (commentout)
    if (help_history_count > 0) {
	parse_helpline ("tcolour 122 153");
	snprintf (help_line, MAX_HELP_LINE, "tbutton %d %d return-1 %s",
		  4, mw->h - 13, _("BACK"));
	parse_helpline (help_line);
    }
    parse_helpline ("tcolour 188 153");
    snprintf (help_line, MAX_HELP_LINE, "tbutton %d %d return-2 %s",
	      mw->w - 34, mw->h - 13, _("OUT"));
    parse_helpline (help_line);
    parse_helpline ("tcolour -1 -1");
#endif

    /* Add help page to history.  If history is going to overflow, 
       throw out oldest page.  */
    strcpy (help_button_history[help_history_count], helppage_short);
    help_history_count++;
    if (help_history_count >= MAX_HELP_HISTORY) {
	for (i = 0; i < (MAX_HELP_HISTORY - 1); i++)
	    strcpy (help_button_history[i], help_button_history[i + 1]);
	help_history_count--;
    }

    free (helppage_short);
}
Example #7
0
void
do_oremine (int x, int y)
{
  /*
     // int_1 is the ore at in stock
     // int_2 is the ore reserve under the ground or at the surface really.
   */
  int xx, yy, xs, ys, xe, ye, cr;
  if (MP_INFO(x,y).int_1 < DIG_MORE_ORE_TRIGGER - 5000)
    {
      xs = x;
      ys = y;
      xe = x + 4;
      ye = y + 4;
      cr = 0;
      for (yy = ys; yy < ye; yy++)
	for (xx = xs; xx < xe; xx++)
	  cr += MP_INFO(xx,yy).ore_reserve;
      MP_INFO(x,y).int_2 = cr;
      if (cr > 0)
	if (get_jobs (x, y, JOBS_DIG_ORE) != 0)
	  for (yy = ys; yy < ye; yy++)
	    for (xx = xs; xx < xe; xx++)
	      if (MP_INFO(xx,yy).ore_reserve > 0)
		{
		  MP_INFO(xx,yy).ore_reserve--;
		  MP_INFO(x,y).int_1 += 5000;
		  ore_made += 5000;
		  sust_dig_ore_coal_tip_flag = 0;
		  /* maybe want an ore tax? */
		  yy = ye;
		  xx = xe;	/* break out */
		}
    }

  if ((MP_INFO(x - 1,y).flags & FLAG_IS_TRANSPORT) != 0)
    {
      if (MP_GROUP(x-1,y) == GROUP_RAIL
	  && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_RAIL
	  && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_RAIL
				      - MP_INFO(x - 1,y).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_RAIL - MP_INFO(x - 1,y).int_5);
	      MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_RAIL;
	    }
	}
      else if (MP_GROUP(x-1,y) == GROUP_ROAD
	       && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_ROAD
	       && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_ROAD
					   - MP_INFO(x - 1,y).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_ROAD - MP_INFO(x - 1,y).int_5);
	      MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_ROAD;
	    }
	}
      else if (MP_GROUP(x - 1,y) == GROUP_TRACK
	       && MP_INFO(x - 1,y).int_5 < MAX_ORE_ON_TRACK
	       && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_TRACK
					   - MP_INFO(x - 1,y).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_TRACK - MP_INFO(x - 1,y).int_5);
	      MP_INFO(x - 1,y).int_5 = MAX_ORE_ON_TRACK;
	    }
	}
    }

  if ((MP_INFO(x,y - 1).flags & FLAG_IS_TRANSPORT) != 0)
    {
      if (MP_GROUP(x,y-1) == GROUP_RAIL
	  && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_RAIL
	  && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_RAIL
				      - MP_INFO(x,y - 1).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_RAIL - MP_INFO(x,y - 1).int_5);
	      MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_RAIL;
	    }
	}
      else if (MP_GROUP(x,y-1) == GROUP_ROAD
	       && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_ROAD
	       && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_ROAD
					   - MP_INFO(x,y - 1).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_ROAD - MP_INFO(x,y - 1).int_5);
	      MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_ROAD;
	    }
	}
      else if (MP_GROUP(x,y-1) == GROUP_TRACK
	       && MP_INFO(x,y - 1).int_5 < MAX_ORE_ON_TRACK
	       && MP_INFO(x,y).int_1 >= (MAX_ORE_ON_TRACK
					   - MP_INFO(x,y - 1).int_5))
	{
	  if (get_jobs (x, y, JOBS_LOAD_ORE) != 0)
	    {
	      MP_INFO(x,y).int_1
		-= (MAX_ORE_ON_TRACK - MP_INFO(x,y - 1).int_5);
	      MP_INFO(x,y - 1).int_5 = MAX_ORE_ON_TRACK;
	    }
	}
    }


  /* choose a graphic */
  if ((total_time & 0x7f) == 0)
    {
      xx = 7 * (MP_INFO(x,y).int_2 + (3 * ORE_RESERVE / 2))
	/ (16 * ORE_RESERVE);
      switch (xx)
	{
	case (0):
	  MP_TYPE(x,y) = CST_OREMINE_8;
	  break;
	case (1):
	  MP_TYPE(x,y) = CST_OREMINE_7;
	  break;
	case (2):
	  MP_TYPE(x,y) = CST_OREMINE_6;
	  break;
	case (3):
	  MP_TYPE(x,y) = CST_OREMINE_5;
	  break;
	case (4):
	  MP_TYPE(x,y) = CST_OREMINE_4;
	  break;
	case (5):
	  MP_TYPE(x,y) = CST_OREMINE_3;
	  break;
	case (6):
	  MP_TYPE(x,y) = CST_OREMINE_2;
	  break;
	case (7):
	  MP_TYPE(x,y) = CST_OREMINE_1;
	  break;
	}
	if (MP_INFO(x,y).int_2 <= 0) {
#if defined (commentout)
	    do_bulldoze_area (CST_GREEN, x, y);
	    place_item(x,y,CST_TIP_0);
#endif
	    int i,j;
	    for (j = 0; j < 4; j++) {
		for (i = 0; i < 4; i++) {
		    do_bulldoze_area (CST_WATER, x+i, y+j);
		}
	    }
	    connect_rivers ();
	    refresh_main_screen ();
	}
    }
}
Example #8
0
void
process_keystrokes (int key)
{

#if defined (commentout)	/* KBR 10/14/2002 - Cleanup MSVC warning */
    int retval;
#endif

    switch (key)
    {
    case 0: printf("dead!"); return;
    case ' ':   /* Space */
    case 10:    /* Linefeed/Return */
    case 13:    /* Enter */
    case 127:   /* Backspace */
	if (key == 127) {
	    cs_mouse_handler (LC_MOUSE_RIGHTBUTTON | LC_MOUSE_PRESS,
			      0, 0);
	    cs_mouse_handler (LC_MOUSE_RIGHTBUTTON | LC_MOUSE_RELEASE,
			      0, 0);
	} else {
	    cs_mouse_handler (LC_MOUSE_LEFTBUTTON | LC_MOUSE_PRESS,
			      0, 0);
	    cs_mouse_handler (LC_MOUSE_LEFTBUTTON | LC_MOUSE_RELEASE,
			      0, 0);
	}
	if (help_flag) {
	    draw_help_page ("return-2");
	}
	if (prefs_flag) {
	    close_prefs_screen ();
	    refresh_main_screen ();
	}
	break;

#if defined (SVGALIB)
    case 91:
	{
	    int w = vga_getkey ();
	    switch (w)
	    {
	    case ('A'):
		cs_mouse_handler (0, 0, -kmouse_val);
		break;
	    case ('B'):
		cs_mouse_handler (0, 0, kmouse_val);
		break;
	    case ('C'):
		cs_mouse_handler (0, kmouse_val, 0);
		break;
	    case ('D'):
		cs_mouse_handler (0, -kmouse_val, 0);
		break;
	    }
	}
	break;
#endif

#if defined (WIN32) || defined (LC_X11)
    case 1:
	/* Scroll left */
	if (x_key_shifted) {
	    adjust_main_origin (main_screen_originx - RIGHT_MOUSE_MOVE_VAL,
				main_screen_originy,
				TRUE);
	} else {
	    adjust_main_origin (main_screen_originx - 1,
				main_screen_originy,
				TRUE);
	}
	break;

    case 2:
	/* Scroll down */
	if (x_key_shifted) {
	    adjust_main_origin (main_screen_originx,
				main_screen_originy + RIGHT_MOUSE_MOVE_VAL,
				TRUE);
	} else {
	    adjust_main_origin (main_screen_originx,
				main_screen_originy + 1,
				TRUE);
	}
	break;

    case 3:
	/* Scroll up */
	if (x_key_shifted) {
	    adjust_main_origin (main_screen_originx,
				main_screen_originy - RIGHT_MOUSE_MOVE_VAL,
				TRUE);
	} else {
	    adjust_main_origin (main_screen_originx,
				main_screen_originy - 1,
				TRUE);
	}
	break;

    case 4:
	/* Scroll right */
	if (x_key_shifted) {
	    adjust_main_origin (main_screen_originx + RIGHT_MOUSE_MOVE_VAL,
				main_screen_originy,
				TRUE);
	} else {
	    adjust_main_origin (main_screen_originx + 1,
				main_screen_originy,
				TRUE);
	}
	break;
#endif

    case 'P':
    case 'p':
	select_pause ();
	break;

#ifdef DEBUG_KEYS
    case 'e':
	if (cheat () != 0)
	    people_pool += 100;
	break;

    case 'd':
	if (cheat () != 0)
	    dump_screen ();
	break;
	  
    case 'D':
	/*	dump_tcore (); */
	break;

    case 't':
	if (cheat () != 0)
	    tech_level += 1000;
	break;

    case 'T':
	if (cheat () != 0)
	    tech_level += 10000;
	break;

    case 'm':
	if (cheat () != 0) 
	    adjust_money(1000000);
	break;
#endif

    case 'f':
	do_random_fire (-1, -1, 1);
	break;

    case 'L':
    case 'l':
	load_flag = 1;
	break;

    case 'H':
    case 'h':
	activate_help ("index.hlp");
	break;

	/* Escape Key */
#ifdef LC_X11
    case 27:
#else
    case 5:
#endif
	if (help_flag) {
	    /* exit help */
	    draw_help_page("return-2"); 
	} else if (prefs_flag) {
	    close_prefs_screen();
	    refresh_main_screen ();
	} else {
	    activate_help ("menu.hlp");
	}
	break;

    case 'S':
    case 's':
	save_flag = 1;
	break;

    case 'v':
    case 'V':
	/* Toggle overlay */
	rotate_main_screen();
	break;

    case 'o':
    case 'O':
	prefs_flag = 1;
	break;

    case 'r':
        window_results();
	break;

    case 'q':
    case 'Q':
	quit_flag = 1;
	break;

    } /* end switch on keystroke */
}